use of org.jboss.as.model.test.FailedOperationTransformationConfig in project wildfly by wildfly.
the class DatasourcesSubsystemTestCase method testTransformer.
/**
* Tests transformation of model from latest version into one passed into modelVersion parameter.
*
* @throws Exception
*/
private void testTransformer(String subsystemXml, ModelTestControllerVersion controllerVersion, final ModelVersion modelVersion) throws Exception {
//Use the non-runtime version of the extension which will happen on the HC
KernelServicesBuilder builder = createKernelServicesBuilder(AdditionalInitialization.MANAGEMENT);
KernelServices mainServices = initialKernelServices(builder, controllerVersion, modelVersion);
List<ModelNode> ops = builder.parseXmlResource(subsystemXml);
PathAddress subsystemAddress = PathAddress.pathAddress(DataSourcesSubsystemRootDefinition.PATH_SUBSYSTEM);
ModelTestUtils.checkFailedTransformedBootOperations(mainServices, modelVersion, ops, new FailedOperationTransformationConfig().addFailedAttribute(subsystemAddress.append(DataSourceDefinition.PATH_DATASOURCE), new FailedOperationTransformationConfig.NewAttributesConfig(TRACKING)).addFailedAttribute(subsystemAddress.append(XaDataSourceDefinition.PATH_XA_DATASOURCE), new FailedOperationTransformationConfig.NewAttributesConfig(TRACKING)));
}
use of org.jboss.as.model.test.FailedOperationTransformationConfig in project wildfly by wildfly.
the class DatasourcesSubsystemTestCase method testTransformerElytronEnabled.
/**
* Tests transformation of model from latest version into one passed into modelVersion parameter.
*
* @throws Exception
*/
private void testTransformerElytronEnabled(String subsystemXml, ModelTestControllerVersion controllerVersion, final ModelVersion modelVersion) throws Exception {
//Use the non-runtime version of the extension which will happen on the HC
KernelServicesBuilder builder = createKernelServicesBuilder(createAdditionalInitialization());
KernelServices mainServices = initialKernelServices(builder, controllerVersion, modelVersion);
List<ModelNode> ops = builder.parseXmlResource(subsystemXml);
PathAddress subsystemAddress = PathAddress.pathAddress(DataSourcesSubsystemRootDefinition.PATH_SUBSYSTEM);
ModelTestUtils.checkFailedTransformedBootOperations(mainServices, modelVersion, ops, new FailedOperationTransformationConfig().addFailedAttribute(subsystemAddress.append(DataSourceDefinition.PATH_DATASOURCE), new FailedOperationTransformationConfig.NewAttributesConfig(TRACKING, ELYTRON_ENABLED, AUTHENTICATION_CONTEXT, CREDENTIAL_REFERENCE)).addFailedAttribute(subsystemAddress.append(XaDataSourceDefinition.PATH_XA_DATASOURCE), new FailedOperationTransformationConfig.NewAttributesConfig(TRACKING, ELYTRON_ENABLED, AUTHENTICATION_CONTEXT, RECOVERY_ELYTRON_ENABLED, RECOVERY_AUTHENTICATION_CONTEXT, CREDENTIAL_REFERENCE, RECOVERY_CREDENTIAL_REFERENCE) {
@Override
protected boolean isAttributeWritable(String attributeName) {
return false;
}
@Override
protected boolean checkValue(String attrName, ModelNode attribute, boolean isWriteAttribute) {
if (attribute.isDefined()) {
return true;
} else {
return false;
}
}
@Override
protected ModelNode correctValue(ModelNode toResolve, boolean isWriteAttribute) {
return new ModelNode();
}
}));
}
use of org.jboss.as.model.test.FailedOperationTransformationConfig in project wildfly by wildfly.
the class ResourceAdaptersSubsystemTestCase method testRejectingTransformer300.
private void testRejectingTransformer300(String subsystemXml, ModelTestControllerVersion controllerVersion, ModelVersion modelVersion) throws Exception {
//Use the non-runtime version of the extension which will happen on the HC
KernelServicesBuilder builder = createKernelServicesBuilder(AdditionalInitialization.MANAGEMENT);
//.setSubsystemXmlResource(subsystemXml);
// Add legacy subsystems
builder.createLegacyKernelServicesBuilder(null, controllerVersion, modelVersion).addMavenResourceURL("org.jboss.as:jboss-as-connector:" + controllerVersion.getMavenGavVersion()).addMavenResourceURL("org.jboss.ironjacamar:ironjacamar-spec-api:1.1.4.Final").addMavenResourceURL("org.jboss.ironjacamar:ironjacamar-common-api:1.1.4.Final").setExtensionClassName("org.jboss.as.connector.subsystems.resourceadapters.ResourceAdaptersExtension").addOperationValidationResolve("add", PathAddress.pathAddress(PathElement.pathElement(SUBSYSTEM, getMainSubsystemName()), PathElement.pathElement("resource-adapter", "*"), PathElement.pathElement("connection-definitions", "*"))).excludeFromParent(SingleClassFilter.createFilter(ConnectorLogger.class)).skipReverseControllerCheck();
KernelServices mainServices = builder.build();
org.junit.Assert.assertTrue(mainServices.isSuccessfulBoot());
KernelServices legacyServices = mainServices.getLegacyServices(modelVersion);
org.junit.Assert.assertTrue(legacyServices.isSuccessfulBoot());
org.junit.Assert.assertNotNull(legacyServices);
List<ModelNode> ops = builder.parseXmlResource(subsystemXml);
PathAddress subsystemAddress = PathAddress.pathAddress(ResourceAdaptersExtension.SUBSYSTEM_PATH);
ModelTestUtils.checkFailedTransformedBootOperations(mainServices, modelVersion, ops, new FailedOperationTransformationConfig().addFailedAttribute(subsystemAddress.append(PathElement.pathElement(RESOURCEADAPTER_NAME), ConnectionDefinitionResourceDefinition.PATH), FailedOperationTransformationConfig.REJECTED_RESOURCE));
}
use of org.jboss.as.model.test.FailedOperationTransformationConfig in project wildfly by wildfly.
the class ResourceAdaptersSubsystemTestCase method testRejectingTransformerElytronEnabled.
/**
* Tests transformation of model from current to passed one
*
* @throws Exception
*/
private void testRejectingTransformerElytronEnabled(String subsystemXml, ModelTestControllerVersion controllerVersion, ModelVersion modelVersion) throws Exception {
//Use the non-runtime version of the extension which will happen on the HC
KernelServicesBuilder builder = createKernelServicesBuilder(AdditionalInitialization.MANAGEMENT);
//.setSubsystemXmlResource(subsystemXml);
// Add legacy subsystems
builder.createLegacyKernelServicesBuilder(null, controllerVersion, modelVersion).addMavenResourceURL("org.jboss.as:jboss-as-connector:" + controllerVersion.getMavenGavVersion()).addMavenResourceURL("org.jboss.ironjacamar:ironjacamar-spec-api:1.1.4.Final").addMavenResourceURL("org.jboss.ironjacamar:ironjacamar-common-api:1.1.4.Final").setExtensionClassName("org.jboss.as.connector.subsystems.resourceadapters.ResourceAdaptersExtension").addOperationValidationResolve("add", PathAddress.pathAddress(PathElement.pathElement(SUBSYSTEM, getMainSubsystemName()), PathElement.pathElement("resource-adapter", "*"), PathElement.pathElement("connection-definitions", "*"))).excludeFromParent(SingleClassFilter.createFilter(ConnectorLogger.class)).skipReverseControllerCheck();
KernelServices mainServices = builder.build();
org.junit.Assert.assertTrue(mainServices.isSuccessfulBoot());
KernelServices legacyServices = mainServices.getLegacyServices(modelVersion);
org.junit.Assert.assertTrue(legacyServices.isSuccessfulBoot());
org.junit.Assert.assertNotNull(legacyServices);
List<ModelNode> ops = builder.parseXmlResource(subsystemXml);
PathAddress subsystemAddress = PathAddress.pathAddress(ResourceAdaptersExtension.SUBSYSTEM_PATH);
ModelTestUtils.checkFailedTransformedBootOperations(mainServices, modelVersion, ops, new FailedOperationTransformationConfig().addFailedAttribute(subsystemAddress.append(PathElement.pathElement(RESOURCEADAPTER_NAME)), new FailedOperationTransformationConfig.AttributesPathAddressConfig(WM_SECURITY.getName(), WM_SECURITY_MAPPING_REQUIRED.getName(), WM_ELYTRON_SECURITY_DOMAIN.getName(), MODULE.getName(), STATISTICS_ENABLED.getName()) {
@Override
protected boolean isAttributeWritable(String attributeName) {
return false;
}
@Override
protected boolean checkValue(String attrName, ModelNode attribute, boolean isWriteAttribute) {
if (attribute.isDefined()) {
return true;
} else {
return false;
}
}
@Override
protected ModelNode correctValue(ModelNode toResolve, boolean isWriteAttribute) {
return new ModelNode();
}
}).addFailedAttribute(subsystemAddress.append(PathElement.pathElement(RESOURCEADAPTER_NAME), ConnectionDefinitionResourceDefinition.PATH), FailedOperationTransformationConfig.ChainedConfig.createBuilder(Constants.CONNECTABLE, Constants.TRACKING).addConfig(new FailedOperationTransformationConfig.RejectExpressionsConfig(Constants.CONNECTABLE) {
@Override
protected boolean checkValue(String attrName, ModelNode attribute, boolean isWriteAttribute) {
if (super.checkValue(attrName, attribute, isWriteAttribute)) {
return true;
}
return attribute.asBoolean();
}
@Override
protected ModelNode correctValue(ModelNode toResolve, boolean isWriteAttribute) {
return new ModelNode(false);
}
}).addConfig(new FailedOperationTransformationConfig.AttributesPathAddressConfig(TRACKING.getName(), ELYTRON_ENABLED.getName(), AUTHENTICATION_CONTEXT.getName(), MCP.getName(), RECOVERY_ELYTRON_ENABLED.getName(), RECOVERY_AUTHENTICATION_CONTEXT.getName(), RECOVERY_CREDENTIAL_REFERENCE.getName()) {
@Override
protected boolean isAttributeWritable(String attributeName) {
return false;
}
@Override
protected boolean checkValue(String attrName, ModelNode attribute, boolean isWriteAttribute) {
if (attribute.isDefined()) {
return true;
} else {
return false;
}
}
@Override
protected ModelNode correctValue(ModelNode toResolve, boolean isWriteAttribute) {
return new ModelNode();
}
}).build()));
}
use of org.jboss.as.model.test.FailedOperationTransformationConfig in project wildfly by wildfly.
the class EeSubsystemTestCase method testTransformers800.
//@Test don't test as we dont have test controller
public void testTransformers800() throws Exception {
final ModelVersion legacyModelVersion = ModelVersion.create(3, 0, 0);
final ModelTestControllerVersion controllerVersion = ModelTestControllerVersion.WILDFLY_8_2_0_FINAL;
KernelServicesBuilder builder = createKernelServicesBuilder(AdditionalInitialization.MANAGEMENT);
// Add legacy subsystems
builder.createLegacyKernelServicesBuilder(null, controllerVersion, legacyModelVersion).addMavenResourceURL("org.wildfly:wildfly-ee:" + controllerVersion.getMavenGavVersion());
KernelServices mainServices = builder.build();
KernelServices legacyServices = mainServices.getLegacyServices(legacyModelVersion);
Assert.assertTrue(mainServices.isSuccessfulBoot());
Assert.assertTrue(legacyServices.isSuccessfulBoot());
List<ModelNode> bootOps = builder.parseXmlResource("subsystem-wf8-transformer.xml");
ModelTestUtils.checkFailedTransformedBootOperations(mainServices, legacyModelVersion, bootOps, new FailedOperationTransformationConfig().addFailedAttribute(PathAddress.pathAddress(EeExtension.PATH_SUBSYSTEM, ManagedExecutorServiceResourceDefinition.INSTANCE.getPathElement()), new RejectUndefinedAttribute(new ModelNode(Integer.MAX_VALUE), ManagedExecutorServiceResourceDefinition.CORE_THREADS_AD.getName())).addFailedAttribute(PathAddress.pathAddress(EeExtension.PATH_SUBSYSTEM, ManagedScheduledExecutorServiceResourceDefinition.INSTANCE.getPathElement()), new RejectUndefinedAttribute(new ModelNode(Integer.MAX_VALUE), ManagedScheduledExecutorServiceResourceDefinition.CORE_THREADS_AD.getName())));
}
Aggregations