use of org.jboss.as.model.test.FailedOperationTransformationConfig in project wildfly by wildfly.
the class XTSSubsystemTestCase method testRejectTransformation.
private void testRejectTransformation(ModelTestControllerVersion controllerVersion, ModelVersion version, String artifact) throws Exception {
FailedOperationTransformationConfig config = createFailedConfig(version);
KernelServicesBuilder builder = createKernelServicesBuilder(createAdditionalInitialization());
builder.createLegacyKernelServicesBuilder(null, controllerVersion, version).addMavenResourceURL(String.format("%s:%s:%s", controllerVersion.getMavenGroupId(), artifact, controllerVersion.getMavenGavVersion())).dontPersistXml();
KernelServices mainServices = builder.build();
KernelServices legacyServices = mainServices.getLegacyServices(version);
Assert.assertTrue(mainServices.isSuccessfulBoot());
Assert.assertTrue(legacyServices.isSuccessfulBoot());
// the latest version
List<ModelNode> ops = builder.parseXmlResource("subsystem-3.0.0.xml");
ModelTestUtils.checkFailedTransformedBootOperations(mainServices, version, ops, config);
}
use of org.jboss.as.model.test.FailedOperationTransformationConfig in project wildfly by wildfly.
the class MessagingSubsystem30TestCase method doTestRejectExpressions_2_0_0_or_2_1_0.
/**
* Tests rejection of expressions in either 2.0.0 or 2.1.0 model.
*/
private void doTestRejectExpressions_2_0_0_or_2_1_0(KernelServicesBuilder builder, ModelVersion version) throws Exception {
KernelServices mainServices = builder.build();
assertTrue(mainServices.isSuccessfulBoot());
KernelServices legacyServices = mainServices.getLegacyServices(version);
assertNotNull(legacyServices);
assertTrue(legacyServices.isSuccessfulBoot());
//Use the real xml with expressions for testing all the attributes
PathAddress subsystemAddress = PathAddress.pathAddress(pathElement(SUBSYSTEM, MessagingExtension.SUBSYSTEM_NAME));
List<ModelNode> modelNodes = builder.parseXmlResource("subsystem_3_0_expressions.xml");
modelNodes.remove(0);
checkFailedTransformedBootOperations(mainServices, version, modelNodes, new FailedOperationTransformationConfig().addFailedAttribute(subsystemAddress.append(HORNETQ_SERVER_PATH), createChainedConfig(new AttributeDefinition[] {}, new AttributeDefinition[] { OVERRIDE_IN_VM_SECURITY })).addFailedAttribute(subsystemAddress.append(HORNETQ_SERVER_PATH).append(AddressSettingDefinition.PATH), createChainedConfig(new AttributeDefinition[] {}, new AttributeDefinition[] { AddressSettingDefinition.MAX_REDELIVERY_DELAY, AddressSettingDefinition.REDELIVERY_MULTIPLIER, AddressSettingDefinition.SLOW_CONSUMER_CHECK_PERIOD, AddressSettingDefinition.SLOW_CONSUMER_POLICY, AddressSettingDefinition.SLOW_CONSUMER_THRESHOLD })));
}
use of org.jboss.as.model.test.FailedOperationTransformationConfig in project wildfly by wildfly.
the class WebSubsystemTestCase method testRejectingTransformers_1_4_0.
private void testRejectingTransformers_1_4_0(ModelTestControllerVersion controllerVersion) throws Exception {
ModelVersion modelVersion = ModelVersion.create(1, 4, 0);
KernelServicesBuilder builder = createKernelServicesBuilder(createAdditionalInitialization());
builder.createLegacyKernelServicesBuilder(null, controllerVersion, modelVersion).addMavenResourceURL("org.jboss.as:jboss-as-web:" + controllerVersion.getMavenGavVersion()).setExtensionClassName("org.jboss.as.web.WebExtension").configureReverseControllerCheck(createAdditionalInitialization(), null);
KernelServices mainServices = builder.build();
KernelServices legacyServices = mainServices.getLegacyServices(modelVersion);
Assert.assertTrue("main services did not boot", mainServices.isSuccessfulBoot());
Assert.assertTrue(legacyServices.isSuccessfulBoot());
final PathAddress subsystem = PathAddress.EMPTY_ADDRESS.append("subsystem", "web");
List<ModelNode> xmlOps = builder.parseXmlResource("subsystem-2.2.0.xml");
FailedOperationTransformationConfig config = new FailedOperationTransformationConfig().addFailedAttribute(subsystem, new IntExpressionConfig("default-session-timeout")).addFailedAttribute(subsystem.append("virtual-server", "default-host").append("configuration", "sso"), new BooleanExpressionConfig("http-only"));
ModelTestUtils.checkFailedTransformedBootOperations(mainServices, modelVersion, xmlOps, config);
}
use of org.jboss.as.model.test.FailedOperationTransformationConfig in project wildfly by wildfly.
the class WebSubsystemTestCase method testRejectingTransformers_1_3_0.
private void testRejectingTransformers_1_3_0(ModelTestControllerVersion controllerVersion) throws Exception {
ModelVersion modelVersion = ModelVersion.create(1, 3, 0);
KernelServicesBuilder builder = createKernelServicesBuilder(createAdditionalInitialization());
builder.createLegacyKernelServicesBuilder(null, controllerVersion, modelVersion).addMavenResourceURL("org.jboss.as:jboss-as-web:" + controllerVersion.getMavenGavVersion()).setExtensionClassName("org.jboss.as.web.WebExtension").configureReverseControllerCheck(createAdditionalInitialization(), null);
KernelServices mainServices = builder.build();
KernelServices legacyServices = mainServices.getLegacyServices(modelVersion);
Assert.assertTrue("main services did not boot", mainServices.isSuccessfulBoot());
Assert.assertTrue(legacyServices.isSuccessfulBoot());
final PathAddress subsystem = PathAddress.EMPTY_ADDRESS.append("subsystem", "web");
List<ModelNode> xmlOps = builder.parseXmlResource("subsystem-2.2.0.xml");
FailedOperationTransformationConfig config = new FailedOperationTransformationConfig().addFailedAttribute(subsystem, new IntExpressionConfig("default-session-timeout")).addFailedAttribute(subsystem.append(PathElement.pathElement("connector", "http")), new FailedOperationTransformationConfig.NewAttributesConfig("redirect-binding", "proxy-binding")).addFailedAttribute(subsystem.append("virtual-server", "default-host").append("configuration", "sso"), new BooleanExpressionConfig("http-only"));
ModelTestUtils.checkFailedTransformedBootOperations(mainServices, modelVersion, xmlOps, config);
checkUndefinedCipherSuite(mainServices, modelVersion);
}
use of org.jboss.as.model.test.FailedOperationTransformationConfig in project wildfly by wildfly.
the class MessagingActiveMQSubsystem_1_1_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)).dontPersistXml();
KernelServices mainServices = builder.build();
assertTrue(mainServices.isSuccessfulBoot());
assertTrue(mainServices.getLegacyServices(messagingVersion).isSuccessfulBoot());
List<ModelNode> ops = builder.parseXmlResource("subsystem_1_1_reject_transform.xml");
System.out.println("ops = " + ops);
PathAddress subsystemAddress = PathAddress.pathAddress(SUBSYSTEM_PATH);
ModelTestUtils.checkFailedTransformedBootOperations(mainServices, messagingVersion, ops, new FailedOperationTransformationConfig().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_LARGE_MESSAGES_TABLE, ServerDefinition.JOURNAL_PAGE_STORE_TABLE, ServerDefinition.JOURNAL_DATABASE)).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, PathElement.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, POOLED_CONNECTION_FACTORY_PATH), new FailedOperationTransformationConfig.NewAttributesConfig(ConnectionFactoryAttributes.Pooled.REBALANCE_CONNECTIONS, ConnectionFactoryAttributes.Pooled.STATISTICS_ENABLED)));
}
Aggregations