Search in sources :

Example 11 with Container

use of com.sun.xml.ws.api.server.Container in project metro-jax-ws by eclipse-ee4j.

the class EngineTest method testEngineStringContainer.

public void testEngineStringContainer() {
    Container testContainer = new Container() {
    };
    String id = "engine1";
    Engine e = new Engine(id, testContainer);
    assertEquals(id, e.getId());
    assertEquals(testContainer, e.getContainer());
    Engine f;
    Container otherContainer = new Container() {
    };
    Container old = ContainerResolver.getDefault().enterContainer(otherContainer);
    try {
        f = new Engine(id, testContainer);
    } finally {
        ContainerResolver.getDefault().exitContainer(old);
    }
    assertEquals(id, f.getId());
    assertEquals(testContainer, f.getContainer());
}
Also used : Container(com.sun.xml.ws.api.server.Container)

Example 12 with Container

use of com.sun.xml.ws.api.server.Container in project metro-jax-ws by eclipse-ee4j.

the class EngineTest method testEngineString.

public void testEngineString() {
    String id = "engine1";
    Engine e = new Engine(id);
    assertEquals(id, e.getId());
    assertEquals(Container.NONE, e.getContainer());
    Container testContainer = new Container() {
    };
    Engine f;
    Container old = ContainerResolver.getDefault().enterContainer(testContainer);
    try {
        f = new Engine(id);
    } finally {
        ContainerResolver.getDefault().exitContainer(old);
    }
    assertEquals(id, f.getId());
    assertEquals(testContainer, f.getContainer());
}
Also used : Container(com.sun.xml.ws.api.server.Container)

Example 13 with Container

use of com.sun.xml.ws.api.server.Container in project metro-jax-ws by eclipse-ee4j.

the class EngineTest method testSetExecutorAndCreateFiber.

public void testSetExecutorAndCreateFiber() {
    Container testContainer = new Container() {
    };
    String id = "engine1";
    Engine e = new Engine(id, testContainer);
    Executor x = new InlineExecutor();
    e.setExecutor(x);
    // Not valid because executor would be wrapped
    // assertEquals(x, e.getExecutor());
    Fiber f = e.createFiber();
    assertNotNull(f);
    TestTube testTube = new TestTube();
    Packet request = new Packet();
    SimpleCompletionCallback callback = new SimpleCompletionCallback();
    f.start(testTube, request, callback);
    assertEquals(request, callback.response);
    assertNull(callback.error);
    List<TubeCall> calls = testTube.getCalls();
    assertNotNull(calls);
    assertEquals(1, calls.size());
    TubeCall firstCall = calls.get(0);
    assertNotNull(firstCall);
    assertEquals(TubeCallType.REQUEST, firstCall.callType);
    assertEquals(testContainer, firstCall.container);
}
Also used : Packet(com.sun.xml.ws.api.message.Packet) Container(com.sun.xml.ws.api.server.Container) Executor(java.util.concurrent.Executor)

Example 14 with Container

use of com.sun.xml.ws.api.server.Container in project metro-jax-ws by eclipse-ee4j.

the class SEIStub method invoke.

public Object invoke(Object proxy, Method method, Object[] args) throws Throwable {
    validateInputs(proxy, method);
    Container old = ContainerResolver.getDefault().enterContainer(owner.getContainer());
    try {
        MethodHandler handler = methodHandlers.get(method);
        if (handler != null) {
            return handler.invoke(proxy, args);
        } else {
            // we handle the other method invocations by ourselves
            try {
                return method.invoke(this, args);
            } catch (IllegalAccessException | IllegalArgumentException e) {
                // impossible
                throw new AssertionError(e);
            } catch (InvocationTargetException e) {
                throw e.getCause();
            }
        }
    } finally {
        ContainerResolver.getDefault().exitContainer(old);
    }
}
Also used : Container(com.sun.xml.ws.api.server.Container) InvocationTargetException(java.lang.reflect.InvocationTargetException)

Aggregations

Container (com.sun.xml.ws.api.server.Container)14 BindingID (com.sun.xml.ws.api.BindingID)4 ClientTubeAssemblerContext (com.sun.xml.ws.api.pipe.ClientTubeAssemblerContext)4 WSBinding (com.sun.xml.ws.api.WSBinding)2 WSEndpointReference (com.sun.xml.ws.api.addressing.WSEndpointReference)2 Packet (com.sun.xml.ws.api.message.Packet)2 WSDLPort (com.sun.xml.ws.api.model.wsdl.WSDLPort)2 Tube (com.sun.xml.ws.api.pipe.Tube)2 WebServiceException (jakarta.xml.ws.WebServiceException)2 URL (java.net.URL)2 QName (javax.xml.namespace.QName)2 DatabindingModeFeature (com.oracle.webservices.api.databinding.DatabindingModeFeature)1 ExternalMetadataFeature (com.oracle.webservices.api.databinding.ExternalMetadataFeature)1 Component (com.sun.xml.ws.api.Component)1 ComponentFeature (com.sun.xml.ws.api.ComponentFeature)1 EndpointAddress (com.sun.xml.ws.api.EndpointAddress)1 ResourceLoader (com.sun.xml.ws.api.ResourceLoader)1 WSPortInfo (com.sun.xml.ws.api.client.WSPortInfo)1 Header (com.sun.xml.ws.api.message.Header)1 WSDLModel (com.sun.xml.ws.api.model.wsdl.WSDLModel)1