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);
}
Aggregations