Search in sources :

Example 6 with SleepRequest

use of org.eclipse.scout.jaxws.consumer.jaxwsconsumertestservice.SleepRequest in project scout.rt by eclipse.

the class AbstractJaxWsClientTest method testSamePortMultipleTimesSleepWithReadTimeoutCheckResponseHeaders.

@Test
public void testSamePortMultipleTimesSleepWithReadTimeoutCheckResponseHeaders() {
    final JaxWsConsumerTestServicePortType port = BEANS.get(JaxWsConsumerTestClient.class).newInvocationContext().withReadTimeout(500, TimeUnit.MILLISECONDS).getPort();
    // 1. invoke set header
    final String testHeaderValue = "test header value";
    SetHeaderRequest headerReq = new SetHeaderRequest();
    headerReq.setHeaderName(X_SCOUT_JAX_WS_TEST_HEADER);
    headerReq.setHeaderValue(testHeaderValue);
    port.setHeader(headerReq);
    assertHttpResponseHeader(port, X_SCOUT_JAX_WS_TEST_HEADER, testHeaderValue);
    // 2. invoke sleep
    SleepRequest req = new SleepRequest();
    req.setMillis(5000);
    try {
        port.sleep(req);
        fail("invocation is expected to be cancelled");
    } catch (WebServiceException e) {
        if (!(e.getCause() instanceof SocketTimeoutException)) {
            throw e;
        }
    }
    assertHttpResponseCode(port, 0);
    assertHttpResponseHeader(port, X_SCOUT_JAX_WS_TEST_HEADER, null);
    // 3. invoke echo
    EchoRequest echoReq = new EchoRequest();
    echoReq.setMessage("test message");
    port.echo(echoReq);
    assertHttpResponseCode(port, 200);
    assertHttpResponseHeader(port, X_SCOUT_JAX_WS_TEST_HEADER, null);
}
Also used : SetHeaderRequest(org.eclipse.scout.jaxws.consumer.jaxwsconsumertestservice.SetHeaderRequest) SleepRequest(org.eclipse.scout.jaxws.consumer.jaxwsconsumertestservice.SleepRequest) SocketTimeoutException(java.net.SocketTimeoutException) WebServiceException(javax.xml.ws.WebServiceException) EchoRequest(org.eclipse.scout.jaxws.consumer.jaxwsconsumertestservice.EchoRequest) JaxWsConsumerTestServicePortType(org.eclipse.scout.jaxws.consumer.jaxwsconsumertestservice.JaxWsConsumerTestServicePortType) Test(org.junit.Test)

Aggregations

JaxWsConsumerTestServicePortType (org.eclipse.scout.jaxws.consumer.jaxwsconsumertestservice.JaxWsConsumerTestServicePortType)6 SleepRequest (org.eclipse.scout.jaxws.consumer.jaxwsconsumertestservice.SleepRequest)6 Test (org.junit.Test)6 SocketTimeoutException (java.net.SocketTimeoutException)5 WebServiceException (javax.xml.ws.WebServiceException)5 EchoRequest (org.eclipse.scout.jaxws.consumer.jaxwsconsumertestservice.EchoRequest)3 SetHeaderRequest (org.eclipse.scout.jaxws.consumer.jaxwsconsumertestservice.SetHeaderRequest)2 CountDownLatch (java.util.concurrent.CountDownLatch)1 Holder (org.eclipse.scout.rt.platform.holders.Holder)1 IRunnable (org.eclipse.scout.rt.platform.util.concurrent.IRunnable)1 JaxWsImplementorSpecifics (org.eclipse.scout.rt.server.jaxws.implementor.JaxWsImplementorSpecifics)1