Examples of AtomFeed


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

    }

    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();
        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

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

        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();
        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

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

            throw new WebApplicationException(e);
        }
    }

    public AtomFeed toAtomFeed(UriInfo uriInfo) {
        AtomFeed feed = new AtomFeed();
        feed.setId(id+"");
        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

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

    public void testJAXBElementProviderReaderWriter() throws SecurityException,
        NoSuchFieldException {

        JAXBElementXmlProvider provider = new JAXBElementXmlProvider();
        AtomFeed af = new AtomFeed();
        org.apache.wink.common.model.atom.ObjectFactory objectFactory =
            new org.apache.wink.common.model.atom.ObjectFactory();
        JAXBElement<AtomFeed> feed = objectFactory.createFeed(af);
        Type genericType =
            JAXBElementProviderTest.class.getDeclaredField("atomfeed").getGenericType();
View Full Code Here

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

    }

    public void testJAXBXmlElementProviderReaderWriter() throws SecurityException,
        NoSuchFieldException {
        JAXBXmlProvider provider = new JAXBXmlProvider();
        AtomFeed af = new AtomFeed();

        assertTrue(provider.isWriteable(af.getClass(), null, null, new MediaType("text", "xml")));
        assertTrue(provider.isWriteable(af.getClass(), null, null, new MediaType("application",
                                                                                 "xml")));
        assertTrue(provider.isWriteable(af.getClass(), null, null, new MediaType("application",
                                                                                 "atom+xml")));
        assertTrue(provider.isWriteable(af.getClass(), null, null, new MediaType("application",
                                                                                 "atomsvc+xml")));
        assertFalse(provider.isWriteable(af.getClass(), null, null, new MediaType("text", "plain")));

        assertTrue(provider.isReadable(af.getClass(), null, null, new MediaType("text", "xml")));
        assertTrue(provider.isReadable(af.getClass(), null, null, new MediaType("application",
                                                                                "xml")));
        assertTrue(provider.isReadable(af.getClass(), null, null, new MediaType("application",
                                                                                "atom+xml")));
        assertTrue(provider.isReadable(af.getClass(), null, null, new MediaType("application",
                                                                                "atomsvc+xml")));
        assertFalse(provider.isReadable(af.getClass(), null, null, new MediaType("text", "plain")));
    }
View Full Code Here

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

    public static class Resource {

        @POST
        @Path("jaxbelement")
        public JAXBElement<AtomFeed> createWraped(JAXBElement<AtomFeed> feed) {
            AtomFeed atomFeed = new AtomFeed();
            atomFeed.setId(feed.getValue().getId());
            JAXBElement<AtomFeed> wrapedFeed = new ObjectFactory().createFeed(atomFeed);
            return wrapedFeed;
        }
View Full Code Here

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

        }

        @POST
        @Path("xmlrootwithfactory")
        public AtomFeed createBare(AtomFeed feed) {
            AtomFeed atomFeed = new AtomFeed();
            atomFeed.setId(feed.getId());
            return atomFeed;
        }
View Full Code Here

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

        @POST
        @Path("jaxbelement")
        public List<JAXBElement<AtomFeed>> createWrapped(List<JAXBElement<AtomFeed>> feedList) {
            List<JAXBElement<AtomFeed>> wrappedFeeds = new ArrayList<JAXBElement<AtomFeed>>();
            for (JAXBElement<AtomFeed> feed : feedList) {
                AtomFeed atomFeed = new AtomFeed();
                atomFeed.setId(feed.getValue().getId() + 10);
                JAXBElement<AtomFeed> wrappedFeed = new ObjectFactory().createFeed(atomFeed);
                wrappedFeeds.add(wrappedFeed);
            }
            return wrappedFeeds;
        }
View Full Code Here

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

        @POST
        @Path("xmlrootwithfactorycollection")
        public List<AtomFeed> createBareCollection(List<AtomFeed> feedList) {
            List<AtomFeed> feeds = new ArrayList<AtomFeed>();
            for (AtomFeed feed : feedList) {
                AtomFeed atomFeed = new AtomFeed();
                atomFeed.setId(feed.getId() + 10);
                feeds.add(atomFeed);
            }
            return feeds;
        }
View Full Code Here

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

        @POST
        @Path("xmlrootwithfactoryarray")
        public AtomFeed[] createBareArray(AtomFeed[] feedList) {
            List<AtomFeed> feeds = new ArrayList<AtomFeed>();
            for (AtomFeed feed : feedList) {
                AtomFeed atomFeed = new AtomFeed();
                atomFeed.setId(feed.getId() + 10);
                feeds.add(atomFeed);
            }
            return feeds.toArray(new AtomFeed[] {});
        }
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.