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

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

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

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: 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: 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: apache/shindig

@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.gatein.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.apache.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.wso2.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: org.wso2.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());
}
origin: org.wso2.org.apache.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: apache/shindig

@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: 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: 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());
}
origin: org.gatein.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

@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: apache/shindig

@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: com.lmco.shindig/shindig-common

/**
 * Tests a data handler that returns a failed Future.
 * @throws Exception on failure
 */
@Test
public void testFailedRequest() throws Exception {
 setupRequest("{id:id,method:test.futureException}");
 expect(res.getWriter()).andReturn(writer);
 expectLastCall();
 mockControl.replay();
 servlet.service(req, res);
 mockControl.verify();
 JsonAssert.assertJsonEquals(
   "{id:id,error:{message:'badRequest: FAILURE_MESSAGE',code:400}}", getOutput());
}
origin: org.wso2.org.apache.shindig/shindig-common

/**
 * Tests a data handler that returns a failed Future.
 * @throws Exception on failure
 */
@Test
public void testFailedRequest() throws Exception {
 setupRequest("{id:id,method:test.futureException}");
 expect(res.getWriter()).andReturn(writer);
 expectLastCall();
 mockControl.replay();
 servlet.service(req, res);
 mockControl.verify();
 JsonAssert.assertJsonEquals(
   "{id:id,error:{message:'badRequest: FAILURE_MESSAGE',code:400}}", getOutput());
}
origin: org.wso2.org.apache.shindig/shindig-common

@Test
public void testDisallowJSONP() throws Exception {
 servlet.setJSONPAllowed(false);
 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());
 servlet.setJSONPAllowed(true);
}
origin: apache/shindig

@Test
public void testDisallowJSONP() throws Exception {
 servlet.setJSONPAllowed(false);
 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());
 servlet.setJSONPAllowed(true);
}
origin: org.apache.shindig/shindig-common

@Test
public void testDisallowJSONP() throws Exception {
 servlet.setJSONPAllowed(false);
 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());
 servlet.setJSONPAllowed(true);
}
org.apache.shindig.protocolJsonRpcServletTestsetupRequest

Popular methods of JsonRpcServletTest

  • assertTrue
  • getOutput
  • mockFormDataItem

Popular in Java

  • Finding current android device location
  • findViewById (Activity)
  • putExtra (Intent)
  • requestLocationUpdates (LocationManager)
  • IOException (java.io)
    Signals a general, I/O-related error. Error details may be specified when calling the constructor, a
  • Collection (java.util)
    Collection is the root of the collection hierarchy. It defines operations on data collections and t
  • ThreadPoolExecutor (java.util.concurrent)
    An ExecutorService that executes each submitted task using one of possibly several pooled threads, n
  • Filter (javax.servlet)
    A filter is an object that performs filtering tasks on either the request to a resource (a servlet o
  • JTable (javax.swing)
  • XPath (javax.xml.xpath)
    XPath provides access to the XPath evaluation environment and expressions. Evaluation of XPath Expr
  • Top Sublime Text plugins
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