Package org.jboss.resteasy.client.jaxrs

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


public class SayHelloTest {

     @Test
     public void testEcho()
     {
       ResteasyClient client = new ResteasyClientBuilder().build();
       ResteasyWebTarget target = client.target("http://localhost:9095");
       HelloString proxy = target.proxy(HelloString.class);
       String hello = proxy.sayHi("hello");
       Assert.assertEquals("hello", hello);
     }
View Full Code Here


   }

   @Test
   public void testEcho()  throws Exception
   {
      ResteasyClient client1 = new ResteasyClientBuilder().socketTimeout(2, TimeUnit.SECONDS).build();
      ClientHttpEngine engine = client1.httpEngine();
      Assert.assertNotNull(engine);

      ResteasyClient client = new ResteasyClientBuilder().httpEngine(engine).build();
      ResteasyWebTarget target = client.target(TestPortProvider.generateURL("/timeout"));
      try
      {
         Response response = target.queryParam("sleep", "5").request().get();
         Assert.fail();
View Full Code Here

   private static final String SPACES_REQUEST = "something something";

   @Test
   public void testEcho()
   {
      ResteasyClient client = new ResteasyClientBuilder().build();
      HelloClient proxy = client.target(generateBaseUrl()).proxy(HelloClient.class);
      Assert.assertEquals(SPACES_REQUEST, proxy.sayHi(SPACES_REQUEST));
      client.close();
   }
View Full Code Here

   @Test
   public void testInvalidMediaTypes() throws Exception
   {
      before();
      ResteasyClient client = new ResteasyClientBuilder().build();
      Invocation.Builder request = client.target(TestPortProvider.generateURL("/test")).request();
     
      // Missing type or subtype
      doTest(request, "/");
      doTest(request, "/*");
 
View Full Code Here

  @BeforeClass
  public static void setUp() throws Exception
  {
    addPerRequestResource(FooImpl.class);
      client = new ResteasyClientBuilder().build();
  }
View Full Code Here

   }

   @Test
   public void testContext() throws Exception
   {
      ResteasyClient client = new ResteasyClientBuilder().build();
      Invocation.Builder request = client.target(TestPortProvider.generateURL("/super/test/BaseService")).request();
      Response response = request.get();
      System.out.println("status: " + response.getStatus());
      String s = response.readEntity(String.class);
      System.out.println("response: " + s);
View Full Code Here

   }

   @Test
   public void testInheritedContextOneLevel() throws Exception
   {
      ResteasyClient client = new ResteasyClientBuilder().build();
      Invocation.Builder request = client.target(TestPortProvider.generateURL("/sub/test/SomeService")).request();
      Response response = request.get();
      System.out.println("status: " + response.getStatus());
      String s = response.readEntity(String.class);
      System.out.println("response: " + s);
View Full Code Here

   }
  
   @Test
   public void testInheritedContextTwoLevels() throws Exception
   {
      ResteasyClient client = new ResteasyClientBuilder().build();
      Invocation.Builder request = client.target(TestPortProvider.generateURL("/subsub/test/SomeSubService")).request();
      Response response = request.get();
      System.out.println("status: " + response.getStatus());
      String s = response.readEntity(String.class);
      System.out.println("response: " + s);
View Full Code Here

         {
            sb.append("0");
         }
         String body = sb.toString();

         ResteasyClient client = new ResteasyClientBuilder().httpEngine(executor).build();
         Response response = client.target(generateURL("/hello")).request().post(Entity.text(body));
         System.out.println("Received response");
         Assert.assertEquals(200, response.getStatus());
         Assert.assertEquals(body, response.readEntity(String.class));
         if (inMemory)
View Full Code Here

      tjws.setPort(TestPortProvider.getPort());
      tjws.setRootResourcePath("/");
      tjws.start();
      tjws.getDeployment().getDispatcher().getRegistry().addSingletonResource(new MyTestResource());
      String url = "http://localhost:" + TestPortProvider.getPort();
      client = new ResteasyClientBuilder().build();
      testClient = client.target(url).proxy(TestClient.class);

   }
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.