diff options
| author | Alex Rudyy <orudyy@apache.org> | 2014-06-09 08:35:09 +0000 |
|---|---|---|
| committer | Alex Rudyy <orudyy@apache.org> | 2014-06-09 08:35:09 +0000 |
| commit | b6249df102d7bd6e43bba2cdc5e8e6d333f1c8b1 (patch) | |
| tree | bc63d3aeb68974512d65574f4f9270388c18a799 /qpid/java/systests | |
| parent | 2a511e6a3b5f278f9c8b572a306b96490f180805 (diff) | |
| download | qpid-python-b6249df102d7bd6e43bba2cdc5e8e6d333f1c8b1.tar.gz | |
QPID-5715: Unregister children MBeans on Virtual Host Node stop
git-svn-id: https://svn.apache.org/repos/asf/qpid/trunk@1601322 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'qpid/java/systests')
| -rw-r--r-- | qpid/java/systests/src/main/java/org/apache/qpid/systest/management/jmx/MBeanLifeCycleTest.java | 29 |
1 files changed, 24 insertions, 5 deletions
diff --git a/qpid/java/systests/src/main/java/org/apache/qpid/systest/management/jmx/MBeanLifeCycleTest.java b/qpid/java/systests/src/main/java/org/apache/qpid/systest/management/jmx/MBeanLifeCycleTest.java index b79c4bdc40..efbd68f9e0 100644 --- a/qpid/java/systests/src/main/java/org/apache/qpid/systest/management/jmx/MBeanLifeCycleTest.java +++ b/qpid/java/systests/src/main/java/org/apache/qpid/systest/management/jmx/MBeanLifeCycleTest.java @@ -33,6 +33,7 @@ import org.apache.qpid.server.model.AuthenticationProvider; import org.apache.qpid.server.model.Plugin; import org.apache.qpid.server.model.Port; import org.apache.qpid.server.model.VirtualHost; +import org.apache.qpid.server.model.State; import org.apache.qpid.server.model.VirtualHostNode; import org.apache.qpid.server.security.auth.manager.AnonymousAuthenticationManager; import org.apache.qpid.server.virtualhost.ProvidedStoreVirtualHost; @@ -43,7 +44,8 @@ import org.apache.qpid.test.utils.TestBrokerConfiguration; public class MBeanLifeCycleTest extends QpidRestTestCase { - + private final static String TEST_VIRTUAL_HOST_MBEAN_SEARCH_QUERY = "org.apache.qpid:type=VirtualHost.VirtualHostManager,VirtualHost=" + + ObjectName.quote(TEST2_VIRTUALHOST); private JMXTestUtils _jmxUtils; @Override @@ -108,14 +110,31 @@ public class MBeanLifeCycleTest extends QpidRestTestCase public void testVirtualHostMBeanIsUnregisteredOnVirtualHostDeletion() throws Exception { - String query = "org.apache.qpid:type=VirtualHost.VirtualHostManager,VirtualHost=" - + ObjectName.quote(TEST2_VIRTUALHOST) + ",*"; - boolean mBeanExists =_jmxUtils.doesManagedObjectExist(query); + boolean mBeanExists =_jmxUtils.doesManagedObjectExist(TEST_VIRTUAL_HOST_MBEAN_SEARCH_QUERY); assertTrue("Host mBean is not registered", mBeanExists); getRestTestHelper().submitRequest("virtualhostnode/" + TEST2_VIRTUALHOST, "DELETE", HttpServletResponse.SC_OK); - mBeanExists =_jmxUtils.doesManagedObjectExist(query); + mBeanExists =_jmxUtils.doesManagedObjectExist(TEST_VIRTUAL_HOST_MBEAN_SEARCH_QUERY); + assertFalse("Host mBean is not unregistered", mBeanExists); + } + + public void testVirtualHostMBeanIsUnregisteredOnVirtualHostNodeStop() throws Exception + { + boolean mBeanExists =_jmxUtils.doesManagedObjectExist(TEST_VIRTUAL_HOST_MBEAN_SEARCH_QUERY); + assertTrue("Host mBean is not registered", mBeanExists); + + ManagedBroker managedBroker = _jmxUtils.getManagedBroker(TEST2_VIRTUALHOST); + assertNotNull("Host mBean is not created", managedBroker); + + Map<String, Object> nodeData = new HashMap<String, Object>(); + nodeData.put(VirtualHostNode.NAME, TEST2_VIRTUALHOST); + nodeData.put(VirtualHostNode.DESIRED_STATE, State.STOPPED.name()); + + int status = getRestTestHelper().submitRequest("virtualhostnode/" + TEST2_VIRTUALHOST, "PUT", nodeData); + assertEquals("Unexpected code", 200, status); + + mBeanExists =_jmxUtils.doesManagedObjectExist(TEST_VIRTUAL_HOST_MBEAN_SEARCH_QUERY); assertFalse("Host mBean is not unregistered", mBeanExists); } } |
