use of jakarta.xml.ws.Dispatch in project metro-jax-ws by eclipse-ee4j.
the class DispatchHelloLiteralTest method testHelloAsyncPollJAXBMult.
public void testHelloAsyncPollJAXBMult() throws Exception {
JAXBContext jc = createJAXBContext();
Hello_Type hello = new Hello_Type();
HelloResponse helloResult = new HelloResponse();
hello.setExtra("Test ");
hello.setArgument("Dispatch ");
Dispatch dispatch = getDispatchJAXB();
Response result = dispatch.invokeAsync(hello);
Response result2 = dispatch.invokeAsync(hello);
Response result3 = dispatch.invokeAsync(hello);
Response result4 = dispatch.invokeAsync(hello);
Response result5 = dispatch.invokeAsync(hello);
Response result6 = dispatch.invokeAsync(hello);
Response result7 = dispatch.invokeAsync(hello);
Response result8 = dispatch.invokeAsync(hello);
Response result9 = dispatch.invokeAsync(hello);
int k = 0;
Response resultf = null;
for (k = 0; k < 55; k++) {
resultf = dispatch.invokeAsync(hello);
}
System.out.println("last k " + k);
while (!resultf.isDone()) {
}
}
use of jakarta.xml.ws.Dispatch in project metro-jax-ws by eclipse-ee4j.
the class DispatchHelloLiteralTest method testVoidAsyncPollXML.
// todo: this does not come back as source investigate
public void testVoidAsyncPollXML() throws Exception {
Dispatch dispatch = getDispatchSource();
Collection<Source> sourceList = makeMsgSource(voidMsg);
Collection<Source> responseList = makeMsgSource(voidResponse);
for (Iterator iter = sourceList.iterator(); iter.hasNext(); ) {
Object sourceObject = iter.next();
Response<Source> result = dispatch.invokeAsync(sourceObject);
Source realResult = result.get();
assertTrue(realResult != null);
System.out.println("-----------------------------------------");
System.out.println("Source Result = ");
System.out.println(sourceToXMLString(realResult));
System.out.println("-----------------------------------------");
}
}
use of jakarta.xml.ws.Dispatch in project metro-jax-ws by eclipse-ee4j.
the class DispatchHelloLiteralTest method testVoidAsyncHandlerJAXB.
public void testVoidAsyncHandlerJAXB() {
JAXBContext jc = null;
VoidTest voidTest = null;
VoidTestResponse voidTestResult = null;
try {
jc = createJAXBContext();
voidTest = new VoidTest();
voidTestResult = new VoidTestResponse();
} catch (Exception jbe) {
jbe.printStackTrace();
}
Dispatch dispatch = getDispatchJAXB();
JAXBAsyncHandler handler = new JAXBAsyncHandler(voidTest);
Future result = dispatch.invokeAsync(voidTest, handler);
System.out.println("Response " + result.getClass().getName());
}
use of jakarta.xml.ws.Dispatch in project metro-jax-ws by eclipse-ee4j.
the class DispatchHelloLiteralTest method kkktestHelloAsyncHandlerCancelInterruptJAXB.
/* public void testHelloAsyncHandlerCancelJAXB() {
JAXBContext jc = null;
Hello_Type hello = null;
try {
jc = createJAXBContext();
hello = new Hello_Type();
} catch (Exception jbe) {
jbe.printStackTrace();
}
try {
hello.setExtra("Test ");
hello.setArgument("Dispatch ");
Dispatch dispatch = getDispatchJAXB();
JAXBAsyncHandler handler = new JAXBAsyncHandler(hello);
Future result = dispatch.invokeAsync(hello, handler);
try {
System.out.println("Response retured to test Thread " + Thread.currentThread().getId());
System.out.println("Response " + result.getClass().getName());
} catch (Exception ex) {
ex.printStackTrace();
}
while (!result.isDone()) {
System.out.println("Not done");
result.cancel(false);
assertTrue(result.isCancelled());
System.out.println("Canceled result");
}
} catch (WebServiceException e) {
e.printStackTrace();
}
}
*/
public void kkktestHelloAsyncHandlerCancelInterruptJAXB() {
JAXBContext jc = null;
Hello_Type hello = null;
try {
jc = createJAXBContext();
hello = new Hello_Type();
} catch (Exception jbe) {
jbe.printStackTrace();
}
hello.setExtra("Test ");
hello.setArgument("Dispatch ");
Dispatch dispatch = getDispatchJAXB();
JAXBAsyncHandler handler = new JAXBAsyncHandler(hello);
Future result = dispatch.invokeAsync(hello, handler);
while (!result.isDone()) {
result.cancel(true);
assertTrue(result.isCancelled());
System.out.println("Cancel interupt passed");
}
}
use of jakarta.xml.ws.Dispatch in project metro-jax-ws by eclipse-ee4j.
the class DispatchHelloLiteralTest method testHelloAsyncHandlerJAXB2.
public void testHelloAsyncHandlerJAXB2() {
JAXBContext jc = null;
Hello_Type hello = null;
try {
jc = createJAXBContext();
hello = new Hello_Type();
} catch (Exception jbe) {
jbe.printStackTrace();
}
Future result = null;
hello.setExtra("Test ");
hello.setArgument("Dispatch ");
Dispatch dispatch = getDispatchJAXB();
JAXBAsyncHandler handler = new JAXBAsyncHandler(hello);
result = dispatch.invokeAsync(hello, handler);
System.out.println("Response " + result.getClass().getName());
int i = 0;
while (!result.isDone()) {
if (i == 1)
System.out.println("Waiting for handler to complete 1");
if (i == 500)
System.out.println("Waiting for handler to complete 500");
if (i == 1500)
System.out.println("Waiting for handler to complete 1500");
i++;
}
System.out.println("Handler is done ");
}
Aggregations