use of org.jboss.as.subsystem.test.KernelServices in project wildfly by wildfly.
the class WeldSubsystemTestCase method testTransformers10.
private void testTransformers10(ModelTestControllerVersion controllerVersion) throws Exception {
ModelVersion modelVersion = ModelVersion.create(1, 0, 0);
KernelServicesBuilder builder = createKernelServicesBuilder(AdditionalInitialization.MANAGEMENT).setSubsystemXmlResource("subsystem_3_0-transformers.xml");
//which is why we need to include the jboss-as-controller artifact.
builder.createLegacyKernelServicesBuilder(AdditionalInitialization.MANAGEMENT, controllerVersion, modelVersion).addMavenResourceURL("org.jboss.as:jboss-as-weld:" + controllerVersion.getMavenGavVersion()).skipReverseControllerCheck().dontPersistXml();
KernelServices mainServices = builder.build();
KernelServices legacyServices = mainServices.getLegacyServices(modelVersion);
assertTrue(mainServices.isSuccessfulBoot());
assertTrue(legacyServices.isSuccessfulBoot());
checkSubsystemModelTransformation(mainServices, modelVersion);
}
use of org.jboss.as.subsystem.test.KernelServices in project wildfly by wildfly.
the class WeldSubsystemTestCase method testTransformers30.
@Test
public void testTransformers30() throws Exception {
ModelVersion modelVersion = ModelVersion.create(3, 0, 0);
KernelServicesBuilder builder = createKernelServicesBuilder(AdditionalInitialization.MANAGEMENT).setSubsystemXmlResource("subsystem_4_0-transformers.xml");
builder.createLegacyKernelServicesBuilder(AdditionalInitialization.MANAGEMENT, ModelTestControllerVersion.EAP_7_0_0, modelVersion).addMavenResourceURL("org.jboss.eap:wildfly-weld:" + ModelTestControllerVersion.EAP_7_0_0.getMavenGavVersion()).skipReverseControllerCheck().dontPersistXml();
KernelServices mainServices = builder.build();
KernelServices legacyServices = mainServices.getLegacyServices(modelVersion);
assertTrue(mainServices.isSuccessfulBoot());
assertTrue(legacyServices.isSuccessfulBoot());
checkSubsystemModelTransformation(mainServices, modelVersion);
}
use of org.jboss.as.subsystem.test.KernelServices in project wildfly by wildfly.
the class WeldSubsystemTestCase method testTransformersRejectionEAP700.
@Test
public void testTransformersRejectionEAP700() throws Exception {
ModelVersion modelVersion = ModelVersion.create(3, 0, 0);
KernelServicesBuilder builder = createKernelServicesBuilder(AdditionalInitialization.MANAGEMENT);
builder.createLegacyKernelServicesBuilder(AdditionalInitialization.MANAGEMENT, ModelTestControllerVersion.EAP_7_0_0, modelVersion).addMavenResourceURL("org.jboss.eap:wildfly-weld:" + ModelTestControllerVersion.EAP_7_0_0.getMavenGavVersion()).skipReverseControllerCheck().dontPersistXml();
KernelServices mainServices = builder.build();
assertTrue(mainServices.isSuccessfulBoot());
assertTrue(mainServices.getLegacyServices(modelVersion).isSuccessfulBoot());
ModelTestUtils.checkFailedTransformedBootOperations(mainServices, modelVersion, parse(getSubsystemXml("subsystem-reject.xml")), new FailedOperationTransformationConfig().addFailedAttribute(PathAddress.pathAddress(WeldExtension.PATH_SUBSYSTEM), ChainedConfig.createBuilder(WeldResourceDefinition.NON_PORTABLE_MODE_ATTRIBUTE, WeldResourceDefinition.REQUIRE_BEAN_DESCRIPTOR_ATTRIBUTE).addConfig(new NewAttributesConfig(WeldResourceDefinition.THREAD_POOL_SIZE_ATTRIBUTE)).build()));
}
use of org.jboss.as.subsystem.test.KernelServices in project wildfly by wildfly.
the class JGroupsSubsystemParsingTestCase method testIndexedAdds.
/**
* Tests that the 'fork' and 'stack' resources allow indexed adds for the 'protocol' children. This is important for
* the work being done for WFCORE-401. This work involves calculating the operations to bring the slave domain model
* into sync with the master domain model. Without ordered resources, that would mean on reconnect if the master
* had added a protocol somewhere in the middle, the protocol would get added to the end rather at the correct place.
*/
@Test
public void testIndexedAdds() throws Exception {
if (!this.schema.since(JGroupsSchema.VERSION_3_0))
return;
final KernelServices services = this.buildKernelServices();
ModelNode originalSubsystemModel = services.readWholeModel().get(JGroupsSubsystemResourceDefinition.PATH.getKeyValuePair());
ModelNode originalChannelModel = originalSubsystemModel.get(ChannelResourceDefinition.pathElement("ee").getKeyValuePair());
ModelNode originalForkModel = originalChannelModel.get(ForkResourceDefinition.pathElement("web").getKeyValuePair());
Assert.assertTrue(originalForkModel.isDefined());
originalForkModel.protect();
Assert.assertTrue(0 < originalForkModel.get(ProtocolResourceDefinition.WILDCARD_PATH.getKey()).keys().size());
ModelNode originalStackModel = originalSubsystemModel.get(StackResourceDefinition.pathElement("maximal").getKeyValuePair());
Assert.assertTrue(originalStackModel.isDefined());
originalStackModel.protect();
final PathAddress subsystemAddress = PathAddress.pathAddress(JGroupsSubsystemResourceDefinition.PATH);
final PathAddress forkAddress = subsystemAddress.append(ChannelResourceDefinition.pathElement("ee")).append(ForkResourceDefinition.pathElement("web"));
final PathAddress stackAddress = subsystemAddress.append(StackResourceDefinition.pathElement("maximal"));
//Check the fork protocols honour indexed adds by inserting a protocol at the start
ModelNode add = Operations.createAddOperation(forkAddress.append(ProtocolResourceDefinition.pathElement("MERGE2")), 0);
ModelTestUtils.checkOutcome(services.executeOperation(add));
ModelNode subsystemModel = services.readWholeModel().get(JGroupsSubsystemResourceDefinition.PATH.getKeyValuePair());
ModelNode channelModel = subsystemModel.get(ChannelResourceDefinition.pathElement("ee").getKeyValuePair());
ModelNode forkModel = channelModel.get(ForkResourceDefinition.pathElement("web").getKeyValuePair());
Assert.assertEquals(originalForkModel.keys().size() + 1, forkModel.get(ProtocolResourceDefinition.WILDCARD_PATH.getKey()).keys().size());
Assert.assertEquals("MERGE2", forkModel.get(ProtocolResourceDefinition.WILDCARD_PATH.getKey()).keys().iterator().next());
//Check the stack protocols honour indexed adds by removing a protocol in the middle and readding it
ModelNode remove = Util.createRemoveOperation(stackAddress.append(ProtocolResourceDefinition.pathElement("FD")));
ModelTestUtils.checkOutcome(services.executeOperation(remove));
//The original index of the FD protocol
add = Operations.createAddOperation(stackAddress.append(ProtocolResourceDefinition.pathElement("FD")), 3);
ModelTestUtils.checkOutcome(services.executeOperation(add));
subsystemModel = services.readWholeModel().get(JGroupsSubsystemResourceDefinition.PATH.getKeyValuePair());
ModelNode stackModel = subsystemModel.get(StackResourceDefinition.pathElement("maximal").getKeyValuePair());
Assert.assertEquals(originalStackModel, stackModel);
}
use of org.jboss.as.subsystem.test.KernelServices in project wildfly by wildfly.
the class JGroupsSubsystemParsingTestCase method testLegacyOperations.
@Test
public void testLegacyOperations() throws Exception {
List<ModelNode> ops = new LinkedList<>();
PathAddress subsystemAddress = PathAddress.pathAddress(JGroupsSubsystemResourceDefinition.PATH);
PathAddress udpAddress = subsystemAddress.append(StackResourceDefinition.pathElement("udp"));
ModelNode op = Util.createAddOperation(subsystemAddress);
///subsystem=jgroups:add(default-stack=udp)
op.get("default-stack").set("udp");
ops.add(op);
//subsystem=jgroups/stack=udp:add(transport={"type"=>"UDP","socket-binding"=>"jgroups-udp"},protocols=["PING","MERGE3","FD_SOCK","FD","VERIFY_SUSPECT","BARRIER","pbcast.NAKACK2","UNICAST2","pbcast.STABLE","pbcast.GMS","UFC","MFC","FRAG2","RSVP"])
op = Util.createAddOperation(udpAddress);
ModelNode transport = new ModelNode();
transport.get("type").set("UDP");
transport.get("socket-binding").set("jgroups-udp");
ModelNode protocols = new ModelNode();
String[] protocolList = { "PING", "MERGE3", "FD_SOCK", "FD", "VERIFY_SUSPECT", "BARRIER", "pbcast.NAKACK2", "UNICAST2", "pbcast.STABLE", "pbcast.GMS", "UFC", "MFC", "FRAG2", "RSVP" };
for (int i = 0; i < protocolList.length; i++) {
ModelNode protocol = new ModelNode();
protocol.get("type").set(protocolList[i]);
protocols.add(protocol);
}
op.get("transport").set(transport);
op.get("protocols").set(protocols);
ops.add(op);
KernelServices servicesA = createKernelServicesBuilder(createAdditionalInitialization()).setBootOperations(ops).build();
Assert.assertTrue("Subsystem boot failed!", servicesA.isSuccessfulBoot());
//Get the model and the persisted xml from the first controller
final ModelNode modelA = servicesA.readWholeModel();
validateModel(modelA);
servicesA.shutdown();
// Test the describe operation
final ModelNode operation = createDescribeOperation();
final ModelNode result = servicesA.executeOperation(operation);
Assert.assertTrue("the subsystem describe operation has to generate a list of operations to recreate the subsystem", !result.hasDefined(ModelDescriptionConstants.FAILURE_DESCRIPTION));
final List<ModelNode> operations = result.get(ModelDescriptionConstants.RESULT).asList();
servicesA.shutdown();
final KernelServices servicesC = createKernelServicesBuilder(createAdditionalInitialization()).setBootOperations(operations).build();
final ModelNode modelC = servicesC.readWholeModel();
compare(modelA, modelC);
assertRemoveSubsystemResources(servicesC, getIgnoredChildResourcesForRemovalTest());
}
Aggregations