Search in sources :

Example 1 with SystemGwtRpc

use of org.pentaho.platform.web.gwt.rpc.SystemGwtRpc in project pentaho-platform by pentaho.

the class SystemGwtRpcRequestMatcherTest method testGetGwtRpcReturnsASystemGwtRpc.

// endregion
// region getGwtRpc integration
@Test
public void testGetGwtRpcReturnsASystemGwtRpc() {
    HttpServletRequest requestMock = createRequestMock(HttpMethod.POST, TEST_PATH);
    IGwtRpcSerializationPolicyCache serializationPolicyCache = (moduleBaseURL, strongName, sourceProvider) -> {
        throw new UnsupportedOperationException();
    };
    SystemGwtRpcRequestMatcher matcher = spy(new SystemGwtRpcRequestMatcher(TEST_PATTERN, TEST_RPC_METHODS_SINGLE, serializationPolicyCache));
    // ---
    AbstractGwtRpc gwtRpc = matcher.getGwtRpc(requestMock);
    assertNotNull(gwtRpc);
    assertTrue(gwtRpc instanceof SystemGwtRpc);
    assertEquals(requestMock, gwtRpc.getServletRequest());
    assertEquals(serializationPolicyCache, gwtRpc.getSerializationPolicyCache());
}
Also used : HttpServletRequest(javax.servlet.http.HttpServletRequest) AbstractGwtRpc(org.pentaho.platform.web.gwt.rpc.AbstractGwtRpc) SystemGwtRpc(org.pentaho.platform.web.gwt.rpc.SystemGwtRpc) ArgumentMatchers.any(org.mockito.ArgumentMatchers.any) Arrays(java.util.Arrays) Assert.assertNotNull(org.junit.Assert.assertNotNull) Collection(java.util.Collection) Assert.assertTrue(org.junit.Assert.assertTrue) Test(org.junit.Test) Mockito.times(org.mockito.Mockito.times) Mockito.when(org.mockito.Mockito.when) IGwtRpcSerializationPolicyCache(org.pentaho.platform.web.gwt.rpc.IGwtRpcSerializationPolicyCache) Mockito.spy(org.mockito.Mockito.spy) HttpMethod(javax.ws.rs.HttpMethod) Mockito.verify(org.mockito.Mockito.verify) HttpServletRequest(javax.servlet.http.HttpServletRequest) Assert.assertNull(org.junit.Assert.assertNull) Assert.assertFalse(org.junit.Assert.assertFalse) NonNull(edu.umd.cs.findbugs.annotations.NonNull) Collections(java.util.Collections) Mockito.doReturn(org.mockito.Mockito.doReturn) Assert.assertEquals(org.junit.Assert.assertEquals) Mockito.mock(org.mockito.Mockito.mock) IGwtRpcSerializationPolicyCache(org.pentaho.platform.web.gwt.rpc.IGwtRpcSerializationPolicyCache) AbstractGwtRpc(org.pentaho.platform.web.gwt.rpc.AbstractGwtRpc) SystemGwtRpc(org.pentaho.platform.web.gwt.rpc.SystemGwtRpc) Test(org.junit.Test)

Aggregations

NonNull (edu.umd.cs.findbugs.annotations.NonNull)1 Arrays (java.util.Arrays)1 Collection (java.util.Collection)1 Collections (java.util.Collections)1 HttpServletRequest (javax.servlet.http.HttpServletRequest)1 HttpMethod (javax.ws.rs.HttpMethod)1 Assert.assertEquals (org.junit.Assert.assertEquals)1 Assert.assertFalse (org.junit.Assert.assertFalse)1 Assert.assertNotNull (org.junit.Assert.assertNotNull)1 Assert.assertNull (org.junit.Assert.assertNull)1 Assert.assertTrue (org.junit.Assert.assertTrue)1 Test (org.junit.Test)1 ArgumentMatchers.any (org.mockito.ArgumentMatchers.any)1 Mockito.doReturn (org.mockito.Mockito.doReturn)1 Mockito.mock (org.mockito.Mockito.mock)1 Mockito.spy (org.mockito.Mockito.spy)1 Mockito.times (org.mockito.Mockito.times)1 Mockito.verify (org.mockito.Mockito.verify)1 Mockito.when (org.mockito.Mockito.when)1 AbstractGwtRpc (org.pentaho.platform.web.gwt.rpc.AbstractGwtRpc)1