summaryrefslogtreecommitdiff
path: root/qpid/java/bdbstore/src/test
diff options
context:
space:
mode:
authorKeith Wall <kwall@apache.org>2012-06-02 11:11:37 +0000
committerKeith Wall <kwall@apache.org>2012-06-02 11:11:37 +0000
commitffb29d39ebba63de972020920a53c1e98b0c9ef8 (patch)
treebf14cfb21f91b649148a7c0750ca2058f2dfe051 /qpid/java/bdbstore/src/test
parentab2e88eba16f283a7f086de5d856da34784343b3 (diff)
downloadqpid-python-ffb29d39ebba63de972020920a53c1e98b0c9ef8.tar.gz
QPID-4006: Introduce coalescing sync configuration, rename replication policy configuration into durability, restore designated primary configuration and remove auto-designated primary functionality
Applied patch from Oleksandr Rudyy <orudyy@gmail.com> and myself. git-svn-id: https://svn.apache.org/repos/asf/qpid/trunk@1345486 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/BDBHAMessageStoreManagerMBeanTest.java15
-rw-r--r--qpid/java/bdbstore/src/test/java/org/apache/qpid/server/store/berkeleydb/HAClusterTwoNodeTest.java53
-rw-r--r--qpid/java/bdbstore/src/test/java/org/apache/qpid/server/store/berkeleydb/HATestClusterCreator.java6
3 files changed, 32 insertions, 42 deletions
diff --git a/qpid/java/bdbstore/src/test/java/org/apache/qpid/server/store/berkeleydb/BDBHAMessageStoreManagerMBeanTest.java b/qpid/java/bdbstore/src/test/java/org/apache/qpid/server/store/berkeleydb/BDBHAMessageStoreManagerMBeanTest.java
index 00f99b7097..b64a213756 100644
--- a/qpid/java/bdbstore/src/test/java/org/apache/qpid/server/store/berkeleydb/BDBHAMessageStoreManagerMBeanTest.java
+++ b/qpid/java/bdbstore/src/test/java/org/apache/qpid/server/store/berkeleydb/BDBHAMessageStoreManagerMBeanTest.java
@@ -47,7 +47,7 @@ public class BDBHAMessageStoreManagerMBeanTest extends TestCase
private static final String TEST_NODE_NAME = "testNodeName";
private static final String TEST_NODE_HOST_PORT = "host:1234";
private static final String TEST_HELPER_HOST_PORT = "host:5678";
- private static final String TEST_REPLICATION_POLICY = "sync,sync,all";
+ private static final String TEST_DURABILITY = "sync,sync,all";
private static final String TEST_NODE_STATE = "MASTER";
private static final String TEST_STORE_NAME = "testStoreName";
private static final boolean TEST_DESIGNATED_PRIMARY_FLAG = false;
@@ -108,11 +108,18 @@ public class BDBHAMessageStoreManagerMBeanTest extends TestCase
assertEquals(TEST_HELPER_HOST_PORT, _mBean.getAttribute(ManagedBDBHAMessageStore.ATTR_HELPER_HOST_PORT));
}
- public void testReplicationPolicy() throws Exception
+ public void testDurability() throws Exception
{
- when(_store.getReplicationPolicy()).thenReturn(TEST_REPLICATION_POLICY);
+ when(_store.getDurability()).thenReturn(TEST_DURABILITY);
- assertEquals(TEST_REPLICATION_POLICY, _mBean.getAttribute(ManagedBDBHAMessageStore.ATTR_REPLICATION_POLICY));
+ assertEquals(TEST_DURABILITY, _mBean.getAttribute(ManagedBDBHAMessageStore.ATTR_DURABILITY));
+ }
+
+ public void testCoalescingSync() throws Exception
+ {
+ when(_store.isCoalescingSync()).thenReturn(true);
+
+ assertEquals(true, _mBean.getAttribute(ManagedBDBHAMessageStore.ATTR_COALESCING_SYNC));
}
public void testNodeState() throws Exception
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 4507ccc282..294859832f 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
@@ -79,7 +79,7 @@ public class HAClusterTwoNodeTest extends QpidBrokerTestCase
// Don't start default broker provided by QBTC.
}
- private void startCluster(boolean autoDesignedPrimary) throws Exception
+ private void startCluster(boolean designedPrimary) throws Exception
{
setSystemProperty("java.util.logging.config.file", "etc" + File.separator + "log.properties");
@@ -92,38 +92,28 @@ public class HAClusterTwoNodeTest extends QpidBrokerTestCase
setConfigurationProperty(storeConfigKeyPrefix + ".repConfig(1).value", "0");
_clusterCreator.configureClusterNodes();
- _clusterCreator.setAutoDesignatedPrimary(autoDesignedPrimary);
+ _clusterCreator.setDesignatedPrimaryOnFirstBroker(designedPrimary);
_brokerFailoverUrl = _clusterCreator.getConnectionUrlForAllClusterNodes();
_clusterCreator.startCluster();
}
- /**
- * Tests that a two node cluster, in which the master CAN automatically designate itself primary
- * (after becoming master) continues to operate after being shut down and restarted.
- *
- * The test does not concern itself with which broker becomes master at any given point
- * (which is likely to swap during the test).
- */
- public void testClusterRestartWithAutoDesignatedPrimary() throws Exception
+ public void testMasterDesignatedPrimaryCanBeRestartedWithoutReplica() throws Exception
{
- testClusterRestartImpl(true);
- }
-
- /**
- * Tests that a two node cluster, in which the master can NOT automatically designate itself
- * primary (after becoming master) continues to operate after being shut down and restarted.
- *
- * The test does not concern itself with which broker becomes master at any given point
- * (which is likely to swap during the test).
- */
- public void testClusterRestartWithoutAutoDesignatedPrimary() throws Exception
- {
- testClusterRestartImpl(false);
+ startCluster(true);
+ final Connection initialConnection = getConnection(_brokerFailoverUrl);
+ int masterPort = _clusterCreator.getBrokerPortNumberFromConnection(initialConnection);
+ assertProducingConsuming(initialConnection);
+ initialConnection.close();
+ _clusterCreator.stopCluster();
+ _clusterCreator.startNode(masterPort);
+ final Connection secondConnection = getConnection(_brokerFailoverUrl);
+ assertProducingConsuming(secondConnection);
+ secondConnection.close();
}
- private void testClusterRestartImpl(boolean autoDesignatedPrimary) throws Exception
+ public void testClusterRestartWithoutDesignatedPrimary() throws Exception
{
- startCluster(autoDesignatedPrimary);
+ startCluster(false);
final Connection initialConnection = getConnection(_brokerFailoverUrl);
assertProducingConsuming(initialConnection);
initialConnection.close();
@@ -134,13 +124,7 @@ public class HAClusterTwoNodeTest extends QpidBrokerTestCase
secondConnection.close();
}
- /**
- * This test make sure than JMS operations are still working after stopping replica
- * when master is designated primary (which is by default).
- * <p>
- * When master is not designated primary this test should fail.
- */
- public void testAutoDesignatedPrimaryContinuesAfterSecondaryStopped() throws Exception
+ public void testDesignatedPrimaryContinuesAfterSecondaryStopped() throws Exception
{
startCluster(true);
_clusterCreator.stopNode(_clusterCreator.getBrokerPortNumberOfSecondaryNode());
@@ -149,9 +133,8 @@ public class HAClusterTwoNodeTest extends QpidBrokerTestCase
assertProducingConsuming(connection);
}
- public void testPersistentOperationsFailOnNonAutoDesignatedPrimarysAfterSecondaryStopped() throws Exception
+ public void testPersistentOperationsFailOnNonDesignatedPrimarysAfterSecondaryStopped() throws Exception
{
-
startCluster(false);
_clusterCreator.stopNode(_clusterCreator.getBrokerPortNumberOfSecondaryNode());
final Connection connection = getConnection(_brokerFailoverUrl);
@@ -167,7 +150,7 @@ public class HAClusterTwoNodeTest extends QpidBrokerTestCase
}
}
- public void testSecondaryDoesNotBecomePrimaryWhenAutoDesignatedPrimaryStopped() throws Exception
+ public void testSecondaryDoesNotBecomePrimaryWhenDesignatedPrimaryStopped() throws Exception
{
startCluster(true);
_clusterCreator.stopNode(_clusterCreator.getBrokerPortNumberOfPrimary());
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 97f69a3f83..7fbf019d75 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
@@ -108,7 +108,7 @@ public class HATestClusterCreator
}
}
- public void setAutoDesignatedPrimary(boolean autoDesignatedPrimary) throws Exception
+ public void setDesignatedPrimaryOnFirstBroker(boolean designatedPrimary) throws Exception
{
if (_numberOfNodes != 2)
{
@@ -116,8 +116,8 @@ public class HATestClusterCreator
}
final Entry<Integer, BrokerConfigHolder> brokerConfigEntry = _brokerConfigurations.entrySet().iterator().next();
- final String configKey = getConfigKey("highAvailability.autoDesignatedPrimary");
- brokerConfigEntry.getValue().getTestVirtualhosts().setProperty(configKey, Boolean.toString(autoDesignatedPrimary));
+ final String configKey = getConfigKey("highAvailability.designatedPrimary");
+ brokerConfigEntry.getValue().getTestVirtualhosts().setProperty(configKey, Boolean.toString(designatedPrimary));
_primaryBrokerPort = brokerConfigEntry.getKey();
}