use of org.jboss.as.subsystem.test.AdditionalInitialization in project wildfly by wildfly.
the class ModClusterSubsystemParsingTestCase method testSSL.
@Ignore
@Test
public void testSSL() throws Exception {
if (schema != ModClusterSchema.CURRENT)
return;
KernelServicesBuilder builder = createKernelServicesBuilder(new AdditionalInitialization()).setSubsystemXml(getSubsystemXml());
KernelServices services = builder.build();
ModelNode model = services.readWholeModel();
ModelNode config = model.get(SUBSYSTEM, getMainSubsystemName()).get(MOD_CLUSTER_CONFIG, CONFIGURATION);
ModelNode ssl = config.get(SSL, CONFIGURATION);
Assert.assertEquals("/home/rhusar/client-keystore.jks", ssl.get("ca-certificate-file").resolve().asString());
Assert.assertEquals("/home/rhusar/revocations", ssl.get("ca-revocation-url").resolve().asString());
Assert.assertEquals("/home/rhusar/client-keystore.jks", ssl.get("certificate-key-file").resolve().asString());
Assert.assertEquals("SSL_DHE_DSS_WITH_3DES_EDE_CBC_SHA,SSL_RSA_WITH_RC4_128_MD5,SSL_RSA_WITH_RC4_128_SHA,SSL_RSA_WITH_3DES_EDE_CBC_SHA", ssl.get("cipher-suite").resolve().asString());
Assert.assertEquals("mykeyalias", ssl.get("key-alias").resolve().asString());
Assert.assertEquals("mypassword", ssl.get("password").resolve().asString());
Assert.assertEquals("TLSv1", ssl.get("protocol").resolve().asString());
ServiceController<?> service = services.getContainer().getService(ContainerEventHandlerService.CONFIG_SERVICE_NAME);
MCMPHandlerConfiguration mcmpHandlerConfiguration = (MCMPHandlerConfiguration) service.getValue();
Assert.assertTrue(mcmpHandlerConfiguration.isSsl());
SSLConfiguration sslConfig = (SSLConfiguration) service.getValue();
Assert.assertEquals("mykeyalias", sslConfig.getSslKeyAlias());
Assert.assertEquals("mypassword", sslConfig.getSslTrustStorePassword());
Assert.assertEquals("mypassword", sslConfig.getSslKeyStorePassword());
Assert.assertEquals("/home/rhusar/client-keystore.jks", sslConfig.getSslKeyStore());
Assert.assertEquals("SSL_DHE_DSS_WITH_3DES_EDE_CBC_SHA,SSL_RSA_WITH_RC4_128_MD5,SSL_RSA_WITH_RC4_128_SHA,SSL_RSA_WITH_3DES_EDE_CBC_SHA", sslConfig.getSslCiphers());
Assert.assertEquals("TLSv1", sslConfig.getSslProtocol());
Assert.assertEquals("/home/rhusar/client-keystore.jks", sslConfig.getSslTrustStore());
Assert.assertEquals("/home/rhusar/revocations", sslConfig.getSslCrlFile());
}
use of org.jboss.as.subsystem.test.AdditionalInitialization in project wildfly by wildfly.
the class EeLegacySubsystemTestCase method createAdditionalInitialization.
@Override
protected AdditionalInitialization createAdditionalInitialization() {
return new AdditionalInitialization() {
@Override
protected RunningMode getRunningMode() {
return RunningMode.ADMIN_ONLY;
}
@Override
protected void initializeExtraSubystemsAndModel(ExtensionRegistry extensionRegistry, Resource rootResource, ManagementResourceRegistration rootRegistration, RuntimeCapabilityRegistry capabilityRegistry) {
if (!extensionAdded) {
// extensionAdded = true;
// bean validation depends on EE, so we can't use the real subsystem here
final OperationDefinition removeExtension = new SimpleOperationDefinitionBuilder("remove", NonResolvingResourceDescriptionResolver.INSTANCE).build();
final OperationDefinition addExtension = new SimpleOperationDefinitionBuilder("add", NonResolvingResourceDescriptionResolver.INSTANCE).addParameter(new SimpleAttributeDefinitionBuilder("module", ModelType.STRING).setRequired(true).build()).build();
PathElement bvExtension = PathElement.pathElement(EXTENSION, "org.wildfly.extension.bean-validation");
ManagementResourceRegistration extensionRegistration = rootRegistration.registerSubModel(new SimpleResourceDefinition(bvExtension, NonResolvingResourceDescriptionResolver.INSTANCE));
extensionRegistration.registerReadOnlyAttribute(new SimpleAttributeDefinitionBuilder("module", ModelType.STRING).setRequired(true).build(), null);
extensionRegistration.registerOperationHandler(removeExtension, new ReloadRequiredRemoveStepHandler());
extensionRegistration.registerOperationHandler(addExtension, new ReloadRequiredAddStepHandler(new SimpleAttributeDefinitionBuilder("module", ModelType.STRING).setRequired(true).build()));
final OperationDefinition removeSubsystem = new SimpleOperationDefinitionBuilder("remove", NonResolvingResourceDescriptionResolver.INSTANCE).build();
final OperationDefinition addSubsystem = new SimpleOperationDefinitionBuilder("add", NonResolvingResourceDescriptionResolver.INSTANCE).build();
PathElement bvSubsystem = PathElement.pathElement(SUBSYSTEM, "bean-validation");
ManagementResourceRegistration subsystemRegistration = rootRegistration.registerSubModel(new SimpleResourceDefinition(bvSubsystem, NonResolvingResourceDescriptionResolver.INSTANCE));
subsystemRegistration.registerOperationHandler(removeSubsystem, new ReloadRequiredRemoveStepHandler());
subsystemRegistration.registerOperationHandler(addSubsystem, new ReloadRequiredAddStepHandler());
}
}
};
}
use of org.jboss.as.subsystem.test.AdditionalInitialization in project wildfly by wildfly.
the class FederationSubsystem_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 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 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