Package org.apache.wink.client

Examples of org.apache.wink.client.RestClient


    }

    public RestClient getReadTimeoutClient() {
        ClientConfig config = new ClientConfig();
        config.readTimeout(20000);
        return new RestClient(config);
    }
View Full Code Here


                classes.add(JsonProvider.class);
                return classes;
            }

        });
        client = new RestClient(config);
    }
View Full Code Here

    }

    public RestClient getConnectTimeoutClient() {
        ClientConfig config = new ClientConfig();
        config.connectTimeout(20000);
        return new RestClient(config);
    }
View Full Code Here

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

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

        }
    }

    public void setUp() throws Exception {
        ClientConfig config = new ClientConfig();
        client = new RestClient(config);
    }
View Full Code Here

                return classes;
            }

        });

        client = new RestClient(config);
    }
View Full Code Here

     * If no entity class is specified in the initial GET, then the
     * {@link AcceptHeaderHandler} should not set anything. However, the
     * underlying client may set the header as a failsafe.
     */
    public void testAcceptHeaderNoEntity() {
        RestClient client = new RestClient();
        ClientResponse resp = client.resource(getBaseURI() + "/echoaccept").get();
        /*
         * in this case the underlying client set the WILDCARD header for
         * default HttpURLConnection based client.
         */
        assertEquals("echo: " + MediaType.WILDCARD, resp.getEntity(String.class));
View Full Code Here

    protected RestClient client;

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

            BASE_URI = ServerEnvironmentInfo.getBaseURI() + "/blogservice";
        }
    }

    public void testAtomGETBlogs() throws Exception {
        RestClient client = new RestClient();
        Resource resource = client.resource(BASE_URI);
        AtomFeed feed = resource.accept("application/atom+xml").get(AtomFeed.class);
        assertEquals(BlogService.ID, feed.getId());
        assertEquals(BlogService.ID, feed.getTitle().getValue());

        List<AtomLink> expectedLinks = new ArrayList<AtomLink>();
View Full Code Here

        for (int i = 0; i < actual.size(); ++i)
            assertEquals(expectedLinks.get(i).getHref(), actual.get(i).getHref());
    }

    public void testAtomGETBlog() throws Exception {
        RestClient client = new RestClient();
        Resource resource = client.resource(BASE_URI + "/blogs/0");
        AtomFeed feed = resource.accept("application/atom+xml").get(AtomFeed.class);
        assertEquals("0", feed.getId());
        assertEquals("wink-developer-blog", feed.getTitle().getValue());

        List<AtomLink> expectedLinks = new ArrayList<AtomLink>();
        AtomLink link = new AtomLink();
        link.setHref(BASE_URI + "/blogs/0/entries/0");
        expectedLinks.add(link);
        link = new AtomLink();
        link.setHref(BASE_URI + "/blogs/0/entries/1");
        expectedLinks.add(link);
        List<AtomLink> actual = feed.getLinks();
        assertEquals(expectedLinks.size(), actual.size());
        for (int i = 0; i < actual.size(); ++i)
            assertEquals(expectedLinks.get(i).getHref(), actual.get(i).getHref());

        client = new RestClient();
        resource = client.resource(BASE_URI + "/blogs/1");
        feed = resource.accept("application/atom+xml").get(AtomFeed.class);
        assertEquals("1", feed.getId());
        assertEquals("wink-user-blog", feed.getTitle().getValue());

        expectedLinks = new ArrayList<AtomLink>();
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.