Search in sources :

Example 11 with GreetMeResponse

use of org.apache.hello_world_soap_http.types.GreetMeResponse in project cxf by apache.

the class AsyncHTTPConduitTest method testCallAsyncCallbackInvokedOnlyOnce.

@Test
public void testCallAsyncCallbackInvokedOnlyOnce() throws Exception {
    // This test is especially targeted for RHEL 6.8
    updateAddressPort(g, PORT_INV);
    int repeat = 100;
    final AtomicInteger count = new AtomicInteger(0);
    for (int i = 0; i < repeat; i++) {
        try {
            g.greetMeAsync(request, new AsyncHandler<GreetMeResponse>() {

                public void handleResponse(Response<GreetMeResponse> res) {
                    count.incrementAndGet();
                }
            }).get();
        } catch (Exception e) {
        }
    }
    Thread.sleep(1000);
    assertEquals("Callback should be invoked only once per request", repeat, count.intValue());
}
Also used : GreetMeLaterResponse(org.apache.hello_world_soap_http.types.GreetMeLaterResponse) GreetMeResponse(org.apache.hello_world_soap_http.types.GreetMeResponse) Response(javax.xml.ws.Response) AsyncHandler(javax.xml.ws.AsyncHandler) AtomicInteger(java.util.concurrent.atomic.AtomicInteger) Endpoint(javax.xml.ws.Endpoint) ExecutionException(java.util.concurrent.ExecutionException) Test(org.junit.Test)

Aggregations

GreetMeResponse (org.apache.hello_world_soap_http.types.GreetMeResponse)11 Test (org.junit.Test)10 ExecutionException (java.util.concurrent.ExecutionException)5 XMLStreamReader (javax.xml.stream.XMLStreamReader)3 Response (javax.xml.ws.Response)3 GreetMeLaterResponse (org.apache.hello_world_soap_http.types.GreetMeLaterResponse)3 ByteArrayInputStream (java.io.ByteArrayInputStream)2 URL (java.net.URL)2 AtomicInteger (java.util.concurrent.atomic.AtomicInteger)2 QName (javax.xml.namespace.QName)2 AsyncHandler (javax.xml.ws.AsyncHandler)2 Endpoint (javax.xml.ws.Endpoint)2 JAXBDataBinding (org.apache.cxf.jaxb.JAXBDataBinding)2 DepthXMLStreamReader (org.apache.cxf.staxutils.DepthXMLStreamReader)2 SOAPService (org.apache.hello_world_soap_http.SOAPService)2 GreetMe (org.apache.hello_world_soap_http.types.GreetMe)2 SocketTimeoutException (java.net.SocketTimeoutException)1 ArrayList (java.util.ArrayList)1 Executor (java.util.concurrent.Executor)1 TimeoutException (java.util.concurrent.TimeoutException)1