Package org.apache.wink.common.model.atom

Examples of org.apache.wink.common.model.atom.AtomLink


        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();
        link.setHref(BASE_URI + "/blogs/0");
        expectedLinks.add(link);
        link = new AtomLink();
        link.setHref(BASE_URI + "/blogs/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());
View Full Code Here


        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();
        link.setHref(BASE_URI + "/blogs/1/entries/2");
        expectedLinks.add(link);
        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());
View Full Code Here

        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();
        link.setHref(BASE_URI + "/blogs/0/entries/1");
        expectedLinks.add(link);
        link = new AtomLink();
        link.setHref(BASE_URI + "/blogs/0/entries/3");
        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());
View Full Code Here

        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();
        link.setHref(BASE_URI + "/blogs/0/entries/1/comments/1");
        expectedLinks.add(link);
        List<AtomLink> actual = entry.getLinks();
        assertEquals(expectedLinks.size(), actual.size());
        for (int i = 0; i < actual.size(); ++i)
            assertEquals(expectedLinks.get(i).getHref(), actual.get(i).getHref());
View Full Code Here

        feed.setTitle(new AtomText(title));
        feed.setUpdated(updated);
        Set<Integer> ids = entries.keySet();
        List<Integer> idList = new ArrayList<Integer>(ids);
        Collections.sort(idList);
        AtomLink link = null;
        for (Integer entryId : idList) {
            link = new AtomLink();
            link.setHref(uriInfo.getBaseUri() + "blogservice/blogs/"
                + this.id
                + "/entries/"
                + entries.get(entryId).getId());
            link.setTitle(entries.get(entryId).getTitle());
            feed.getLinks().add(link);
        }
        return feed;
    }
View Full Code Here

        entry.getAuthors().add(author.toAtomPerson());
        AtomContent content = new AtomContent();
        content.setType("text");
        content.setValue(this.posting);
        entry.setContent(content);
        AtomLink link = null;
        int i = 0;
        for (Comment comment : comments) {
            link = new AtomLink();
            link.setHref(uriInfo.getBaseUri() + "blogservice/blogs/"
                + parent.getId()
                + "/entries/"
                + this.id
                + "/comments/"
                + i);
View Full Code Here

        feed.setTitle(new AtomText(title));
        feed.setUpdated(updated);
        Set<Integer> ids = entries.keySet();
        List<Integer> idList = new ArrayList<Integer>(ids);
        Collections.sort(idList);
        AtomLink link = null;
        for (Integer entryId : idList) {
            link = new AtomLink();
            link.setHref(uriInfo.getBaseUri() + "blogservice/blogs/"
                + this.id
                + "/entries/"
                + entries.get(entryId).getId());
            link.setTitle(entries.get(entryId).getTitle());
            feed.getLinks().add(link);
        }
        return feed;
    }
View Full Code Here

    @Produces("application/atom+xml")
    public AtomFeed getBlogs() {
        AtomFeed ret = new AtomFeed();
        ret.setId(BlogService.ID);
        ret.setTitle(new AtomText(BlogService.ID));
        AtomLink link = null;
        for(int i = 0; i < BlogService.blogs.size(); ++i) {
            link = new AtomLink();
            link.setHref(baseUri.getAbsolutePath() + "/blogs/" + i);
            link.setTitle(BlogService.blogs.get(i).getTitle());
            ret.getLinks().add(link);
        }
        return ret;
    }
View Full Code Here

        request.addParameter(RestConstants.REST_PARAM_ABSOLUTE_URLS, "");
        MockHttpServletResponse response = invoke(request);
        assertEquals("status", HttpStatus.OK.getCode(), response.getStatus());
        String contentString = response.getContentAsString();
        AtomEntry entry = AtomEntry.unmarshal(new StringReader(contentString));
        AtomLink link = entry.getLinks().get(0);
        assertTrue("ipv6 URI: " + link, link.getHref().startsWith(http));
    }
View Full Code Here

        request.addParameter(RestConstants.REST_PARAM_ABSOLUTE_URLS, "");
        MockHttpServletResponse response = invoke(request);
        assertEquals("status", HttpStatus.OK.getCode(), response.getStatus());
        String contentString = response.getContentAsString();
        AtomEntry entry = AtomEntry.unmarshal(new StringReader(contentString));
        AtomLink link = entry.getLinks().get(0);
        assertTrue("ipv6 URI: " + link, link.getHref().startsWith(https));
    }
View Full Code Here

TOP

Related Classes of org.apache.wink.common.model.atom.AtomLink

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.