Examples of AtomFeed


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

                        Type genericType,
                        Annotation[] annotations,
                        MediaType mediaType,
                        MultivaluedMap<String, Object> httpHeaders,
                        OutputStream entityStream) throws IOException, WebApplicationException {
        AtomFeed feed = t.getValue();
        writeFeed(feed,
                  AtomFeed.class,
                  genericType,
                  annotations,
                  mediaType,
View Full Code Here

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

                             MultivaluedMap<String, String> httpHeaders,
                             InputStream entityStream) throws IOException, WebApplicationException {

        MessageBodyReader<AtomFeed> reader =
            providers.getMessageBodyReader(AtomFeed.class, genericType, annotations, mediaType);
        AtomFeed feed =
            reader.readFrom(AtomFeed.class,
                            genericType,
                            annotations,
                            mediaType,
                            httpHeaders,
                            entityStream);
        return feed.toSynd(new SyndFeed());
    }
View Full Code Here

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

                        Type genericType,
                        Annotation[] annotations,
                        MediaType mediaType,
                        MultivaluedMap<String, Object> httpHeaders,
                        OutputStream entityStream) throws IOException, WebApplicationException {
        AtomFeed feed = new AtomFeed(t);
        MessageBodyWriter<AtomFeed> writer =
            providers.getMessageBodyWriter(AtomFeed.class, genericType, annotations, mediaType);
        writer.writeTo(feed,
                       AtomFeed.class,
                       genericType,
View Full Code Here

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

    private String diffFeed(String expectedFileName, String actual) throws Exception {
        InputStream expected = TestUtils.getResourceOfSamePackage(expectedFileName, getClass());

        // sort feeds
        AtomFeed expectedFeed = AtomFeed.unmarshal(new InputStreamReader(expected));
        AtomFeed actualFeed = AtomFeed.unmarshal(new StringReader(actual));
        Collections.sort(actualFeed.getEntries(), new AtomEntryComparator());
        Collections.sort(expectedFeed.getEntries(), new AtomEntryComparator());

        ByteArrayOutputStream actualOS = new ByteArrayOutputStream();
        ByteArrayOutputStream expectedOS = new ByteArrayOutputStream();
        AtomFeed.marshal(expectedFeed, expectedOS);
View Full Code Here

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

        Unmarshaller unmarshaller = AtomFeed.getUnmarshaller();
        InputStreamReader reader =
            new InputStreamReader(entityStream, ProviderUtils.getCharset(mediaType));
        Object object = AtomJAXBUtils.unmarshal(unmarshaller, reader);
        AtomFeed feed = null;
        if (object instanceof AtomFeed) {
            feed = (AtomFeed)object;
        } else {
            logger.error("request entity is not an atom feed (it was unmarshalled as {})", object
                .getClass());
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

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