use of org.jboss.as.subsystem.test.KernelServices in project wildfly by wildfly.
the class JGroupsSubsystemParsingTestCase method testDescribeHandler.
/**
* Starts a controller with the given subsystem xml and then checks that a second controller
* started with the operations from its describe action results in the same model
*/
@Test
public void testDescribeHandler() throws Exception {
KernelServices servicesA = this.buildKernelServices();
// Get the model and the describe operations from the first controller
ModelNode modelA = servicesA.readWholeModel();
ModelNode operation = Operations.createDescribeOperation(PathAddress.pathAddress(JGroupsSubsystemResourceDefinition.PATH));
List<ModelNode> operations = checkResultAndGetContents(servicesA.executeOperation(operation)).asList();
// Install the describe options from the first controller into a second controller
KernelServices servicesB = this.createKernelServicesBuilder().setBootOperations(operations).build();
ModelNode modelB = servicesB.readWholeModel();
// Make sure the models from the two controllers are identical
super.compare(modelA, modelB);
}
use of org.jboss.as.subsystem.test.KernelServices in project wildfly by wildfly.
the class JGroupsTransformersTestCase method testRejections.
private void testRejections(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());
// initialize the legacy services and add required jars
builder.createLegacyKernelServicesBuilder(createAdditionalInitialization(), controller, version).addSingleChildFirstClass(AdditionalInitialization.class).addMavenResourceURL(dependencies).dontPersistXml();
KernelServices services = builder.build();
Assert.assertTrue(services.isSuccessfulBoot());
KernelServices legacyServices = services.getLegacyServices(version);
Assert.assertNotNull(legacyServices);
Assert.assertTrue(legacyServices.isSuccessfulBoot());
List<ModelNode> operations = builder.parseXmlResource("subsystem-jgroups-transform-reject.xml");
ModelTestUtils.checkFailedTransformedBootOperations(services, version, operations, createFailedOperationTransformationConfig(version));
}
use of org.jboss.as.subsystem.test.KernelServices in project wildfly by wildfly.
the class OperationSequencesTestCase method testProtocolStackRemoveRemoveSequence.
@Test
public void testProtocolStackRemoveRemoveSequence() throws Exception {
KernelServices services = buildKernelServices();
ModelNode operation = Operations.createCompositeOperation(addStackOp, addTransportOp, addProtocolOp);
// add a protocol stack
ModelNode result = services.executeOperation(operation);
Assert.assertEquals(SUCCESS, result.get(OUTCOME).asString());
// remove the protocol stack
result = services.executeOperation(removeStackOp);
Assert.assertEquals(SUCCESS, result.get(OUTCOME).asString());
// remove the protocol stack again
result = services.executeOperation(removeStackOp);
Assert.assertEquals(FAILED, result.get(OUTCOME).asString());
}
use of org.jboss.as.subsystem.test.KernelServices in project wildfly by wildfly.
the class OperationsTestCase method testProtocolReadWriteOperation.
@Test
public void testProtocolReadWriteOperation() throws Exception {
KernelServices services = this.buildKernelServices();
// add a protocol stack specifying TRANSPORT and PROTOCOLS parameters
ModelNode result = services.executeOperation(getProtocolStackAddOperationWithParameters("maximal2"));
Assert.assertEquals(result.toString(), SUCCESS, result.get(OUTCOME).asString());
// read the socket binding attribute
result = services.executeOperation(getProtocolReadOperation("maximal", "MPING", SocketBindingProtocolResourceDefinition.Attribute.SOCKET_BINDING));
Assert.assertEquals(result.toString(), SUCCESS, result.get(OUTCOME).asString());
Assert.assertEquals("jgroups-mping", result.get(RESULT).asString());
// write the attribute
result = services.executeOperation(getProtocolWriteOperation("maximal", "MPING", SocketBindingProtocolResourceDefinition.Attribute.SOCKET_BINDING, "new-socket-binding"));
Assert.assertEquals(result.toString(), SUCCESS, result.get(OUTCOME).asString());
// re-read the attribute
result = services.executeOperation(getProtocolReadOperation("maximal", "MPING", SocketBindingProtocolResourceDefinition.Attribute.SOCKET_BINDING));
Assert.assertEquals(result.toString(), SUCCESS, result.get(OUTCOME).asString());
Assert.assertEquals("new-socket-binding", result.get(RESULT).asString());
}
use of org.jboss.as.subsystem.test.KernelServices in project wildfly by wildfly.
the class OperationsTestCase method testProtocolPropertyReadWriteOperation.
@Test
public void testProtocolPropertyReadWriteOperation() throws Exception {
KernelServices services = this.buildKernelServices();
// read the name protocol property
ModelNode result = services.executeOperation(getProtocolGetPropertyOperation("maximal", "MPING", "name"));
Assert.assertEquals(result.toString(), SUCCESS, result.get(OUTCOME).asString());
Assert.assertEquals("value", result.get(RESULT).resolve().asString());
// write the property
result = services.executeOperation(getProtocolPutPropertyOperation("maximal", "MPING", "name", "new-value"));
Assert.assertEquals(result.toString(), SUCCESS, result.get(OUTCOME).asString());
// re-read the property
result = services.executeOperation(getProtocolGetPropertyOperation("maximal", "MPING", "name"));
Assert.assertEquals(result.toString(), SUCCESS, result.get(OUTCOME).asString());
Assert.assertEquals("new-value", result.get(RESULT).asString());
// remove the property
result = services.executeOperation(getProtocolRemovePropertyOperation("maximal", "MPING", "name"));
Assert.assertEquals(result.toString(), SUCCESS, result.get(OUTCOME).asString());
// re-read the property
result = services.executeOperation(getProtocolGetPropertyOperation("maximal", "MPING", "name"));
Assert.assertEquals(result.toString(), SUCCESS, result.get(OUTCOME).asString());
Assert.assertFalse(result.get(RESULT).isDefined());
// Validate property add/read/write/remove via legacy property resource
result = services.executeOperation(getProtocolPropertyAddOperation("maximal", "MPING", "async_discovery", "false"));
Assert.assertEquals(result.toString(), SUCCESS, result.get(OUTCOME).asString());
result = services.executeOperation(getProtocolPropertyReadOperation("maximal", "MPING", "async_discovery"));
Assert.assertEquals(result.toString(), SUCCESS, result.get(OUTCOME).asString());
Assert.assertEquals("false", result.get(RESULT).asString());
result = services.executeOperation(getProtocolGetPropertyOperation("maximal", "MPING", "async_discovery"));
Assert.assertEquals(result.toString(), SUCCESS, result.get(OUTCOME).asString());
Assert.assertEquals("false", result.get(RESULT).asString());
result = services.executeOperation(getProtocolPropertyWriteOperation("maximal", "MPING", "async_discovery", "true"));
Assert.assertEquals(result.toString(), SUCCESS, result.get(OUTCOME).asString());
result = services.executeOperation(getProtocolPropertyReadOperation("maximal", "MPING", "async_discovery"));
Assert.assertEquals(result.toString(), SUCCESS, result.get(OUTCOME).asString());
Assert.assertEquals("true", result.get(RESULT).asString());
result = services.executeOperation(getProtocolGetPropertyOperation("maximal", "MPING", "async_discovery"));
Assert.assertEquals(result.toString(), SUCCESS, result.get(OUTCOME).asString());
Assert.assertEquals("true", result.get(RESULT).asString());
result = services.executeOperation(getProtocolPropertyRemoveOperation("maximal", "MPING", "async_discovery"));
Assert.assertEquals(result.toString(), SUCCESS, result.get(OUTCOME).asString());
result = services.executeOperation(getProtocolGetPropertyOperation("maximal", "MPING", "async_discovery"));
Assert.assertEquals(result.toString(), SUCCESS, result.get(OUTCOME).asString());
Assert.assertFalse(result.get(RESULT).isDefined());
}
Aggregations