Search in sources :

Example 46 with FailedOperationTransformationConfig

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);
}
Also used : FailedOperationTransformationConfig(org.jboss.as.model.test.FailedOperationTransformationConfig) PathAddress(org.jboss.as.controller.PathAddress) KernelServices(org.jboss.as.subsystem.test.KernelServices) ModelNode(org.jboss.dmr.ModelNode) KernelServicesBuilder(org.jboss.as.subsystem.test.KernelServicesBuilder)

Example 47 with FailedOperationTransformationConfig

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);
}
Also used : FailedOperationTransformationConfig(org.jboss.as.model.test.FailedOperationTransformationConfig) PathAddress(org.jboss.as.controller.PathAddress) KernelServices(org.jboss.as.subsystem.test.KernelServices) ModelNode(org.jboss.dmr.ModelNode) KernelServicesBuilder(org.jboss.as.subsystem.test.KernelServicesBuilder)

Example 48 with FailedOperationTransformationConfig

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();
}
Also used : FailedOperationTransformationConfig(org.jboss.as.model.test.FailedOperationTransformationConfig) PathAddress(org.jboss.as.controller.PathAddress) KernelServices(org.jboss.as.subsystem.test.KernelServices) KernelServicesBuilder(org.jboss.as.subsystem.test.KernelServicesBuilder)

Aggregations

FailedOperationTransformationConfig (org.jboss.as.model.test.FailedOperationTransformationConfig)48 KernelServices (org.jboss.as.subsystem.test.KernelServices)43 KernelServicesBuilder (org.jboss.as.subsystem.test.KernelServicesBuilder)41 ModelNode (org.jboss.dmr.ModelNode)37 PathAddress (org.jboss.as.controller.PathAddress)34 ModelVersion (org.jboss.as.controller.ModelVersion)11 ModelTestControllerVersion (org.jboss.as.model.test.ModelTestControllerVersion)3 Test (org.junit.Test)3 NewAttributesConfig (org.jboss.as.model.test.FailedOperationTransformationConfig.NewAttributesConfig)2 LinkedList (java.util.LinkedList)1 AdditionalInitialization (org.jboss.as.clustering.subsystem.AdditionalInitialization)1 ConnectorLogger (org.jboss.as.connector.logging.ConnectorLogger)1 AttributeDefinition (org.jboss.as.controller.AttributeDefinition)1 AttributesPathAddressConfig (org.jboss.as.model.test.FailedOperationTransformationConfig.AttributesPathAddressConfig)1 ChainedConfig (org.jboss.as.model.test.FailedOperationTransformationConfig.ChainedConfig)1 AbstractSubsystemBaseTest (org.jboss.as.subsystem.test.AbstractSubsystemBaseTest)1 AbstractSubsystemTest (org.jboss.as.subsystem.test.AbstractSubsystemTest)1 AdditionalInitialization (org.jboss.as.subsystem.test.AdditionalInitialization)1