Search in sources :

Example 1 with ControlImpl

use of org.apache.cxf.greeter_control.ControlImpl in project cxf by apache.

the class LifeCycleTest method testGetActiveFeatures.

@Test
public void testGetActiveFeatures() {
    assertNotNull("unexpected non-null ServerLifeCycleManager", manager);
    manager.registerListener(new ServerLifeCycleListener() {

        public void startServer(Server server) {
            org.apache.cxf.endpoint.Endpoint endpoint = server.getEndpoint();
            updateMap(startNotificationMap, endpoint.getEndpointInfo().getAddress());
            String portName = endpoint.getEndpointInfo().getName().getLocalPart();
            if ("SoapPort".equals(portName)) {
                List<Feature> active = endpoint.getActiveFeatures();
                assertNotNull(active);
                assertEquals(1, active.size());
                assertTrue(active.get(0) instanceof WSAddressingFeature);
                assertSame(active.get(0), AbstractFeature.getActive(active, WSAddressingFeature.class));
            } else {
                List<Feature> active = endpoint.getActiveFeatures();
                assertNotNull(active);
                assertEquals(0, active.size());
                assertNull(AbstractFeature.getActive(active, WSAddressingFeature.class));
            }
        }

        public void stopServer(Server server) {
            updateMap(stopNotificationMap, server.getEndpoint().getEndpointInfo().getAddress());
        }
    });
    Endpoint greeter = Endpoint.publish(ADDRESSES[0], new GreeterImpl());
    Endpoint control = Endpoint.publish(ADDRESSES[1], new ControlImpl());
    greeter.stop();
    control.stop();
    for (int i = 0; i < 2; i++) {
        verifyNotification(startNotificationMap, ADDRESSES[i], 1);
        verifyNotification(stopNotificationMap, ADDRESSES[i], 1);
    }
}
Also used : WSAddressingFeature(org.apache.cxf.ws.addressing.WSAddressingFeature) Server(org.apache.cxf.endpoint.Server) Endpoint(javax.xml.ws.Endpoint) ServerLifeCycleListener(org.apache.cxf.endpoint.ServerLifeCycleListener) List(java.util.List) ControlImpl(org.apache.cxf.greeter_control.ControlImpl) Endpoint(javax.xml.ws.Endpoint) Test(org.junit.Test)

Aggregations

List (java.util.List)1 Endpoint (javax.xml.ws.Endpoint)1 Server (org.apache.cxf.endpoint.Server)1 ServerLifeCycleListener (org.apache.cxf.endpoint.ServerLifeCycleListener)1 ControlImpl (org.apache.cxf.greeter_control.ControlImpl)1 WSAddressingFeature (org.apache.cxf.ws.addressing.WSAddressingFeature)1 Test (org.junit.Test)1