use of org.jboss.as.subsystem.test.KernelServicesBuilder in project wildfly by wildfly.
the class EeSubsystemTestCase method testTransformers1_1_x_reject.
private void testTransformers1_1_x_reject(ModelTestControllerVersion controllerVersion) throws Exception {
String subsystemXml = readResource("subsystem.xml");
//Use the non-runtime version of the extension which will happen on the HC
KernelServicesBuilder builder = createKernelServicesBuilder(AdditionalInitialization.MANAGEMENT);
List<ModelNode> xmlOps = builder.parseXml(subsystemXml);
ModelVersion modelVersion = ModelVersion.create(1, 1);
// Add legacy subsystems
builder.createLegacyKernelServicesBuilder(null, controllerVersion, modelVersion).addMavenResourceURL("org.jboss.as:jboss-as-ee:" + controllerVersion.getMavenGavVersion());
KernelServices mainServices = builder.build();
Assert.assertTrue(mainServices.isSuccessfulBoot());
FailedOperationTransformationConfig config = new FailedOperationTransformationConfig().addFailedAttribute(PathAddress.pathAddress(EeExtension.PATH_SUBSYSTEM, PathElement.pathElement(EESubsystemModel.CONTEXT_SERVICE)), REJECTED_RESOURCE).addFailedAttribute(PathAddress.pathAddress(EeExtension.PATH_SUBSYSTEM, PathElement.pathElement(EESubsystemModel.MANAGED_THREAD_FACTORY)), REJECTED_RESOURCE).addFailedAttribute(PathAddress.pathAddress(EeExtension.PATH_SUBSYSTEM, PathElement.pathElement(EESubsystemModel.MANAGED_EXECUTOR_SERVICE)), REJECTED_RESOURCE).addFailedAttribute(PathAddress.pathAddress(EeExtension.PATH_SUBSYSTEM, PathElement.pathElement(EESubsystemModel.MANAGED_SCHEDULED_EXECUTOR_SERVICE)), REJECTED_RESOURCE);
ModelTestUtils.checkFailedTransformedBootOperations(mainServices, modelVersion, xmlOps, config);
}
use of org.jboss.as.subsystem.test.KernelServicesBuilder in project wildfly by wildfly.
the class WebservicesSubsystemParserTestCase method testRejections_2_0_0.
private void testRejections_2_0_0(ModelTestControllerVersion controllerVersion) throws Exception {
// create builder for current subsystem version
KernelServicesBuilder builder = createKernelServicesBuilder(createAdditionalInitialization());
// create builder for legacy subsystem version
ModelVersion version_2_0_0 = ModelVersion.create(2, 0, 0);
builder.createLegacyKernelServicesBuilder(null, controllerVersion, version_2_0_0).addMavenResourceURL("org.jboss.eap:wildfly-webservices-server-integration:" + controllerVersion.getMavenGavVersion()).configureReverseControllerCheck(AdditionalInitialization.MANAGEMENT, null).dontPersistXml();
KernelServices mainServices = builder.build();
KernelServices legacyServices = mainServices.getLegacyServices(version_2_0_0);
Assert.assertNotNull(legacyServices);
Assert.assertTrue("main services did not boot", mainServices.isSuccessfulBoot());
Assert.assertTrue(legacyServices.isSuccessfulBoot());
List<ModelNode> xmlOps = builder.parseXmlResource("ws-subsystem20.xml");
ModelTestUtils.checkFailedTransformedBootOperations(mainServices, version_2_0_0, xmlOps, getFailedTransformationConfig());
}
use of org.jboss.as.subsystem.test.KernelServicesBuilder in project wildfly by wildfly.
the class WebservicesSubsystemRuntimeTestCase method testSubsystem.
@Test
public void testSubsystem() throws Exception {
KernelServicesBuilder builder = createKernelServicesBuilder(createAdditionalInitialization()).setSubsystemXml(getSubsystemXml());
KernelServices mainServices = builder.build();
if (!mainServices.isSuccessfulBoot()) {
Assert.fail(mainServices.getBootError().toString());
}
//WSDL soap:address rewrite engine options test
ServerConfig serverConfig = getMSCService(mainServices.getContainer(), WSServices.CONFIG_SERVICE, ServerConfig.class);
Assert.assertTrue(serverConfig.isModifySOAPAddress());
Assert.assertEquals("localhost", serverConfig.getWebServiceHost());
Assert.assertEquals(9895, serverConfig.getWebServicePort());
Assert.assertEquals(9944, serverConfig.getWebServiceSecurePort());
Assert.assertEquals("https", serverConfig.getWebServiceUriScheme());
//Client & Endpoint predefined configuration tests
//HACK: we need to manually reload the client/endpoint configs as the ServerConfigService is actually not starting in this test;
//the reason is that it requires services which are not installed here and even if those were available it would fail to start
//because we're not running in a modular environment and hence it won't be able to detect the proper ws stack implementation.
//Even if we made the subsystem work with a flat classloader (which would not make sense except for the tests here), we'd have
//to deal a hell of ws specific maven dependencies here... so really not worth the effort.
serverConfig.reloadClientConfigs();
ClientConfig clCfg = serverConfig.getClientConfig("My-Client-Config");
Assert.assertNotNull(clCfg);
Assert.assertEquals(1, clCfg.getProperties().size());
Assert.assertEquals("bar3", clCfg.getProperties().get("foo3"));
Assert.assertEquals(2, clCfg.getPreHandlerChains().size());
Map<String, UnifiedHandlerChainMetaData> map = new HashMap<String, UnifiedHandlerChainMetaData>();
for (UnifiedHandlerChainMetaData uhc : clCfg.getPreHandlerChains()) {
map.put(uhc.getId(), uhc);
}
Assert.assertTrue(map.get("my-handlers").getHandlers().isEmpty());
Assert.assertEquals("##SOAP11_HTTP ##SOAP11_HTTP_MTOM ##SOAP12_HTTP ##SOAP12_HTTP_MTOM", map.get("my-handlers").getProtocolBindings());
Assert.assertEquals(1, map.get("my-handlers2").getHandlers().size());
Assert.assertEquals("MyHandler", map.get("my-handlers2").getHandlers().get(0).getHandlerName());
Assert.assertEquals("org.jboss.ws.common.invocation.MyHandler", map.get("my-handlers2").getHandlers().get(0).getHandlerClass());
Assert.assertEquals("##SOAP11_HTTP ##SOAP11_HTTP_MTOM ##SOAP12_HTTP ##SOAP12_HTTP_MTOM", map.get("my-handlers").getProtocolBindings());
Assert.assertEquals(1, clCfg.getPostHandlerChains().size());
Assert.assertEquals("my-handlers2", clCfg.getPostHandlerChains().get(0).getId());
Assert.assertEquals(1, clCfg.getPostHandlerChains().get(0).getHandlers().size());
Assert.assertEquals("MyHandler2", clCfg.getPostHandlerChains().get(0).getHandlers().get(0).getHandlerName());
Assert.assertEquals("org.jboss.ws.common.invocation.MyHandler2", clCfg.getPostHandlerChains().get(0).getHandlers().get(0).getHandlerClass());
Assert.assertEquals("##SOAP11_HTTP ##SOAP11_HTTP_MTOM ##SOAP12_HTTP ##SOAP12_HTTP_MTOM", clCfg.getPostHandlerChains().get(0).getProtocolBindings());
serverConfig.reloadEndpointConfigs();
EndpointConfig epCfg = serverConfig.getEndpointConfig("Standard-Endpoint-Config");
Assert.assertNotNull(epCfg);
Assert.assertTrue(epCfg.getProperties().isEmpty());
Assert.assertTrue(epCfg.getPreHandlerChains().isEmpty());
Assert.assertTrue(epCfg.getPostHandlerChains().isEmpty());
epCfg = serverConfig.getEndpointConfig("Recording-Endpoint-Config");
Assert.assertNotNull(epCfg);
Assert.assertEquals(2, epCfg.getProperties().size());
Assert.assertEquals("bar", epCfg.getProperties().get("foo"));
Assert.assertEquals("bar2", epCfg.getProperties().get("foo2"));
Assert.assertEquals(1, epCfg.getPreHandlerChains().size());
Assert.assertEquals("recording-handlers", epCfg.getPreHandlerChains().get(0).getId());
Assert.assertEquals(2, epCfg.getPreHandlerChains().get(0).getHandlers().size());
Assert.assertEquals("RecordingHandler", epCfg.getPreHandlerChains().get(0).getHandlers().get(0).getHandlerName());
Assert.assertEquals("org.jboss.ws.common.invocation.RecordingServerHandler", epCfg.getPreHandlerChains().get(0).getHandlers().get(0).getHandlerClass());
Assert.assertEquals("AnotherRecordingHandler", epCfg.getPreHandlerChains().get(0).getHandlers().get(1).getHandlerName());
Assert.assertEquals("org.jboss.ws.common.invocation.RecordingServerHandler", epCfg.getPreHandlerChains().get(0).getHandlers().get(1).getHandlerClass());
Assert.assertEquals("##SOAP11_HTTP ##SOAP11_HTTP_MTOM ##SOAP12_HTTP ##SOAP12_HTTP_MTOM", epCfg.getPreHandlerChains().get(0).getProtocolBindings());
Assert.assertEquals(1, epCfg.getPostHandlerChains().size());
Assert.assertEquals("recording-handlers2", epCfg.getPostHandlerChains().get(0).getId());
Assert.assertEquals(2, epCfg.getPostHandlerChains().get(0).getHandlers().size());
Assert.assertEquals("RecordingHandler2", epCfg.getPostHandlerChains().get(0).getHandlers().get(0).getHandlerName());
Assert.assertEquals("org.jboss.ws.common.invocation.RecordingServerHandler", epCfg.getPostHandlerChains().get(0).getHandlers().get(0).getHandlerClass());
Assert.assertEquals("AnotherRecordingHandler2", epCfg.getPostHandlerChains().get(0).getHandlers().get(1).getHandlerName());
Assert.assertEquals("org.jboss.ws.common.invocation.RecordingServerHandler", epCfg.getPostHandlerChains().get(0).getHandlers().get(1).getHandlerClass());
Assert.assertEquals("##SOAP11_HTTP ##SOAP11_HTTP_MTOM ##SOAP12_HTTP ##SOAP12_HTTP_MTOM", epCfg.getPostHandlerChains().get(0).getProtocolBindings());
}
use of org.jboss.as.subsystem.test.KernelServicesBuilder in project wildfly by wildfly.
the class Ejb3TransformersTestCase method testRejections.
private void testRejections(ModelVersion model, ModelTestControllerVersion controller, String... mavenResourceURLs) throws Exception {
// create builder for current subsystem version
KernelServicesBuilder builder = createKernelServicesBuilder(this.createAdditionalInitialization().withCapabilities(buildDynamicCapabilityName("org.wildfly.security.security-domain", "ApplicationDomain")));
// initialize the legacy services and add required jars
builder.createLegacyKernelServicesBuilder(null, controller, model).addMavenResourceURL(mavenResourceURLs).dontPersistXml();
KernelServices services = builder.build();
Assert.assertTrue(services.isSuccessfulBoot());
KernelServices legacyServices = services.getLegacyServices(model);
Assert.assertNotNull(legacyServices);
Assert.assertTrue(legacyServices.isSuccessfulBoot());
List<ModelNode> operations = builder.parseXmlResource("subsystem-ejb3-transform-reject.xml");
ModelTestUtils.checkFailedTransformedBootOperations(services, model, operations, createFailedOperationTransformationConfig(services, model));
}
use of org.jboss.as.subsystem.test.KernelServicesBuilder in project wildfly by wildfly.
the class FederationSubsystem_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(FederationExtension.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());
List<ModelNode> ops = builder.parseXmlResource("federation-subsystem-2.0.xml");
ModelTestUtils.checkFailedTransformedBootOperations(mainServices, oldVersion, ops, new FailedOperationTransformationConfig().addFailedAttribute(PathAddress.pathAddress(PathElement.pathElement(ModelDescriptionConstants.SUBSYSTEM, FederationExtension.SUBSYSTEM_NAME), PathElement.pathElement(ModelElement.FEDERATION.getName()), KeyStoreProviderResourceDefinition.INSTANCE.getPathElement(), KeyResourceDefinition.INSTANCE.getPathElement()), FailedOperationTransformationConfig.REJECTED_RESOURCE));
}
Aggregations