Package com.google.gdata.data

Examples of com.google.gdata.data.Entry


        assertEquals(entryID, entry.getId());
    }

    @Test
    public void testClientPost() throws Exception {
        Entry newEntry = new Entry();
        newEntry.setTitle(new PlainTextConstruct("NewEntry title by Post"));
        newEntry.setContent(new PlainTextConstruct("NewEntry Content by Post"));       
        Entry postedEntry = testService.clientPost(newEntry);       
        assertEquals("NewEntry title by Post", postedEntry.getTitle().getPlainText());
    }
View Full Code Here


        String newTitleValue = "newTitleValueByPut";
        String entryID = "urn:uuid:customer-0";
        System.out.println("Before clientPut");
        testService.clientPut(entryID, newTitleValue);
        System.out.println("After clientPut");
        Entry updatedEntry = testService.clientGetEntry(entryID);
        System.out.println("title: "+ updatedEntry.getTitle().getPlainText());
        assertEquals(newTitleValue, updatedEntry.getTitle().getPlainText());
    }
View Full Code Here

    public void testClientDelete() throws Exception {

        // We first create a new entry, then delete it

        // Post a new entry
        Entry newEntry = new Entry();
        newEntry.setTitle(new PlainTextConstruct("NewEntry title to be deleted"));
        newEntry.setContent(new PlainTextConstruct("NewEntry Content to be delted"));
        Entry confirmedNewEntry = testService.clientPost(newEntry);

        Thread.sleep(300);
      
        Feed feed00 = testService.clientGetFeed();
        int entryNum00 = feed00.getEntries().size(); // The number of entries
                                                        // before deleting
        System.out.println("entryNum00:" + entryNum00);
               
        // Delete this newly created entry
        String entryID = confirmedNewEntry.getId();
        Thread.sleep(300);
       
        System.out.println("confirmed entry ID: " + confirmedNewEntry.getId());
        System.out.println("confirmed entry title: " + confirmedNewEntry.getTitle().getPlainText());
       
        System.out.println("Before test clientDelete");
        testService.clientDelete(entryID);
        System.out.println("After test clientDelete");
       
View Full Code Here

   
    // Call Collection.get(entryID)
    public Entry clientGetEntry(String entryID) throws Exception {
        // Get an existing entry based on its id
        System.out.println(">>> get an existing entry from the provider service");
        Entry entry = resourceCollection.get(entryID);
        System.out.println("\n\n!!! Entry retrieved with id=" + entry.getId()
            + " title="
            + entry.getTitle().getPlainText());
        return entry;
    }
View Full Code Here

      
    // Call Collection.post(newEntry)
    public Entry clientPost(Entry newEntry) throws Exception {
        // Put a new entry to the provider
        System.out.println(">>> post a new entry to the provider service");
        Entry confirmedNewEntry = resourceCollection.post(newEntry);
        System.out.println("!!! New entry posted with id=" + confirmedNewEntry.getId()
            + " title="
            + confirmedNewEntry.getTitle().getPlainText());       
        System.out.println("\n");
        return confirmedNewEntry;
    }
View Full Code Here

    public void clientPut(String entryID, String newTitle) throws Exception {

        System.out.println("clientPut");
        // Put a new entry to the provider
        System.out.println(">>> put id=" + entryID + " title=" + newTitle);
        Entry entry = resourceCollection.get(entryID);
       
        //change the title of this entry
        entry.setTitle(new PlainTextConstruct(newTitle));
        resourceCollection.put(entryID, entry);
        System.out.println("!!! Updated entry with id=" + entry.getId() + " title=" + entry.getTitle());
        System.out.println("\n");
    }
View Full Code Here

   
   
    @Test
    public void testClientGetEntry() throws Exception {
        String entryID = "8308734583601887890";
        Entry blogEntry = testService.clientGetEntry(entryID);
        System.out.println("Entry ID: " + blogEntry.getId());
        assertTrue(blogEntry.getId().endsWith(entryID));
        System.out.println("------------------------------------------------------------\n\n");
    }
View Full Code Here

    public void testClientPut() throws Exception
        String entryID = "2889832689497686762";         
        String newBlogEntryTitle = "updatedTitleByTestCase2";
        testService.clientPut(entryID, newBlogEntryTitle);      //update the title
        Thread.sleep(300);           
        Entry updatedEntry = testService.clientGetEntry(entryID);        
        assertEquals(newBlogEntryTitle, updatedEntry.getTitle().getPlainText());
    }
View Full Code Here

                           (content.length() > 0 ? ": " : "") + content);
      }

      // Insert, update, and delete an entry if so requested.
      if (updateEntry) {
        BaseEntry newEntry = new Entry();
        newEntry.setTitle(new PlainTextConstruct("Sample entry title"));
        newEntry.setContent(new PlainTextConstruct("Sample entry content"));
        BaseEntry e = service.insert(feedUrl, newEntry);
        System.out.println("Inserted an entry, ID is " + e.getId());
        e.setContent(new PlainTextConstruct("New sample entry content"));
        service.update(new URL(e.getEditLink().getHref()), e);
        System.out.println("Updated the entry");
View Full Code Here

    final URL feedUrl = new URL(METAFEED_URL);
    Feed resultFeed = myService.getFeed(feedUrl, Feed.class);

    // If the user has a blog then return the id (which comes after 'blog-')
    if (resultFeed.getEntries().size() > 0) {
      Entry entry = resultFeed.getEntries().get(0);
      return entry.getId().split("blog-")[1];
    }
    throw new IOException("User has no blogs!");
  }
View Full Code Here

TOP

Related Classes of com.google.gdata.data.Entry

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.