summaryrefslogtreecommitdiff
path: root/qpid/java/bdbstore/src/test
diff options
context:
space:
mode:
authorKeith Wall <kwall@apache.org>2012-05-25 16:23:28 +0000
committerKeith Wall <kwall@apache.org>2012-05-25 16:23:28 +0000
commitc2e4ca664d87709905f6ac5535ff8d06a9ead3b1 (patch)
tree74c1f4308a8d23d6f1ce698c65ea4851da4a5812 /qpid/java/bdbstore/src/test
parent8f460e49c0c32fd773dd3d3fb8b73ea563527b5a (diff)
downloadqpid-python-c2e4ca664d87709905f6ac5535ff8d06a9ead3b1.tar.gz
QPID-4006: [Java Broker] BDB HA.
Close BDB environment in the event of unexpected exceptions during commit/begin tran. Install BDB exception listener to log exception arising from its own threads. Default BDB parameters for sensible defaults for standard Qpid use-cases. Ensure that closeInternal always closes the environment. Added MBean operation descriptions. Work of Robbie Gemmell <robbie@apache.org> and myself. git-svn-id: https://svn.apache.org/repos/asf/qpid/trunk@1342712 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'qpid/java/bdbstore/src/test')
-rw-r--r--qpid/java/bdbstore/src/test/java/org/apache/qpid/server/store/berkeleydb/HAClusterBlackboxTest.java2
-rw-r--r--qpid/java/bdbstore/src/test/java/org/apache/qpid/server/store/berkeleydb/HAClusterManagementTest.java3
-rw-r--r--qpid/java/bdbstore/src/test/java/org/apache/qpid/server/store/berkeleydb/HAClusterTwoNodeTest.java10
-rw-r--r--qpid/java/bdbstore/src/test/java/org/apache/qpid/server/store/berkeleydb/HAClusterWhiteboxTest.java2
-rw-r--r--qpid/java/bdbstore/src/test/java/org/apache/qpid/server/store/berkeleydb/HATestClusterCreator.java27
5 files changed, 26 insertions, 18 deletions
diff --git a/qpid/java/bdbstore/src/test/java/org/apache/qpid/server/store/berkeleydb/HAClusterBlackboxTest.java b/qpid/java/bdbstore/src/test/java/org/apache/qpid/server/store/berkeleydb/HAClusterBlackboxTest.java
index 6c5c51a355..c6a9ba8f8b 100644
--- a/qpid/java/bdbstore/src/test/java/org/apache/qpid/server/store/berkeleydb/HAClusterBlackboxTest.java
+++ b/qpid/java/bdbstore/src/test/java/org/apache/qpid/server/store/berkeleydb/HAClusterBlackboxTest.java
@@ -32,6 +32,8 @@ import org.apache.qpid.jms.ConnectionListener;
import org.apache.qpid.jms.ConnectionURL;
import org.apache.qpid.test.utils.QpidBrokerTestCase;
+import com.sleepycat.je.rep.ReplicationConfig;
+
/**
* The HA black box tests test the BDB cluster as a opaque unit. Client connects to
* the cluster via a failover url
diff --git a/qpid/java/bdbstore/src/test/java/org/apache/qpid/server/store/berkeleydb/HAClusterManagementTest.java b/qpid/java/bdbstore/src/test/java/org/apache/qpid/server/store/berkeleydb/HAClusterManagementTest.java
index 1afa45fd5a..b01f169715 100644
--- a/qpid/java/bdbstore/src/test/java/org/apache/qpid/server/store/berkeleydb/HAClusterManagementTest.java
+++ b/qpid/java/bdbstore/src/test/java/org/apache/qpid/server/store/berkeleydb/HAClusterManagementTest.java
@@ -64,9 +64,6 @@ public class HAClusterManagementTest extends QpidBrokerTestCase
protected void setUp() throws Exception
{
_brokerType = BrokerType.SPAWNED;
-
- assertTrue(isJavaBroker());
- assertTrue(isBrokerStorePersistent());
_jmxUtils.setUp();
_clusterCreator.configureClusterNodes();
diff --git a/qpid/java/bdbstore/src/test/java/org/apache/qpid/server/store/berkeleydb/HAClusterTwoNodeTest.java b/qpid/java/bdbstore/src/test/java/org/apache/qpid/server/store/berkeleydb/HAClusterTwoNodeTest.java
index 2fdba5a7cf..4507ccc282 100644
--- a/qpid/java/bdbstore/src/test/java/org/apache/qpid/server/store/berkeleydb/HAClusterTwoNodeTest.java
+++ b/qpid/java/bdbstore/src/test/java/org/apache/qpid/server/store/berkeleydb/HAClusterTwoNodeTest.java
@@ -83,13 +83,13 @@ public class HAClusterTwoNodeTest extends QpidBrokerTestCase
{
setSystemProperty("java.util.logging.config.file", "etc" + File.separator + "log.properties");
- String vhostPrefix = "virtualhosts.virtualhost." + VIRTUAL_HOST;
+ String storeConfigKeyPrefix = _clusterCreator.getStoreConfigKeyPrefix();
- setConfigurationProperty(vhostPrefix + ".store.repConfig(0).name", ReplicationConfig.INSUFFICIENT_REPLICAS_TIMEOUT);
- setConfigurationProperty(vhostPrefix + ".store.repConfig(0).value", "2 s");
+ setConfigurationProperty(storeConfigKeyPrefix + ".repConfig(0).name", ReplicationConfig.INSUFFICIENT_REPLICAS_TIMEOUT);
+ setConfigurationProperty(storeConfigKeyPrefix + ".repConfig(0).value", "2 s");
- setConfigurationProperty(vhostPrefix + ".store.repConfig(1).name", ReplicationConfig.ELECTIONS_PRIMARY_RETRIES);
- setConfigurationProperty(vhostPrefix + ".store.repConfig(1).value", "0");
+ setConfigurationProperty(storeConfigKeyPrefix + ".repConfig(1).name", ReplicationConfig.ELECTIONS_PRIMARY_RETRIES);
+ setConfigurationProperty(storeConfigKeyPrefix + ".repConfig(1).value", "0");
_clusterCreator.configureClusterNodes();
_clusterCreator.setAutoDesignatedPrimary(autoDesignedPrimary);
diff --git a/qpid/java/bdbstore/src/test/java/org/apache/qpid/server/store/berkeleydb/HAClusterWhiteboxTest.java b/qpid/java/bdbstore/src/test/java/org/apache/qpid/server/store/berkeleydb/HAClusterWhiteboxTest.java
index 12e281cd65..88f79e8823 100644
--- a/qpid/java/bdbstore/src/test/java/org/apache/qpid/server/store/berkeleydb/HAClusterWhiteboxTest.java
+++ b/qpid/java/bdbstore/src/test/java/org/apache/qpid/server/store/berkeleydb/HAClusterWhiteboxTest.java
@@ -35,6 +35,8 @@ import org.apache.log4j.Logger;
import org.apache.qpid.test.utils.QpidBrokerTestCase;
import org.apache.qpid.url.URLSyntaxException;
+import com.sleepycat.je.rep.ReplicationConfig;
+
/**
* The HA white box tests test the BDB cluster where the test retains the knowledge of the
* individual test nodes. It uses this knowledge to examine the nodes to ensure that they
diff --git a/qpid/java/bdbstore/src/test/java/org/apache/qpid/server/store/berkeleydb/HATestClusterCreator.java b/qpid/java/bdbstore/src/test/java/org/apache/qpid/server/store/berkeleydb/HATestClusterCreator.java
index a47597942b..97f69a3f83 100644
--- a/qpid/java/bdbstore/src/test/java/org/apache/qpid/server/store/berkeleydb/HATestClusterCreator.java
+++ b/qpid/java/bdbstore/src/test/java/org/apache/qpid/server/store/berkeleydb/HATestClusterCreator.java
@@ -53,8 +53,8 @@ public class HATestClusterCreator
private static final String MANY_BROKER_URL_FORMAT = "amqp://guest:guest@/%s?brokerlist='%s'&failover='roundrobin?cyclecount='%d''";
private static final String BROKER_PORTION_FORMAT = "tcp://localhost:%d?connectdelay='%d',retries='%d'";
- private static final int FAILOVER_CYCLECOUNT = 2;
- private static final int FAILOVER_RETRIES = 2;
+ private static final int FAILOVER_CYCLECOUNT = 5;
+ private static final int FAILOVER_RETRIES = 1;
private static final int FAILOVER_CONNECTDELAY = 1000;
private static final String SINGLE_BROKER_URL_WITH_RETRY_FORMAT = "amqp://guest:guest@/%s?brokerlist='tcp://localhost:%d?connectdelay='%d',retries='%d''";
@@ -67,7 +67,7 @@ public class HATestClusterCreator
private final Map<Integer, Integer> _brokerPortToBdbPortMap = new HashMap<Integer, Integer>();
private final Map<Integer, BrokerConfigHolder> _brokerConfigurations = new TreeMap<Integer, BrokerConfigHolder>();
private final String _virtualHostName;
- private final String _configKeyPrefix;
+ private final String _storeConfigKeyPrefix;
private final String _ipAddressOfBroker;
private final String _groupName ;
@@ -82,7 +82,7 @@ public class HATestClusterCreator
_groupName = "group" + _testcase.getName();
_ipAddressOfBroker = getIpAddressOfBrokerHost();
_numberOfNodes = numberOfNodes;
- _configKeyPrefix = "virtualhosts.virtualhost." + _virtualHostName + ".store.";
+ _storeConfigKeyPrefix = "virtualhosts.virtualhost." + _virtualHostName + ".store.";
_bdbHelperPort = 0;
}
@@ -127,7 +127,7 @@ public class HATestClusterCreator
*/
private String getConfigKey(String configKeySuffix)
{
- final String configKey = StringUtils.substringAfter(_configKeyPrefix + configKeySuffix, "virtualhosts.");
+ final String configKey = StringUtils.substringAfter(_storeConfigKeyPrefix + configKeySuffix, "virtualhosts.");
return configKey;
}
@@ -348,12 +348,12 @@ public class HATestClusterCreator
{
final String nodeName = getNodeNameForNodeAt(bdbPort);
- _testcase.setConfigurationProperty(_configKeyPrefix + "class", "org.apache.qpid.server.store.berkeleydb.BDBHAMessageStore");
+ _testcase.setConfigurationProperty(_storeConfigKeyPrefix + "class", "org.apache.qpid.server.store.berkeleydb.BDBHAMessageStore");
- _testcase.setConfigurationProperty(_configKeyPrefix + "highAvailability.groupName", _groupName);
- _testcase.setConfigurationProperty(_configKeyPrefix + "highAvailability.nodeName", nodeName);
- _testcase.setConfigurationProperty(_configKeyPrefix + "highAvailability.nodeHostPort", getNodeHostPortForNodeAt(bdbPort));
- _testcase.setConfigurationProperty(_configKeyPrefix + "highAvailability.helperHostPort", getHelperHostPort());
+ _testcase.setConfigurationProperty(_storeConfigKeyPrefix + "highAvailability.groupName", _groupName);
+ _testcase.setConfigurationProperty(_storeConfigKeyPrefix + "highAvailability.nodeName", nodeName);
+ _testcase.setConfigurationProperty(_storeConfigKeyPrefix + "highAvailability.nodeHostPort", getNodeHostPortForNodeAt(bdbPort));
+ _testcase.setConfigurationProperty(_storeConfigKeyPrefix + "highAvailability.helperHostPort", getHelperHostPort());
}
public String getIpAddressOfBrokerHost()
@@ -413,4 +413,11 @@ public class HATestClusterCreator
virtualHostConfig.setProperty(configKey, newBdbHostPort);
collectConfig(brokerPortNumberToBeMoved, brokerConfigHolder.getTestConfiguration(), virtualHostConfig);
}
+
+ public String getStoreConfigKeyPrefix()
+ {
+ return _storeConfigKeyPrefix;
+ }
+
+
}