Examples of MockHttpRequest


Examples of org.jboss.resteasy.mock.MockHttpRequest

        rmethod = mock(ResourceMethod.class);
    }

    @Test
    public void testNoAnything() throws Exception {
        MockHttpRequest req = MockHttpRequest.create("GET",
            "http://localhost/candlepin/status");

        interceptor.preProcess(req, rmethod);

        PageRequest p = ResteasyProviderFactory.getContextData(PageRequest.class);
View Full Code Here

Examples of org.jboss.resteasy.mock.MockHttpRequest

        assertNull(p);
    }

    @Test
    public void testBothLimitAndPage() throws Exception {
        MockHttpRequest req = MockHttpRequest.create("GET",
            "http://localhost/candlepin/status?per_page=10&page=4");

        interceptor.preProcess(req, rmethod);

        PageRequest p = ResteasyProviderFactory.getContextData(PageRequest.class);
View Full Code Here

Examples of org.jboss.resteasy.mock.MockHttpRequest

        assertNull(p.getSortBy());
    }

    @Test
    public void testNoLimitButPage() throws Exception {
        MockHttpRequest req = MockHttpRequest.create("GET",
            "http://localhost/candlepin/status?page=5");

        interceptor.preProcess(req, rmethod);

        PageRequest p = ResteasyProviderFactory.getContextData(PageRequest.class);
View Full Code Here

Examples of org.jboss.resteasy.mock.MockHttpRequest

        assertNull(p.getSortBy());
    }

    @Test
    public void testLimitButNoPage() throws Exception {
        MockHttpRequest req = MockHttpRequest.create("GET",
            "http://localhost/candlepin/status?per_page=10");

        interceptor.preProcess(req, rmethod);

        PageRequest p = ResteasyProviderFactory.getContextData(PageRequest.class);
View Full Code Here

Examples of org.jboss.resteasy.mock.MockHttpRequest

        assertNull(p.getSortBy());
    }

    @Test(expected = BadRequestException.class)
    public void testBadIntegerValue() throws Exception {
        MockHttpRequest req = MockHttpRequest.create("GET",
            "http://localhost/candlepin/status?page=foo&per_page=456");

        interceptor.preProcess(req, rmethod);
    }
View Full Code Here

Examples of org.jboss.resteasy.mock.MockHttpRequest

  }
 

  private void assertCharset(String path) throws URISyntaxException {
    for (String characterSet : characterSets) {
      MockHttpRequest request = MockHttpRequest.get(path);
      request.accept("application/xml");
      request.header("Accept-Charset", characterSet);
   
      MockHttpResponse response = new MockHttpResponse();
      dispatcher.invoke(request, response);
      assertEquals("Status code.", 200, response.getStatus());
View Full Code Here

Examples of org.jboss.resteasy.mock.MockHttpRequest

      }
   }

   public void postJob(HttpRequest request, HttpResponse response, final ResourceInvoker invoker)
   {
      final MockHttpRequest in;
      try
      {
         in = MockHttpRequest.deepCopy(request);
      }
      catch (IOException e)
View Full Code Here

Examples of org.jboss.resteasy.mock.MockHttpRequest

   }

   public void oneway(HttpRequest request, HttpResponse response, final ResourceInvoker invoker)
   {
      logger.debug("IN ONE WAY!!!!!");
      final MockHttpRequest in;
      try
      {
         in = MockHttpRequest.deepCopy(request);
      }
      catch (IOException e)
View Full Code Here

Examples of org.jboss.resteasy.mock.MockHttpRequest

      POJOResourceFactory noDefaults = new POJOResourceFactory(SimpleResource.class);
      dispatcher.getRegistry().addResourceFactory(noDefaults);

      {
         MockHttpRequest request = MockHttpRequest.get("/basic/");
         MockHttpResponse response = new MockHttpResponse();

         dispatcher.invoke(request, response);


         Assert.assertEquals(HttpServletResponse.SC_OK, response.getStatus());
         Assert.assertEquals("basic", response.getContentAsString());
      }
      {
         MockHttpRequest request = MockHttpRequest.put("/basic");
         request.content("basic".getBytes());
         request.contentType("text/plain");
         MockHttpResponse response = new MockHttpResponse();

         dispatcher.invoke(request, response);


         Assert.assertEquals(204, response.getStatus());
      }
      {
         MockHttpRequest request = MockHttpRequest.get("/queryParam?" + "param=" + URLEncoder.encode("hello world", "UTF-8"));
         MockHttpResponse response = new MockHttpResponse();

         dispatcher.invoke(request, response);


         Assert.assertEquals(HttpServletResponse.SC_OK, response.getStatus());
         Assert.assertEquals("hello world", response.getContentAsString());
      }
      {
         MockHttpRequest request = MockHttpRequest.get("/uriParam/1234");
         MockHttpResponse response = new MockHttpResponse();

         dispatcher.invoke(request, response);

View Full Code Here

Examples of org.rendersnake.test.MockHttpRequest

import junit.framework.TestCase;

public class DebugServletCanvasTest extends TestCase {

    public void testRenderCount() throws IOException {
        DebugHtmlCanvas html = new DebugHtmlCanvas(new MockHttpRequest(), new MockHttpResponse(), new StringWriter());
        html.render(new PersonalPage());
        assertEquals(3, html.renderCount);
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.