use of org.jboss.as.subsystem.test.KernelServicesBuilder in project wildfly by wildfly.
the class MessagingSubsystem30TestCase method testRejectExpressionsEAP_6_2_0.
@Test
public void testRejectExpressionsEAP_6_2_0() throws Exception {
KernelServicesBuilder builder = createKernelServicesBuilder(EAP_6_2_0, VERSION_1_3_0, PATH_FIXER, "empty_subsystem_3_0.xml");
doTestRejectExpressions_1_3_0(builder);
}
use of org.jboss.as.subsystem.test.KernelServicesBuilder in project wildfly by wildfly.
the class MessagingSubsystem30TestCase method testRejectExpressionsEAP_6_4_0.
@Test
public void testRejectExpressionsEAP_6_4_0() throws Exception {
KernelServicesBuilder builder = createKernelServicesBuilder(EAP_6_4_0, VERSION_1_4_0, PATH_FIXER, "empty_subsystem_3_0.xml");
doTestRejectExpressions_1_4_0(builder);
}
use of org.jboss.as.subsystem.test.KernelServicesBuilder in project wildfly by wildfly.
the class RoleGeneratorDeclarationUnitTestCase 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.KernelServicesBuilder in project wildfly by wildfly.
the class SecurityDomainModelv30UnitTestCase method testTransformers.
private void testTransformers(ModelTestControllerVersion controllerVersion) throws Exception {
KernelServicesBuilder builder = createKernelServicesBuilder(createAdditionalInitialization());
ModelVersion version = ModelVersion.create(1, 3, 0);
final String mavenGavVersion = controllerVersion.getMavenGavVersion();
final String artifactId;
if (controllerVersion.isEap() && mavenGavVersion.equals(controllerVersion.getCoreVersion())) {
/* EAP 6 */
artifactId = "jboss-as-security";
} else {
artifactId = "wildfly-security";
}
builder.createLegacyKernelServicesBuilder(AdditionalInitialization.MANAGEMENT, controllerVersion, version).addMavenResourceURL(controllerVersion.getMavenGroupId() + ":" + artifactId + ":" + mavenGavVersion);
KernelServices mainServices = builder.build();
assertTrue(mainServices.isSuccessfulBoot());
KernelServices legacyServices = mainServices.getLegacyServices(version);
assertNotNull(legacyServices);
assertTrue(legacyServices.isSuccessfulBoot());
// any elytron-related resources in the model should get rejected as those are not supported in model version 1.3.0.
PathAddress subsystemAddress = PathAddress.pathAddress(PathElement.pathElement(SUBSYSTEM, getMainSubsystemName()));
ModelTestUtils.checkFailedTransformedBootOperations(mainServices, version, builder.parseXmlResource("securitysubsystemv30.xml"), new FailedOperationTransformationConfig().addFailedAttribute(PathAddress.pathAddress(subsystemAddress, PathElement.pathElement(Constants.ELYTRON_REALM)), FailedOperationTransformationConfig.REJECTED_RESOURCE).addFailedAttribute(PathAddress.pathAddress(subsystemAddress, PathElement.pathElement(Constants.ELYTRON_KEY_STORE)), FailedOperationTransformationConfig.REJECTED_RESOURCE).addFailedAttribute(PathAddress.pathAddress(subsystemAddress, PathElement.pathElement(Constants.ELYTRON_TRUST_STORE)), FailedOperationTransformationConfig.REJECTED_RESOURCE).addFailedAttribute(PathAddress.pathAddress(subsystemAddress, PathElement.pathElement(Constants.ELYTRON_KEY_MANAGER)), FailedOperationTransformationConfig.REJECTED_RESOURCE).addFailedAttribute(PathAddress.pathAddress(subsystemAddress, PathElement.pathElement(Constants.ELYTRON_TRUST_MANAGER)), FailedOperationTransformationConfig.REJECTED_RESOURCE).addFailedAttribute(PathAddress.pathAddress(subsystemAddress, PathElement.pathElement(Constants.SECURITY_DOMAIN, "domain-with-custom-audit-provider"), SecurityExtension.PATH_AUDIT_CLASSIC, PathElement.pathElement(Constants.PROVIDER_MODULE, "org.myorg.security.MyCustomLogAuditProvider")), new FailedOperationTransformationConfig.NewAttributesConfig(Constants.MODULE)).addFailedAttribute(PathAddress.pathAddress(subsystemAddress, PathElement.pathElement(Constants.SECURITY_MANAGEMENT)), new FailedOperationTransformationConfig.NewAttributesConfig(Constants.INITIALIZE_JACC)));
}
use of org.jboss.as.subsystem.test.KernelServicesBuilder in project wildfly by wildfly.
the class MailSubsystem21TestCase method testOperations.
@Test
public void testOperations() throws Exception {
KernelServicesBuilder builder = createKernelServicesBuilder(new MailSubsystem10TestCase.Initializer()).setSubsystemXml(getSubsystemXml());
KernelServices mainServices = builder.build();
if (!mainServices.isSuccessfulBoot()) {
Assert.fail(mainServices.getBootError().toString());
}
PathAddress sessionAddress = PathAddress.pathAddress(MailExtension.SUBSYSTEM_PATH, PathElement.pathElement(MailExtension.MAIL_SESSION_PATH.getKey(), "defaultMail"));
ModelNode result;
ModelNode removeServerOp = Util.createRemoveOperation(sessionAddress.append("server", "imap"));
removeServerOp.get(OPERATION_HEADERS).get(ALLOW_RESOURCE_SERVICE_RESTART).set(true);
result = mainServices.executeOperation(removeServerOp);
checkResult(result);
ModelNode addServerOp = Util.createAddOperation(sessionAddress.append("server", "imap"));
addServerOp.get(OPERATION_HEADERS).get(ALLOW_RESOURCE_SERVICE_RESTART).set(true);
addServerOp.get("outbound-socket-binding-ref").set("mail-imap");
addServerOp.get("username").set("user");
addServerOp.get("password").set("pswd");
result = mainServices.executeOperation(addServerOp);
checkResult(result);
//to make sure noting is left behind
checkResult(mainServices.executeOperation(removeServerOp));
checkResult(mainServices.executeOperation(addServerOp));
ModelNode writeOp = Util.createEmptyOperation(WRITE_ATTRIBUTE_OPERATION, sessionAddress);
writeOp.get(OPERATION_HEADERS).get(ALLOW_RESOURCE_SERVICE_RESTART).set(true);
writeOp.get("name").set("debug");
writeOp.get("value").set(false);
result = mainServices.executeOperation(writeOp);
checkResult(result);
ServiceController<?> javaMailService = mainServices.getContainer().getService(MailSessionAdd.MAIL_SESSION_SERVICE_NAME.append("defaultMail"));
javaMailService.setMode(ServiceController.Mode.ACTIVE);
Session session = (Session) javaMailService.getValue();
Assert.assertNotNull("session should not be null", session);
Properties properties = session.getProperties();
Assert.assertNotNull("smtp host should be set", properties.getProperty("mail.smtp.host"));
Assert.assertNotNull("imap host should be set", properties.getProperty("mail.imap.host"));
PathAddress nonExisting = PathAddress.pathAddress(MailExtension.SUBSYSTEM_PATH, PathElement.pathElement(MailExtension.MAIL_SESSION_PATH.getKey(), "non-existing-session"));
ModelNode addSession = Util.createAddOperation(nonExisting);
addSession.get("jndi-name").set("java:/bah");
checkResult(mainServices.executeOperation(addSession));
removeServerOp = Util.createRemoveOperation(nonExisting.append("server", "imap"));
//removeServerOp.get(OPERATION_HEADERS).get(ALLOW_RESOURCE_SERVICE_RESTART).set(true);
result = mainServices.executeOperation(removeServerOp);
checkForFailure(result);
}
Aggregations