use of org.jboss.as.model.test.FailedOperationTransformationConfig in project wildfly by wildfly.
the class Subsystem_3_0_ParsingTestCase method testRejectingTransformers.
private void testRejectingTransformers(ModelTestControllerVersion controllerVersion, ModelVersion opentracingVersion) 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, opentracingVersion).addMavenResourceURL(String.format("%s:wildfly-microprofile-opentracing-extension:%s", controllerVersion.getMavenGroupId(), controllerVersion.getMavenGavVersion())).addMavenResourceURL(String.format("%s:wildfly-microprofile-opentracing-smallrye:%s", controllerVersion.getMavenGroupId(), controllerVersion.getMavenGavVersion())).addMavenResourceURL(String.format("%s:wildfly-weld:%s", controllerVersion.getMavenGroupId(), controllerVersion.getMavenGavVersion())).addMavenResourceURL(String.format("%s:wildfly-weld-common:%s", controllerVersion.getMavenGroupId(), controllerVersion.getMavenGavVersion())).addSingleChildFirstClass(OpentracingAdditionalInitialization.class).skipReverseControllerCheck().dontPersistXml();
KernelServices mainServices = builder.build();
assertTrue(mainServices.isSuccessfulBoot());
assertTrue(mainServices.getLegacyServices(opentracingVersion).isSuccessfulBoot());
List<ModelNode> ops = builder.parseXmlResource("subsystem_3_0_reject_transform.xml");
PathAddress subsystemAddress = PathAddress.pathAddress(SubsystemExtension.SUBSYSTEM_PATH);
FailedOperationTransformationConfig config = new FailedOperationTransformationConfig();
config.addFailedAttribute(subsystemAddress, new FailedOperationTransformationConfig.NewAttributesConfig(SubsystemDefinition.DEFAULT_TRACER)).addFailedAttribute(subsystemAddress.append(JaegerTracerConfigurationDefinition.TRACER_CONFIGURATION_PATH), FailedOperationTransformationConfig.REJECTED_RESOURCE);
ModelTestUtils.checkFailedTransformedBootOperations(mainServices, opentracingVersion, ops, config);
}
use of org.jboss.as.model.test.FailedOperationTransformationConfig in project wildfly by wildfly.
the class Subsystem_2_0_ParsingTestCase method testRejectingTransformers.
private void testRejectingTransformers(ModelTestControllerVersion controllerVersion, ModelVersion opentracingVersion) 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, opentracingVersion).addMavenResourceURL(String.format("%s:wildfly-microprofile-opentracing-extension:%s", controllerVersion.getMavenGroupId(), controllerVersion.getMavenGavVersion())).addMavenResourceURL(String.format("%s:wildfly-microprofile-opentracing-smallrye:%s", controllerVersion.getMavenGroupId(), controllerVersion.getMavenGavVersion())).addMavenResourceURL(String.format("%s:wildfly-weld:%s", controllerVersion.getMavenGroupId(), controllerVersion.getMavenGavVersion())).addMavenResourceURL(String.format("%s:wildfly-weld-common:%s", controllerVersion.getMavenGroupId(), controllerVersion.getMavenGavVersion())).addSingleChildFirstClass(OpentracingAdditionalInitialization.class).skipReverseControllerCheck().dontPersistXml();
KernelServices mainServices = builder.build();
assertTrue(mainServices.isSuccessfulBoot());
assertTrue(mainServices.getLegacyServices(opentracingVersion).isSuccessfulBoot());
List<ModelNode> ops = builder.parseXmlResource("subsystem_2_0_reject_transform.xml");
PathAddress subsystemAddress = PathAddress.pathAddress(SubsystemExtension.SUBSYSTEM_PATH);
FailedOperationTransformationConfig config = new FailedOperationTransformationConfig();
config.addFailedAttribute(subsystemAddress, new FailedOperationTransformationConfig.NewAttributesConfig(SubsystemDefinition.DEFAULT_TRACER)).addFailedAttribute(subsystemAddress.append(JaegerTracerConfigurationDefinition.TRACER_CONFIGURATION_PATH), FailedOperationTransformationConfig.REJECTED_RESOURCE);
ModelTestUtils.checkFailedTransformedBootOperations(mainServices, opentracingVersion, ops, config);
}
use of org.jboss.as.model.test.FailedOperationTransformationConfig in project wildfly by wildfly.
the class SecurityTransformersTestCase method testReject.
private void testReject(ModelTestControllerVersion controllerVersion, ModelVersion targetVersion, String mavenGAV) throws Exception {
KernelServicesBuilder builder = createKernelServicesBuilder(createAdditionalInitialization());
builder.createLegacyKernelServicesBuilder(null, controllerVersion, targetVersion).configureReverseControllerCheck(createAdditionalInitialization(), null).addMavenResourceURL(mavenGAV).dontPersistXml();
KernelServices mainServices = builder.build();
Assert.assertTrue(mainServices.isSuccessfulBoot());
KernelServices legacyServices = mainServices.getLegacyServices(targetVersion);
Assert.assertTrue(legacyServices.isSuccessfulBoot());
Assert.assertNotNull(legacyServices);
// 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, targetVersion, builder.parseXmlResource("security-transformers-reject_2.0.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), new FailedOperationTransformationConfig.NewAttributesConfig(Constants.INITIALIZE_JACC)));
legacyServices.shutdown();
mainServices.shutdown();
}
Aggregations