Assert.assertTrue(names.contains(testObjectName));
MBeanInfo subsystemInfo = connection.getMBeanInfo(testObjectName);
Assert.assertEquals(0, subsystemInfo.getAttributes().length);
Assert.assertEquals(1, subsystemInfo.getOperations().length);
OpenMBeanOperationInfo op = findOperation(subsystemInfo.getOperations(), "addSiblings");
Assert.assertEquals("Adds a child", op.getDescription());
Assert.assertEquals(2, op.getSignature().length);
Assert.assertEquals(String.class.getName(), op.getSignature()[0].getType());
Assert.assertEquals(Integer.class.getName(), op.getSignature()[1].getType());
connection.invoke(testObjectName, "addSiblings", new Object[] {"test1", Integer.valueOf(123)}, new String[] {String.class.getName(), String.class.getName()});
names = connection.queryNames(createObjectName(Constants.DOMAIN + ":subsystem=test,*"), null);
Assert.assertEquals(2, names.size());
Assert.assertTrue(names.contains(testObjectName));
Assert.assertTrue(names.contains(child1ObjectName));
subsystemInfo = connection.getMBeanInfo(testObjectName);
Assert.assertEquals(0, subsystemInfo.getAttributes().length);
Assert.assertEquals(1, subsystemInfo.getOperations().length);
op = findOperation(subsystemInfo.getOperations(), "addSiblings");
Assert.assertEquals("Adds a child", op.getDescription());
Assert.assertEquals(2, op.getSignature().length);
Assert.assertEquals(String.class.getName(), op.getSignature()[0].getType());
Assert.assertEquals(Integer.class.getName(), op.getSignature()[1].getType());
MBeanInfo childInfo = connection.getMBeanInfo(child1ObjectName);
Assert.assertEquals(1, childInfo.getAttributes().length);
Assert.assertEquals(Integer.class.getName(), childInfo.getAttributes()[0].getType());
Assert.assertEquals(1, childInfo.getOperations().length);
op = findOperation(childInfo.getOperations(), REMOVE);
Assert.assertEquals("Removes a child", op.getDescription());
Assert.assertEquals(0, op.getSignature().length);
connection.invoke(testObjectName, "addSiblings", new Object[] {"test2", Integer.valueOf(456)}, new String[] {String.class.getName(), String.class.getName()});
names = connection.queryNames(createObjectName(Constants.DOMAIN + ":subsystem=test,*"), null);
Assert.assertEquals(3, names.size());
Assert.assertTrue(names.contains(testObjectName));
Assert.assertTrue(names.contains(child1ObjectName));
Assert.assertTrue(names.contains(child2ObjectName));
subsystemInfo = connection.getMBeanInfo(testObjectName);
Assert.assertEquals(0, subsystemInfo.getAttributes().length);
Assert.assertEquals(1, subsystemInfo.getOperations().length);
op = findOperation(subsystemInfo.getOperations(), "addSiblings");
Assert.assertEquals("Adds a child", op.getDescription());
Assert.assertEquals(2, op.getSignature().length);
Assert.assertEquals(String.class.getName(), op.getSignature()[0].getType());
Assert.assertEquals(Integer.class.getName(), op.getSignature()[1].getType());
childInfo = connection.getMBeanInfo(child1ObjectName);
Assert.assertEquals(1, childInfo.getAttributes().length);
Assert.assertEquals(Integer.class.getName(), childInfo.getAttributes()[0].getType());
Assert.assertEquals(1, childInfo.getOperations().length);
op = findOperation(childInfo.getOperations(), REMOVE);
Assert.assertEquals("Removes a child", op.getDescription());
Assert.assertEquals(0, op.getSignature().length);
childInfo = connection.getMBeanInfo(child2ObjectName);
Assert.assertEquals(1, childInfo.getAttributes().length);
Assert.assertEquals(Integer.class.getName(), childInfo.getAttributes()[0].getType());
Assert.assertEquals(1, childInfo.getOperations().length);
op = findOperation(childInfo.getOperations(), REMOVE);
Assert.assertEquals("Removes a child", op.getDescription());
Assert.assertEquals(0, op.getSignature().length);
Assert.assertEquals(Integer.valueOf(123), connection.getAttribute(child1ObjectName, "attr"));
Assert.assertEquals(Integer.valueOf(456), connection.getAttribute(child2ObjectName, "attr"));
connection.invoke(child1ObjectName, REMOVE, new Object[] {}, new String[] {});