Search in sources :

Example 61 with KernelServicesBuilder

use of org.jboss.as.subsystem.test.KernelServicesBuilder 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());
}
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)

Example 62 with KernelServicesBuilder

use of org.jboss.as.subsystem.test.KernelServicesBuilder in project wildfly by wildfly.

the class IDMSubsystemExampleConfigurationUnitTestCase 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());
}
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)

Example 63 with KernelServicesBuilder

use of org.jboss.as.subsystem.test.KernelServicesBuilder in project wildfly by wildfly.

the class IDMSubsystem_1_0_TransformerUnitTestCase method testRejectionExpressions.

private void testRejectionExpressions(ModelTestControllerVersion controllerVersion, String picketLinkJBossAs7Version) throws Exception {
    ModelVersion oldVersion = ModelVersion.create(1, 0, 0);
    KernelServicesBuilder builder = createKernelServicesBuilder(AdditionalInitialization.MANAGEMENT);
    builder.createLegacyKernelServicesBuilder(null, controllerVersion, oldVersion).setExtensionClassName(IDMExtension.class.getName()).addMavenResourceURL("org.wildfly:wildfly-picketlink:" + controllerVersion.getMavenGavVersion()).addMavenResourceURL("org.picketlink.distribution:picketlink-jbas7:" + picketLinkJBossAs7Version).dontPersistXml();
    KernelServices mainServices = builder.build();
    KernelServices legacyServices = mainServices.getLegacyServices(oldVersion);
    Assert.assertNotNull(legacyServices);
    Assert.assertTrue(mainServices.isSuccessfulBoot());
    Assert.assertTrue(legacyServices.isSuccessfulBoot());
    ModelNode op = createOperation(ADD, ModelElement.PARTITION_MANAGER.getName(), "test.partition", ModelElement.IDENTITY_CONFIGURATION.getName(), "test.config", ModelElement.LDAP_STORE.getName(), "ldap-store");
    op.get(ModelElement.LDAP_STORE_ACTIVE_DIRECTORY.getName()).set(true);
    TransformedOperation transformedOperation = mainServices.transformOperation(oldVersion, op);
    Assert.assertTrue(transformedOperation.rejectOperation(null));
    op = createOperation(ADD, ModelElement.PARTITION_MANAGER.getName(), "test.partition", ModelElement.IDENTITY_CONFIGURATION.getName(), "test.config", ModelElement.LDAP_STORE.getName(), "ldap-store");
    op.get(ModelElement.LDAP_STORE_UNIQUE_ID_ATTRIBUTE_NAME.getName()).set("SOMEaTTRIBUTE");
    transformedOperation = mainServices.transformOperation(oldVersion, op);
    Assert.assertTrue(transformedOperation.rejectOperation(null));
}
Also used : TransformedOperation(org.jboss.as.controller.transform.OperationTransformer.TransformedOperation) KernelServices(org.jboss.as.subsystem.test.KernelServices) ModelVersion(org.jboss.as.controller.ModelVersion) ModelNode(org.jboss.dmr.ModelNode) KernelServicesBuilder(org.jboss.as.subsystem.test.KernelServicesBuilder)

Example 64 with KernelServicesBuilder

use of org.jboss.as.subsystem.test.KernelServicesBuilder 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());
}
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)

Example 65 with KernelServicesBuilder

use of org.jboss.as.subsystem.test.KernelServicesBuilder 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());
}
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

KernelServicesBuilder (org.jboss.as.subsystem.test.KernelServicesBuilder)73 KernelServices (org.jboss.as.subsystem.test.KernelServices)69 ModelNode (org.jboss.dmr.ModelNode)33 ModelVersion (org.jboss.as.controller.ModelVersion)28 Test (org.junit.Test)25 FailedOperationTransformationConfig (org.jboss.as.model.test.FailedOperationTransformationConfig)20 PathAddress (org.jboss.as.controller.PathAddress)13 AbstractSubsystemBaseTest (org.jboss.as.subsystem.test.AbstractSubsystemBaseTest)13 ModelFixer (org.jboss.as.model.test.ModelFixer)7 AdditionalInitialization (org.jboss.as.subsystem.test.AdditionalInitialization)6 ModelTestControllerVersion (org.jboss.as.model.test.ModelTestControllerVersion)5 ControllerInitializer (org.jboss.as.subsystem.test.ControllerInitializer)5 Properties (java.util.Properties)4 Session (javax.mail.Session)4 NewAttributesConfig (org.jboss.as.model.test.FailedOperationTransformationConfig.NewAttributesConfig)2 TransactionLogger (org.jboss.as.txn.logging.TransactionLogger)2 HttpHandler (io.undertow.server.HttpHandler)1 PathHandler (io.undertow.server.handlers.PathHandler)1 ArrayList (java.util.ArrayList)1 HashMap (java.util.HashMap)1