use of jakarta.xml.ws.Holder in project metro-jax-ws by eclipse-ee4j.
the class SoapMuHeaderTest method testMUHeaderNotInWSDL.
public void testMUHeaderNotInWSDL() {
Hello_Service service = new Hello_Service();
Hello port = service.getHelloPort();
Holder<String> extra = new Holder<String>();
try {
port.hello("extraMU", extra);
fail("MU Exception expected");
} catch (SOAPFaultException e) {
assertTrue(e.getFault().getFaultCode().endsWith(":MustUnderstand"));
}
}
use of jakarta.xml.ws.Holder in project metro-jax-ws by eclipse-ee4j.
the class HelloLiteralTest method testEchoImageWithInfo.
public void testEchoImageWithInfo() throws Exception {
String imageType = "image/jpeg";
Holder<String> outImageType = new Holder<String>();
Holder<Image> outImage = new Holder<Image>();
Map<String, DataHandler> att = new HashMap<String, DataHandler>();
att.put("<abcd@example.org>", new DataHandler(getSource("sample.xml"), "text/xml"));
((BindingProvider) port).getRequestContext().put(MessageContext.OUTBOUND_MESSAGE_ATTACHMENTS, att);
port.echoImageWithInfo(imageType, getImage("vivek.jpg"), outImageType, outImage);
assertEquals(outImageType.value, imageType);
assertNotNull(outImage.value);
assertTrue(AttachmentHelper.compareImages(getImage("vivek.jpg"), outImage.value));
}
use of jakarta.xml.ws.Holder in project metro-jax-ws by eclipse-ee4j.
the class MtomAppTest method testUpload.
public void testUpload() throws Exception {
int size = 123 * 1000 * 1000;
Hello port = new HelloService().getHelloPort(new MTOMFeature());
Map<String, Object> ctxt = ((BindingProvider) port).getRequestContext();
// At present, JDK internal property - not supported
ctxt.put("com.sun.xml.internal.ws.transport.http.client.streaming.chunk.size", 8192);
// Add this one to run with standalone RI bits
ctxt.put("com.sun.xml.ws.transport.http.client.streaming.chunk.size", 8192);
Holder<Integer> total = new Holder<Integer>(size);
Holder<String> name = new Holder<String>("huge");
Holder<DataHandler> dh = new Holder<DataHandler>(getDataHandler(total.value));
port.upload(total, name, dh);
if (!"hugehuge".equals(name.value)) {
fail("FAIL: Expecting: hugehuge Got: " + name.value);
}
if (!total.value.equals(size + 1)) {
fail("FAIL: Expecting size: " + (size + 1) + " Got: " + total.value);
}
System.out.println("SUCCESS: Got: " + name.value);
System.out.println("Going to verify DataHandler. This would take some time");
validateDataHandler(total.value, dh.value);
System.out.println("SUCCESS: DataHandler is verified");
if (dh.value instanceof Closeable) {
System.out.println("Client:Received DH is closeable");
((Closeable) dh.value).close();
}
}
use of jakarta.xml.ws.Holder in project metro-jax-ws by eclipse-ee4j.
the class FiberTest method testStartTubePacketCompletionCallback.
public void testStartTubePacketCompletionCallback() {
final Holder<Boolean> isInExecutor = new Holder<Boolean>(Boolean.FALSE);
TestTube testTube = new TestTube() {
@Override
@NotNull
public NextAction processRequest(@NotNull Packet request) {
isInExecutor.value = executor.isInExecutor();
return super.processRequest(request);
}
};
Packet request = new Packet();
SimpleCompletionCallback callback = new SimpleCompletionCallback();
Fiber fiber = engine.createFiber();
assertNotNull(fiber);
fiber.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);
assertTrue(isInExecutor.value);
}
use of jakarta.xml.ws.Holder in project metro-jax-ws by eclipse-ee4j.
the class FiberTest method testStartTubePacketCompletionCallbackBoolean.
public void testStartTubePacketCompletionCallbackBoolean() {
final Holder<Boolean> isInExecutor = new Holder<Boolean>(Boolean.FALSE);
TestTube testTube = new TestTube() {
@Override
@NotNull
public NextAction processRequest(@NotNull Packet request) {
isInExecutor.value = executor.isInExecutor();
return super.processRequest(request);
}
};
Packet request = new Packet();
SimpleCompletionCallback callback = new SimpleCompletionCallback();
Fiber fiber = engine.createFiber();
assertNotNull(fiber);
fiber.start(testTube, request, callback, true);
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);
assertFalse(isInExecutor.value);
}
Aggregations