Search in sources :

Example 61 with KernelServices

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));
}
Also used : KernelServices(org.jboss.as.subsystem.test.KernelServices) ModelNode(org.jboss.dmr.ModelNode) AbstractSubsystemBaseTest(org.jboss.as.subsystem.test.AbstractSubsystemBaseTest) Test(org.junit.Test)

Example 62 with KernelServices

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);
}
Also used : PathAddress(org.jboss.as.controller.PathAddress) KernelServices(org.jboss.as.subsystem.test.KernelServices) ModelNode(org.jboss.dmr.ModelNode) AbstractSubsystemTest(org.jboss.as.subsystem.test.AbstractSubsystemTest) Test(org.junit.Test)

Example 63 with KernelServices

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);
}
Also used : PathAddress(org.jboss.as.controller.PathAddress) KernelServices(org.jboss.as.subsystem.test.KernelServices) ModelNode(org.jboss.dmr.ModelNode) AbstractSubsystemTest(org.jboss.as.subsystem.test.AbstractSubsystemTest) Test(org.junit.Test)

Example 64 with KernelServices

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);
}
Also used : KernelServices(org.jboss.as.subsystem.test.KernelServices) ModelNode(org.jboss.dmr.ModelNode) AbstractSubsystemTest(org.jboss.as.subsystem.test.AbstractSubsystemTest) Test(org.junit.Test)

Example 65 with KernelServices

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());
}
Also used : KernelServices(org.jboss.as.subsystem.test.KernelServices) ControllerInitializer(org.jboss.as.subsystem.test.ControllerInitializer) KernelServicesBuilder(org.jboss.as.subsystem.test.KernelServicesBuilder) AdditionalInitialization(org.jboss.as.subsystem.test.AdditionalInitialization) AbstractSubsystemBaseTest(org.jboss.as.subsystem.test.AbstractSubsystemBaseTest) Test(org.junit.Test)

Aggregations

KernelServices (org.jboss.as.subsystem.test.KernelServices)144 ModelNode (org.jboss.dmr.ModelNode)102 Test (org.junit.Test)86 KernelServicesBuilder (org.jboss.as.subsystem.test.KernelServicesBuilder)69 ModelVersion (org.jboss.as.controller.ModelVersion)30 AbstractSubsystemBaseTest (org.jboss.as.subsystem.test.AbstractSubsystemBaseTest)29 PathAddress (org.jboss.as.controller.PathAddress)24 FailedOperationTransformationConfig (org.jboss.as.model.test.FailedOperationTransformationConfig)21 AbstractSubsystemTest (org.jboss.as.subsystem.test.AbstractSubsystemTest)11 ClusteringSubsystemTest (org.jboss.as.clustering.subsystem.ClusteringSubsystemTest)10 AdditionalInitialization (org.jboss.as.subsystem.test.AdditionalInitialization)8 ModelFixer (org.jboss.as.model.test.ModelFixer)7 ControllerInitializer (org.jboss.as.subsystem.test.ControllerInitializer)6 ModelTestControllerVersion (org.jboss.as.model.test.ModelTestControllerVersion)5 Properties (java.util.Properties)4 Session (javax.mail.Session)4 CompositeOperationBuilder (org.jboss.as.controller.client.helpers.Operations.CompositeOperationBuilder)3 ConnectorLogger (org.jboss.as.connector.logging.ConnectorLogger)2 Operation (org.jboss.as.controller.client.Operation)2 NewAttributesConfig (org.jboss.as.model.test.FailedOperationTransformationConfig.NewAttributesConfig)2