Package org.apache.wink.client

Examples of org.apache.wink.client.Resource


        client = new RestClient(config);
    }

    public void testXMLRootWithObjectFactoryList() throws Exception {
        List<Book> source = getBookSource();
        Resource resource = client.resource(BASE_URI + "/booklist");
        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


        verifyResponse(responseEntity, Book.class);
    }
   
    public void testXMLRootWithObjectFactoryArray() throws Exception {
        Book[] source = getBookSource().toArray(new Book[]{});
        Resource resource = client.resource(BASE_URI + "/bookarray");
        ClientResponse response =
            resource.accept(MediaType.APPLICATION_XML).contentType(MediaType.APPLICATION_XML)
                .post(new GenericEntity<Book[]>(source) {
                });
        Book[] responseEntity = response.getEntity(new EntityType<Book[]>() {
        });
View Full Code Here

        verifyResponse(responseEntity, Book.class);
    }
   
    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

        verifyResponse(responseEntity, Book.class);
    }
   
    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

        verifyResponse(responseEntity, Book.class);
    }
   
    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

        verifyResponse(responseEntity, Person.class);
    }
   
    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

        verifyResponse(responseEntity, Person.class);
    }
   
    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

        verifyResponse(responseEntity, Person.class);
    }
   
    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

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

TOP

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

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.