Search in sources :

Example 21 with KernelServices

use of org.jboss.as.subsystem.test.KernelServices in project wildfly by wildfly.

the class EeSubsystemTestCase method testTransformersDiscardsImpliedValues1_1_0.

private void testTransformersDiscardsImpliedValues1_1_0(ModelTestControllerVersion controllerVersion) throws Exception {
    String subsystemXml = readResource("subsystem-transformers-discard.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);
    // Add legacy subsystems
    builder.createLegacyKernelServicesBuilder(null, controllerVersion, modelVersion).addMavenResourceURL("org.jboss.as:jboss-as-ee:" + controllerVersion.getMavenGavVersion()).configureReverseControllerCheck(AdditionalInitialization.MANAGEMENT, null);
    KernelServices mainServices = builder.build();
    KernelServices legacyServices = mainServices.getLegacyServices(modelVersion);
    Assert.assertTrue(mainServices.isSuccessfulBoot());
    Assert.assertTrue(legacyServices.isSuccessfulBoot());
}
Also used : KernelServices(org.jboss.as.subsystem.test.KernelServices) ModelVersion(org.jboss.as.controller.ModelVersion) KernelServicesBuilder(org.jboss.as.subsystem.test.KernelServicesBuilder)

Example 22 with KernelServices

use of org.jboss.as.subsystem.test.KernelServices in project wildfly by wildfly.

the class EeSubsystemTestCase method testTransformers800.

//@Test don't test as we dont have test controller
public void testTransformers800() throws Exception {
    final ModelVersion legacyModelVersion = ModelVersion.create(3, 0, 0);
    final ModelTestControllerVersion controllerVersion = ModelTestControllerVersion.WILDFLY_8_2_0_FINAL;
    KernelServicesBuilder builder = createKernelServicesBuilder(AdditionalInitialization.MANAGEMENT);
    // Add legacy subsystems
    builder.createLegacyKernelServicesBuilder(null, controllerVersion, legacyModelVersion).addMavenResourceURL("org.wildfly:wildfly-ee:" + controllerVersion.getMavenGavVersion());
    KernelServices mainServices = builder.build();
    KernelServices legacyServices = mainServices.getLegacyServices(legacyModelVersion);
    Assert.assertTrue(mainServices.isSuccessfulBoot());
    Assert.assertTrue(legacyServices.isSuccessfulBoot());
    List<ModelNode> bootOps = builder.parseXmlResource("subsystem-wf8-transformer.xml");
    ModelTestUtils.checkFailedTransformedBootOperations(mainServices, legacyModelVersion, bootOps, new FailedOperationTransformationConfig().addFailedAttribute(PathAddress.pathAddress(EeExtension.PATH_SUBSYSTEM, ManagedExecutorServiceResourceDefinition.INSTANCE.getPathElement()), new RejectUndefinedAttribute(new ModelNode(Integer.MAX_VALUE), ManagedExecutorServiceResourceDefinition.CORE_THREADS_AD.getName())).addFailedAttribute(PathAddress.pathAddress(EeExtension.PATH_SUBSYSTEM, ManagedScheduledExecutorServiceResourceDefinition.INSTANCE.getPathElement()), new RejectUndefinedAttribute(new ModelNode(Integer.MAX_VALUE), ManagedScheduledExecutorServiceResourceDefinition.CORE_THREADS_AD.getName())));
}
Also used : FailedOperationTransformationConfig(org.jboss.as.model.test.FailedOperationTransformationConfig) KernelServices(org.jboss.as.subsystem.test.KernelServices) ModelTestControllerVersion(org.jboss.as.model.test.ModelTestControllerVersion) ModelVersion(org.jboss.as.controller.ModelVersion) ModelNode(org.jboss.dmr.ModelNode) KernelServicesBuilder(org.jboss.as.subsystem.test.KernelServicesBuilder)

Example 23 with KernelServices

use of org.jboss.as.subsystem.test.KernelServices in project wildfly by wildfly.

the class EeSubsystemTestCase method testTransformers1_1.

private void testTransformers1_1(ModelTestControllerVersion controllerVersion, ModelVersion modelVersion) throws Exception {
    //Do a normal transformation test containing parts of the subsystem that work everywhere
    String subsystemXml = readResource("subsystem-transformers.xml");
    //Use the non-runtime version of the extension which will happen on the HC
    KernelServicesBuilder builder = createKernelServicesBuilder(AdditionalInitialization.MANAGEMENT).setSubsystemXml(subsystemXml);
    // Add legacy subsystems
    builder.createLegacyKernelServicesBuilder(null, controllerVersion, modelVersion).addMavenResourceURL("org.jboss.as:jboss-as-ee:" + controllerVersion.getMavenGavVersion());
    KernelServices mainServices = builder.build();
    KernelServices legacyServices = mainServices.getLegacyServices(modelVersion);
    Assert.assertTrue(mainServices.isSuccessfulBoot());
    Assert.assertTrue(legacyServices.isSuccessfulBoot());
    checkSubsystemModelTransformation(mainServices, modelVersion);
}
Also used : KernelServices(org.jboss.as.subsystem.test.KernelServices) KernelServicesBuilder(org.jboss.as.subsystem.test.KernelServicesBuilder)

Example 24 with KernelServices

use of org.jboss.as.subsystem.test.KernelServices in project wildfly by wildfly.

the class TransactionSubsystemTestCase method testTransformersFull.

private void testTransformersFull(ModelTestControllerVersion controllerVersion, ModelVersion modelVersion) throws Exception {
    String subsystemXml = readResource("full-expressions-transform.xml");
    //Use the non-runtime version of the extension which will happen on the HC
    KernelServicesBuilder builder = createKernelServicesBuilder(AdditionalInitialization.MANAGEMENT).setSubsystemXml(subsystemXml);
    // Add legacy subsystems
    builder.createLegacyKernelServicesBuilder(null, controllerVersion, modelVersion).addMavenResourceURL("org.jboss.as:jboss-as-transactions:" + controllerVersion.getMavenGavVersion()).addSingleChildFirstClass(RemoveProcessUUIDOperationFixer.class).configureReverseControllerCheck(AdditionalInitialization.MANAGEMENT, ADD_REMOVED_HORNETQ_STORE_ENABLE_ASYNC_IO, RemoveProcessUUIDOperationFixer.INSTANCE).excludeFromParent(SingleClassFilter.createFilter(TransactionLogger.class));
    KernelServices mainServices = builder.build();
    KernelServices legacyServices = mainServices.getLegacyServices(modelVersion);
    Assert.assertTrue(mainServices.isSuccessfulBoot());
    Assert.assertTrue(legacyServices.isSuccessfulBoot());
    checkSubsystemModelTransformation(mainServices, modelVersion, new ModelFixer() {

        @Override
        public ModelNode fixModel(ModelNode modelNode) {
            modelNode.remove("path");
            modelNode.remove("relative-to");
            //only needs to be removed for 6.2
            modelNode.get("process-id-uuid").set(false);
            return modelNode;
        }
    });
}
Also used : KernelServices(org.jboss.as.subsystem.test.KernelServices) ModelFixer(org.jboss.as.model.test.ModelFixer) ModelNode(org.jboss.dmr.ModelNode) KernelServicesBuilder(org.jboss.as.subsystem.test.KernelServicesBuilder) TransactionLogger(org.jboss.as.txn.logging.TransactionLogger)

Example 25 with KernelServices

use of org.jboss.as.subsystem.test.KernelServices in project wildfly by wildfly.

the class TransactionSubsystemTestCase method testRejectTransformers.

private void testRejectTransformers(ModelTestControllerVersion controllerVersion, ModelVersion modelVersion, FailedOperationTransformationConfig config) throws Exception {
    KernelServicesBuilder builder = createKernelServicesBuilder(createAdditionalInitialization());
    // Add legacy subsystems
    builder.createLegacyKernelServicesBuilder(createAdditionalInitialization(), controllerVersion, modelVersion).addMavenResourceURL("org.jboss.as:jboss-as-transactions:" + controllerVersion.getMavenGavVersion()).excludeFromParent(SingleClassFilter.createFilter(TransactionLogger.class));
    KernelServices mainServices = builder.build();
    assertTrue(mainServices.isSuccessfulBoot());
    KernelServices legacyServices = mainServices.getLegacyServices(modelVersion);
    assertNotNull(legacyServices);
    assertTrue(legacyServices.isSuccessfulBoot());
    List<ModelNode> ops = builder.parseXmlResource("full-expressions.xml");
    ModelTestUtils.checkFailedTransformedBootOperations(mainServices, modelVersion, ops, config);
}
Also used : KernelServices(org.jboss.as.subsystem.test.KernelServices) ModelNode(org.jboss.dmr.ModelNode) KernelServicesBuilder(org.jboss.as.subsystem.test.KernelServicesBuilder) TransactionLogger(org.jboss.as.txn.logging.TransactionLogger)

Aggregations

KernelServices (org.jboss.as.subsystem.test.KernelServices)144 ModelNode (org.jboss.dmr.ModelNode)102 Test (org.junit.Test)86 KernelServicesBuilder (org.jboss.as.subsystem.test.KernelServicesBuilder)69 ModelVersion (org.jboss.as.controller.ModelVersion)30 AbstractSubsystemBaseTest (org.jboss.as.subsystem.test.AbstractSubsystemBaseTest)29 PathAddress (org.jboss.as.controller.PathAddress)24 FailedOperationTransformationConfig (org.jboss.as.model.test.FailedOperationTransformationConfig)21 AbstractSubsystemTest (org.jboss.as.subsystem.test.AbstractSubsystemTest)11 ClusteringSubsystemTest (org.jboss.as.clustering.subsystem.ClusteringSubsystemTest)10 AdditionalInitialization (org.jboss.as.subsystem.test.AdditionalInitialization)8 ModelFixer (org.jboss.as.model.test.ModelFixer)7 ControllerInitializer (org.jboss.as.subsystem.test.ControllerInitializer)6 ModelTestControllerVersion (org.jboss.as.model.test.ModelTestControllerVersion)5 Properties (java.util.Properties)4 Session (javax.mail.Session)4 CompositeOperationBuilder (org.jboss.as.controller.client.helpers.Operations.CompositeOperationBuilder)3 ConnectorLogger (org.jboss.as.connector.logging.ConnectorLogger)2 Operation (org.jboss.as.controller.client.Operation)2 NewAttributesConfig (org.jboss.as.model.test.FailedOperationTransformationConfig.NewAttributesConfig)2