Search in sources :

Example 46 with KernelServicesBuilder

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

the class WebSubsystemTestCase method testTransformation_1_4_0.

//no need to test target 6.4 as current == 6.4
private void testTransformation_1_4_0(ModelTestControllerVersion controllerVersion) throws Exception {
    ModelVersion modelVersion = ModelVersion.create(1, 4, 0);
    String subsystemXml = readResource("subsystem-1.4.0.xml");
    KernelServicesBuilder builder = createKernelServicesBuilder(createAdditionalInitialization()).setSubsystemXml(subsystemXml);
    builder.createLegacyKernelServicesBuilder(null, controllerVersion, modelVersion).addMavenResourceURL("org.jboss.as:jboss-as-web:" + controllerVersion.getMavenGavVersion()).setExtensionClassName("org.jboss.as.web.WebExtension").configureReverseControllerCheck(createAdditionalInitialization(), null);
    KernelServices mainServices = builder.build();
    KernelServices legacyServices = mainServices.getLegacyServices(modelVersion);
    Assert.assertTrue(mainServices.isSuccessfulBoot());
    Assert.assertTrue(legacyServices.isSuccessfulBoot());
    checkSubsystemModelTransformation(mainServices, modelVersion, new ModelFixer.CumulativeModelFixer(SSLConfigurationNameFixer.INSTANCE, AccessLogPrefixFixer_1_2_0.INSTANCE));
}
Also used : KernelServices(org.jboss.as.subsystem.test.KernelServices) ModelVersion(org.jboss.as.controller.ModelVersion) ModelFixer(org.jboss.as.model.test.ModelFixer) KernelServicesBuilder(org.jboss.as.subsystem.test.KernelServicesBuilder)

Example 47 with KernelServicesBuilder

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

the class WebSubsystemTestCase method testRejectingTransformers_1_3_0.

private void testRejectingTransformers_1_3_0(ModelTestControllerVersion controllerVersion) throws Exception {
    ModelVersion modelVersion = ModelVersion.create(1, 3, 0);
    KernelServicesBuilder builder = createKernelServicesBuilder(createAdditionalInitialization());
    builder.createLegacyKernelServicesBuilder(null, controllerVersion, modelVersion).addMavenResourceURL("org.jboss.as:jboss-as-web:" + controllerVersion.getMavenGavVersion()).setExtensionClassName("org.jboss.as.web.WebExtension").configureReverseControllerCheck(createAdditionalInitialization(), null);
    KernelServices mainServices = builder.build();
    KernelServices legacyServices = mainServices.getLegacyServices(modelVersion);
    Assert.assertTrue("main services did not boot", mainServices.isSuccessfulBoot());
    Assert.assertTrue(legacyServices.isSuccessfulBoot());
    final PathAddress subsystem = PathAddress.EMPTY_ADDRESS.append("subsystem", "web");
    List<ModelNode> xmlOps = builder.parseXmlResource("subsystem-2.2.0.xml");
    FailedOperationTransformationConfig config = new FailedOperationTransformationConfig().addFailedAttribute(subsystem, new IntExpressionConfig("default-session-timeout")).addFailedAttribute(subsystem.append(PathElement.pathElement("connector", "http")), new FailedOperationTransformationConfig.NewAttributesConfig("redirect-binding", "proxy-binding")).addFailedAttribute(subsystem.append("virtual-server", "default-host").append("configuration", "sso"), new BooleanExpressionConfig("http-only"));
    ModelTestUtils.checkFailedTransformedBootOperations(mainServices, modelVersion, xmlOps, config);
    checkUndefinedCipherSuite(mainServices, modelVersion);
}
Also used : FailedOperationTransformationConfig(org.jboss.as.model.test.FailedOperationTransformationConfig) 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)

Example 48 with KernelServicesBuilder

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

the class MessagingActiveMQSubsystem_1_1_TestCase method testTransformers.

private void testTransformers(ModelTestControllerVersion controllerVersion, ModelVersion messagingVersion) throws Exception {
    //Boot up empty controllers with the resources needed for the ops coming from the xml to work
    KernelServicesBuilder builder = createKernelServicesBuilder(createAdditionalInitialization()).setSubsystemXmlResource("subsystem_1_1_transform.xml");
    builder.createLegacyKernelServicesBuilder(createAdditionalInitialization(), controllerVersion, messagingVersion).addMavenResourceURL(getMessagingActiveMQGAV(controllerVersion)).addMavenResourceURL(getActiveMQDependencies(controllerVersion)).configureReverseControllerCheck(createAdditionalInitialization(), null).dontPersistXml();
    KernelServices mainServices = builder.build();
    assertTrue(mainServices.isSuccessfulBoot());
    assertTrue(mainServices.getLegacyServices(messagingVersion).isSuccessfulBoot());
    checkSubsystemModelTransformation(mainServices, messagingVersion);
}
Also used : KernelServices(org.jboss.as.subsystem.test.KernelServices) KernelServicesBuilder(org.jboss.as.subsystem.test.KernelServicesBuilder)

Example 49 with KernelServicesBuilder

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

the class MessagingActiveMQSubsystem_1_1_TestCase method testRejectingTransformers.

private void testRejectingTransformers(ModelTestControllerVersion controllerVersion, ModelVersion messagingVersion) throws Exception {
    //Boot up empty controllers with the resources needed for the ops coming from the xml to work
    KernelServicesBuilder builder = createKernelServicesBuilder(createAdditionalInitialization());
    builder.createLegacyKernelServicesBuilder(createAdditionalInitialization(), controllerVersion, messagingVersion).addMavenResourceURL(getMessagingActiveMQGAV(controllerVersion)).addMavenResourceURL(getActiveMQDependencies(controllerVersion)).dontPersistXml();
    KernelServices mainServices = builder.build();
    assertTrue(mainServices.isSuccessfulBoot());
    assertTrue(mainServices.getLegacyServices(messagingVersion).isSuccessfulBoot());
    List<ModelNode> ops = builder.parseXmlResource("subsystem_1_1_reject_transform.xml");
    System.out.println("ops = " + ops);
    PathAddress subsystemAddress = PathAddress.pathAddress(SUBSYSTEM_PATH);
    ModelTestUtils.checkFailedTransformedBootOperations(mainServices, messagingVersion, ops, new FailedOperationTransformationConfig().addFailedAttribute(subsystemAddress, new FailedOperationTransformationConfig.NewAttributesConfig(MessagingSubsystemRootResourceDefinition.GLOBAL_CLIENT_THREAD_POOL_MAX_SIZE, MessagingSubsystemRootResourceDefinition.GLOBAL_CLIENT_SCHEDULED_THREAD_POOL_MAX_SIZE)).addFailedAttribute(subsystemAddress.append(SERVER_PATH), new FailedOperationTransformationConfig.NewAttributesConfig(ServerDefinition.ELYTRON_DOMAIN, ServerDefinition.JOURNAL_DATASOURCE, ServerDefinition.JOURNAL_MESSAGES_TABLE, ServerDefinition.JOURNAL_BINDINGS_TABLE, ServerDefinition.JOURNAL_LARGE_MESSAGES_TABLE, ServerDefinition.JOURNAL_PAGE_STORE_TABLE, ServerDefinition.JOURNAL_DATABASE)).addFailedAttribute(subsystemAddress.append(SERVER_PATH, REPLICATION_MASTER_PATH), new ChangeToTrueConfig(HAAttributes.CHECK_FOR_LIVE_SERVER.getName())).addFailedAttribute(subsystemAddress.append(SERVER_PATH, REPLICATION_COLOCATED_PATH, MessagingExtension.CONFIGURATION_MASTER_PATH), new ChangeToTrueConfig(HAAttributes.CHECK_FOR_LIVE_SERVER.getName())).addFailedAttribute(subsystemAddress.append(SERVER_PATH, PathElement.pathElement(CommonAttributes.HTTP_CONNECTOR)), new FailedOperationTransformationConfig.NewAttributesConfig(HTTPConnectorDefinition.SERVER_NAME)).addFailedAttribute(subsystemAddress.append(SERVER_PATH, BRIDGE_PATH), new FailedOperationTransformationConfig.NewAttributesConfig(BridgeDefinition.PRODUCER_WINDOW_SIZE)).addFailedAttribute(subsystemAddress.append(SERVER_PATH, CLUSTER_CONNECTION_PATH), new FailedOperationTransformationConfig.NewAttributesConfig(ClusterConnectionDefinition.PRODUCER_WINDOW_SIZE)).addFailedAttribute(subsystemAddress.append(SERVER_PATH, POOLED_CONNECTION_FACTORY_PATH), new FailedOperationTransformationConfig.NewAttributesConfig(ConnectionFactoryAttributes.Pooled.REBALANCE_CONNECTIONS, ConnectionFactoryAttributes.Pooled.STATISTICS_ENABLED)));
}
Also used : FailedOperationTransformationConfig(org.jboss.as.model.test.FailedOperationTransformationConfig) PathAddress(org.jboss.as.controller.PathAddress) KernelServices(org.jboss.as.subsystem.test.KernelServices) ModelNode(org.jboss.dmr.ModelNode) KernelServicesBuilder(org.jboss.as.subsystem.test.KernelServicesBuilder)

Example 50 with KernelServicesBuilder

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

the class WeldSubsystemTestCase method testTransformers10.

private void testTransformers10(ModelTestControllerVersion controllerVersion) throws Exception {
    ModelVersion modelVersion = ModelVersion.create(1, 0, 0);
    KernelServicesBuilder builder = createKernelServicesBuilder(AdditionalInitialization.MANAGEMENT).setSubsystemXmlResource("subsystem_3_0-transformers.xml");
    //which is why we need to include the jboss-as-controller artifact.
    builder.createLegacyKernelServicesBuilder(AdditionalInitialization.MANAGEMENT, controllerVersion, modelVersion).addMavenResourceURL("org.jboss.as:jboss-as-weld:" + controllerVersion.getMavenGavVersion()).skipReverseControllerCheck().dontPersistXml();
    KernelServices mainServices = builder.build();
    KernelServices legacyServices = mainServices.getLegacyServices(modelVersion);
    assertTrue(mainServices.isSuccessfulBoot());
    assertTrue(legacyServices.isSuccessfulBoot());
    checkSubsystemModelTransformation(mainServices, modelVersion);
}
Also used : KernelServices(org.jboss.as.subsystem.test.KernelServices) ModelVersion(org.jboss.as.controller.ModelVersion) 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