Package org.apache.wink.client

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


        assertEquals("Welcome to the wink developer blog!!", entry.getContent().getValue());
        assertEquals("welcomePosting", entry.getTitle().getValue());
        assertEquals(0, entry.getLinks().size());

        resource = client.resource(BASE_URI + "/blogs/0/entries/1");
        entry = resource.accept("application/atom+xml").get(AtomEntry.class);
        assertNotNull(entry.getAuthors());
        assertEquals(1, entry.getAuthors().size());
        author = entry.getAuthors().get(0);
        assertNotNull(author);
        assertEquals("Blog Admin", author.getName());
View Full Code Here


        assertEquals(1, entry.getLinks().size());
        List<AtomLink> comments = entry.getLinks();
        assertEquals(BASE_URI + "/blogs/0/entries/1/comments/0", comments.get(0).getHref());

        resource = client.resource(BASE_URI + "/blogs/1/entries/2");
        entry = resource.accept("application/atom+xml").get(AtomEntry.class);
        assertNotNull(entry.getAuthors());
        assertEquals(1, entry.getAuthors().size());
        author = entry.getAuthors().get(0);
        assertNotNull(author);
        assertEquals("Eager User", author.getName());
View Full Code Here

    }

    public void testAtomGETBlogComments() throws Exception {
        RestClient client = new RestClient();
        Resource resource = client.resource(BASE_URI + "/blogs/0/entries/1/comments/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("Wink Coder", author.getName());
View Full Code Here

        assertEquals("Great!", entry.getTitle().getValue());
        assertEquals("Instructions look great! Now I can begin Wink development!", entry
            .getContent().getValue());

        resource = client.resource(BASE_URI + "/blogs/1/entries/2/comments/0");
        entry = resource.accept("application/atom+xml").get(AtomEntry.class);
        assertNotNull(entry.getAuthors());
        assertEquals(1, entry.getAuthors().size());
        author = entry.getAuthors().get(0);
        assertNotNull(author);
        assertEquals("Blog Reader", author.getName());
View Full Code Here

        content.setValue("This is a new entry in the blog");
        entry.setContent(content);
        entry.setTitle(new AtomText(("New blog entry")));

        ClientResponse uri =
            resource.accept("application/atom+xml").contentType("application/atom+xml").post(entry);
        String location = uri.getHeaders().getFirst("Location");
        assertEquals(BASE_URI + "/blogs/0/entries/3", location);

        resource = client.resource(location);
        AtomEntry postedEntry = resource.accept("application/atom+xml").get(AtomEntry.class);
View Full Code Here

            resource.accept("application/atom+xml").contentType("application/atom+xml").post(entry);
        String location = uri.getHeaders().getFirst("Location");
        assertEquals(BASE_URI + "/blogs/0/entries/3", location);

        resource = client.resource(location);
        AtomEntry postedEntry = resource.accept("application/atom+xml").get(AtomEntry.class);
        author = postedEntry.getAuthors().get(0);
        assertNotNull(author);
        assertEquals("Blog Admin", author.getName());
        assertEquals("winkblogadmin@wink.blog.com", author.getEmail());
        assertEquals("3", postedEntry.getId());
View Full Code Here

        assertEquals("This is a new entry in the blog", entry.getContent().getValue());
        assertEquals("New blog entry", entry.getTitle().getValue());
        assertEquals(0, entry.getLinks().size());

        resource = client.resource(BASE_URI + "/blogs/0");
        AtomFeed feed = resource.accept("application/atom+xml").get(AtomFeed.class);
        List<AtomLink> expectedLinks = new ArrayList<AtomLink>();
        AtomLink link = new AtomLink();
        link.setHref(BASE_URI + "/blogs/0/entries/0");
        expectedLinks.add(link);
        link = new AtomLink();
View Full Code Here

        content.setValue("I was able to set up the Wink development environment!");
        entry.setContent(content);
        entry.setTitle(new AtomText(("Success")));

        ClientResponse uri =
            resource.accept("application/atom+xml").contentType("application/atom+xml").post(entry);
        String location = uri.getHeaders().getFirst("Location");
        assertEquals(BASE_URI + "/blogs/0/entries/1/comments/1", location);

        resource = client.resource(location);
        AtomEntry postedEntry = resource.accept("application/atom+xml").get(AtomEntry.class);
View Full Code Here

            resource.accept("application/atom+xml").contentType("application/atom+xml").post(entry);
        String location = uri.getHeaders().getFirst("Location");
        assertEquals(BASE_URI + "/blogs/0/entries/1/comments/1", location);

        resource = client.resource(location);
        AtomEntry postedEntry = resource.accept("application/atom+xml").get(AtomEntry.class);
        author = postedEntry.getAuthors().get(0);
        assertNotNull(author);
        assertEquals("Wink Coder", author.getName());
        assertEquals("winkcoder@mybusiness.com", author.getEmail());
        assertEquals("I was able to set up the Wink development environment!", entry.getContent()
View Full Code Here

        assertEquals("I was able to set up the Wink development environment!", entry.getContent()
            .getValue());
        assertEquals("Success", entry.getTitle().getValue());

        resource = client.resource(BASE_URI + "/blogs/0/entries/1");
        entry = resource.accept("application/atom+xml").get(AtomEntry.class);
        List<AtomLink> expectedLinks = new ArrayList<AtomLink>();
        AtomLink link = new AtomLink();
        link.setHref(BASE_URI + "/blogs/0/entries/1/comments/0");
        expectedLinks.add(link);
        link = new AtomLink();
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.