Search in sources :

Example 6 with FailedOperationTransformationConfig

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

Example 7 with FailedOperationTransformationConfig

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

Example 8 with FailedOperationTransformationConfig

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

Example 9 with FailedOperationTransformationConfig

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

Example 10 with FailedOperationTransformationConfig

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());
}
Also used : FailedOperationTransformationConfig(org.jboss.as.model.test.FailedOperationTransformationConfig) KernelServices(org.jboss.as.subsystem.test.KernelServices) ModelNode(org.jboss.dmr.ModelNode) KernelServicesBuilder(org.jboss.as.subsystem.test.KernelServicesBuilder) AdditionalInitialization(org.jboss.as.clustering.subsystem.AdditionalInitialization) AbstractSubsystemTest(org.jboss.as.subsystem.test.AbstractSubsystemTest) Test(org.junit.Test)

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