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

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


    }
   
    public void testAtomPostBlogComment() throws Exception {
        RestClient client = new RestClient();
        Resource resource = client.resource(BASE_URI+"/blogs/0/entries/1/comments");
        AtomEntry entry = new AtomEntry();
        AtomPerson author = new AtomPerson();
        author.setName("Wink Coder");
        author.setEmail("winkcoder@mybusiness.com");
        entry.getAuthors().add(author);
        AtomContent content = new AtomContent();
        content.setType("String");
        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);
        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().getValue());
        assertEquals("Success", entry.getTitle().getValue());
View Full Code Here


    }
   
    public void testAtomPUTBlogEntry() throws Exception {
        RestClient client = new RestClient();
        Resource resource = client.resource(BASE_URI+"/blogs/0/entries/0");
        AtomEntry entry = resource.accept("application/atom+xml").get(AtomEntry.class);
        AtomPerson author = entry.getAuthors().get(0);
        author.setName(author.getName()+"Updated");
        author.setEmail(author.getEmail()+"Updated");
        AtomText title = entry.getTitle();
        title.setValue(title.getValue()+"Updated");
        AtomContent content = entry.getContent();
        content.setValue(content.getValue()+"Updated");
       
        resource = client.resource(BASE_URI+"/blogs/0/entries/0");
        AtomEntry updated = resource.accept("application/atom+xml").contentType("application/atom+xml").put(AtomEntry.class, entry);
        assertNotNull(updated.getAuthors());
        assertEquals(1, updated.getAuthors().size());
        author = updated.getAuthors().get(0);
        assertNotNull(author);
        assertEquals("Blog AdminUpdated", author.getName());
        assertEquals("winkblogadmin@wink.blog.comUpdated", author.getEmail());
        assertEquals("0", updated.getId());
        assertEquals("Welcome to the wink developer blog!!Updated", updated.getContent().getValue());
        assertEquals("welcomePostingUpdated", updated.getTitle().getValue());
    }
View Full Code Here

    }
   
    public void testAtomPUTBlogComment() 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);
        AtomPerson author = entry.getAuthors().get(0);
        author.setName(author.getName()+"Updated");
        author.setEmail(author.getEmail()+"Updated");
        AtomText title = entry.getTitle();
        title.setValue(title.getValue()+"Updated");
        AtomContent content = entry.getContent();
        content.setValue(content.getValue()+"Updated");
       
        resource = client.resource(BASE_URI+"/blogs/0/entries/1/comments/0");
        AtomEntry updated = resource.accept("application/atom+xml").contentType("application/atom+xml").put(AtomEntry.class, entry);
        assertNotNull(updated.getAuthors());
        assertEquals(1, updated.getAuthors().size());
        author = updated.getAuthors().get(0);
        assertNotNull(author);
        assertNotNull(author);
        assertEquals("Wink CoderUpdated", author.getName());
        assertEquals("winkcoder@mybusiness.comUpdated", author.getEmail());
        assertEquals("Great!Updated", entry.getTitle().getValue());
View Full Code Here

    }
   
    public void testAtomGETBlogEntry() throws Exception {
        RestClient client = new RestClient();
        Resource resource = client.resource(BASE_URI+"/blogs/0/entries/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("Blog Admin", author.getName());
        assertEquals("winkblogadmin@wink.blog.com", author.getEmail());
        assertEquals("0", entry.getId());
        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());
        assertEquals("winkblogadmin@wink.blog.com", author.getEmail());
        assertEquals("1", entry.getId());
        assertEquals("Wink developers,\n\nInstructions on how to set up the wink development have been posted to the wink wiki. Happy wink development!\n\nw--inkblogadmin", entry.getContent().getValue());
        assertEquals("Wink Development Env", entry.getTitle().getValue());
        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());
        assertEquals("winkuser@wink.blog.com", author.getEmail());
        assertEquals("2", entry.getId());
        assertEquals("I hear that the 0.1 SNAPSHOT will be available soon! I can't wait!!!", entry.getContent().getValue());
        assertEquals("0.1 SNAPSHOT", entry.getTitle().getValue());
        comments = entry.getLinks();
        assertEquals(1, entry.getLinks().size());
        assertEquals(BASE_URI+"/blogs/1/entries/2/comments/0", comments.get(0).getHref());
    }
View Full Code Here

            constructMockRequest("GET", "/world", MediaTypeUtils.ATOM_ENTRY);
        MockHttpServletResponse response = invoke(request);

        // check resulting mock response
        assertEquals("HTTP status", HttpStatus.OK.getCode(), response.getStatus());
        AtomEntry entry = AtomEntry.unmarshal(new StringReader(response.getContentAsString()));
        String id = entry.getId();
        assertEquals("entry id", HelloWorld.ID, id);
    }
View Full Code Here

        @GET
        @Produces("application/atom+xml")
        public AtomEntryAsset getAsset() {
            AtomEntryAsset asset = new AtomEntryAsset();
            AtomEntry ae = new AtomEntry();
            ae.setId("id");
            ae.setTitle(new AtomText("title", AtomTextType.text));
            asset.setEntity(ae);
            return asset;

        }
View Full Code Here

        @GET
        @Path("jaxbelement")
        @Produces("application/atom+xml")
        public AtomEntryJaxbAsset getAssetAsJaxbElement() {
            AtomEntryJaxbAsset asset = new AtomEntryJaxbAsset();
            AtomEntry ae = new AtomEntry();
            ae.setId("id");
            ae.setTitle(new AtomText("title", AtomTextType.text));
            ObjectFactory of = new ObjectFactory();
            asset.entry = of.createEntry(ae);
            return asset;
        }
View Full Code Here

        @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

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.