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();
}
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();
}
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);
}
}
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();
}
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());
}
Aggregations