Search in sources :

Example 1 with OperationFixer

use of org.jboss.as.model.test.OperationFixer in project wildfly by wildfly.

the class XTSSubsystemTestCase method testBoot1_1_0.

private void testBoot1_1_0(ModelTestControllerVersion controllerVersion) throws Exception {
    String subsystemXml = readResource("subsystem.xml");
    ModelVersion modelVersion = ModelVersion.create(1, 1, 0);
    //Use the non-runtime version of the extension which will happen on the HC
    KernelServicesBuilder builder = createKernelServicesBuilder(AdditionalInitialization.MANAGEMENT).setSubsystemXml(subsystemXml);
    builder.createLegacyKernelServicesBuilder(null, controllerVersion, modelVersion).configureReverseControllerCheck(AdditionalInitialization.MANAGEMENT, null, new OperationFixer() {

        @Override
        public ModelNode fixOperation(ModelNode operation) {
            String name = operation.get(ModelDescriptionConstants.OP).asString();
            PathAddress addr = PathAddress.pathAddress(operation.require(ModelDescriptionConstants.OP_ADDR));
            if (name.equals(ModelDescriptionConstants.ADD) && addr.size() == 1 && addr.getElement(0).equals(XTSExtension.SUBSYSTEM_PATH)) {
                operation.get(ModelDescriptionConstants.HOST).set("default-host");
                operation.get(XTSSubsystemDefinition.DEFAULT_CONTEXT_PROPAGATION.getName()).set(false);
            }
            return operation;
        }
    }).addMavenResourceURL("org.jboss.as:jboss-as-xts:" + controllerVersion.getMavenGavVersion());
    KernelServices mainServices = builder.build();
    KernelServices legacyServices = mainServices.getLegacyServices(modelVersion);
    Assert.assertTrue(mainServices.isSuccessfulBoot());
    Assert.assertTrue(legacyServices.isSuccessfulBoot());
    checkSubsystemModelTransformation(mainServices, modelVersion);
}
Also used : OperationFixer(org.jboss.as.model.test.OperationFixer) PathAddress(org.jboss.as.controller.PathAddress) KernelServices(org.jboss.as.subsystem.test.KernelServices) ModelVersion(org.jboss.as.controller.ModelVersion) ModelNode(org.jboss.dmr.ModelNode) KernelServicesBuilder(org.jboss.as.subsystem.test.KernelServicesBuilder)

Aggregations

ModelVersion (org.jboss.as.controller.ModelVersion)1 PathAddress (org.jboss.as.controller.PathAddress)1 OperationFixer (org.jboss.as.model.test.OperationFixer)1 KernelServices (org.jboss.as.subsystem.test.KernelServices)1 KernelServicesBuilder (org.jboss.as.subsystem.test.KernelServicesBuilder)1 ModelNode (org.jboss.dmr.ModelNode)1