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

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


        @GET
        @Path("atomentry")
        @Produces("application/atom+xml")
        public AtomEntry getAtomEntry() throws IOException {
            AtomEntry entry = AtomEntry.unmarshal(new StringReader(ENTRY));
            return entry;
        }
View Full Code Here


        @GET
        @Path("atomentryelement")
        @Produces("application/atom+xml")
        public JAXBElement<AtomEntry> getAtomEntryElement() throws IOException {
            AtomEntry entry = AtomEntry.unmarshal(new StringReader(ENTRY));
            org.apache.wink.common.model.atom.ObjectFactory of =
                new org.apache.wink.common.model.atom.ObjectFactory();
            return of.createEntry(entry);
        }
View Full Code Here

        @GET
        @Path("atomsyndentry")
        @Produces("application/atom+xml")
        public SyndEntry getSyndEntry() throws IOException {
            AtomEntry entry = AtomEntry.unmarshal(new StringReader(ENTRY));
            return entry.toSynd(new SyndEntry());
        }
View Full Code Here

        @GET
        @Path("atomentry")
        @Produces("application/atom+xml")
        public Response getAtomEntry() throws IOException {
            AtomEntry entry = AtomEntry.unmarshal(new StringReader(ENTRY));
            return Response.ok(entry).build();
        }
View Full Code Here

        @GET
        @Path("atomentryelement")
        @Produces("application/atom+xml")
        public Response getAtomEntryElement() throws IOException {
            AtomEntry entry = AtomEntry.unmarshal(new StringReader(ENTRY));
            org.apache.wink.common.model.atom.ObjectFactory of =
                new org.apache.wink.common.model.atom.ObjectFactory();
            return Response.ok(of.createEntry(entry)).build();
        }
View Full Code Here

        @GET
        @Path("atomsyndentry")
        @Produces("application/atom+xml")
        public Response getSyndEntry() throws IOException {
            AtomEntry entry = AtomEntry.unmarshal(new StringReader(ENTRY));
            return Response.ok(entry.toSynd(new SyndEntry())).build();
        }
View Full Code Here

        }
       
        @POST
        @Path("jaxbentry")
        public JAXBElement<AtomEntry> createWrappedElement(JAXBElement<AtomEntry> element) {
            AtomEntry atomEntry = new AtomEntry();
            atomEntry.setId(element.getValue().getId());
            AtomContent content = new AtomContent();
            content.setType(MediaType.APPLICATION_XML);
            Blob blob = new Blob();
            content.setValue(blob);
            atomEntry.setContent(content);
            JAXBElement<AtomEntry> wrappedEntry = new ObjectFactory().createEntry(atomEntry);
            return wrappedEntry;
        }
View Full Code Here

        setContent(comment.getContent().getValue());
        return toAtomEntry();
    }
   
    public AtomEntry toAtomEntry() {
        AtomEntry entry = new AtomEntry();
        AtomContent content = new AtomContent();
        content.setValue(this.content);
        content.setType("String");
        entry.setContent(content);
        entry.getAuthors().add(this.author.toAtomPerson());
        entry.setTitle(new AtomText(this.title));
        return entry;
    }
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());
        assertEquals("winkcoder@mybusiness.com", author.getEmail());
        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());
        assertEquals("blogreader@blogreaders.org", author.getEmail());
        assertEquals("Good news", entry.getTitle().getValue());
        assertEquals("This is good news. I'll be sure to try it out.", entry.getContent().getValue());
    }
View Full Code Here

    }
   
    public void testAtomPOSTBlogEntry() throws Exception {
        RestClient client = new RestClient();
        Resource resource = client.resource(BASE_URI+"/blogs/0/entries");
        AtomEntry entry = new AtomEntry();
        AtomPerson author = new AtomPerson();
        author.setName("Blog Admin");
        author.setEmail("winkblogadmin@wink.blog.com");
        entry.getAuthors().add(author);
        AtomContent content = new AtomContent();
        content.setType("String");
        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);
        author = postedEntry.getAuthors().get(0);
        assertNotNull(author);
        assertEquals("Blog Admin", author.getName());
        assertEquals("winkblogadmin@wink.blog.com", author.getEmail());
        assertEquals("3", postedEntry.getId());
        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");
View Full Code Here

TOP

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

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.