use of org.jboss.as.subsystem.test.AdditionalInitialization in project wildfly by wildfly.
the class IDMSubsystem_2_0_UnitTestCase method testRuntime.
@Test
public void testRuntime() throws Exception {
System.setProperty("jboss.server.data.dir", System.getProperty("java.io.tmpdir"));
System.setProperty("jboss.home.dir", System.getProperty("java.io.tmpdir"));
System.setProperty("jboss.server.server.dir", System.getProperty("java.io.tmpdir"));
KernelServicesBuilder builder = createKernelServicesBuilder(new AdditionalInitialization() {
@Override
protected RunningMode getRunningMode() {
return RunningMode.NORMAL;
}
@Override
protected void setupController(ControllerInitializer controllerInitializer) {
super.setupController(controllerInitializer);
controllerInitializer.addPath("jboss.server.data.dir", System.getProperty("java.io.tmpdir"), null);
}
}).setSubsystemXml(getSubsystemXml());
KernelServices mainServices = builder.build();
assertTrue(mainServices.isSuccessfulBoot());
}
use of org.jboss.as.subsystem.test.AdditionalInitialization in project wildfly by wildfly.
the class InvalidAttributeManagerDeclarationUnitTestCase method testSubsystem.
@Test
public void testSubsystem() throws Exception {
System.setProperty("jboss.server.data.dir", System.getProperty("java.io.tmpdir"));
System.setProperty("jboss.home.dir", System.getProperty("java.io.tmpdir"));
System.setProperty("jboss.server.server.dir", System.getProperty("java.io.tmpdir"));
KernelServicesBuilder builder = createKernelServicesBuilder(new AdditionalInitialization() {
@Override
protected RunningMode getRunningMode() {
return RunningMode.NORMAL;
}
@Override
protected void setupController(ControllerInitializer controllerInitializer) {
super.setupController(controllerInitializer);
controllerInitializer.addPath("jboss.server.data.dir", System.getProperty("java.io.tmpdir"), null);
}
}).setSubsystemXml(getSubsystemXml());
KernelServices mainServices = builder.build();
assertFalse(mainServices.isSuccessfulBoot());
}
use of org.jboss.as.subsystem.test.AdditionalInitialization in project wildfly by wildfly.
the class ResourceAdaptersSubsystemTestCase method standardSubsystemTest.
//TODO: remove this special method as soon as RA will have a unique name in DMR marshalled in xml
protected KernelServices standardSubsystemTest(final String configId, final String configIdResolvedModel, boolean compareXml) throws Exception {
final AdditionalInitialization additionalInit = createAdditionalInitialization();
// Parse the subsystem xml and install into the first controller
final String subsystemXml = configId == null ? getSubsystemXml() : getSubsystemXml(configId);
final KernelServices servicesA = super.createKernelServicesBuilder(additionalInit).setSubsystemXml(subsystemXml).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);
// Test marshaling
final String marshalled = servicesA.getPersistedSubsystemXml();
servicesA.shutdown();
// validate the the normalized xmls
String normalizedSubsystem = normalizeXML(subsystemXml);
if (compareXml) {
compareXml(configId, normalizedSubsystem, normalizeXML(marshalled));
}
//Install the persisted xml from the first controller into a second controller
final KernelServices servicesB = super.createKernelServicesBuilder(additionalInit).setSubsystemXml(marshalled).build();
final ModelNode modelB = servicesB.readWholeModel();
//WE CANT DO THAT FOR RA BECAUSE THEIR NAME IS GENERATED ON THE FLY W/ archive/module concatenated to a counter.
//IT'S AN ISSUE WM_SECURITY_MAPPING_TO BE FIXED IN SUBSYSTEM
//Make sure the models from the two controllers are identical
//compare(modelA, modelB);
// Test the describe operation
final ModelNode operation = createDescribeOperation();
final ModelNode result = servicesB.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();
servicesB.shutdown();
final KernelServices servicesC = super.createKernelServicesBuilder(additionalInit).setBootOperations(operations).build();
final ModelNode modelC = servicesC.readWholeModel();
compare(modelB, modelC);
assertRemoveSubsystemResources(servicesC, getIgnoredChildResourcesForRemovalTest());
if (configIdResolvedModel != null) {
final String subsystemResolvedXml = getSubsystemXml(configIdResolvedModel);
final KernelServices servicesD = super.createKernelServicesBuilder(additionalInit).setSubsystemXml(subsystemResolvedXml).build();
Assert.assertTrue("Subsystem w/ reolved xml boot failed!", servicesD.isSuccessfulBoot());
final ModelNode modelD = servicesD.readWholeModel();
validateModel(modelD);
resolveandCompareModel(modelA, modelD);
}
return servicesA;
}
use of org.jboss.as.subsystem.test.AdditionalInitialization in project wildfly by wildfly.
the class IIOPSubsystemTestCase method testDescribeHandler.
@Test
public void testDescribeHandler() throws Exception {
// parse the subsystem xml and install into the first controller.
String subsystemXml = "<subsystem xmlns=\"" + Namespace.CURRENT.getUriString() + "\">" + "<orb socket-binding=\"iiop\" ssl-socket-binding=\"iiop-ssl\"/>" + "</subsystem>";
AdditionalInitialization additionalInit = new AdditionalInitialization() {
@Override
protected void setupController(ControllerInitializer controllerInitializer) {
controllerInitializer.addSocketBinding("iiop", 3528);
controllerInitializer.addSocketBinding("iiop-ssl", 3529);
}
};
KernelServices servicesA = createKernelServicesBuilder(additionalInit).setSubsystemXml(subsystemXml).build();
// get the model and the describe operations from the first controller.
ModelNode modelA = servicesA.readWholeModel();
ModelNode describeOp = new ModelNode();
describeOp.get(OP).set(DESCRIBE);
describeOp.get(OP_ADDR).set(PathAddress.pathAddress(PathElement.pathElement(SUBSYSTEM, IIOPExtension.SUBSYSTEM_NAME)).toModelNode());
List<ModelNode> operations = checkResultAndGetContents(servicesA.executeOperation(describeOp)).asList();
servicesA.shutdown();
Assert.assertEquals(1, operations.size());
// install the describe options from the first controller into a second controller.
KernelServices servicesB = createKernelServicesBuilder(additionalInit).setBootOperations(operations).build();
ModelNode modelB = servicesB.readWholeModel();
servicesB.shutdown();
// make sure the models from the two controllers are identical.
super.compare(modelA, modelB);
}
Aggregations