Package org.jboss.resteasy.client.jaxrs

Examples of org.jboss.resteasy.client.jaxrs.ResteasyClientBuilder


   @Test
   public void testGoodRealmCreation() throws Exception
   {
      RealmRepresentation realm = SkeletonTestBase.loadJson("testrealm.json");

      Client client = new ResteasyClientBuilder().build();
      WebTarget target = client.target(generateURL("/realms"));
      Response response = target.request().post(Entity.json(realm));
      Assert.assertEquals(201, response.getStatus());
      response.close();
      client.close();
View Full Code Here


   }

   @Test
   public void testAsync() throws Exception
   {
      ResteasyClient client = new ResteasyClientBuilder().build();

      {
         Future<Response> future = client.target(generateURL("/test")).request().async().get();
         Response res = future.get();
         Assert.assertEquals(200, res.getStatus());
View Full Code Here

   static boolean ok;

   @Test
   public void testAsyncCallback() throws Exception
   {
      ResteasyClient client = new ResteasyClientBuilder().build();

      {
         ok = false;
         Future<Response> future = client.target(generateURL("/test")).request().async().get(new InvocationCallback<Response>()
         {
View Full Code Here


   @Test
   public void testSubmit() throws Exception
   {
      ResteasyClient client = new ResteasyClientBuilder().build();

      {
         Future<Response> future = client.target(generateURL("/test")).request().buildGet().submit();
         Response res = future.get();
         Assert.assertEquals(200, res.getStatus());
View Full Code Here

   @Test
   public void testProjects()
   {
      String newProject = "{ \"project\" : { \"name\" : \"Resteasy\", \"description\" : \"The Best of REST\", \"enabled\" : true } }";
      ResteasyClient client = new ResteasyClientBuilder().providerFactory(deployment.getProviderFactory()).build();
      ResteasyWebTarget projectsTarget = client.target(generateURL("/projects"));
      Response response = projectsTarget.request().post(Entity.json(newProject));
      Assert.assertEquals(response.getStatus(), 201);
      response.close();
      ResteasyWebTarget target = client.target(response.getLocation());
View Full Code Here

   }
   @Test
   public void testProjectsId()
   {
      String newProject = "{ \"project\" : { \"id\" : \"5\", \"name\" : \"Resteasy\", \"description\" : \"The Best of REST\", \"enabled\" : true } }";
      ResteasyClient client = new ResteasyClientBuilder().providerFactory(deployment.getProviderFactory()).build();
      Response response = client.target(generateURL("/projects")).request().post(Entity.json(newProject));
      Assert.assertEquals(response.getStatus(), 201);
      response.close();
      ResteasyWebTarget target = client.target(response.getLocation());
      String project = target.request().get(String.class);
View Full Code Here

      doTestReturnValueViolations("true", "*");
   }
  
   public void doTestInputViolations(String suppress, String fieldPath, String propertyPath, String classPath, String parameterPath) throws Exception
   {
      ResteasyClient client = new ResteasyClientBuilder().build();
      Builder builder = client.target("http://localhost:8080/RESTEASY-945-" + suppress + "/all/a/b/c").request();
      Response response = builder.get();
      System.out.println("status: " + response.getStatus());
      Object header = response.getHeaders().getFirst(Validation.VALIDATION_HEADER);
      Assert.assertTrue(header instanceof String);
View Full Code Here

      Assert.assertEquals(parameterPath, violation.getPath());
   }
  
   public void doTestReturnValueViolations(String suppress, String returnValuePath) throws Exception
   {
      ResteasyClient client = new ResteasyClientBuilder().build();
      Builder builder = client.target("http://localhost:8080/RESTEASY-945/all/aa/bbb/cccc").request();
//      builder.accept(MediaType.APPLICATION_XML);
      Response response = builder.get();
      System.out.println("status: " + response.getStatus());
      Object header = response.getHeaders().getFirst(Validation.VALIDATION_HEADER);
View Full Code Here

{
   protected Client client;

   @Before
   public void beforeTest() {
      client = new ResteasyClientBuilder().connectionPoolSize(10).build();
   }
View Full Code Here

      // You really should come up with a better way to initialize
      // and obtain the ServletOAuthClient.  I actually suggest downloading the ServletOAuthClient code
      // and take a look how it works.
      ServletOAuthClient oAuthClient = (ServletOAuthClient)request.getServletContext().getAttribute(ServletOAuthClient.class.getName());
      String token = oAuthClient.getBearerToken(request);
      ResteasyClient client = new ResteasyClientBuilder()
                 .trustStore(oAuthClient.getTruststore())
                 .hostnameVerification(ResteasyClientBuilder.HostnameVerificationPolicy.ANY).build();
      try
      {
         // invoke without the Authorization header
View Full Code Here

TOP

Related Classes of org.jboss.resteasy.client.jaxrs.ResteasyClientBuilder

Copyright © 2018 www.massapicom. 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.