diff options
| author | Keith Wall <kwall@apache.org> | 2014-04-30 15:51:32 +0000 |
|---|---|---|
| committer | Keith Wall <kwall@apache.org> | 2014-04-30 15:51:32 +0000 |
| commit | 935c44e8b502304cec0830bb09099c27c3ed07bb (patch) | |
| tree | a259fabc3dd53dfa0870dd64c6d5b22a580fc7ab /qpid/java/bdbstore/src/test | |
| parent | f27ee6dbd1b52faa40c7c6c544b60cbd30ef4da2 (diff) | |
| download | qpid-python-935c44e8b502304cec0830bb09099c27c3ed07bb.tar.gz | |
QPID-5715: Address review comments from Alex Rudyy
git-svn-id: https://svn.apache.org/repos/asf/qpid/trunk@1591366 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/BDBHAVirtualHostNodeTest.java | 33 |
1 files changed, 32 insertions, 1 deletions
diff --git a/qpid/java/bdbstore/src/test/java/org/apache/qpid/server/store/berkeleydb/BDBHAVirtualHostNodeTest.java b/qpid/java/bdbstore/src/test/java/org/apache/qpid/server/store/berkeleydb/BDBHAVirtualHostNodeTest.java index 826694904c..78a86c685d 100644 --- a/qpid/java/bdbstore/src/test/java/org/apache/qpid/server/store/berkeleydb/BDBHAVirtualHostNodeTest.java +++ b/qpid/java/bdbstore/src/test/java/org/apache/qpid/server/store/berkeleydb/BDBHAVirtualHostNodeTest.java @@ -246,7 +246,6 @@ public class BDBHAVirtualHostNodeTest extends QpidTestCase assertNotNull("Join time should be set", node.getJoinTime()); assertNotNull("Last known replication transaction idshould be set", node.getLastKnownReplicationTransactionId()); - } public void testTransferMasterToSelf() throws Exception @@ -421,6 +420,38 @@ public class BDBHAVirtualHostNodeTest extends QpidTestCase } } + public void testMutatingRoleWhenNotReplica_IsDisallowed() throws Exception + { + int nodePortNumber = findFreePort(); + String helperAddress = "localhost:" + nodePortNumber; + String groupName = "group"; + + Map<String, Object> node1Attributes = new HashMap<String, Object>(); + node1Attributes.put(BDBHAVirtualHostNode.ID, UUID.randomUUID()); + node1Attributes.put(BDBHAVirtualHostNode.TYPE, "BDB_HA"); + node1Attributes.put(BDBHAVirtualHostNode.NAME, "node1"); + node1Attributes.put(BDBHAVirtualHostNode.GROUP_NAME, groupName); + node1Attributes.put(BDBHAVirtualHostNode.ADDRESS, helperAddress); + node1Attributes.put(BDBHAVirtualHostNode.HELPER_ADDRESS, helperAddress); + node1Attributes.put(BDBHAVirtualHostNode.STORE_PATH, _bdbStorePath + File.separator + "1"); + + BDBHAVirtualHostNode<?> node = createHaVHN(node1Attributes); + assertEquals("Failed to activate node", State.ACTIVE, node.setDesiredState(node.getState(), State.ACTIVE)); + + assertEquals("Node is expected to be master", "MASTER", node.getRole()); + + try + { + node.setAttributes(Collections.<String,Object>singletonMap(BDBHAVirtualHostNode.ROLE, "REPLICA")); + fail("Role mutation should fail"); + } + catch(IllegalStateException e) + { + // PASS + } + } + + private BDBHAVirtualHostNode<?> createHaVHN(Map<String, Object> attributes) { BDBHAVirtualHostNode<?> node = (BDBHAVirtualHostNode<?>) _objectFactory.create(VirtualHostNode.class, attributes, _broker); |
