Search in sources :

Example 1 with UnifiedHandlerChainMetaData

use of org.jboss.wsf.spi.metadata.j2ee.serviceref.UnifiedHandlerChainMetaData in project wildfly by wildfly.

the class WSHandlerChainAnnotationProcessor method getHandlers.

private static Set<String> getHandlers(final InputStream is) throws IOException {
    final Set<String> retVal = new HashSet<String>();
    final UnifiedHandlerChainsMetaData handlerChainsUMDM = UnifiedHandlerChainsMetaDataParser.parse(is);
    if (handlerChainsUMDM != null) {
        for (final UnifiedHandlerChainMetaData handlerChainUMDM : handlerChainsUMDM.getHandlerChains()) {
            for (final UnifiedHandlerMetaData handlerUMDM : handlerChainUMDM.getHandlers()) {
                retVal.add(handlerUMDM.getHandlerClass());
            }
        }
    }
    return retVal;
}
Also used : UnifiedHandlerChainMetaData(org.jboss.wsf.spi.metadata.j2ee.serviceref.UnifiedHandlerChainMetaData) UnifiedHandlerMetaData(org.jboss.wsf.spi.metadata.j2ee.serviceref.UnifiedHandlerMetaData) UnifiedHandlerChainsMetaData(org.jboss.wsf.spi.metadata.j2ee.serviceref.UnifiedHandlerChainsMetaData) HashSet(java.util.HashSet)

Example 2 with UnifiedHandlerChainMetaData

use of org.jboss.wsf.spi.metadata.j2ee.serviceref.UnifiedHandlerChainMetaData in project wildfly by wildfly.

the class HandlerChainService method start.

@Override
public void start(final StartContext context) throws StartException {
    Comparator<UnifiedHandlerMetaData> c = new Comparator<UnifiedHandlerMetaData>() {

        @Override
        public int compare(UnifiedHandlerMetaData o1, UnifiedHandlerMetaData o2) {
            return o1.getId().compareTo(o2.getId());
        }
    };
    synchronized (handlers) {
        Collections.sort(handlers, c);
    }
    handlerChain = new UnifiedHandlerChainMetaData(null, null, protocolBindings, handlers, false, handlerChainId);
}
Also used : UnifiedHandlerMetaData(org.jboss.wsf.spi.metadata.j2ee.serviceref.UnifiedHandlerMetaData) UnifiedHandlerChainMetaData(org.jboss.wsf.spi.metadata.j2ee.serviceref.UnifiedHandlerChainMetaData) Comparator(java.util.Comparator)

Example 3 with UnifiedHandlerChainMetaData

use of org.jboss.wsf.spi.metadata.j2ee.serviceref.UnifiedHandlerChainMetaData in project wildfly by wildfly.

the class XTSHandlersManager method getHandlerChain.

public UnifiedHandlerChainMetaData getHandlerChain() {
    List<UnifiedHandlerMetaData> handlers = new ArrayList<UnifiedHandlerMetaData>(2);
    if (enabled) {
        handlers.add(new UnifiedHandlerMetaData(BRIDGE_ENABLED_HANDLER_CLASS, BRIDGE_HANDLER_NAME, null, null, null, null));
        handlers.add(new UnifiedHandlerMetaData(WSAT_ENABLED_HANDLER_CLASS, WSAT_HANDLER_NAME, null, null, null, null));
    } else {
        handlers.add(new UnifiedHandlerMetaData(BRIDGE_DISABLED_HANDLER_CLASS, BRIDGE_HANDLER_NAME, null, null, null, null));
        handlers.add(new UnifiedHandlerMetaData(WSAT_DISABLED_HANDLER_CLASS, WSAT_HANDLER_NAME, null, null, null, null));
    }
    return new UnifiedHandlerChainMetaData(null, null, HANDLER_PROTOCOL_BINDINGS, handlers, false, HANDLER_CHAIN_ID);
}
Also used : UnifiedHandlerMetaData(org.jboss.wsf.spi.metadata.j2ee.serviceref.UnifiedHandlerMetaData) UnifiedHandlerChainMetaData(org.jboss.wsf.spi.metadata.j2ee.serviceref.UnifiedHandlerChainMetaData) ArrayList(java.util.ArrayList)

Example 4 with UnifiedHandlerChainMetaData

use of org.jboss.wsf.spi.metadata.j2ee.serviceref.UnifiedHandlerChainMetaData 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 5 with UnifiedHandlerChainMetaData

use of org.jboss.wsf.spi.metadata.j2ee.serviceref.UnifiedHandlerChainMetaData in project wildfly by wildfly.

the class WSRefUtils method getUnifiedHandlerChainsMetaData.

private static UnifiedHandlerChainsMetaData getUnifiedHandlerChainsMetaData(final ServiceReferenceHandlerChainsMetaData handlerChainsMD) {
    List<UnifiedHandlerChainMetaData> uhcmds = new LinkedList<UnifiedHandlerChainMetaData>();
    for (final ServiceReferenceHandlerChainMetaData handlerChainMD : handlerChainsMD.getHandlers()) {
        List<UnifiedHandlerMetaData> uhmds = new LinkedList<UnifiedHandlerMetaData>();
        for (final ServiceReferenceHandlerMetaData handlerMD : handlerChainMD.getHandler()) {
            final UnifiedHandlerMetaData handlerUMDM = getUnifiedHandlerMetaData(handlerMD);
            uhmds.add(handlerUMDM);
        }
        uhcmds.add(new UnifiedHandlerChainMetaData(handlerChainMD.getServiceNamePattern(), handlerChainMD.getPortNamePattern(), handlerChainMD.getProtocolBindings(), uhmds, false, null));
    }
    return new UnifiedHandlerChainsMetaData(uhcmds);
}
Also used : ServiceReferenceHandlerMetaData(org.jboss.metadata.javaee.spec.ServiceReferenceHandlerMetaData) UnifiedHandlerChainMetaData(org.jboss.wsf.spi.metadata.j2ee.serviceref.UnifiedHandlerChainMetaData) ServiceReferenceHandlerChainMetaData(org.jboss.metadata.javaee.spec.ServiceReferenceHandlerChainMetaData) UnifiedHandlerMetaData(org.jboss.wsf.spi.metadata.j2ee.serviceref.UnifiedHandlerMetaData) UnifiedHandlerChainsMetaData(org.jboss.wsf.spi.metadata.j2ee.serviceref.UnifiedHandlerChainsMetaData) LinkedList(java.util.LinkedList)

Aggregations

UnifiedHandlerChainMetaData (org.jboss.wsf.spi.metadata.j2ee.serviceref.UnifiedHandlerChainMetaData)5 UnifiedHandlerMetaData (org.jboss.wsf.spi.metadata.j2ee.serviceref.UnifiedHandlerMetaData)4 UnifiedHandlerChainsMetaData (org.jboss.wsf.spi.metadata.j2ee.serviceref.UnifiedHandlerChainsMetaData)2 ArrayList (java.util.ArrayList)1 Comparator (java.util.Comparator)1 HashMap (java.util.HashMap)1 HashSet (java.util.HashSet)1 LinkedList (java.util.LinkedList)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 ServiceReferenceHandlerChainMetaData (org.jboss.metadata.javaee.spec.ServiceReferenceHandlerChainMetaData)1 ServiceReferenceHandlerMetaData (org.jboss.metadata.javaee.spec.ServiceReferenceHandlerMetaData)1 ServerConfig (org.jboss.wsf.spi.management.ServerConfig)1 ClientConfig (org.jboss.wsf.spi.metadata.config.ClientConfig)1 EndpointConfig (org.jboss.wsf.spi.metadata.config.EndpointConfig)1 Test (org.junit.Test)1