Package org.apache.wink.client

Examples of org.apache.wink.client.RestClient


    protected RestClient client;

    @Override
    public void setUp() throws Exception {
        super.setUp();
        client = new RestClient();
    }
View Full Code Here


    @RunAsClient
    public void simpleClientToServerCall() throws URISyntaxException, MalformedURLException {
        Assert.assertNotNull(url);
        String resourcePath = TEST_SERVLET_PATH + TestController.PATH;

        RestClient restClient = new RestClient(new ClientConfig());

        URL resourceURL = new URL(url.toExternalForm() + resourcePath);
        Resource resource = restClient.resource(resourceURL.toURI());

        // invoke GET on the resource and check the result
        Assert.assertEquals("Hello CDI", resource.get(SyndFeed.class).getTitle().getValue());
    }
View Full Code Here

//        "geronimo-servlet_2.5_spec").versionAsInProject()));
  }

  @Test
  public void testRestServletResolves() {
    new RestClient();
  }
View Full Code Here

                                                     .toString())).start();
    }

    @Test
    public void testDummy() {
        RestClient client = new RestClient();
        ClientResponse response = client.resource("http://localhost:8080/world").get();
        String out = response.getEntity(String.class);
        System.out.println(out);
        Assert.assertEquals(200, response.getStatusCode());
    }
View Full Code Here

            }

        });
       
        config.readTimeout(binding.getReadTimeout());
        RestClient client = new RestClient(config);
       
        // Default to GET for RPC
        httpMethod = HttpMethod.GET;

        for (Map.Entry<Class<?>, String> e : mapping.entrySet()) {
View Full Code Here

    protected RestClient client;

    @Override
    public void setUp() throws Exception {
        super.setUp();
        client = new RestClient();
    }
View Full Code Here

    @Override
    public void setUp() throws Exception {
        super.setUp();
        client =
            new RestClient(new ClientConfig().acceptHeaderAutoSet(false)
                .applications(new Application() {

                    @Override
                    public Set<Class<?>> getClasses() {
                        Set<Class<?>> classes = new HashSet<Class<?>>();
View Full Code Here

    /**
     * Test that a request is processed if it takes less time than the timeout
     * value
     */
    public void testReadTimeoutNoTimeout() {
        RestClient client = getDefaultClient();
        Resource resource = client.resource(getBaseURI() + "?timeout=5000");
        ClientResponse response = resource.get();
        assertEquals(200, response.getStatusCode());
        assertEquals("request processed", response.getEntity(String.class));
    }
View Full Code Here

    /**
     * Test that the client times out if the request is not processed in less
     * than the readTimeout value
     */
    public void testReadTimeoutTimeout() {
        RestClient client = getDefaultClient();
        Resource resource = client.resource(getBaseURI() + "?timeout=30000");
        try {
            resource.get();
            fail("The client did not timeout after waiting more than 20000 milliseconds for the request.");
        } catch (ClientRuntimeException e) {
            assertTrue(e.getMessage().indexOf("SocketTimeoutException") != -1);
View Full Code Here

            assertTrue(e.getMessage().indexOf("SocketTimeoutException") != -1);
        }
    }

    public RestClient getDefaultClient() {
        return new RestClient();
    }
View Full Code Here

TOP

Related Classes of org.apache.wink.client.RestClient

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.