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