use of org.jboss.as.model.test.FailedOperationTransformationConfig in project wildfly by wildfly.
the class WeldSubsystemTestCase method testRejectTransformers10.
private void testRejectTransformers10(ModelTestControllerVersion controllerVersion) throws Exception {
ModelVersion modelVersion = ModelVersion.create(1, 0, 0);
KernelServicesBuilder builder = createKernelServicesBuilder(AdditionalInitialization.MANAGEMENT);
//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();
Assert.assertTrue(mainServices.isSuccessfulBoot());
Assert.assertTrue(mainServices.getLegacyServices(modelVersion).isSuccessfulBoot());
ModelTestUtils.checkFailedTransformedBootOperations(mainServices, modelVersion, parse(getSubsystemXml("subsystem-reject.xml")), new FailedOperationTransformationConfig().addFailedAttribute(PathAddress.pathAddress(WeldExtension.PATH_SUBSYSTEM), ChainedConfig.createBuilder(WeldResourceDefinition.NON_PORTABLE_MODE_ATTRIBUTE, WeldResourceDefinition.REQUIRE_BEAN_DESCRIPTOR_ATTRIBUTE).addConfig(new FalseOrUndefinedToTrueConfig(WeldResourceDefinition.NON_PORTABLE_MODE_ATTRIBUTE, WeldResourceDefinition.REQUIRE_BEAN_DESCRIPTOR_ATTRIBUTE)).addConfig(new NewAttributesConfig(WeldResourceDefinition.DEVELOPMENT_MODE_ATTRIBUTE)).addConfig(new NewAttributesConfig(WeldResourceDefinition.THREAD_POOL_SIZE_ATTRIBUTE)).build()));
}
use of org.jboss.as.model.test.FailedOperationTransformationConfig in project wildfly by wildfly.
the class SubsystemTransformerTestCase method testFailedTransformersEAP700.
@Test
public void testFailedTransformersEAP700() throws Exception {
final KernelServicesBuilder builder = createKernelServicesBuilder(AdditionalInitialization.MANAGEMENT);
final ModelVersion legacyVersion = ModelVersion.create(1, 1, 0);
final ModelTestControllerVersion controllerVersion = ModelTestControllerVersion.EAP_7_0_0;
// Add legacy subsystems
builder.createLegacyKernelServicesBuilder(AdditionalInitialization.MANAGEMENT, controllerVersion, legacyVersion).addMavenResourceURL(controllerVersion.getMavenGroupId() + ":wildfly-batch-jberet:" + controllerVersion.getMavenGavVersion()).addMavenResourceURL(controllerVersion.getCoreMavenGroupId() + ":wildfly-threads:" + controllerVersion.getCoreVersion());
final KernelServices mainServices = builder.build();
final KernelServices legacyServices = mainServices.getLegacyServices(legacyVersion);
Assert.assertNotNull(legacyServices);
Assert.assertTrue("main services did not boot", mainServices.isSuccessfulBoot());
Assert.assertTrue(legacyServices.isSuccessfulBoot());
final List<ModelNode> ops = builder.parseXmlResource("/default-subsystem.xml");
ModelTestUtils.checkFailedTransformedBootOperations(mainServices, legacyVersion, ops, new FailedOperationTransformationConfig().addFailedAttribute(PathAddress.pathAddress(BatchSubsystemDefinition.SUBSYSTEM_PATH), new FailedOperationTransformationConfig.NewAttributesConfig(BatchSubsystemDefinition.SECURITY_DOMAIN)));
}
use of org.jboss.as.model.test.FailedOperationTransformationConfig in project wildfly by wildfly.
the class ModClusterTransformersTestCase method createFailedOperationConfig.
/**
* Changed attributes:
*
* - proxies configuration
* - status-interval is rejected if set to value other than 10
* - session-draining-strategy configuration
*/
private static FailedOperationTransformationConfig createFailedOperationConfig(ModelVersion version) {
FailedOperationTransformationConfig config = new FailedOperationTransformationConfig();
PathAddress subsystemAddress = PathAddress.pathAddress(ModClusterSubsystemResourceDefinition.PATH);
PathAddress configurationAddress = subsystemAddress.append(ModClusterConfigResourceDefinition.PATH);
if (ModClusterModel.VERSION_3_0_0.requiresTransformation(version)) {
config.addFailedAttribute(configurationAddress, FailedOperationTransformationConfig.ChainedConfig.createBuilder(CommonAttributes.STATUS_INTERVAL, CommonAttributes.PROXIES).addConfig(new StatusIntervalConfig(CommonAttributes.STATUS_INTERVAL)).addConfig(new ProxiesConfig(CommonAttributes.PROXIES)).build());
}
if (ModClusterModel.VERSION_1_5_0.requiresTransformation(version)) {
config.addFailedAttribute(configurationAddress, FailedOperationTransformationConfig.ChainedConfig.createBuilder(CommonAttributes.STATUS_INTERVAL, CommonAttributes.PROXIES, CommonAttributes.SESSION_DRAINING_STRATEGY).addConfig(new StatusIntervalConfig(CommonAttributes.STATUS_INTERVAL)).addConfig(new ProxiesConfig(CommonAttributes.PROXIES)).addConfig(new SessionDrainingStrategyConfig(CommonAttributes.SESSION_DRAINING_STRATEGY)).build());
}
return config;
}
use of org.jboss.as.model.test.FailedOperationTransformationConfig in project wildfly by wildfly.
the class SecurityDomainModelv30UnitTestCase method testTransformers.
private void testTransformers(ModelTestControllerVersion controllerVersion) throws Exception {
KernelServicesBuilder builder = createKernelServicesBuilder(createAdditionalInitialization());
ModelVersion version = ModelVersion.create(1, 3, 0);
final String mavenGavVersion = controllerVersion.getMavenGavVersion();
final String artifactId;
if (controllerVersion.isEap() && mavenGavVersion.equals(controllerVersion.getCoreVersion())) {
/* EAP 6 */
artifactId = "jboss-as-security";
} else {
artifactId = "wildfly-security";
}
builder.createLegacyKernelServicesBuilder(AdditionalInitialization.MANAGEMENT, controllerVersion, version).addMavenResourceURL(controllerVersion.getMavenGroupId() + ":" + artifactId + ":" + mavenGavVersion);
KernelServices mainServices = builder.build();
assertTrue(mainServices.isSuccessfulBoot());
KernelServices legacyServices = mainServices.getLegacyServices(version);
assertNotNull(legacyServices);
assertTrue(legacyServices.isSuccessfulBoot());
// any elytron-related resources in the model should get rejected as those are not supported in model version 1.3.0.
PathAddress subsystemAddress = PathAddress.pathAddress(PathElement.pathElement(SUBSYSTEM, getMainSubsystemName()));
ModelTestUtils.checkFailedTransformedBootOperations(mainServices, version, builder.parseXmlResource("securitysubsystemv30.xml"), new FailedOperationTransformationConfig().addFailedAttribute(PathAddress.pathAddress(subsystemAddress, PathElement.pathElement(Constants.ELYTRON_REALM)), FailedOperationTransformationConfig.REJECTED_RESOURCE).addFailedAttribute(PathAddress.pathAddress(subsystemAddress, PathElement.pathElement(Constants.ELYTRON_KEY_STORE)), FailedOperationTransformationConfig.REJECTED_RESOURCE).addFailedAttribute(PathAddress.pathAddress(subsystemAddress, PathElement.pathElement(Constants.ELYTRON_TRUST_STORE)), FailedOperationTransformationConfig.REJECTED_RESOURCE).addFailedAttribute(PathAddress.pathAddress(subsystemAddress, PathElement.pathElement(Constants.ELYTRON_KEY_MANAGER)), FailedOperationTransformationConfig.REJECTED_RESOURCE).addFailedAttribute(PathAddress.pathAddress(subsystemAddress, PathElement.pathElement(Constants.ELYTRON_TRUST_MANAGER)), FailedOperationTransformationConfig.REJECTED_RESOURCE).addFailedAttribute(PathAddress.pathAddress(subsystemAddress, PathElement.pathElement(Constants.SECURITY_DOMAIN, "domain-with-custom-audit-provider"), SecurityExtension.PATH_AUDIT_CLASSIC, PathElement.pathElement(Constants.PROVIDER_MODULE, "org.myorg.security.MyCustomLogAuditProvider")), new FailedOperationTransformationConfig.NewAttributesConfig(Constants.MODULE)).addFailedAttribute(PathAddress.pathAddress(subsystemAddress, PathElement.pathElement(Constants.SECURITY_MANAGEMENT)), new FailedOperationTransformationConfig.NewAttributesConfig(Constants.INITIALIZE_JACC)));
}
use of org.jboss.as.model.test.FailedOperationTransformationConfig in project wildfly by wildfly.
the class DistributableWebTransformerTestCase method testRejections.
/**
* Tests rejected transformation of the model from current version into specified version.
*/
@Test
public void testRejections() throws Exception {
// create builder for current subsystem version
KernelServicesBuilder builder = createKernelServicesBuilder(this.additionalInitialization);
// initialize the legacy services and add required jars
builder.createLegacyKernelServicesBuilder(this.additionalInitialization, this.controller, this.version).addMavenResourceURL(this.getDependencies()).addSingleChildFirstClass(AdditionalInitialization.class).dontPersistXml();
KernelServices services = builder.build();
Assert.assertTrue(services.isSuccessfulBoot());
KernelServices legacyServices = services.getLegacyServices(this.version);
Assert.assertNotNull(legacyServices);
Assert.assertTrue(legacyServices.isSuccessfulBoot());
List<ModelNode> operations = builder.parseXmlResource("wildfly-distributable-web-transform-reject.xml");
ModelTestUtils.checkFailedTransformedBootOperations(services, this.version, operations, new FailedOperationTransformationConfig());
}
Aggregations