Search in sources :

Example 6 with ServiceTunnelResponse

use of org.eclipse.scout.rt.shared.servicetunnel.ServiceTunnelResponse in project scout.rt by eclipse.

the class ServiceOperationInvokerTest method testInvokeInvalidWithoutSession.

// exception is handled with JUnitExceptionHandler
@Test(expected = ProcessingException.class)
public void testInvokeInvalidWithoutSession() {
    String exceptionMessage = "xxx";
    when(m_pingSvc.ping(any(String.class))).thenThrow(new ProcessingException(exceptionMessage));
    ServiceTunnelResponse res = invokePingService(ServerRunContexts.empty());
    assertProcessingException(res, exceptionMessage);
}
Also used : StringContains.containsString(org.hamcrest.core.StringContains.containsString) ServiceTunnelResponse(org.eclipse.scout.rt.shared.servicetunnel.ServiceTunnelResponse) ProcessingException(org.eclipse.scout.rt.platform.exception.ProcessingException) Test(org.junit.Test)

Example 7 with ServiceTunnelResponse

use of org.eclipse.scout.rt.shared.servicetunnel.ServiceTunnelResponse in project scout.rt by eclipse.

the class ServiceTunnelServletTest method testPostSuccessful.

@Test
public void testPostSuccessful() throws ServletException, IOException {
    ServiceTunnelServlet s = new ServiceTunnelServlet();
    Class[] parameterTypes = new Class[] { String.class };
    Object[] args = new Object[] { "test" };
    ServiceTunnelRequest req = new ServiceTunnelRequest(IPingService.class.getName(), "ping", parameterTypes, args);
    ServiceTunnelResponse res = s.doPost(req);
    assertEquals("test", res.getData());
    assertNull(res.getException());
    assertEquals(0, res.getNotifications().size());
}
Also used : IPingService(org.eclipse.scout.rt.shared.services.common.ping.IPingService) ServiceTunnelRequest(org.eclipse.scout.rt.shared.servicetunnel.ServiceTunnelRequest) ServiceTunnelResponse(org.eclipse.scout.rt.shared.servicetunnel.ServiceTunnelResponse) Test(org.junit.Test)

Example 8 with ServiceTunnelResponse

use of org.eclipse.scout.rt.shared.servicetunnel.ServiceTunnelResponse in project scout.rt by eclipse.

the class ServiceOperationInvokerTest method testInvokeInvalidWithSession.

// exception is handled with JUnitExceptionHandler
@Test(expected = ProcessingException.class)
public void testInvokeInvalidWithSession() {
    String exceptionMessage = "xxx";
    when(m_pingSvc.ping(any(String.class))).thenThrow(new ProcessingException(exceptionMessage));
    ServiceTunnelResponse res = invokePingService(createRunContextWithSession());
    assertProcessingException(res, exceptionMessage);
}
Also used : StringContains.containsString(org.hamcrest.core.StringContains.containsString) ServiceTunnelResponse(org.eclipse.scout.rt.shared.servicetunnel.ServiceTunnelResponse) ProcessingException(org.eclipse.scout.rt.platform.exception.ProcessingException) Test(org.junit.Test)

Example 9 with ServiceTunnelResponse

use of org.eclipse.scout.rt.shared.servicetunnel.ServiceTunnelResponse in project scout.rt by eclipse.

the class ServiceOperationInvokerTest method testInvokeInspectedWithSession.

@Test
public void testInvokeInspectedWithSession() {
    try {
        BEANS.get(ProcessInspector.class).setEnabled(true);
        when(m_pingSvc.ping(any(String.class))).thenReturn(m_testData);
        ServiceTunnelResponse res = invokePingService(createRunContextWithSession());
        assertValidResponse(res, m_testData);
    } finally {
        BEANS.get(ProcessInspector.class).setEnabled(false);
    }
}
Also used : ProcessInspector(org.eclipse.scout.rt.server.admin.inspector.ProcessInspector) StringContains.containsString(org.hamcrest.core.StringContains.containsString) ServiceTunnelResponse(org.eclipse.scout.rt.shared.servicetunnel.ServiceTunnelResponse) Test(org.junit.Test)

Example 10 with ServiceTunnelResponse

use of org.eclipse.scout.rt.shared.servicetunnel.ServiceTunnelResponse in project scout.rt by eclipse.

the class ServiceOperationInvokerTest method testInvokeWithoutSession.

@Test
public void testInvokeWithoutSession() {
    when(m_pingSvc.ping(any(String.class))).thenReturn(m_testData);
    ServiceTunnelResponse res = invokePingService(ServerRunContexts.empty());
    assertValidResponse(res, m_testData);
}
Also used : StringContains.containsString(org.hamcrest.core.StringContains.containsString) ServiceTunnelResponse(org.eclipse.scout.rt.shared.servicetunnel.ServiceTunnelResponse) Test(org.junit.Test)

Aggregations

ServiceTunnelResponse (org.eclipse.scout.rt.shared.servicetunnel.ServiceTunnelResponse)16 Test (org.junit.Test)8 StringContains.containsString (org.hamcrest.core.StringContains.containsString)5 ServiceTunnelRequest (org.eclipse.scout.rt.shared.servicetunnel.ServiceTunnelRequest)4 ProcessingException (org.eclipse.scout.rt.platform.exception.ProcessingException)3 HttpResponse (com.google.api.client.http.HttpResponse)2 ByteArrayOutputStream (java.io.ByteArrayOutputStream)2 IOException (java.io.IOException)2 InputStream (java.io.InputStream)2 OutputStream (java.io.OutputStream)2 Method (java.lang.reflect.Method)2 FutureCancelledError (org.eclipse.scout.rt.platform.util.concurrent.FutureCancelledError)2 ThreadInterruptedError (org.eclipse.scout.rt.platform.util.concurrent.ThreadInterruptedError)2 IPingService (org.eclipse.scout.rt.shared.services.common.ping.IPingService)2 IServiceTunnelContentHandler (org.eclipse.scout.rt.shared.servicetunnel.IServiceTunnelContentHandler)2 ServiceUtility (org.eclipse.scout.rt.shared.servicetunnel.ServiceUtility)2 GenericUrl (com.google.api.client.http.GenericUrl)1 HttpContent (com.google.api.client.http.HttpContent)1 HttpRequest (com.google.api.client.http.HttpRequest)1 HttpRequestFactory (com.google.api.client.http.HttpRequestFactory)1