Package org.apache.wink.client

Examples of org.apache.wink.client.Resource.accept()


   
    public void testXMLRootWithObjectFactoryListResponse() throws Exception {
        List<Book> source = getBookSource();
        Resource resource = client.resource(BASE_URI + "/booklistresponse");
        ClientResponse response =
            resource.accept(MediaType.APPLICATION_XML).contentType(MediaType.APPLICATION_XML)
                .post(new GenericEntity<List<Book>>(source) {
                });
        List<Book> responseEntity = response.getEntity(new EntityType<List<Book>>() {
        });
View Full Code Here


   
    public void testXMLRootWithObjectFactoryJAXBElement() throws Exception {
        List<Book> source = getBookSource();
        Resource resource = client.resource(BASE_URI + "/booklistjaxbelement");
        ClientResponse response =
            resource.accept(MediaType.APPLICATION_XML).contentType(MediaType.APPLICATION_XML)
                .post(new GenericEntity<List<Book>>(source) {
                });
        List<Book> responseEntity = response.getEntity(new EntityType<List<Book>>() {
        });
View Full Code Here

   
    public void testXMLRootNoObjectFactoryList() throws Exception {
        List<Person> source = getPersonSource();
        Resource resource = client.resource(BASE_URI + "/personlist");
        ClientResponse response =
            resource.accept(MediaType.APPLICATION_XML).contentType(MediaType.APPLICATION_XML)
                .post(new GenericEntity<List<Person>>(source) {
                });
        List<Person> responseEntity = response.getEntity(new EntityType<List<Person>>() {
        });
View Full Code Here

   
    public void testXMLRootNoObjectFactoryArray() throws Exception {
        Person[] source = getPersonSource().toArray(new Person[]{});
        Resource resource = client.resource(BASE_URI + "/personarray");
        ClientResponse response =
            resource.accept(MediaType.APPLICATION_XML).contentType(MediaType.APPLICATION_XML)
                .post(new GenericEntity<Person[]>(source) {
                });
        Person[] responseEntity = response.getEntity(new EntityType<Person[]>() {
        });
View Full Code Here

   
    public void testXMLRootNoObjectFactoryListResponse() throws Exception {
        List<Person> source = getPersonSource();
        Resource resource = client.resource(BASE_URI + "/personlistresponse");
        ClientResponse response =
            resource.accept(MediaType.APPLICATION_XML).contentType(MediaType.APPLICATION_XML)
                .post(new GenericEntity<List<Person>>(source) {
                });
        List<Person> responseEntity = response.getEntity(new EntityType<List<Person>>() {
        });
View Full Code Here

   
    public void testXMLRootNoObjectFactoryJAXBElement() throws Exception {
        List<Person> source = getPersonSource();
        Resource resource = client.resource(BASE_URI + "/personlistjaxbelement");
        ClientResponse response =
            resource.accept(MediaType.APPLICATION_XML).contentType(MediaType.APPLICATION_XML)
                .post(new GenericEntity<List<Person>>(source) {
                });
        List<Person> responseEntity = response.getEntity(new EntityType<List<Person>>() {
        });
View Full Code Here

    }

    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>();
        AtomLink link = new AtomLink();
View Full Code Here

    }

    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();
View Full Code Here

        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>();
        link = new AtomLink();
View Full Code Here

    }

    public void testAtomGETBlogEntry() throws Exception {
        RestClient client = new RestClient();
        Resource resource = client.resource(BASE_URI + "/blogs/0/entries/0");
        AtomEntry entry = resource.accept("application/atom+xml").get(AtomEntry.class);
        assertNotNull(entry.getAuthors());
        assertEquals(1, entry.getAuthors().size());
        AtomPerson author = entry.getAuthors().get(0);
        assertNotNull(author);
        assertEquals("Blog Admin", author.getName());
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.