use of org.jboss.as.controller.PathAddress 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.controller.PathAddress 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.controller.PathAddress 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.controller.PathAddress 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.controller.PathAddress in project wildfly by wildfly.
the class ExternalAuthSecurityDomainSetup method setup.
@Override
public void setup(final ManagementClient managementClient, final String containerId) {
log.debug("start of the domain creation");
final ModelNode compositeOp = new ModelNode();
compositeOp.get(OP).set(COMPOSITE);
compositeOp.get(OP_ADDR).setEmptyList();
ModelNode steps = compositeOp.get(STEPS);
PathAddress address = PathAddress.pathAddress().append(SUBSYSTEM, "security").append(SECURITY_DOMAIN, getSecurityDomainName());
steps.add(Util.createAddOperation(address));
address = address.append(Constants.AUTHENTICATION, Constants.CLASSIC);
steps.add(Util.createAddOperation(address));
ModelNode loginModule = Util.createAddOperation(address.append(LOGIN_MODULE, "External"));
loginModule.get(CODE).set("org.jboss.as.test.integration.web.security.external.ExternalLoginModule");
loginModule.get(MODULE).set("deployment.web-secure-external.war");
loginModule.get(FLAG).set("required");
loginModule.get(OPERATION_HEADERS).get(ALLOW_RESOURCE_SERVICE_RESTART).set(true);
steps.add(loginModule);
applyUpdates(managementClient.getControllerClient(), Arrays.asList(compositeOp));
log.debug("end of the domain creation");
}
Aggregations