Search in sources :

Example 26 with ModelVersion

use of org.jboss.as.controller.ModelVersion in project wildfly by wildfly.

the class MailExtension method registerTransformers.

private void registerTransformers(SubsystemRegistration subsystem) {
    ChainedTransformationDescriptionBuilder chained = ResourceTransformationDescriptionBuilder.Factory.createChainedSubystemInstance(CURRENT_MODEL_VERSION);
    ModelVersion MODEL_VERSION_EAP64 = ModelVersion.create(1, 4, 0);
    ModelVersion MODEL_VERSION_EAP70 = ModelVersion.create(2, 0, 0);
    ResourceTransformationDescriptionBuilder builder70 = chained.createBuilder(CURRENT_MODEL_VERSION, MODEL_VERSION_EAP70);
    builder70.addChildResource(MAIL_SESSION_PATH).addChildResource(PathElement.pathElement(SERVER_TYPE)).getAttributeBuilder().addRejectCheck(RejectAttributeChecker.DEFINED, MailServerDefinition.CREDENTIAL_REFERENCE.getName()).setDiscard(DiscardAttributeChecker.UNDEFINED, MailServerDefinition.CREDENTIAL_REFERENCE.getName()).end().addChildResource(CUSTOM_SERVER_PATH).getAttributeBuilder().addRejectCheck(RejectAttributeChecker.DEFINED, MailServerDefinition.CREDENTIAL_REFERENCE.getName()).setDiscard(DiscardAttributeChecker.UNDEFINED, MailServerDefinition.CREDENTIAL_REFERENCE.getName());
    ResourceTransformationDescriptionBuilder builder64 = chained.createBuilder(MODEL_VERSION_EAP70, MODEL_VERSION_EAP64);
    ResourceTransformationDescriptionBuilder sessionBuilder = builder64.addChildResource(MAIL_SESSION_PATH).addChildResource(PathElement.pathElement(SERVER_TYPE)).getAttributeBuilder().addRejectCheck(RejectAttributeChecker.DEFINED, TLS).setDiscard(DiscardAttributeChecker.UNDEFINED, TLS).end();
    sessionBuilder.discardChildResource(CUSTOM_SERVER_PATH);
    chained.buildAndRegister(subsystem, new ModelVersion[] { MODEL_VERSION_EAP70, MODEL_VERSION_EAP64 });
}
Also used : ChainedTransformationDescriptionBuilder(org.jboss.as.controller.transform.description.ChainedTransformationDescriptionBuilder) ResourceTransformationDescriptionBuilder(org.jboss.as.controller.transform.description.ResourceTransformationDescriptionBuilder) ModelVersion(org.jboss.as.controller.ModelVersion)

Example 27 with ModelVersion

use of org.jboss.as.controller.ModelVersion in project wildfly by wildfly.

the class WSExtension method registerTransformers2_0_0.

private void registerTransformers2_0_0(SubsystemRegistration registration) {
    ModelVersion version = ModelVersion.create(2, 0, 0);
    ResourceTransformationDescriptionBuilder builder = TransformationDescriptionBuilder.Factory.createSubsystemInstance();
    builder.getAttributeBuilder().addRejectCheck(RejectAttributeChecker.SIMPLE_EXPRESSIONS, Attributes.STATISTICS_ENABLED);
    TransformationDescription.Tools.register(builder.build(), registration, version);
}
Also used : ResourceTransformationDescriptionBuilder(org.jboss.as.controller.transform.description.ResourceTransformationDescriptionBuilder) ModelVersion(org.jboss.as.controller.ModelVersion)

Example 28 with ModelVersion

use of org.jboss.as.controller.ModelVersion in project wildfly by wildfly.

the class SingletonTransformersTestCase method testTransformation.

private void testTransformation(final ModelTestControllerVersion controller) throws Exception {
    final ModelVersion version = getModelVersion(controller).getVersion();
    final String subsystemXmlResource = String.format("subsystem-transform-%d_%d_%d.xml", version.getMajor(), version.getMinor(), version.getMicro());
    final String[] dependencies = getDependencies(controller);
    KernelServices services = this.buildKernelServices(subsystemXmlResource, controller, version, dependencies);
    checkSubsystemModelTransformation(services, version, null, false);
}
Also used : KernelServices(org.jboss.as.subsystem.test.KernelServices) ModelVersion(org.jboss.as.controller.ModelVersion)

Example 29 with ModelVersion

use of org.jboss.as.controller.ModelVersion 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)

Example 30 with ModelVersion

use of org.jboss.as.controller.ModelVersion in project wildfly by wildfly.

the class WeldSubsystemTestCase method testTransformers30.

@Test
public void testTransformers30() throws Exception {
    ModelVersion modelVersion = ModelVersion.create(3, 0, 0);
    KernelServicesBuilder builder = createKernelServicesBuilder(AdditionalInitialization.MANAGEMENT).setSubsystemXmlResource("subsystem_4_0-transformers.xml");
    builder.createLegacyKernelServicesBuilder(AdditionalInitialization.MANAGEMENT, ModelTestControllerVersion.EAP_7_0_0, modelVersion).addMavenResourceURL("org.jboss.eap:wildfly-weld:" + ModelTestControllerVersion.EAP_7_0_0.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) AbstractSubsystemBaseTest(org.jboss.as.subsystem.test.AbstractSubsystemBaseTest) Test(org.junit.Test)

Aggregations

ModelVersion (org.jboss.as.controller.ModelVersion)37 KernelServices (org.jboss.as.subsystem.test.KernelServices)30 KernelServicesBuilder (org.jboss.as.subsystem.test.KernelServicesBuilder)28 ModelNode (org.jboss.dmr.ModelNode)18 FailedOperationTransformationConfig (org.jboss.as.model.test.FailedOperationTransformationConfig)10 ResourceTransformationDescriptionBuilder (org.jboss.as.controller.transform.description.ResourceTransformationDescriptionBuilder)7 PathAddress (org.jboss.as.controller.PathAddress)6 ChainedTransformationDescriptionBuilder (org.jboss.as.controller.transform.description.ChainedTransformationDescriptionBuilder)5 ModelTestControllerVersion (org.jboss.as.model.test.ModelTestControllerVersion)5 Test (org.junit.Test)4 ModelFixer (org.jboss.as.model.test.ModelFixer)3 NewAttributesConfig (org.jboss.as.model.test.FailedOperationTransformationConfig.NewAttributesConfig)2 AbstractSubsystemBaseTest (org.jboss.as.subsystem.test.AbstractSubsystemBaseTest)2 Map (java.util.Map)1 JGroupsSubsystemInitialization (org.jboss.as.clustering.jgroups.subsystem.JGroupsSubsystemInitialization)1 AdditionalInitialization (org.jboss.as.clustering.subsystem.AdditionalInitialization)1 AttributeDefinition (org.jboss.as.controller.AttributeDefinition)1 TransformedOperation (org.jboss.as.controller.transform.OperationTransformer.TransformedOperation)1 TransformationContext (org.jboss.as.controller.transform.TransformationContext)1 AttributeConverter (org.jboss.as.controller.transform.description.AttributeConverter)1