Package org.jboss.resteasy.core

Examples of org.jboss.resteasy.core.Dispatcher.invoke()


      {
         MockHttpRequest request = MockHttpRequest.get("/locating/uriParam/x123");
         MockHttpResponse response = new MockHttpResponse();

         dispatcher.invoke(request, response);

         Assert.assertEquals(HttpServletResponse.SC_BAD_REQUEST, response.getStatus());

         // XXX Should this be SC_NOT_FOUND?
         // Assert.assertEquals(HttpServletResponse.SC_NOT_FOUND, response.getStatus());
View Full Code Here


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

         dispatcher.invoke(request, response);

         Assert.assertEquals(HttpServletResponse.SC_NOT_FOUND, response.getStatus());
         Assert.assertEquals("", response.getContentAsString());
      }
View Full Code Here

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

         dispatcher.invoke(request, response);

         Assert.assertEquals(HttpServletResponse.SC_NOT_FOUND, response.getStatus());
         Assert.assertEquals("", response.getContentAsString());
      }
View Full Code Here

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

         dispatcher.invoke(request, response);

         Assert.assertEquals(HttpServletResponse.SC_OK, response.getStatus());
         Assert.assertEquals("basic", response.getContentAsString());
      }
View Full Code Here

         System.out.println("Expect to see WARN about not injecting in subresources");

         MockHttpRequest request = MockHttpRequest.get("/subresource/testContextParam");
         MockHttpResponse response = new MockHttpResponse();

         dispatcher.invoke(request, response);

         Assert.assertEquals(204, response.getStatus());
      }

   }
View Full Code Here

      dispatcher.getRegistry().addPerRequestResource(BaseResource.class);
      {
         MockHttpRequest request = MockHttpRequest.get("/base/1/resources");
         MockHttpResponse response = new MockHttpResponse();

         dispatcher.invoke(request, response);


         Assert.assertEquals(HttpServletResponse.SC_OK, response.getStatus());
         Assert.assertEquals(Subresource.class.getName(), response.getContentAsString());
      }
View Full Code Here

      {
         MockHttpRequest request = MockHttpRequest.get("/base/1/resources/subresource2/stuff/2/bar");
         MockHttpResponse response = new MockHttpResponse();

         dispatcher.invoke(request, response);


         Assert.assertEquals(HttpServletResponse.SC_OK, response.getStatus());
         Assert.assertEquals(Subresource2.class.getName() + "-2", response.getContentAsString());
      }
View Full Code Here

      dispatcher.getRegistry().addPerRequestResource(Directory.class);
      {
         MockHttpRequest request = MockHttpRequest.delete("/directory/receivers/1");
         MockHttpResponse response = new MockHttpResponse();

         dispatcher.invoke(request, response);


         Assert.assertEquals(HttpServletResponse.SC_OK, response.getStatus());
         Assert.assertEquals(Directory.class.getName(), new String(response.getOutput()));
      }
View Full Code Here

      dispatcher.getRegistry().addPerRequestResource(CollectionResource.class);
      {
         MockHttpRequest request = MockHttpRequest.get("/collection/annotation_free_subresource");
         MockHttpResponse response = new MockHttpResponse();

         dispatcher.invoke(request, response);

         Assert.assertEquals(HttpServletResponse.SC_OK, response.getStatus());
         Assert.assertEquals("got", response.getContentAsString());
         Assert.assertNotNull(response.getOutputHeaders().get("Content-Type"));
         Assert.assertTrue(response.getOutputHeaders().get("Content-Type").size() > 0);
View Full Code Here

      {
         MockHttpRequest request = MockHttpRequest.post("/collection/annotation_free_subresource");
         request.content("hello!".getBytes()).contentType(MediaType.TEXT_PLAIN);
         MockHttpResponse response = new MockHttpResponse();

         dispatcher.invoke(request, response);

         Assert.assertEquals(HttpServletResponse.SC_OK, response.getStatus());
         Assert.assertEquals("posted: hello!", response.getContentAsString());
      }
   }
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.