Search in sources :

Example 1 with ChainedConfig

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

the class XTSSubsystemTestCase method createFailedConfig.

private FailedOperationTransformationConfig createFailedConfig(ModelVersion version) {
    ChainedConfig chainedConfig;
    if (version == EAP6_4_0) {
        final AttributesPathAddressConfig hostConfig = new AttributesPathAddressConfig(HOST_NAME.getName()) {

            private static final String DEFAULT_HOST = "default-host";

            @Override
            protected boolean isAttributeWritable(String attributeName) {
                return true;
            }

            @Override
            protected boolean checkValue(String attrName, ModelNode attribute, boolean isGeneratedWriteAttribute) {
                // If it is not equal to 'default-host' we will change it
                return !attribute.asString().equals(DEFAULT_HOST);
            }

            @Override
            protected ModelNode correctValue(ModelNode toResolve, boolean isGeneratedWriteAttribute) {
                return new ModelNode(DEFAULT_HOST);
            }
        };
        chainedConfig = ChainedConfig.createBuilder(ASYNC_REGISTRATION, DEFAULT_CONTEXT_PROPAGATION, HOST_NAME).addConfig(new FailedOperationTransformationConfig.NewAttributesConfig(ASYNC_REGISTRATION, DEFAULT_CONTEXT_PROPAGATION)).addConfig(hostConfig).build();
    } else if (version == EAP7_1_0) {
        chainedConfig = ChainedConfig.createBuilder(ASYNC_REGISTRATION).addConfig(new FailedOperationTransformationConfig.NewAttributesConfig(ASYNC_REGISTRATION)).build();
    } else {
        throw new IllegalStateException();
    }
    return new FailedOperationTransformationConfig().addFailedAttribute(PathAddress.pathAddress(SUBSYSTEM, XTSExtension.SUBSYSTEM_NAME), chainedConfig);
}
Also used : FailedOperationTransformationConfig(org.jboss.as.model.test.FailedOperationTransformationConfig) ChainedConfig(org.jboss.as.model.test.FailedOperationTransformationConfig.ChainedConfig) ModelNode(org.jboss.dmr.ModelNode) AttributesPathAddressConfig(org.jboss.as.model.test.FailedOperationTransformationConfig.AttributesPathAddressConfig)

Aggregations

FailedOperationTransformationConfig (org.jboss.as.model.test.FailedOperationTransformationConfig)1 AttributesPathAddressConfig (org.jboss.as.model.test.FailedOperationTransformationConfig.AttributesPathAddressConfig)1 ChainedConfig (org.jboss.as.model.test.FailedOperationTransformationConfig.ChainedConfig)1 ModelNode (org.jboss.dmr.ModelNode)1