use of org.jboss.as.controller.ModelVersion in project wildfly by wildfly.
the class DatasourcesSubsystemTestCase method testTransformerEAP7FullConfiguration.
/**
* Tests transformation of model from latest version which works well in EAP 7.0.0 without setting up FailedOperationTransformationConfig.
*
* @throws Exception
*/
private void testTransformerEAP7FullConfiguration(String subsystemXml) throws Exception {
ModelTestControllerVersion eap7ControllerVersion = ModelTestControllerVersion.EAP_7_0_0;
ModelVersion eap7ModelVersion = ModelVersion.create(4, 0, 0);
KernelServicesBuilder builder = createKernelServicesBuilder(AdditionalInitialization.MANAGEMENT);
KernelServices mainServices = initialKernelServices(builder, eap7ControllerVersion, eap7ModelVersion);
List<ModelNode> ops = builder.parseXmlResource(subsystemXml);
ModelTestUtils.checkFailedTransformedBootOperations(mainServices, eap7ModelVersion, ops, FailedOperationTransformationConfig.NO_FAILURES);
}
use of org.jboss.as.controller.ModelVersion in project wildfly by wildfly.
the class DatasourcesSubsystemTestCase method testTransformerEAP7Rejection.
/**
* Tests transformation of model from latest version which needs to be rejected in EAP 7.0.0
*
* @throws Exception
*/
private void testTransformerEAP7Rejection(String subsystemXml) throws Exception {
//Use the non-runtime version of the extension which will happen on the HC
ModelTestControllerVersion eap7ControllerVersion = ModelTestControllerVersion.EAP_7_0_0;
ModelVersion eap7ModelVersion = ModelVersion.create(4, 0, 0);
KernelServicesBuilder builder = createKernelServicesBuilder(AdditionalInitialization.MANAGEMENT);
KernelServices mainServices = initialKernelServices(builder, eap7ControllerVersion, eap7ModelVersion);
List<ModelNode> ops = builder.parseXmlResource(subsystemXml);
PathAddress subsystemAddress = PathAddress.pathAddress(DataSourcesSubsystemRootDefinition.PATH_SUBSYSTEM);
ModelTestUtils.checkFailedTransformedBootOperations(mainServices, eap7ModelVersion, ops, new FailedOperationTransformationConfig().addFailedAttribute(subsystemAddress.append(DataSourceDefinition.PATH_DATASOURCE), new RejectUndefinedAttribute(Constants.CONNECTION_URL.getName())));
}
use of org.jboss.as.controller.ModelVersion in project wildfly by wildfly.
the class NamingExtension method registerTransformers.
private void registerTransformers(SubsystemRegistration subsystem) {
final ModelVersion v2_0_0 = ModelVersion.create(2, 0, 0);
ChainedTransformationDescriptionBuilder chainedBuilder = TransformationDescriptionBuilder.Factory.createChainedSubystemInstance(subsystem.getSubsystemVersion());
ResourceTransformationDescriptionBuilder builder_2_0 = chainedBuilder.createBuilder(subsystem.getSubsystemVersion(), v2_0_0);
NamingBindingResourceDefinition.INSTANCE.registerTransformers_2_0(builder_2_0);
chainedBuilder.buildAndRegister(subsystem, new ModelVersion[] { v2_0_0 });
}
use of org.jboss.as.controller.ModelVersion 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);
}
use of org.jboss.as.controller.ModelVersion 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));
}
Aggregations