Search in sources :

Example 71 with KernelServicesBuilder

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

the class ModClusterTransformersTestCase method testTransformation.

private void testTransformation(ModelTestControllerVersion controllerVersion) throws Exception {
    String[] dependencies = getDependencies(controllerVersion);
    String subsystemXml = readResource("subsystem-transform.xml");
    ModClusterModel model = getModelVersion(controllerVersion);
    ModelVersion modelVersion = model.getVersion();
    String extensionClassName = (model.getVersion().getMajor() == 1) ? "org.jboss.as.modcluster.ModClusterExtension" : "org.wildfly.extension.mod_cluster.ModClusterExtension";
    KernelServicesBuilder builder = createKernelServicesBuilder(createAdditionalInitialization()).setSubsystemXml(subsystemXml);
    builder.createLegacyKernelServicesBuilder(null, controllerVersion, modelVersion).addMavenResourceURL(dependencies).setExtensionClassName(extensionClassName).skipReverseControllerCheck();
    KernelServices mainServices = builder.build();
    KernelServices legacyServices = mainServices.getLegacyServices(modelVersion);
    Assert.assertNotNull(legacyServices);
    Assert.assertTrue(mainServices.isSuccessfulBoot());
    Assert.assertTrue(legacyServices.isSuccessfulBoot());
    checkSubsystemModelTransformation(mainServices, modelVersion, null, false);
}
Also used : KernelServices(org.jboss.as.subsystem.test.KernelServices) ModelVersion(org.jboss.as.controller.ModelVersion) KernelServicesBuilder(org.jboss.as.subsystem.test.KernelServicesBuilder)

Example 72 with KernelServicesBuilder

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

the class InfinispanTransformersTestCase method testRejections.

private void testRejections(final ModelTestControllerVersion controller) throws Exception {
    final ModelVersion version = getModelVersion(controller).getVersion();
    final String[] dependencies = getDependencies(controller);
    // create builder for current subsystem version
    KernelServicesBuilder builder = this.createKernelServicesBuilder();
    // initialize the legacy services
    builder.createLegacyKernelServicesBuilder(createAdditionalInitialization(), controller, version).addSingleChildFirstClass(InfinispanSubsystemInitialization.class).addSingleChildFirstClass(JGroupsSubsystemInitialization.class).addSingleChildFirstClass(org.jboss.as.clustering.subsystem.AdditionalInitialization.class).addMavenResourceURL(dependencies).dontPersistXml();
    KernelServices services = builder.build();
    KernelServices legacyServices = services.getLegacyServices(version);
    Assert.assertNotNull(legacyServices);
    Assert.assertTrue("main services did not boot", services.isSuccessfulBoot());
    Assert.assertTrue(legacyServices.isSuccessfulBoot());
    // test failed operations involving backups
    List<ModelNode> xmlOps = builder.parseXmlResource("infinispan-transformer-reject.xml");
    ModelTestUtils.checkFailedTransformedBootOperations(services, version, xmlOps, createFailedOperationConfig(version));
}
Also used : 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) JGroupsSubsystemInitialization(org.jboss.as.clustering.jgroups.subsystem.JGroupsSubsystemInitialization)

Example 73 with KernelServicesBuilder

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

the class JacORBTransformersTestCase method testTransformersIORSettings.

private void testTransformersIORSettings(ModelTestControllerVersion controllerVersion, ModelVersion modelVersion) throws Exception {
    KernelServicesBuilder builder = createKernelServicesBuilder(AdditionalInitialization.ADMIN_ONLY_HC);
    // Add legacy subsystems
    builder.createLegacyKernelServicesBuilder(AdditionalInitialization.ADMIN_ONLY_HC, controllerVersion, modelVersion).addMavenResourceURL("org.jboss.as:jboss-as-jacorb:" + controllerVersion.getMavenGavVersion()).configureReverseControllerCheck(AdditionalInitialization.ADMIN_ONLY_HC, null);
    KernelServices mainServices = builder.build();
    assertTrue(mainServices.isSuccessfulBoot());
    KernelServices legacyServices = mainServices.getLegacyServices(modelVersion);
    assertNotNull(legacyServices);
    assertTrue(legacyServices.isSuccessfulBoot());
    ModelTestUtils.checkFailedTransformedBootOperations(mainServices, modelVersion, builder.parseXmlResource("subsystem-ior-settings.xml"), new FailedOperationTransformationConfig().addFailedAttribute(PathAddress.pathAddress(JacORBSubsystemResource.INSTANCE.getPathElement(), IORSettingsDefinition.INSTANCE.getPathElement()), FailedOperationTransformationConfig.REJECTED_RESOURCE).addFailedAttribute(PathAddress.pathAddress(JacORBSubsystemResource.INSTANCE.getPathElement(), IORSettingsDefinition.INSTANCE.getPathElement(), IORTransportConfigDefinition.INSTANCE.getPathElement()), FailedOperationTransformationConfig.REJECTED_RESOURCE).addFailedAttribute(PathAddress.pathAddress(JacORBSubsystemResource.INSTANCE.getPathElement(), IORSettingsDefinition.INSTANCE.getPathElement(), IORASContextDefinition.INSTANCE.getPathElement()), FailedOperationTransformationConfig.REJECTED_RESOURCE).addFailedAttribute(PathAddress.pathAddress(JacORBSubsystemResource.INSTANCE.getPathElement(), IORSettingsDefinition.INSTANCE.getPathElement(), IORSASContextDefinition.INSTANCE.getPathElement()), FailedOperationTransformationConfig.REJECTED_RESOURCE));
}
Also used : FailedOperationTransformationConfig(org.jboss.as.model.test.FailedOperationTransformationConfig) KernelServices(org.jboss.as.subsystem.test.KernelServices) KernelServicesBuilder(org.jboss.as.subsystem.test.KernelServicesBuilder)

Aggregations

KernelServicesBuilder (org.jboss.as.subsystem.test.KernelServicesBuilder)73 KernelServices (org.jboss.as.subsystem.test.KernelServices)69 ModelNode (org.jboss.dmr.ModelNode)33 ModelVersion (org.jboss.as.controller.ModelVersion)28 Test (org.junit.Test)25 FailedOperationTransformationConfig (org.jboss.as.model.test.FailedOperationTransformationConfig)20 PathAddress (org.jboss.as.controller.PathAddress)13 AbstractSubsystemBaseTest (org.jboss.as.subsystem.test.AbstractSubsystemBaseTest)13 ModelFixer (org.jboss.as.model.test.ModelFixer)7 AdditionalInitialization (org.jboss.as.subsystem.test.AdditionalInitialization)6 ModelTestControllerVersion (org.jboss.as.model.test.ModelTestControllerVersion)5 ControllerInitializer (org.jboss.as.subsystem.test.ControllerInitializer)5 Properties (java.util.Properties)4 Session (javax.mail.Session)4 NewAttributesConfig (org.jboss.as.model.test.FailedOperationTransformationConfig.NewAttributesConfig)2 TransactionLogger (org.jboss.as.txn.logging.TransactionLogger)2 HttpHandler (io.undertow.server.HttpHandler)1 PathHandler (io.undertow.server.handlers.PathHandler)1 ArrayList (java.util.ArrayList)1 HashMap (java.util.HashMap)1