Examples of InMemoryClientExecutor


Examples of org.jboss.resteasy.client.core.executors.InMemoryClientExecutor

   }

   @Test
   public void testCustomInjectorFactory() throws Exception
   {
      InMemoryClientExecutor executor = new InMemoryClientExecutor(initializeDispatcher());
      executor.getRegistry().addPerRequestResource(HelloResource.class);

      Object result = new ClientRequest("/", executor).get().getEntity(String.class);
      Assert.assertEquals("world", result);
   }
View Full Code Here

Examples of org.jboss.resteasy.client.core.executors.InMemoryClientExecutor

    * This method tests RESTEASY-356
    */
   @Test
   public void testProxiedSubresource() throws Exception
   {
      InMemoryClientExecutor executor = new InMemoryClientExecutor();
      executor.getRegistry().addPerRequestResource(Garage.class);
      ClientResponse<String> result = new ClientRequest("/garage/car", executor).get(String.class);

      assertEquals(200, result.getStatus());
      assertEquals("MT-123AB", result.getEntity());
   }
View Full Code Here

Examples of org.jboss.resteasy.client.core.executors.InMemoryClientExecutor

   private static ResponseObjectClient client;

   @BeforeClass
   public static void setup()
   {
      executor = new InMemoryClientExecutor();
      executor.getRegistry().addPerRequestResource(ResponseObjectResource.class);
      client = ProxyFactory.create(ResponseObjectClient.class, "", executor);
   }
View Full Code Here

Examples of org.jboss.resteasy.client.core.executors.InMemoryClientExecutor

   }

   @Test
   public void testSimple() throws Exception
   {
      InMemoryClientExecutor executor = new InMemoryClientExecutor();
      executor.getDispatcher().getRegistry().addPerRequestResource(SimpleTest.class);
      ClientRequest request = new ClientRequest("/foo", executor);
      request.body("text/plain", "hello world");
      Assert.assertEquals("hello world", request.postTarget(String.class));

      request = new ClientRequest("/foo", executor);
View Full Code Here

Examples of org.jboss.resteasy.client.core.executors.InMemoryClientExecutor

{

   @Test
   public void testNoDefaultsResource() throws Exception
   {
      InMemoryClientExecutor executor = new InMemoryClientExecutor(createDispatcher());
      Registry registry = executor.getRegistry();
      int oldSize = registry.getSize();
      registry.addPerRequestResource(SimpleResource.class);
      Assert.assertTrue(oldSize < registry.getSize());

      {
View Full Code Here

Examples of org.jboss.resteasy.client.core.executors.InMemoryClientExecutor

public class CustomProviderPreferenceTest {

    @Test
    public void testCustomProviderPreference() throws Exception {

        InMemoryClientExecutor executor = new InMemoryClientExecutor();
        executor.getRegistry().addPerRequestResource(UserResource.class);
        executor.getDispatcher().getProviderFactory().registerProvider(UserBodyWriter.class);
        ClientResponse<String> result = new ClientRequest("/user", executor).get(String.class);

        assertEquals(200, result.getStatus());
        assertEquals("jharting;email@example.com", result.getEntity());
    }
View Full Code Here

Examples of org.jboss.resteasy.client.core.executors.InMemoryClientExecutor

   }

   @Test
   public void testLocatingResource() throws Exception
   {
      InMemoryClientExecutor executor = new InMemoryClientExecutor(createDispatcher());
      Registry registry = executor.getRegistry();
      int oldSize = registry.getSize();
      registry.addPerRequestResource(LocatingResource.class);
      Assert.assertTrue(oldSize < registry.getSize());

      {
View Full Code Here

Examples of org.jboss.resteasy.client.core.executors.InMemoryClientExecutor

   
    @Test
    @Ignore
    public void testApplicationProvidedLessSpecificWriterOverBuiltinStringWriter() throws Exception {

        InMemoryClientExecutor executor = new InMemoryClientExecutor();
        executor.getRegistry().addPerRequestResource(StringResource.class);
        executor.getDispatcher().getProviderFactory().registerProvider(GeneralWriter.class);
        ClientResponse<String> result = new ClientRequest("/test", executor).get(String.class);

        assertEquals(200, result.getStatus());
        assertEquals("The resource returned: Hello world!", result.getEntity());
    }
View Full Code Here

Examples of org.jboss.resteasy.client.core.executors.InMemoryClientExecutor

   }

   @Test
   public void testCustomInjectorFactory() throws Exception
   {
      InMemoryClientExecutor executor = new InMemoryClientExecutor(initializeDispatcher());
      executor.getRegistry().addPerRequestResource(HelloResource.class);

      Object result = new ClientRequest("/", executor).get().getEntity(String.class);
      Assert.assertEquals("world", result);
   }
View Full Code Here

Examples of org.jboss.resteasy.client.core.executors.InMemoryClientExecutor

    * This method tests RESTEASY-356
    */
   @Test
   public void testProxiedSubresource() throws Exception
   {
      InMemoryClientExecutor executor = new InMemoryClientExecutor();
      executor.getRegistry().addPerRequestResource(Garage.class);
      ClientResponse<String> result = new ClientRequest("/garage/car", executor).get(String.class);

      assertEquals(200, result.getStatus());
      assertEquals("MT-123AB", result.getEntity());
   }
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.