Search in sources :

Example 11 with ServerConfig

use of org.jboss.wsf.spi.management.ServerConfig in project jbossws-cxf by jbossws.

the class TestUtils method registerClientConfigAndReload.

public static void registerClientConfigAndReload(ClientConfig config) {
    ServerConfig sc = getServerConfig();
    sc.registerClientConfig(config);
    sc.reloadClientConfigs();
}
Also used : ServerConfig(org.jboss.wsf.spi.management.ServerConfig)

Example 12 with ServerConfig

use of org.jboss.wsf.spi.management.ServerConfig in project wildfly by wildfly.

the class ClientConfigAdd method performRuntime.

@Override
protected void performRuntime(final OperationContext context, final ModelNode operation, final ModelNode model) throws OperationFailedException {
    //modify the runtime if we're booting, otherwise set reload required and leave the runtime unchanged
    if (context.isBooting()) {
        final PathAddress address = PathAddress.pathAddress(operation.require(OP_ADDR));
        final String name = address.getLastElement().getValue();
        //get the server config object from the ServerConfigService (service installed and not started yet, but the object is fine for our needs here)
        final ServerConfig serverConfig = ASHelper.getMSCService(WSServices.CONFIG_SERVICE, ServerConfig.class, context);
        if (serverConfig == null) {
            throw WSLogger.ROOT_LOGGER.serviceNotAvailable(WSServices.CONFIG_SERVICE.getCanonicalName());
        }
        final ServiceName serviceName = getClientConfigServiceName(name);
        final ConfigService clientConfigService = new ConfigService(serverConfig, name, true);
        final ServiceTarget target = context.getServiceTarget();
        final ServiceBuilder<?> clientServiceBuilder = target.addService(serviceName, clientConfigService);
        for (ServiceName sn : PackageUtils.getServiceNameDependencies(context, serviceName, address, Constants.PROPERTY)) {
            //get a new injector instance each time
            clientServiceBuilder.addDependency(sn, PropertyService.class, clientConfigService.getPropertiesInjector());
        }
        for (ServiceName sn : PackageUtils.getServiceNameDependencies(context, serviceName, address, Constants.PRE_HANDLER_CHAIN)) {
            //get a new injector instance each time
            clientServiceBuilder.addDependency(sn, UnifiedHandlerChainMetaData.class, clientConfigService.getPreHandlerChainsInjector());
        }
        for (ServiceName sn : PackageUtils.getServiceNameDependencies(context, serviceName, address, Constants.POST_HANDLER_CHAIN)) {
            //get a new injector instance each time
            clientServiceBuilder.addDependency(sn, UnifiedHandlerChainMetaData.class, clientConfigService.getPostHandlerChainsInjector());
        }
        clientServiceBuilder.setInitialMode(ServiceController.Mode.ACTIVE).install();
    } else {
        context.reloadRequired();
    }
}
Also used : ServerConfig(org.jboss.wsf.spi.management.ServerConfig) ConfigService(org.jboss.as.webservices.service.ConfigService) PackageUtils.getClientConfigServiceName(org.jboss.as.webservices.dmr.PackageUtils.getClientConfigServiceName) ServiceName(org.jboss.msc.service.ServiceName) PathAddress(org.jboss.as.controller.PathAddress) ServiceTarget(org.jboss.msc.service.ServiceTarget)

Example 13 with ServerConfig

use of org.jboss.wsf.spi.management.ServerConfig 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());
}
Also used : ServerConfig(org.jboss.wsf.spi.management.ServerConfig) HashMap(java.util.HashMap) UnifiedHandlerChainMetaData(org.jboss.wsf.spi.metadata.j2ee.serviceref.UnifiedHandlerChainMetaData) KernelServices(org.jboss.as.subsystem.test.KernelServices) ClientConfig(org.jboss.wsf.spi.metadata.config.ClientConfig) KernelServicesBuilder(org.jboss.as.subsystem.test.KernelServicesBuilder) EndpointConfig(org.jboss.wsf.spi.metadata.config.EndpointConfig) AbstractSubsystemBaseTest(org.jboss.as.subsystem.test.AbstractSubsystemBaseTest) Test(org.junit.Test)

Example 14 with ServerConfig

use of org.jboss.wsf.spi.management.ServerConfig in project jbossws-cxf by jbossws.

the class Helper method registerClientConfigAndReload.

protected static void registerClientConfigAndReload(ClientConfig config) {
    ServerConfig sc = getServerConfig();
    sc.registerClientConfig(config);
    sc.reloadClientConfigs();
}
Also used : ServerConfig(org.jboss.wsf.spi.management.ServerConfig)

Example 15 with ServerConfig

use of org.jboss.wsf.spi.management.ServerConfig in project jbossws-cxf by jbossws.

the class Helper method registerEndpointConfigAndReload.

protected static void registerEndpointConfigAndReload(EndpointConfig config) {
    ServerConfig sc = getServerConfig();
    sc.registerEndpointConfig(config);
    sc.reloadEndpointConfigs();
}
Also used : ServerConfig(org.jboss.wsf.spi.management.ServerConfig)

Aggregations

ServerConfig (org.jboss.wsf.spi.management.ServerConfig)17 ClientConfig (org.jboss.wsf.spi.metadata.config.ClientConfig)5 ServiceName (org.jboss.msc.service.ServiceName)3 EndpointConfig (org.jboss.wsf.spi.metadata.config.EndpointConfig)3 UnifiedHandlerChainMetaData (org.jboss.wsf.spi.metadata.j2ee.serviceref.UnifiedHandlerChainMetaData)3 PathAddress (org.jboss.as.controller.PathAddress)2 ConfigService (org.jboss.as.webservices.service.ConfigService)2 ServiceTarget (org.jboss.msc.service.ServiceTarget)2 HashMap (java.util.HashMap)1 MBeanServer (javax.management.MBeanServer)1 AbstractSubsystemBaseTest (org.jboss.as.subsystem.test.AbstractSubsystemBaseTest)1 KernelServices (org.jboss.as.subsystem.test.KernelServices)1 KernelServicesBuilder (org.jboss.as.subsystem.test.KernelServicesBuilder)1 PackageUtils.getClientConfigServiceName (org.jboss.as.webservices.dmr.PackageUtils.getClientConfigServiceName)1 PackageUtils.getEndpointConfigServiceName (org.jboss.as.webservices.dmr.PackageUtils.getEndpointConfigServiceName)1 XTSService (org.jboss.jbossts.XTSService)1 WSCEnvironmentBean (org.jboss.jbossts.xts.environment.WSCEnvironmentBean)1 StartException (org.jboss.msc.service.StartException)1 SPIProvider (org.jboss.wsf.spi.SPIProvider)1 ServerConfigFactory (org.jboss.wsf.spi.management.ServerConfigFactory)1