use of org.apache.aries.jmx.whiteboard.integration.helper2.TestClass2 in project aries by apache.
the class MBeanTest method test_simple_MBean_different_package.
@Test
public void test_simple_MBean_different_package() throws Exception {
final String instanceName = "simple.test.instance.2";
final String objectNameString = "domain:instance=" + instanceName;
final ObjectName objectName = new ObjectName(objectNameString);
final TestClass testInstance = new TestClass2(instanceName);
final MBeanServer server = getStaticMBeanServer();
// expect MBean to not be registered yet
assertNotRegistered(server, objectName);
// expect the MBean to be registered with the static server
final ServiceRegistration reg = registerService(TestClassMBean.class.getName(), testInstance, objectNameString);
assertRegistered(server, objectName);
// expect MBean to return expected value
TestCase.assertEquals(instanceName, server.getAttribute(objectName, "InstanceName"));
// unregister MBean, expect to not be registered any more
reg.unregister();
assertNotRegistered(server, objectName);
}
Aggregations