Search in sources :

Example 6 with AbstractGwtRpc

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

the class PluginGwtRpcRequestMatcherTest method testGetGwtRpcReturnsAPluginGwtRpc.

// endregion
// region getGwtRpc integration
@Test
public void testGetGwtRpcReturnsAPluginGwtRpc() {
    HttpServletRequest requestMock = createRequestMock(HttpMethod.POST, TEST_PATH);
    IGwtRpcSerializationPolicyCache serializationPolicyCache = (moduleBaseURL, strongName, sourceProvider) -> {
        throw new UnsupportedOperationException();
    };
    PluginGwtRpcRequestMatcher matcher = spy(new PluginGwtRpcRequestMatcher(TEST_PATTERN, TEST_RPC_METHODS_SINGLE, serializationPolicyCache));
    // ---
    AbstractGwtRpc gwtRpc = matcher.getGwtRpc(requestMock);
    assertNotNull(gwtRpc);
    assertTrue(gwtRpc instanceof PluginGwtRpc);
    assertEquals(requestMock, gwtRpc.getServletRequest());
    assertEquals(serializationPolicyCache, gwtRpc.getSerializationPolicyCache());
}
Also used : HttpServletRequest(javax.servlet.http.HttpServletRequest) AbstractGwtRpc(org.pentaho.platform.web.gwt.rpc.AbstractGwtRpc) 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) PluginGwtRpc(org.pentaho.platform.web.gwt.rpc.PluginGwtRpc) 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) PluginGwtRpc(org.pentaho.platform.web.gwt.rpc.PluginGwtRpc) Test(org.junit.Test)

Aggregations

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