private void testTransformersDiscardsImpliedValues1_0_0(ModelTestControllerVersion controllerVersion) throws Exception {
String subsystemXml = readResource("subsystem-transformers-discard.xml");
ModelVersion modelVersion = ModelVersion.create(1, 0, 0);
//Use the non-runtime version of the extension which will happen on the HC
KernelServicesBuilder builder = createKernelServicesBuilder(AdditionalInitialization.MANAGEMENT)
.setSubsystemXml(subsystemXml);
// Add legacy subsystems
builder.createLegacyKernelServicesBuilder(null, controllerVersion, modelVersion)
.addMavenResourceURL("org.jboss.as:jboss-as-ee:" + controllerVersion.getMavenGavVersion())
.configureReverseControllerCheck(AdditionalInitialization.MANAGEMENT, new ModelFixer() {
// The regular model will have the new attributes because they are in the xml,
// but the reverse controller model will not because transformation strips them
@Override
public ModelNode fixModel(ModelNode modelNode) {
for(ModelNode node : modelNode.get(GLOBAL_MODULES).asList()) {
if ("org.apache.log4j".equals(node.get(NAME).asString())) {
if (!node.has(ANNOTATIONS)) {
node.get(ANNOTATIONS).set(false);
}
if (!node.has(META_INF)) {
node.get(META_INF).set(false);
}
if (!node.has(SERVICES)) {
node.get(SERVICES).set(true);
}
}
}
return modelNode;
}
});
KernelServices mainServices = builder.build();
KernelServices legacyServices = mainServices.getLegacyServices(modelVersion);
Assert.assertTrue(mainServices.isSuccessfulBoot());
Assert.assertTrue(legacyServices.isSuccessfulBoot());
ModelNode globalModules = mainServices.readTransformedModel(modelVersion).get(ModelDescriptionConstants.SUBSYSTEM, "ee").get(GlobalModulesDefinition.GLOBAL_MODULES);