/** * Starts a controller with the given subsystem xml and then checks that a second controller * started with the operations from its describe action results in the same model */ @Test public void testDescribeHandler() throws Exception { // Parse the subsystem xml and install into the first controller KernelServices servicesA = createKernelServicesBuilder(AdditionalInitialization.MANAGEMENT) .setSubsystemXml(getSubsystemXml()) .build(); // Get the model and the describe operations from the first controller ModelNode modelA = servicesA.readWholeModel(); ModelNode describeOp = new ModelNode(); describeOp.get(OP).set(DESCRIBE); describeOp .get(OP_ADDR) .set( PathAddress.pathAddress(PathElement.pathElement(SUBSYSTEM, getMainSubsystemName())) .toModelNode()); List<ModelNode> operations = checkResultAndGetContents(servicesA.executeOperation(describeOp)).asList(); // Install the describe options from the first controller into a second controller KernelServices servicesB = createKernelServicesBuilder(null).setBootOperations(operations).build(); ModelNode modelB = servicesB.readWholeModel(); // Make sure the models from the two controllers are identical super.compare(modelA, modelB); }
/** * Starts a controller with a given subsystem xml and then checks that a second controller started * with the xml marshalled from the first one results in the same model */ @Test public void testParseAndMarshalModel() throws Exception { // Parse the subsystem xml and install into the first controller KernelServices servicesA = createKernelServicesBuilder(AdditionalInitialization.MANAGEMENT) .setSubsystemXml(getSubsystemXml()) .build(); // Get the model and the persisted xml from the first controller ModelNode modelA = servicesA.readWholeModel(); String marshalled = servicesA.getPersistedSubsystemXml(); // Install the persisted xml from the first controller into a second controller KernelServices servicesB = createKernelServicesBuilder(AdditionalInitialization.MANAGEMENT) .setSubsystemXml(marshalled) .build(); ModelNode modelB = servicesB.readWholeModel(); // Make sure the models from the two controllers are identical super.compare(modelA, modelB); }