Tabnine Logo
JsonRpcServletTest
Code IndexAdd Tabnine to your IDE (free)

How to use
JsonRpcServletTest
in
org.apache.shindig.protocol

Best Java code snippets using org.apache.shindig.protocol.JsonRpcServletTest (Showing top 20 results out of 315)

origin: com.lmco.shindig/shindig-common

@Test
public void testBasicBatch() throws Exception {
 setupRequest("[{method:test.get,id:'1'},{method:test.get,id:'2'}]");
 expect(res.getWriter()).andReturn(writer);
 expectLastCall();
 mockControl.replay();
 servlet.service(req, res);
 mockControl.verify();
 JsonAssert.assertJsonEquals("[{id:'1',result:{foo:'bar'}},{id:'2',result:{foo:'bar'}}]",
   getOutput());
}
origin: com.lmco.shindig/shindig-common

String request = "{method:'test.get',id:'id',params:" +
  "{userId:5,groupId:'@self',image-ref:'@" + IMAGE_FIELDNAME + "'}}";
formItems.add(mockFormDataItem(IMAGE_FIELDNAME, IMAGE_TYPE, IMAGE_DATA_BYTES, false));
formItems.add(mockFormDataItem("oauth_hash", "application/octet-stream",
  "oauth-hash".getBytes(), true));
formItems.add(mockFormDataItem("request", null, request.getBytes(), true));
formItems.add(mockFormDataItem("oauth_signature", "application/octet-stream",
  "oauth_signature".getBytes(), true));
expect(multipartFormParser.isMultipartContent(req)).andReturn(true);
  "', image-type:'" + IMAGE_TYPE + "', image-ref:'@" + IMAGE_FIELDNAME + "'}}", getOutput());
origin: org.wso2.org.apache.shindig/shindig-common

String request = "{method:'test.get',id:'id',params:" +
  "{userId:5,groupId:'@self',image-ref:'@" + IMAGE_FIELDNAME + "'}}";
formItems.add(mockFormDataItem(IMAGE_FIELDNAME, IMAGE_TYPE, IMAGE_DATA_BYTES, false));
formItems.add(mockFormDataItem("request", "application/octet-stream", request.getBytes(),
  true));
expect(multipartFormParser.isMultipartContent(req)).andReturn(true);
mockControl.verify();
String output = getOutput();
assertTrue(output.contains("Unsupported Content-Type application/octet-stream"));
origin: org.apache.shindig/shindig-common

@Test
public void testGetExecution() throws Exception {
 expect(req.getParameterMap()).andStubReturn(
   ImmutableMap.of("method", new String[]{"test.get"}, "id", new String[]{"1"}));
 expect(req.getMethod()).andStubReturn("GET");
 expect(req.getAttribute(isA(String.class))).andReturn(FAKE_GADGET_TOKEN);
 expect(req.getCharacterEncoding()).andStubReturn("UTF-8");
 res.setCharacterEncoding("UTF-8");
 expect(res.getWriter()).andReturn(writer);
 expectLastCall();
 mockControl.replay();
 servlet.service(req, res);
 mockControl.verify();
 JsonAssert.assertJsonEquals("{id:'1',result:{foo:'bar'}}", getOutput());
}
origin: org.gatein.shindig/shindig-common

String request = "{method:'test.get',id:'id',params:" +
  "{userId:5,groupId:'@self',image-ref:'@" + IMAGE_FIELDNAME + "'}}";
formItems.add(mockFormDataItem(IMAGE_FIELDNAME, IMAGE_TYPE, IMAGE_DATA_BYTES, false));
formItems.add(mockFormDataItem("oauth_hash", "application/octet-stream",
  "oauth-hash".getBytes(), true));
formItems.add(mockFormDataItem("request", null, request.getBytes(), true));
formItems.add(mockFormDataItem("oauth_signature", "application/octet-stream",
  "oauth_signature".getBytes(), true));
expect(multipartFormParser.isMultipartContent(req)).andReturn(true);
  "', image-type:'" + IMAGE_TYPE + "', image-ref:'@" + IMAGE_FIELDNAME + "'}}", getOutput());
origin: org.gatein.shindig/shindig-common

String request = "{method:'test.get',id:'id',params:" +
  "{userId:5,groupId:'@self',image-ref:'@" + IMAGE_FIELDNAME + "'}}";
formItems.add(mockFormDataItem(IMAGE_FIELDNAME, IMAGE_TYPE, IMAGE_DATA_BYTES, false));
formItems.add(mockFormDataItem("request", "application/octet-stream", request.getBytes(),
  true));
expect(multipartFormParser.isMultipartContent(req)).andReturn(true);
mockControl.verify();
String output = getOutput();
assertTrue(output.contains("Unsupported Content-Type application/octet-stream"));
origin: org.gatein.shindig/shindig-common

@Test
public void testGetExecution() throws Exception {
 expect(req.getParameterMap()).andStubReturn(
   ImmutableMap.of("method", new String[]{"test.get"}, "id", new String[]{"1"}));
 expect(req.getMethod()).andStubReturn("GET");
 expect(req.getAttribute(isA(String.class))).andReturn(FAKE_GADGET_TOKEN);
 expect(req.getCharacterEncoding()).andStubReturn("UTF-8");
 res.setCharacterEncoding("UTF-8");
 expect(res.getWriter()).andReturn(writer);
 expectLastCall();
 mockControl.replay();
 servlet.service(req, res);
 mockControl.verify();
 JsonAssert.assertJsonEquals("{id:'1',result:{foo:'bar'}}", getOutput());
}
origin: org.gatein.shindig/shindig-common

@Test
public void testMethodRecognition() throws Exception {
 setupRequest("{method:test.get,id:id,params:{userId:5,groupId:@self}}");
 expect(res.getWriter()).andReturn(writer);
 expectLastCall();
 mockControl.replay();
 servlet.service(req, res);
 mockControl.verify();
 JsonAssert.assertJsonEquals("{id: 'id', result: {foo:'bar'}}", getOutput());
}
origin: org.apache.shindig/shindig-common

String request = "{method:'test.get',id:'id',params:" +
  "{userId:5,groupId:'@self',image-ref:'@" + IMAGE_FIELDNAME + "'}}";
formItems.add(mockFormDataItem(IMAGE_FIELDNAME, IMAGE_TYPE, IMAGE_DATA_BYTES, false));
formItems.add(mockFormDataItem("oauth_hash", "application/octet-stream",
  "oauth-hash".getBytes(), true));
formItems.add(mockFormDataItem("request", null, request.getBytes(), true));
formItems.add(mockFormDataItem("oauth_signature", "application/octet-stream",
  "oauth_signature".getBytes(), true));
expect(multipartFormParser.isMultipartContent(req)).andReturn(true);
  "', image-type:'" + IMAGE_TYPE + "', image-ref:'@" + IMAGE_FIELDNAME + "'}}", getOutput());
origin: org.apache.shindig/shindig-common

String request = "{method:'test.get',id:'id',params:" +
  "{userId:5,groupId:'@self',image-ref:'@" + IMAGE_FIELDNAME + "'}}";
formItems.add(mockFormDataItem(IMAGE_FIELDNAME, IMAGE_TYPE, IMAGE_DATA_BYTES, false));
formItems.add(mockFormDataItem("request", "application/octet-stream", request.getBytes(),
  true));
expect(multipartFormParser.isMultipartContent(req)).andReturn(true);
mockControl.verify();
String output = getOutput();
assertTrue(output.contains("Unsupported Content-Type application/octet-stream"));
origin: org.wso2.org.apache.shindig/shindig-common

@Test
public void testGetExecution() throws Exception {
 expect(req.getParameterMap()).andStubReturn(
   ImmutableMap.of("method", new String[]{"test.get"}, "id", new String[]{"1"}));
 expect(req.getMethod()).andStubReturn("GET");
 expect(req.getAttribute(isA(String.class))).andReturn(FAKE_GADGET_TOKEN);
 expect(req.getCharacterEncoding()).andStubReturn("UTF-8");
 res.setCharacterEncoding("UTF-8");
 expect(res.getWriter()).andReturn(writer);
 expectLastCall();
 mockControl.replay();
 servlet.service(req, res);
 mockControl.verify();
 JsonAssert.assertJsonEquals("{id:'1',result:{foo:'bar'}}", getOutput());
}
origin: com.lmco.shindig/shindig-common

@Test
public void testInvalidService() throws Exception {
 setupRequest("{method:junk.get,id:id,params:{userId:5,groupId:@self}}");
 expect(res.getWriter()).andReturn(writer);
 expectLastCall();
 mockControl.replay();
 servlet.service(req, res);
 mockControl.verify();
 JsonAssert.assertJsonEquals(
   "{id:id,error:{message:'notImplemented: The method junk.get is not implemented',code:501}}",
   getOutput());
}
origin: org.wso2.org.apache.shindig/shindig-common

String request = "{method:'test.get',id:'id',params:" +
  "{userId:5,groupId:'@self',image-ref:'@" + IMAGE_FIELDNAME + "'}}";
formItems.add(mockFormDataItem(IMAGE_FIELDNAME, IMAGE_TYPE, IMAGE_DATA_BYTES, false));
formItems.add(mockFormDataItem("oauth_hash", "application/octet-stream",
  "oauth-hash".getBytes(), true));
formItems.add(mockFormDataItem("request", null, request.getBytes(), true));
formItems.add(mockFormDataItem("oauth_signature", "application/octet-stream",
  "oauth_signature".getBytes(), true));
expect(multipartFormParser.isMultipartContent(req)).andReturn(true);
  "', image-type:'" + IMAGE_TYPE + "', image-ref:'@" + IMAGE_FIELDNAME + "'}}", getOutput());
origin: apache/shindig

String request = "{method:'test.get',id:'id',params:" +
  "{userId:5,groupId:'@self',image-ref:'@" + IMAGE_FIELDNAME + "'}}";
formItems.add(mockFormDataItem(IMAGE_FIELDNAME, IMAGE_TYPE, IMAGE_DATA_BYTES, false));
formItems.add(mockFormDataItem("request", "application/octet-stream", request.getBytes(),
  true));
expect(multipartFormParser.isMultipartContent(req)).andReturn(true);
mockControl.verify();
String output = getOutput();
assertTrue(output.contains("Unsupported Content-Type application/octet-stream"));
origin: com.lmco.shindig/shindig-common

@Test
public void testGetExecution() throws Exception {
 expect(req.getParameterMap()).andStubReturn(
   ImmutableMap.of("method", new String[]{"test.get"}, "id", new String[]{"1"}));
 expect(req.getMethod()).andStubReturn("GET");
 expect(req.getAttribute(isA(String.class))).andReturn(FAKE_GADGET_TOKEN);
 expect(req.getCharacterEncoding()).andStubReturn("UTF-8");
 res.setCharacterEncoding("UTF-8");
 expect(res.getWriter()).andReturn(writer);
 expectLastCall();
 mockControl.replay();
 servlet.service(req, res);
 mockControl.verify();
 JsonAssert.assertJsonEquals("{id:'1',result:{foo:'bar'}}", getOutput());
}
origin: org.apache.shindig/shindig-common

@Test
public void testInvalidService() throws Exception {
 setupRequest("{method:junk.get,id:id,params:{userId:5,groupId:@self}}");
 expect(res.getWriter()).andReturn(writer);
 expectLastCall();
 mockControl.replay();
 servlet.service(req, res);
 mockControl.verify();
 JsonAssert.assertJsonEquals(
   "{id:id,error:{message:'notImplemented: The method junk.get is not implemented',code:501}}",
   getOutput());
}
origin: apache/shindig

String request = "{method:'test.get',id:'id',params:" +
  "{userId:5,groupId:'@self',image-ref:'@" + IMAGE_FIELDNAME + "'}}";
formItems.add(mockFormDataItem(IMAGE_FIELDNAME, IMAGE_TYPE, IMAGE_DATA_BYTES, false));
formItems.add(mockFormDataItem("oauth_hash", "application/octet-stream",
  "oauth-hash".getBytes(), true));
formItems.add(mockFormDataItem("request", null, request.getBytes(), true));
formItems.add(mockFormDataItem("oauth_signature", "application/octet-stream",
  "oauth_signature".getBytes(), true));
expect(multipartFormParser.isMultipartContent(req)).andReturn(true);
  "', image-type:'" + IMAGE_TYPE + "', image-ref:'@" + IMAGE_FIELDNAME + "'}}", getOutput());
origin: com.lmco.shindig/shindig-common

String request = "{method:'test.get',id:'id',params:" +
  "{userId:5,groupId:'@self',image-ref:'@" + IMAGE_FIELDNAME + "'}}";
formItems.add(mockFormDataItem(IMAGE_FIELDNAME, IMAGE_TYPE, IMAGE_DATA_BYTES, false));
formItems.add(mockFormDataItem("request", "application/octet-stream", request.getBytes(),
  true));
expect(multipartFormParser.isMultipartContent(req)).andReturn(true);
mockControl.verify();
String output = getOutput();
assertTrue(output.contains("Unsupported Content-Type application/octet-stream"));
origin: apache/shindig

@Test
public void testGetExecution() throws Exception {
 expect(req.getParameterMap()).andStubReturn(
   ImmutableMap.of("method", new String[]{"test.get"}, "id", new String[]{"1"}));
 expect(req.getMethod()).andStubReturn("GET");
 expect(req.getAttribute(isA(String.class))).andReturn(FAKE_GADGET_TOKEN);
 expect(req.getCharacterEncoding()).andStubReturn("UTF-8");
 res.setCharacterEncoding("UTF-8");
 expect(res.getWriter()).andReturn(writer);
 expectLastCall();
 mockControl.replay();
 servlet.service(req, res);
 mockControl.verify();
 JsonAssert.assertJsonEquals("{id:'1',result:{foo:'bar'}}", getOutput());
}
origin: org.apache.shindig/shindig-common

@Test
public void testBasicBatch() throws Exception {
 setupRequest("[{method:test.get,id:'1'},{method:test.get,id:'2'}]");
 expect(res.getWriter()).andReturn(writer);
 expectLastCall();
 mockControl.replay();
 servlet.service(req, res);
 mockControl.verify();
 JsonAssert.assertJsonEquals("[{id:'1',result:{foo:'bar'}},{id:'2',result:{foo:'bar'}}]",
   getOutput());
}
org.apache.shindig.protocolJsonRpcServletTest

Most used methods

  • assertTrue
  • getOutput
  • mockFormDataItem
  • setupRequest

Popular in Java

  • Reading from database using SQL prepared statement
  • setRequestProperty (URLConnection)
  • getResourceAsStream (ClassLoader)
  • getSupportFragmentManager (FragmentActivity)
  • Component (java.awt)
    A component is an object having a graphical representation that can be displayed on the screen and t
  • Collection (java.util)
    Collection is the root of the collection hierarchy. It defines operations on data collections and t
  • Random (java.util)
    This class provides methods that return pseudo-random values.It is dangerous to seed Random with the
  • ServletException (javax.servlet)
    Defines a general exception a servlet can throw when it encounters difficulty.
  • Options (org.apache.commons.cli)
    Main entry-point into the library. Options represents a collection of Option objects, which describ
  • Loader (org.hibernate.loader)
    Abstract superclass of object loading (and querying) strategies. This class implements useful common
  • Github Copilot alternatives
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now