use of org.jboss.as.subsystem.test.KernelServices in project wildfly by wildfly.
the class SingletonSubsystemParsingTestCase method testDescribeHandler.
/**
* Starts a controller with the given subsystem xml and then checks that a second controller
* started with the operations from its describe action results in the same model
*/
@Test
public void testDescribeHandler() throws Exception {
KernelServices services = this.buildKernelServices();
ModelNode modelA = services.readWholeModel();
ModelNode operation = Operations.createDescribeOperation(PathAddress.pathAddress(SingletonResourceDefinition.PATH));
List<ModelNode> operations = checkResultAndGetContents(services.executeOperation(operation)).asList();
ModelNode modelB = this.createKernelServicesBuilder().setBootOperations(operations).build().readWholeModel();
this.compare(modelA, modelB);
}
use of org.jboss.as.subsystem.test.KernelServices in project wildfly by wildfly.
the class SingletonTransformersTestCase method testTransformation.
private void testTransformation(final ModelTestControllerVersion controller) throws Exception {
final ModelVersion version = getModelVersion(controller).getVersion();
final String subsystemXmlResource = String.format("subsystem-transform-%d_%d_%d.xml", version.getMajor(), version.getMinor(), version.getMicro());
final String[] dependencies = getDependencies(controller);
KernelServices services = this.buildKernelServices(subsystemXmlResource, controller, version, dependencies);
checkSubsystemModelTransformation(services, version, null, false);
}
use of org.jboss.as.subsystem.test.KernelServices in project wildfly by wildfly.
the class MessagingActiveMQSubsystem_1_1_TestCase method testTransformers.
private void testTransformers(ModelTestControllerVersion controllerVersion, ModelVersion messagingVersion) throws Exception {
//Boot up empty controllers with the resources needed for the ops coming from the xml to work
KernelServicesBuilder builder = createKernelServicesBuilder(createAdditionalInitialization()).setSubsystemXmlResource("subsystem_1_1_transform.xml");
builder.createLegacyKernelServicesBuilder(createAdditionalInitialization(), controllerVersion, messagingVersion).addMavenResourceURL(getMessagingActiveMQGAV(controllerVersion)).addMavenResourceURL(getActiveMQDependencies(controllerVersion)).configureReverseControllerCheck(createAdditionalInitialization(), null).dontPersistXml();
KernelServices mainServices = builder.build();
assertTrue(mainServices.isSuccessfulBoot());
assertTrue(mainServices.getLegacyServices(messagingVersion).isSuccessfulBoot());
checkSubsystemModelTransformation(mainServices, messagingVersion);
}
use of org.jboss.as.subsystem.test.KernelServices in project wildfly by wildfly.
the class MessagingActiveMQSubsystem_1_1_TestCase method testRejectingTransformers.
private void testRejectingTransformers(ModelTestControllerVersion controllerVersion, ModelVersion messagingVersion) throws Exception {
//Boot up empty controllers with the resources needed for the ops coming from the xml to work
KernelServicesBuilder builder = createKernelServicesBuilder(createAdditionalInitialization());
builder.createLegacyKernelServicesBuilder(createAdditionalInitialization(), controllerVersion, messagingVersion).addMavenResourceURL(getMessagingActiveMQGAV(controllerVersion)).addMavenResourceURL(getActiveMQDependencies(controllerVersion)).dontPersistXml();
KernelServices mainServices = builder.build();
assertTrue(mainServices.isSuccessfulBoot());
assertTrue(mainServices.getLegacyServices(messagingVersion).isSuccessfulBoot());
List<ModelNode> ops = builder.parseXmlResource("subsystem_1_1_reject_transform.xml");
System.out.println("ops = " + ops);
PathAddress subsystemAddress = PathAddress.pathAddress(SUBSYSTEM_PATH);
ModelTestUtils.checkFailedTransformedBootOperations(mainServices, messagingVersion, ops, new FailedOperationTransformationConfig().addFailedAttribute(subsystemAddress, new FailedOperationTransformationConfig.NewAttributesConfig(MessagingSubsystemRootResourceDefinition.GLOBAL_CLIENT_THREAD_POOL_MAX_SIZE, MessagingSubsystemRootResourceDefinition.GLOBAL_CLIENT_SCHEDULED_THREAD_POOL_MAX_SIZE)).addFailedAttribute(subsystemAddress.append(SERVER_PATH), new FailedOperationTransformationConfig.NewAttributesConfig(ServerDefinition.ELYTRON_DOMAIN, ServerDefinition.JOURNAL_DATASOURCE, ServerDefinition.JOURNAL_MESSAGES_TABLE, ServerDefinition.JOURNAL_BINDINGS_TABLE, ServerDefinition.JOURNAL_LARGE_MESSAGES_TABLE, ServerDefinition.JOURNAL_PAGE_STORE_TABLE, ServerDefinition.JOURNAL_DATABASE)).addFailedAttribute(subsystemAddress.append(SERVER_PATH, REPLICATION_MASTER_PATH), new ChangeToTrueConfig(HAAttributes.CHECK_FOR_LIVE_SERVER.getName())).addFailedAttribute(subsystemAddress.append(SERVER_PATH, REPLICATION_COLOCATED_PATH, MessagingExtension.CONFIGURATION_MASTER_PATH), new ChangeToTrueConfig(HAAttributes.CHECK_FOR_LIVE_SERVER.getName())).addFailedAttribute(subsystemAddress.append(SERVER_PATH, PathElement.pathElement(CommonAttributes.HTTP_CONNECTOR)), new FailedOperationTransformationConfig.NewAttributesConfig(HTTPConnectorDefinition.SERVER_NAME)).addFailedAttribute(subsystemAddress.append(SERVER_PATH, BRIDGE_PATH), new FailedOperationTransformationConfig.NewAttributesConfig(BridgeDefinition.PRODUCER_WINDOW_SIZE)).addFailedAttribute(subsystemAddress.append(SERVER_PATH, CLUSTER_CONNECTION_PATH), new FailedOperationTransformationConfig.NewAttributesConfig(ClusterConnectionDefinition.PRODUCER_WINDOW_SIZE)).addFailedAttribute(subsystemAddress.append(SERVER_PATH, POOLED_CONNECTION_FACTORY_PATH), new FailedOperationTransformationConfig.NewAttributesConfig(ConnectionFactoryAttributes.Pooled.REBALANCE_CONNECTIONS, ConnectionFactoryAttributes.Pooled.STATISTICS_ENABLED)));
}
use of org.jboss.as.subsystem.test.KernelServices in project wildfly by wildfly.
the class SubsystemDescriptionsUnitTestCase method testSubsystemDescriptions.
@Test
public void testSubsystemDescriptions() throws Exception {
List<ModelNode> empty = Collections.emptyList();
KernelServices servicesA = createKernelServicesBuilder(null).setBootOperations(empty).build();
final ModelNode operation = createReadResourceDescriptionOperation();
final ModelNode result = servicesA.executeOperation(operation);
Assert.assertEquals(ModelDescriptionConstants.SUCCESS, result.get(ModelDescriptionConstants.OUTCOME).asString());
servicesA.shutdown();
}
Aggregations