Search in sources :

Example 16 with FailedOperationTransformationConfig

use of org.jboss.as.model.test.FailedOperationTransformationConfig in project wildfly by wildfly.

the class MessagingActiveMQSubsystem_4_0_TestCase method testRejectingTransformers.

private void testRejectingTransformers(ModelTestControllerVersion controllerVersion, ModelVersion messagingVersion) 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, messagingVersion).addMavenResourceURL(getMessagingActiveMQGAV(controllerVersion)).addMavenResourceURL(getActiveMQDependencies(controllerVersion)).addMavenResourceURL(getJGroupsDependencies(controllerVersion)).skipReverseControllerCheck().dontPersistXml();
    KernelServices mainServices = builder.build();
    assertTrue(mainServices.isSuccessfulBoot());
    assertTrue(mainServices.getLegacyServices(messagingVersion).isSuccessfulBoot());
    List<ModelNode> ops = builder.parseXmlResource("subsystem_4_0_reject_transform.xml");
    System.out.println("ops = " + ops);
    PathAddress subsystemAddress = PathAddress.pathAddress(SUBSYSTEM_PATH);
    FailedOperationTransformationConfig config = new FailedOperationTransformationConfig();
    if (messagingVersion.equals(MessagingExtension.VERSION_1_0_0)) {
        config.addFailedAttribute(subsystemAddress, new FailedOperationTransformationConfig.NewAttributesConfig(MessagingSubsystemRootResourceDefinition.GLOBAL_CLIENT_THREAD_POOL_MAX_SIZE, MessagingSubsystemRootResourceDefinition.GLOBAL_CLIENT_SCHEDULED_THREAD_POOL_MAX_SIZE)).addFailedAttribute(subsystemAddress.append(SERVER_PATH), new FailedOperationTransformationConfig.NewAttributesConfig(ServerDefinition.ELYTRON_DOMAIN, ServerDefinition.JOURNAL_DATASOURCE, ServerDefinition.JOURNAL_MESSAGES_TABLE, ServerDefinition.JOURNAL_BINDINGS_TABLE, ServerDefinition.JOURNAL_JMS_BINDINGS_TABLE, ServerDefinition.JOURNAL_LARGE_MESSAGES_TABLE, ServerDefinition.JOURNAL_PAGE_STORE_TABLE, ServerDefinition.JOURNAL_DATABASE, ServerDefinition.JOURNAL_JDBC_NETWORK_TIMEOUT, ServerDefinition.JOURNAL_JDBC_LOCK_EXPIRATION, ServerDefinition.JOURNAL_JDBC_LOCK_RENEW_PERIOD, ServerDefinition.JOURNAL_NODE_MANAGER_STORE_TABLE)).addFailedAttribute(subsystemAddress.append(SERVER_PATH, REPLICATION_MASTER_PATH), new ChangeToTrueConfig(HAAttributes.CHECK_FOR_LIVE_SERVER.getName())).addFailedAttribute(subsystemAddress.append(SERVER_PATH, REPLICATION_COLOCATED_PATH, MessagingExtension.CONFIGURATION_MASTER_PATH), new ChangeToTrueConfig(HAAttributes.CHECK_FOR_LIVE_SERVER.getName())).addFailedAttribute(subsystemAddress.append(SERVER_PATH, ADDRESS_SETTING_PATH), new FailedOperationTransformationConfig.NewAttributesConfig(AddressSettingDefinition.AUTO_CREATE_QUEUES, AddressSettingDefinition.AUTO_DELETE_QUEUES, AddressSettingDefinition.AUTO_CREATE_ADDRESSES, AddressSettingDefinition.AUTO_DELETE_ADDRESSES)).addFailedAttribute(subsystemAddress.append(SERVER_PATH, pathElement(CommonAttributes.HTTP_CONNECTOR)), new FailedOperationTransformationConfig.NewAttributesConfig(HTTPConnectorDefinition.SERVER_NAME)).addFailedAttribute(subsystemAddress.append(SERVER_PATH, BRIDGE_PATH), new FailedOperationTransformationConfig.NewAttributesConfig(BridgeDefinition.PRODUCER_WINDOW_SIZE)).addFailedAttribute(subsystemAddress.append(SERVER_PATH, CLUSTER_CONNECTION_PATH), new FailedOperationTransformationConfig.NewAttributesConfig(ClusterConnectionDefinition.PRODUCER_WINDOW_SIZE)).addFailedAttribute(subsystemAddress.append(SERVER_PATH, CONNECTION_FACTORY_PATH), new FailedOperationTransformationConfig.NewAttributesConfig(ConnectionFactoryAttributes.Common.DESERIALIZATION_BLACKLIST, ConnectionFactoryAttributes.Common.DESERIALIZATION_WHITELIST, ConnectionFactoryAttributes.Common.INITIAL_MESSAGE_PACKET_SIZE)).addFailedAttribute(subsystemAddress.append(SERVER_PATH, POOLED_CONNECTION_FACTORY_PATH), new FailedOperationTransformationConfig.NewAttributesConfig(ConnectionFactoryAttributes.Pooled.ALLOW_LOCAL_TRANSACTIONS, ConnectionFactoryAttributes.Pooled.REBALANCE_CONNECTIONS, ConnectionFactoryAttributes.Pooled.STATISTICS_ENABLED, ConnectionFactoryAttributes.Pooled.CREDENTIAL_REFERENCE, ConnectionFactoryAttributes.Common.DESERIALIZATION_BLACKLIST, ConnectionFactoryAttributes.Common.DESERIALIZATION_WHITELIST));
    } else if (messagingVersion.equals(MessagingExtension.VERSION_2_0_0)) {
        config.addFailedAttribute(subsystemAddress.append(SERVER_PATH, ADDRESS_SETTING_PATH), new FailedOperationTransformationConfig.NewAttributesConfig(AddressSettingDefinition.AUTO_CREATE_QUEUES, AddressSettingDefinition.AUTO_DELETE_QUEUES, AddressSettingDefinition.AUTO_CREATE_ADDRESSES, AddressSettingDefinition.AUTO_DELETE_ADDRESSES)).addFailedAttribute(subsystemAddress.append(SERVER_PATH), new FailedOperationTransformationConfig.NewAttributesConfig(ServerDefinition.JOURNAL_JDBC_LOCK_EXPIRATION, ServerDefinition.JOURNAL_JDBC_LOCK_RENEW_PERIOD, ServerDefinition.JOURNAL_NODE_MANAGER_STORE_TABLE)).addFailedAttribute(subsystemAddress.append(SERVER_PATH, CONNECTION_FACTORY_PATH), new FailedOperationTransformationConfig.NewAttributesConfig(ConnectionFactoryAttributes.Common.INITIAL_MESSAGE_PACKET_SIZE));
    }
    config.addFailedAttribute(subsystemAddress.append(SERVER_PATH, MessagingExtension.BROADCAST_GROUP_PATH), new FailedOperationTransformationConfig.NewAttributesConfig(BroadcastGroupDefinition.JGROUPS_CHANNEL));
    config.addFailedAttribute(subsystemAddress.append(SERVER_PATH, DiscoveryGroupDefinition.PATH), new FailedOperationTransformationConfig.NewAttributesConfig(DiscoveryGroupDefinition.JGROUPS_CHANNEL));
    config.addFailedAttribute(subsystemAddress.append(DiscoveryGroupDefinition.PATH), FailedOperationTransformationConfig.REJECTED_RESOURCE);
    config.addFailedAttribute(subsystemAddress.append(pathElement(CommonAttributes.REMOTE_CONNECTOR)), FailedOperationTransformationConfig.REJECTED_RESOURCE);
    config.addFailedAttribute(subsystemAddress.append(pathElement(CommonAttributes.IN_VM_CONNECTOR)), FailedOperationTransformationConfig.REJECTED_RESOURCE);
    config.addFailedAttribute(subsystemAddress.append(pathElement(CommonAttributes.CONNECTOR)), FailedOperationTransformationConfig.REJECTED_RESOURCE);
    config.addFailedAttribute(subsystemAddress.append(MessagingExtension.HTTP_CONNECTOR_PATH), FailedOperationTransformationConfig.REJECTED_RESOURCE);
    config.addFailedAttribute(subsystemAddress.append(CONNECTION_FACTORY_PATH), FailedOperationTransformationConfig.REJECTED_RESOURCE);
    config.addFailedAttribute(subsystemAddress.append(POOLED_CONNECTION_FACTORY_PATH), FailedOperationTransformationConfig.REJECTED_RESOURCE);
    config.addFailedAttribute(subsystemAddress.append(EXTERNAL_JMS_QUEUE_PATH), FailedOperationTransformationConfig.REJECTED_RESOURCE);
    config.addFailedAttribute(subsystemAddress.append(EXTERNAL_JMS_TOPIC_PATH), FailedOperationTransformationConfig.REJECTED_RESOURCE);
    ModelTestUtils.checkFailedTransformedBootOperations(mainServices, messagingVersion, ops, config);
    mainServices.shutdown();
}
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 17 with FailedOperationTransformationConfig

use of org.jboss.as.model.test.FailedOperationTransformationConfig in project wildfly by wildfly.

the class JacORBTransformersTestCase method testTransformersSecurityClient.

private void testTransformersSecurityClient(ModelTestControllerVersion controllerVersion, ModelVersion modelVersion) throws Exception {
    KernelServicesBuilder builder = createKernelServicesBuilder(AdditionalInitialization.ADMIN_ONLY_HC);
    // Add legacy subsystems
    builder.createLegacyKernelServicesBuilder(AdditionalInitialization.ADMIN_ONLY_HC, controllerVersion, modelVersion).addMavenResourceURL("org.jboss.as:jboss-as-jacorb:" + controllerVersion.getMavenGavVersion()).addMavenResourceURL("org.jboss.spec.javax.rmi:jboss-rmi-api_1.0_spec:1.0.4.Final-redhat-3").configureReverseControllerCheck(AdditionalInitialization.ADMIN_ONLY_HC, null);
    KernelServices mainServices = builder.build();
    assertTrue(mainServices.isSuccessfulBoot());
    KernelServices legacyServices = mainServices.getLegacyServices(modelVersion);
    assertNotNull(legacyServices);
    assertTrue(legacyServices.isSuccessfulBoot());
    FailedOperationTransformationConfig config = new FailedOperationTransformationConfig();
    ModelTestUtils.checkFailedTransformedBootOperations(mainServices, modelVersion, builder.parseXmlResource("subsystem-security-client.xml"), config);
    checkSubsystemModelTransformation(mainServices, modelVersion);
}
Also used : FailedOperationTransformationConfig(org.jboss.as.model.test.FailedOperationTransformationConfig) KernelServices(org.jboss.as.subsystem.test.KernelServices) KernelServicesBuilder(org.jboss.as.subsystem.test.KernelServicesBuilder)

Example 18 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 healthVersion) 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, healthVersion).addMavenResourceURL(getMicroProfileSmallryeHeatlhGAV(controllerVersion)).skipReverseControllerCheck().dontPersistXml();
    KernelServices mainServices = builder.build();
    assertTrue(mainServices.isSuccessfulBoot());
    assertTrue(mainServices.getLegacyServices(healthVersion).isSuccessfulBoot());
    List<ModelNode> ops = builder.parseXmlResource("subsystem_2_0_reject_transform.xml");
    PathAddress subsystemAddress = PathAddress.pathAddress(MicroProfileHealthExtension.SUBSYSTEM_PATH);
    FailedOperationTransformationConfig config = new FailedOperationTransformationConfig();
    if (healthVersion.equals(MicroProfileHealthExtension.VERSION_1_0_0)) {
        config.addFailedAttribute(subsystemAddress, new FailedOperationTransformationConfig.NewAttributesConfig(MicroProfileHealthSubsystemDefinition.EMPTY_LIVENESS_CHECKS_STATUS, MicroProfileHealthSubsystemDefinition.EMPTY_READINESS_CHECKS_STATUS));
    }
    ModelTestUtils.checkFailedTransformedBootOperations(mainServices, healthVersion, 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 19 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 healthVersion) 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, healthVersion).addMavenResourceURL(getMicroProfileSmallryeHeatlhGAV(controllerVersion)).skipReverseControllerCheck().dontPersistXml();
    KernelServices mainServices = builder.build();
    assertTrue(mainServices.isSuccessfulBoot());
    assertTrue(mainServices.getLegacyServices(healthVersion).isSuccessfulBoot());
    List<ModelNode> ops = builder.parseXmlResource("subsystem_3_0_reject_transform.xml");
    PathAddress subsystemAddress = PathAddress.pathAddress(MicroProfileHealthExtension.SUBSYSTEM_PATH);
    FailedOperationTransformationConfig config = new FailedOperationTransformationConfig();
    if (healthVersion.equals(VERSION_2_0_0)) {
        config.addFailedAttribute(subsystemAddress, new FailedOperationTransformationConfig.NewAttributesConfig(MicroProfileHealthSubsystemDefinition.EMPTY_STARTUP_CHECKS_STATUS));
    }
    ModelTestUtils.checkFailedTransformedBootOperations(mainServices, healthVersion, 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 20 with FailedOperationTransformationConfig

use of org.jboss.as.model.test.FailedOperationTransformationConfig in project wildfly by wildfly.

the class WeldSubsystemTestCase method testTransformersRejection.

private void testTransformersRejection(ModelTestControllerVersion controllerVersion) throws Exception {
    ModelVersion modelVersion = controllerVersion.getSubsystemModelVersion(getMainSubsystemName());
    KernelServices mainServices = buildKernelServices(controllerVersion, null, false);
    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), FailedOperationTransformationConfig.ChainedConfig.createBuilder(WeldResourceDefinition.NON_PORTABLE_MODE_ATTRIBUTE, WeldResourceDefinition.REQUIRE_BEAN_DESCRIPTOR_ATTRIBUTE).addConfig(new FailedOperationTransformationConfig.NewAttributesConfig(WeldResourceDefinition.THREAD_POOL_SIZE_ATTRIBUTE)).addConfig(new FailedOperationTransformationConfig.NewAttributesConfig(WeldResourceDefinition.LEGACY_EMPTY_BEANS_XML_TREATMENT_ATTRIBUTE)).build()));
}
Also used : FailedOperationTransformationConfig(org.jboss.as.model.test.FailedOperationTransformationConfig) KernelServices(org.jboss.as.subsystem.test.KernelServices) ModelVersion(org.jboss.as.controller.ModelVersion)

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