use of org.jboss.as.controller.ModelVersion in project wildfly by wildfly.
the class IDMSubsystem_1_0_TransformerUnitTestCase method testRejectionExpressions.
private void testRejectionExpressions(ModelTestControllerVersion controllerVersion, String picketLinkJBossAs7Version) throws Exception {
ModelVersion oldVersion = ModelVersion.create(1, 0, 0);
KernelServicesBuilder builder = createKernelServicesBuilder(AdditionalInitialization.MANAGEMENT);
builder.createLegacyKernelServicesBuilder(null, controllerVersion, oldVersion).setExtensionClassName(IDMExtension.class.getName()).addMavenResourceURL("org.wildfly:wildfly-picketlink:" + controllerVersion.getMavenGavVersion()).addMavenResourceURL("org.picketlink.distribution:picketlink-jbas7:" + picketLinkJBossAs7Version).dontPersistXml();
KernelServices mainServices = builder.build();
KernelServices legacyServices = mainServices.getLegacyServices(oldVersion);
Assert.assertNotNull(legacyServices);
Assert.assertTrue(mainServices.isSuccessfulBoot());
Assert.assertTrue(legacyServices.isSuccessfulBoot());
ModelNode op = createOperation(ADD, ModelElement.PARTITION_MANAGER.getName(), "test.partition", ModelElement.IDENTITY_CONFIGURATION.getName(), "test.config", ModelElement.LDAP_STORE.getName(), "ldap-store");
op.get(ModelElement.LDAP_STORE_ACTIVE_DIRECTORY.getName()).set(true);
TransformedOperation transformedOperation = mainServices.transformOperation(oldVersion, op);
Assert.assertTrue(transformedOperation.rejectOperation(null));
op = createOperation(ADD, ModelElement.PARTITION_MANAGER.getName(), "test.partition", ModelElement.IDENTITY_CONFIGURATION.getName(), "test.config", ModelElement.LDAP_STORE.getName(), "ldap-store");
op.get(ModelElement.LDAP_STORE_UNIQUE_ID_ATTRIBUTE_NAME.getName()).set("SOMEaTTRIBUTE");
transformedOperation = mainServices.transformOperation(oldVersion, op);
Assert.assertTrue(transformedOperation.rejectOperation(null));
}
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);
}
Aggregations