Search in sources :

Example 11 with Server

use of org.apache.cxf.endpoint.Server in project tesb-rt-se by Talend.

the class SingleBusLocatorRegistrarTest method startListenForServer.

@Test
public void startListenForServer() throws Exception {
    CXFEndpointProvider endpoint = new CXFEndpointProvider(SERVICE_QNAME_1, ENDPOINT_1, null);
    Bus bus = createMock(Bus.class);
    Capture<ServerLifeCycleListener> slclCapture = addServerLifeCycleManager(bus);
    List<Server> servers = Collections.emptyList();
    addRegisteredServers(bus, servers);
    sl.addPostConnectAction((PostConnectAction) anyObject());
    sl.register(endpoint);
    replayAll();
    SingleBusLocatorRegistrar locatorRegistrar = new SingleBusLocatorRegistrar(bus);
    locatorRegistrar.setServiceLocator(sl);
    locatorRegistrar.startListenForServers();
    ServerLifeCycleListener listener = slclCapture.getValue();
    listener.startServer(SERVER_1);
    verifyAll();
}
Also used : Bus(org.apache.cxf.Bus) Server(org.apache.cxf.endpoint.Server) ServerLifeCycleListener(org.apache.cxf.endpoint.ServerLifeCycleListener) Test(org.junit.Test)

Example 12 with Server

use of org.apache.cxf.endpoint.Server in project tesb-rt-se by Talend.

the class SingleBusLocatorRegistrarTest method ignoreStartedServersIfNotStartListenForServerCalled.

@Test
public void ignoreStartedServersIfNotStartListenForServerCalled() throws Exception {
    Bus bus = createMock(Bus.class);
    Capture<ServerLifeCycleListener> slclCapture = addServerLifeCycleManager(bus);
    List<Server> servers = Collections.emptyList();
    addRegisteredServers(bus, servers);
    sl.addPostConnectAction((PostConnectAction) anyObject());
    replayAll();
    SingleBusLocatorRegistrar locatorRegistrar = new SingleBusLocatorRegistrar(bus);
    locatorRegistrar.setServiceLocator(sl);
    ServerLifeCycleListener listener = slclCapture.getValue();
    listener.startServer(SERVER_1);
    verifyAll();
}
Also used : Bus(org.apache.cxf.Bus) Server(org.apache.cxf.endpoint.Server) ServerLifeCycleListener(org.apache.cxf.endpoint.ServerLifeCycleListener) Test(org.junit.Test)

Example 13 with Server

use of org.apache.cxf.endpoint.Server in project tesb-rt-se by Talend.

the class SingleBusLocatorRegistrar method registerAvailableServers.

private void registerAvailableServers() {
    ServerRegistry serverRegistry = bus.getExtension(ServerRegistry.class);
    List<Server> servers = serverRegistry.getServers();
    for (Server server : servers) {
        registerServer(server);
    }
}
Also used : Server(org.apache.cxf.endpoint.Server) ServerRegistry(org.apache.cxf.endpoint.ServerRegistry)

Example 14 with Server

use of org.apache.cxf.endpoint.Server in project tesb-rt-se by Talend.

the class AuxiliaryStorageRestServiceSecurityProvider method init.

public void init() {
    if (Authentication.NO == auxiliaryStorageAuthentication) {
        return;
    }
    // TODO: !!! find more correct way to enable/switch(?) security on provider endpoint
    Bus serverBus = server.getBus();
    ServerRegistry registry = serverBus.getExtension(ServerRegistry.class);
    List<Server> servers = registry.getServers();
    for (Server sr : servers) {
        EndpointInfo ei = sr.getEndpoint().getEndpointInfo();
        if (null != ei && ei.getAddress().endsWith(server.getAddress())) {
            registry.unregister(sr);
            sr.destroy();
        }
    }
    @SuppressWarnings("unchecked") List<Object> providers = (List<Object>) server.getProviders();
    if (Authentication.BASIC == auxiliaryStorageAuthentication) {
        JAASAuthenticationFilter jaasAuthFilter = new JAASAuthenticationFilter();
        jaasAuthFilter.setContextName("karaf");
        providers.add(jaasAuthFilter);
        server.setProviders(providers);
    }
    if (Authentication.SAML == auxiliaryStorageAuthentication) {
        Map<String, Object> endpointProps = new HashMap<String, Object>();
        endpointProps.put(SecurityConstants.SIGNATURE_PROPERTIES, signatureProperties);
        endpointProps.put(SecurityConstants.SIGNATURE_USERNAME, signatureUsername);
        endpointProps.put(ENDPOINT_SIGNATURE_PASSWORD, signaturePassword);
        endpointProps.put(SecurityConstants.CALLBACK_HANDLER, new WSPasswordCallbackHandler(signatureUsername, signaturePassword));
        Map<String, Object> properties = server.getProperties();
        if (null == properties) {
            properties = new HashMap<String, Object>();
        }
        properties.putAll(endpointProps);
        server.setProperties(properties);
        SamlHeaderInHandler samlHandler = new SamlHeaderInHandler();
        providers.add(samlHandler);
        server.setProviders(providers);
    }
    server.create();
}
Also used : Bus(org.apache.cxf.Bus) Server(org.apache.cxf.endpoint.Server) HashMap(java.util.HashMap) ServerRegistry(org.apache.cxf.endpoint.ServerRegistry) EndpointInfo(org.apache.cxf.service.model.EndpointInfo) SamlHeaderInHandler(org.apache.cxf.rs.security.saml.SamlHeaderInHandler) JAASAuthenticationFilter(org.apache.cxf.jaxrs.security.JAASAuthenticationFilter) List(java.util.List)

Example 15 with Server

use of org.apache.cxf.endpoint.Server in project tesb-rt-se by Talend.

the class DurableSubscriptionFeatureTest method testDurableSubscriptionFeature2.

@Test
public void testDurableSubscriptionFeature2() throws Exception {
    DurableSubscriptionFeature f = new DurableSubscriptionFeature();
    f.setDurableSubscriptionName("durableSubscriptionName");
    f.setDurableSubscriptionClientId("durableSubscriptionClientId");
    JMSConfiguration jmsConfig = new JMSConfiguration();
    JMSDestination destination = createMock(JMSDestination.class);
    expect(destination.getJmsConfig()).andReturn(jmsConfig).anyTimes();
    replay(destination);
    Server server = createMock(Server.class);
    expect(server.getDestination()).andReturn(destination).anyTimes();
    replay(server);
    Bus bus = createNiceMock(Bus.class);
    f.initialize(server, bus);
    assertSame("durableSubscriptionName", jmsConfig.getDurableSubscriptionName());
    assertSame("durableSubscriptionClientId", jmsConfig.getDurableSubscriptionClientId());
}
Also used : Bus(org.apache.cxf.Bus) JMSConfiguration(org.apache.cxf.transport.jms.JMSConfiguration) JMSDestination(org.apache.cxf.transport.jms.JMSDestination) Server(org.apache.cxf.endpoint.Server) Test(org.junit.Test)

Aggregations

Server (org.apache.cxf.endpoint.Server)199 Test (org.junit.Test)119 ReferenceParametersType (org.apache.cxf.ws.addressing.ReferenceParametersType)54 ResourceManager (org.apache.cxf.ws.transfer.manager.ResourceManager)52 MemoryResourceManager (org.apache.cxf.ws.transfer.manager.MemoryResourceManager)50 Resource (org.apache.cxf.ws.transfer.resource.Resource)50 ExpressionType (org.apache.cxf.ws.transfer.dialect.fragment.ExpressionType)47 ValueType (org.apache.cxf.ws.transfer.dialect.fragment.ValueType)44 Element (org.w3c.dom.Element)44 JaxWsServerFactoryBean (org.apache.cxf.jaxws.JaxWsServerFactoryBean)33 Put (org.apache.cxf.ws.transfer.Put)33 Fragment (org.apache.cxf.ws.transfer.dialect.fragment.Fragment)32 Service (org.apache.cxf.service.Service)27 Bus (org.apache.cxf.Bus)25 PutResponse (org.apache.cxf.ws.transfer.PutResponse)25 Endpoint (org.apache.cxf.endpoint.Endpoint)21 ArrayList (java.util.ArrayList)18 QName (javax.xml.namespace.QName)18 ServerRegistry (org.apache.cxf.endpoint.ServerRegistry)18 Document (org.w3c.dom.Document)18