Package org.jboss.resteasy.client

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


      request.body("application/xml", foo);
      ClientResponse res = request.post();
      Assert.assertEquals(res.getEntity(String.class), "Bill");

      request = new ClientRequest(generateURL("/test2"));
      res = request.post();
      Assert.assertEquals(res.getEntity(String.class), "NULL");


   }
View Full Code Here


              + "<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();
      Assert.assertEquals(2, map.size());
View Full Code Here

      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

              + "</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"));
      request.body("application/xml", xml);
View Full Code Here

      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();
      Assert.assertEquals(2, map.size());
View Full Code Here

   @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());
   }

   /**
    *  * Test case for RESTEASY-169
View Full Code Here

              + "<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

   @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

      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());
      Assert.assertEquals(list.get(0).getTest(), "hello");
View Full Code Here

      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);
      Assert.assertEquals(list[0].getTest(), "hello");
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.