use of org.jboss.as.subsystem.test.KernelServices in project wildfly by wildfly.
the class NamingSubsystemTestCase method testCompositeBindingOps.
/**
* Asserts that bindings may be added through composite ops.
* @throws Exception
*/
@Test
public void testCompositeBindingOps() throws Exception {
final KernelServices services = createKernelServicesBuilder(createAdditionalInitialization()).setSubsystemXml(getSubsystemXml()).build();
// add binding 'alookup' through composite op
// note that a binding-type of 'lookup' requires 'lookup' attr value, which in this case is set by a followup step
final ModelNode addr = Operations.createAddress(ModelDescriptionConstants.SUBSYSTEM, NamingExtension.SUBSYSTEM_NAME, NamingSubsystemModel.BINDING, "java:global/alookup");
final ModelNode addOp = Operations.createAddOperation(addr);
addOp.get(NamingSubsystemModel.BINDING_TYPE).set(NamingSubsystemModel.LOOKUP);
final ModelNode compositeOp = Operations.CompositeOperationBuilder.create().addStep(addOp).addStep(Operations.createWriteAttributeOperation(addr, NamingSubsystemModel.LOOKUP, "java:global/a")).build().getOperation();
ModelTestUtils.checkOutcome(services.executeOperation(compositeOp));
}
use of org.jboss.as.subsystem.test.KernelServices in project wildfly by wildfly.
the class FederationSubsystem_1_0_CertAliasUnsupportedTestCase method failWriteTrustDomainWithCertAlias.
@Test
public void failWriteTrustDomainWithCertAlias() throws Exception {
//Parse the subsystem xml and install into the first controller
String subsystemXml = readResource("federation-subsystem-1.0.xml");
KernelServices servicesA = createKernelServicesBuilder(AdditionalInitialization.MANAGEMENT).setSubsystemXml(subsystemXml).build();
PathAddress address = PathAddress.pathAddress(FederationExtension.SUBSYSTEM_PATH).append(ModelElement.FEDERATION.getName(), "federation-without-signatures").append(ModelElement.IDENTITY_PROVIDER.getName(), "idp.war").append(ModelElement.IDENTITY_PROVIDER_TRUST_DOMAIN.getName(), "invalid-trust-domain");
ModelNode operation = Util.getWriteAttributeOperation(address, ModelElement.IDENTITY_PROVIDER_TRUST_DOMAIN_CERT_ALIAS.getName(), new ModelNode("servercert"));
servicesA.executeForFailure(operation);
}
use of org.jboss.as.subsystem.test.KernelServices in project wildfly by wildfly.
the class FederationSubsystem_1_0_CertAliasUnsupportedTestCase method failAddTrustDomainWithCertAlias.
@Test
public void failAddTrustDomainWithCertAlias() throws Exception {
//Parse the subsystem xml and install into the first controller
String subsystemXml = readResource("federation-subsystem-1.0.xml");
KernelServices servicesA = createKernelServicesBuilder(AdditionalInitialization.MANAGEMENT).setSubsystemXml(subsystemXml).build();
PathAddress address = PathAddress.pathAddress(FederationExtension.SUBSYSTEM_PATH).append(ModelElement.FEDERATION.getName(), "federation-without-signatures").append(ModelElement.IDENTITY_PROVIDER.getName(), "idp.war").append(ModelElement.IDENTITY_PROVIDER_TRUST_DOMAIN.getName(), "invalid-trust-domain");
ModelNode operation = Util.createAddOperation(address);
operation.get(ModelElement.IDENTITY_PROVIDER_TRUST_DOMAIN_CERT_ALIAS.getName()).set("servercert");
servicesA.executeForFailure(operation);
}
use of org.jboss.as.subsystem.test.KernelServices in project wildfly by wildfly.
the class FederationSubsystem_1_0_UnitTestCase method testParseAndMarshalModel.
@Test
public void testParseAndMarshalModel() throws Exception {
//Parse the subsystem xml and install into the first controller
String subsystemXml = readResource("federation-subsystem-1.0.xml");
KernelServices servicesA = createKernelServicesBuilder(AdditionalInitialization.MANAGEMENT).setSubsystemXml(subsystemXml).build();
//Get the model and the persisted xml from the first controller
ModelNode modelA = servicesA.readWholeModel();
String marshalled = servicesA.getPersistedSubsystemXml();
servicesA.shutdown();
//Install the persisted xml from the first controller into a second controller
KernelServices servicesB = createKernelServicesBuilder(AdditionalInitialization.MANAGEMENT).setSubsystemXml(marshalled).build();
ModelNode modelB = servicesB.readWholeModel();
//Make sure the models from the two controllers are identical
super.compare(modelA, modelB);
assertRemoveSubsystemResources(servicesB);
}
use of org.jboss.as.subsystem.test.KernelServices 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());
}
Aggregations