Search in sources :

Example 36 with KernelServices

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

the class SubsystemOperationsTestCase method testRemoveSubsystem.

@Test
public void testRemoveSubsystem() throws Exception {
    final KernelServices kernelServices = boot();
    final ModelNode removeSubsystemOp = SubsystemOperations.createRemoveOperation(createAddress(null));
    executeOperation(kernelServices, removeSubsystemOp);
}
Also used : KernelServices(org.jboss.as.subsystem.test.KernelServices) ModelNode(org.jboss.dmr.ModelNode) Test(org.junit.Test)

Example 37 with KernelServices

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

the class SubsystemTransformerTestCase method testFailedTransformersEAP700.

@Test
public void testFailedTransformersEAP700() throws Exception {
    final KernelServicesBuilder builder = createKernelServicesBuilder(AdditionalInitialization.MANAGEMENT);
    final ModelVersion legacyVersion = ModelVersion.create(1, 1, 0);
    final ModelTestControllerVersion controllerVersion = ModelTestControllerVersion.EAP_7_0_0;
    // Add legacy subsystems
    builder.createLegacyKernelServicesBuilder(AdditionalInitialization.MANAGEMENT, controllerVersion, legacyVersion).addMavenResourceURL(controllerVersion.getMavenGroupId() + ":wildfly-batch-jberet:" + controllerVersion.getMavenGavVersion()).addMavenResourceURL(controllerVersion.getCoreMavenGroupId() + ":wildfly-threads:" + controllerVersion.getCoreVersion());
    final KernelServices mainServices = builder.build();
    final KernelServices legacyServices = mainServices.getLegacyServices(legacyVersion);
    Assert.assertNotNull(legacyServices);
    Assert.assertTrue("main services did not boot", mainServices.isSuccessfulBoot());
    Assert.assertTrue(legacyServices.isSuccessfulBoot());
    final List<ModelNode> ops = builder.parseXmlResource("/default-subsystem.xml");
    ModelTestUtils.checkFailedTransformedBootOperations(mainServices, legacyVersion, ops, new FailedOperationTransformationConfig().addFailedAttribute(PathAddress.pathAddress(BatchSubsystemDefinition.SUBSYSTEM_PATH), new FailedOperationTransformationConfig.NewAttributesConfig(BatchSubsystemDefinition.SECURITY_DOMAIN)));
}
Also used : FailedOperationTransformationConfig(org.jboss.as.model.test.FailedOperationTransformationConfig) KernelServices(org.jboss.as.subsystem.test.KernelServices) ModelTestControllerVersion(org.jboss.as.model.test.ModelTestControllerVersion) ModelVersion(org.jboss.as.controller.ModelVersion) ModelNode(org.jboss.dmr.ModelNode) KernelServicesBuilder(org.jboss.as.subsystem.test.KernelServicesBuilder) Test(org.junit.Test)

Example 38 with KernelServices

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

the class SubsystemTransformerTestCase method testTransformersEAP700.

@Test
public void testTransformersEAP700() throws Exception {
    final KernelServicesBuilder builder = createKernelServicesBuilder(createAdditionalInitialization()).setSubsystemXmlResource("/default-subsystem_1_0.xml");
    final ModelVersion legacyVersion = ModelVersion.create(1, 1, 0);
    final ModelTestControllerVersion controllerVersion = ModelTestControllerVersion.EAP_7_0_0;
    // Add legacy subsystems
    builder.createLegacyKernelServicesBuilder(createAdditionalInitialization(), controllerVersion, legacyVersion).addMavenResourceURL(controllerVersion.getMavenGroupId() + ":wildfly-batch-jberet:" + controllerVersion.getMavenGavVersion()).addMavenResourceURL(controllerVersion.getCoreMavenGroupId() + ":wildfly-threads:" + controllerVersion.getCoreVersion());
    final KernelServices mainServices = builder.build();
    assertTrue(mainServices.isSuccessfulBoot());
    final KernelServices legacyServices = mainServices.getLegacyServices(legacyVersion);
    assertNotNull(legacyServices);
    assertTrue(legacyServices.isSuccessfulBoot());
    checkSubsystemModelTransformation(mainServices, legacyVersion, null, false);
}
Also used : KernelServices(org.jboss.as.subsystem.test.KernelServices) ModelTestControllerVersion(org.jboss.as.model.test.ModelTestControllerVersion) ModelVersion(org.jboss.as.controller.ModelVersion) KernelServicesBuilder(org.jboss.as.subsystem.test.KernelServicesBuilder) Test(org.junit.Test)

Example 39 with KernelServices

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

the class OperationSequencesTestCase method testCacheContainerAddRemoveAddSequence.

@Test
public void testCacheContainerAddRemoveAddSequence() throws Exception {
    // Parse and install the XML into the controller
    String subsystemXml = getSubsystemXml();
    KernelServices servicesA = this.createKernelServicesBuilder().setSubsystemXml(subsystemXml).build();
    ModelNode addContainerOp = getCacheContainerAddOperation("maximal2");
    ModelNode removeContainerOp = getCacheContainerRemoveOperation("maximal2");
    ModelNode addCacheOp = getCacheAddOperation("maximal2", LocalCacheResourceDefinition.WILDCARD_PATH.getKey(), "fred");
    // add a cache container
    ModelNode result = servicesA.executeOperation(addContainerOp);
    Assert.assertEquals(result.get(FAILURE_DESCRIPTION).asString(), SUCCESS, result.get(OUTCOME).asString());
    // add a local cache
    result = servicesA.executeOperation(addCacheOp);
    Assert.assertEquals(result.get(FAILURE_DESCRIPTION).asString(), SUCCESS, result.get(OUTCOME).asString());
    // remove the cache container
    result = servicesA.executeOperation(removeContainerOp);
    Assert.assertEquals(result.get(FAILURE_DESCRIPTION).asString(), SUCCESS, result.get(OUTCOME).asString());
    // add the same cache container
    result = servicesA.executeOperation(addContainerOp);
    Assert.assertEquals(result.get(FAILURE_DESCRIPTION).asString(), SUCCESS, result.get(OUTCOME).asString());
    // add the same local cache
    result = servicesA.executeOperation(addCacheOp);
    Assert.assertEquals(result.get(FAILURE_DESCRIPTION).asString(), SUCCESS, result.get(OUTCOME).asString());
}
Also used : KernelServices(org.jboss.as.subsystem.test.KernelServices) ModelNode(org.jboss.dmr.ModelNode) Test(org.junit.Test)

Example 40 with KernelServices

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

the class OperationSequencesTestCase method testCacheContainerRemoveRemoveSequence.

@Test
public void testCacheContainerRemoveRemoveSequence() throws Exception {
    // Parse and install the XML into the controller
    String subsystemXml = getSubsystemXml();
    KernelServices servicesA = this.createKernelServicesBuilder().setSubsystemXml(subsystemXml).build();
    ModelNode addContainerOp = getCacheContainerAddOperation("maximal2");
    ModelNode removeContainerOp = getCacheContainerRemoveOperation("maximal2");
    ModelNode addCacheOp = getCacheAddOperation("maximal2", LocalCacheResourceDefinition.WILDCARD_PATH.getKey(), "fred");
    // add a cache container
    ModelNode result = servicesA.executeOperation(addContainerOp);
    Assert.assertEquals(result.get(FAILURE_DESCRIPTION).asString(), SUCCESS, result.get(OUTCOME).asString());
    // add a local cache
    result = servicesA.executeOperation(addCacheOp);
    Assert.assertEquals(result.get(FAILURE_DESCRIPTION).asString(), SUCCESS, result.get(OUTCOME).asString());
    // remove the cache container
    result = servicesA.executeOperation(removeContainerOp);
    Assert.assertEquals(result.get(FAILURE_DESCRIPTION).asString(), SUCCESS, result.get(OUTCOME).asString());
    // remove the cache container again
    result = servicesA.executeOperation(removeContainerOp);
    Assert.assertEquals(result.toString(), FAILED, result.get(OUTCOME).asString());
}
Also used : KernelServices(org.jboss.as.subsystem.test.KernelServices) ModelNode(org.jboss.dmr.ModelNode) 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