use of org.jboss.as.subsystem.test.KernelServices in project wildfly by wildfly.
the class SingletonTransformersTestCase method buildKernelServices.
private KernelServices buildKernelServices(String subsystemXml, ModelTestControllerVersion controllerVersion, ModelVersion version, String... mavenResourceURLs) throws Exception {
KernelServicesBuilder builder = this.createKernelServicesBuilder().setSubsystemXmlResource(subsystemXml);
builder.createLegacyKernelServicesBuilder(this.createAdditionalInitialization(), controllerVersion, version).addSingleChildFirstClass(AdditionalInitialization.class).addMavenResourceURL(mavenResourceURLs).skipReverseControllerCheck();
KernelServices services = builder.build();
Assert.assertTrue(ModelTestControllerVersion.MASTER + " boot failed", services.isSuccessfulBoot());
Assert.assertTrue(controllerVersion.getMavenGavVersion() + " boot failed", services.getLegacyServices(version).isSuccessfulBoot());
return services;
}
use of org.jboss.as.subsystem.test.KernelServices in project wildfly by wildfly.
the class SingletonTransformersTestCase method testRejections.
private void testRejections(final ModelTestControllerVersion controller) throws Exception {
final ModelVersion version = getModelVersion(controller).getVersion();
final String subsystemXmlResource = String.format("subsystem-reject-%d_%d_%d.xml", version.getMajor(), version.getMinor(), version.getMicro());
final String[] dependencies = getDependencies(controller);
// create builder for current subsystem version
KernelServicesBuilder builder = createKernelServicesBuilder();
// initialize the legacy services
builder.createLegacyKernelServicesBuilder(this.createAdditionalInitialization(), controller, version).addSingleChildFirstClass(AdditionalInitialization.class).addMavenResourceURL(dependencies);
KernelServices services = builder.build();
KernelServices legacyServices = services.getLegacyServices(version);
Assert.assertNotNull(legacyServices);
Assert.assertTrue(services.isSuccessfulBoot());
Assert.assertTrue(legacyServices.isSuccessfulBoot());
// test failed operations involving backups
List<ModelNode> xmlOps = builder.parseXmlResource(subsystemXmlResource);
ModelTestUtils.checkFailedTransformedBootOperations(services, version, xmlOps, createFailedOperationConfig(version));
}
use of org.jboss.as.subsystem.test.KernelServices in project wildfly by wildfly.
the class JGroupsTransformersTestCase method testTransformation.
/**
* Tests transformation of model from current version into specified version.
*/
private void testTransformation(final ModelTestControllerVersion controller) throws Exception {
final ModelVersion version = getModelVersion(controller).getVersion();
final String[] dependencies = getDependencies(controller);
// create builder for current subsystem version
KernelServicesBuilder builder = createKernelServicesBuilder(createAdditionalInitialization()).setSubsystemXmlResource("subsystem-jgroups-transform.xml");
// initialize the legacy services and add required jars
builder.createLegacyKernelServicesBuilder(null, controller, version).addMavenResourceURL(dependencies).skipReverseControllerCheck();
KernelServices services = builder.build();
Assert.assertTrue(services.isSuccessfulBoot());
Assert.assertTrue(services.getLegacyServices(version).isSuccessfulBoot());
// check that both versions of the legacy model are the same and valid
checkSubsystemModelTransformation(services, version);
if (JGroupsModel.VERSION_3_0_0.requiresTransformation(version)) {
// Test properties operations
propertiesMapOperationsTest(services, version);
testNonMapTransformersWork(services, version);
}
}
use of org.jboss.as.subsystem.test.KernelServices in project wildfly by wildfly.
the class OperationSequencesTestCase method testLegacyTransportAliasSequence.
/**
* Test for https://issues.jboss.org/browse/WFLY-5290 where server/test hangs when using legacy TRANSPORT alias:
*
* Create a simple stack, then remove, re-add a different transport, remove twice expecting the 2nd remove to fail.
* Tests both situations when stack in inferred from :add operation and when its inferred from the existing resource.
*/
@Test
public void testLegacyTransportAliasSequence() throws Exception {
KernelServices services = buildKernelServices();
String stackName = "legacyStack";
// add a sample stack to test legacy paths on
ModelNode result = services.executeOperation(getProtocolStackAddOperationWithParameters(stackName));
Assert.assertEquals(SUCCESS, result.get(OUTCOME).asString());
// add a thread pool
result = services.executeOperation(getLegacyThreadPoolAddOperation(stackName, "default"));
Assert.assertEquals(SUCCESS, result.get(OUTCOME).asString());
ModelNode op = getLegacyThreadPoolAddOperation(stackName, "default");
op.get("operation").set("write-attribute");
op.get("name").set("keepalive-time");
op.get("value").set(999);
result = services.executeOperation(op);
Assert.assertEquals(SUCCESS, result.get(OUTCOME).asString());
op = Operations.createReadResourceOperation(getSubsystemAddress());
op.get(ModelDescriptionConstants.INCLUDE_ALIASES).set("true");
op.get(ModelDescriptionConstants.RECURSIVE).set("true");
result = services.executeOperation(op);
Assert.assertEquals(SUCCESS, result.get(OUTCOME).asString());
op = Util.createOperation(ModelDescriptionConstants.READ_RESOURCE_DESCRIPTION_OPERATION, getSubsystemAddress());
op.get(ModelDescriptionConstants.INCLUDE_ALIASES).set("true");
op.get(ModelDescriptionConstants.RECURSIVE).set("true");
result = services.executeOperation(op);
Assert.assertEquals(SUCCESS, result.get(OUTCOME).asString());
result = services.executeOperation(getLegacyTransportRemoveOperation(stackName));
Assert.assertEquals(SUCCESS, result.get(OUTCOME).asString());
result = services.executeOperation(getLegacyTransportAddOperation(stackName, "TCP"));
Assert.assertEquals(SUCCESS, result.get(OUTCOME).asString());
result = services.executeOperation(getLegacyTransportRemoveOperation(stackName));
Assert.assertEquals(SUCCESS, result.get(OUTCOME).asString());
result = services.executeOperation(getLegacyTransportRemoveOperation(stackName));
Assert.assertEquals(FAILED, result.get(OUTCOME).asString());
}
use of org.jboss.as.subsystem.test.KernelServices in project wildfly by wildfly.
the class OperationSequencesTestCase method testProtocolStackAddRemoveAddSequence.
@Test
public void testProtocolStackAddRemoveAddSequence() throws Exception {
KernelServices services = buildKernelServices();
ModelNode operation = Operations.createCompositeOperation(addStackOp, addTransportOp, addProtocolOp);
// add a protocol stack, its transport and a protocol as a batch
ModelNode result = services.executeOperation(operation);
Assert.assertEquals(SUCCESS, result.get(OUTCOME).asString());
// remove the stack
result = services.executeOperation(removeStackOp);
Assert.assertEquals(SUCCESS, result.get(OUTCOME).asString());
// add the same stack
result = services.executeOperation(operation);
Assert.assertEquals(SUCCESS, result.get(OUTCOME).asString());
}
Aggregations