Examples of body()


Examples of org.jboss.resteasy.client.ClientRequest.body()

   public void test2() throws Exception
   {
      ClientRequest request = new ClientRequest(generateURL("/test2"));
      Foo foo = new Foo();
      foo.setName("Bill");
      request.body("application/xml", foo);
      ClientResponse res = request.post();
      Assert.assertEquals(res.getEntity(String.class), "Bill");

      request = new ClientRequest(generateURL("/test2"));
      res = request.post();
View Full Code Here

Examples of org.jboss.resteasy.client.ClientRequest.body()

              + "<resteasy:entry key=\"monica\" xmlns=\"http://foo.com\">"
              + "<foo name=\"monica\"/></resteasy:entry>"
              + "</resteasy:map>";

      ClientRequest request = new ClientRequest(generateURL("/map"));
      request.body("application/xml", xml);
      ClientResponse<Map<String, Foo>> response = request.post(new GenericType<Map<String, Foo>>()
      {
      });
      Assert.assertEquals(200, response.getStatus());
      Map<String, Foo> map = response.getEntity();
View Full Code Here

Examples of org.jboss.resteasy.client.ClientRequest.body()

      Assert.assertNotNull(map.get("monica"));
      Assert.assertEquals(map.get("bill").getName(), "bill");
      Assert.assertEquals(map.get("monica").getName(), "monica");

      request = new ClientRequest(generateURL("/map"));
      request.body("application/xml", xml);
      ClientResponse<String> response2 = request.post(String.class);
      System.out.println(response2.getEntity());


   }
View Full Code Here

Examples of org.jboss.resteasy.client.ClientRequest.body()

              + "<foo:foo name=\"monica\"/></entry>"
              + "</map>";


      ClientRequest request = new ClientRequest(generateURL("/map/wrapped"));
      request.body("application/xml", xml);
      ClientResponse<String> response2 = request.post(String.class);
      Assert.assertEquals(200, response2.getStatus());
      System.out.println(response2.getEntity());

      request = new ClientRequest(generateURL("/map/wrapped"));
View Full Code Here

Examples of org.jboss.resteasy.client.ClientRequest.body()

    */
   @Test
   public void testBadRequest() throws Exception
   {
      ClientRequest request = new ClientRequest(generateURL("/test"));
      request.body("application/xml", "<junk");
      ClientResponse res = request.post();
      Assert.assertEquals(Response.Status.BAD_REQUEST.getStatusCode(), res.getStatus());
   }

   /**
 
View Full Code Here

Examples of org.jboss.resteasy.client.ClientRequest.body()

      ClientResponse<String> response2 = request.post(String.class);
      Assert.assertEquals(200, response2.getStatus());
      System.out.println(response2.getEntity());

      request = new ClientRequest(generateURL("/map/wrapped"));
      request.body("application/xml", xml);
      ClientResponse<Map<String, Foo>> response = request.post(new GenericType<Map<String, Foo>>()
      {
      });
      Assert.assertEquals(200, response.getStatus());
      Map<String, Foo> map = response.getEntity();
View Full Code Here

Examples of org.jboss.resteasy.client.ClientRequest.body()

              + "<resteasy:entry key=\"monica\" xmlns=\"http://foo.com\">"
              + "<foo name=\"monica\"/></resteasy:entry>"
              + "</resteasy:map>";

      ClientRequest request = new ClientRequest(generateURL("/map/wrapped"));
      request.body("application/xml", xml);
      ClientResponse<String> response2 = request.post(String.class);
      Assert.assertEquals(400, response2.getStatus());

   }
}
View Full Code Here

Examples of org.jboss.resteasy.client.ClientRequest.body()

   @Test
   public void testFailure() throws Exception
   {
      ClientRequest request = new ClientRequest(TestPortProvider.generateURL("/test"));
      request.body("application/xml", "<person");
      ClientResponse<?> response = request.post();
      Assert.assertEquals(400, response.getStatus());
      String output = response.getEntity(String.class);
      System.out.println(output);
   }
View Full Code Here

Examples of org.jboss.resteasy.client.ClientRequest.body()

   {
      String xml = "<resteasy:collection xmlns:resteasy=\"http://jboss.org/resteasy\">"
              + "<foo test=\"hello\"/></resteasy:collection>";

      ClientRequest request = new ClientRequest(generateURL("/array"));
      request.body("application/xml", xml);
      ClientResponse<List<Foo>> response = request.post(new GenericType<List<Foo>>()
      {
      });
      List<Foo> list = response.getEntity();
      Assert.assertEquals(1, list.size());
View Full Code Here

Examples of org.jboss.resteasy.client.ClientRequest.body()

   {
      String xml = "<list>"
              + "<foo test=\"hello\"/></list>";

      ClientRequest request = new ClientRequest(generateURL("/list"));
      request.body("application/xml", xml);
      ClientResponse<Foo[]> response = request.post(new GenericType<Foo[]>()
      {
      });
      Foo[] list = response.getEntity();
      Assert.assertEquals(1, list.length);
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.