abdera-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jmsn...@apache.org
Subject svn commit: r471003 - in /incubator/abdera/java/trunk/extensions/src: main/java/org/apache/abdera/ext/history/ test/java/org/apache/abdera/test/ext/ test/java/org/apache/abdera/test/ext/history/
Date Fri, 03 Nov 2006 21:46:44 GMT
Author: jmsnell
Date: Fri Nov  3 13:46:44 2006
New Revision: 471003

URL: http://svn.apache.org/viewvc?view=rev&rev=471003
Log:
The Feed History spec has been renamed to "Feed Paging and Archiving". 
Rename the FeedHistoryHelper appropriately.
Add some javadocs
Plug the junit test into the test suite

Added:
    incubator/abdera/java/trunk/extensions/src/main/java/org/apache/abdera/ext/history/FeedPagingHelper.java
      - copied, changed from r470978, incubator/abdera/java/trunk/extensions/src/main/java/org/apache/abdera/ext/history/FeedHistoryHelper.java
    incubator/abdera/java/trunk/extensions/src/test/java/org/apache/abdera/test/ext/history/FeedPagingTest.java
      - copied, changed from r470978, incubator/abdera/java/trunk/extensions/src/test/java/org/apache/abdera/test/ext/history/HistoryTest.java
Removed:
    incubator/abdera/java/trunk/extensions/src/main/java/org/apache/abdera/ext/history/FeedHistoryHelper.java
    incubator/abdera/java/trunk/extensions/src/test/java/org/apache/abdera/test/ext/history/HistoryTest.java
Modified:
    incubator/abdera/java/trunk/extensions/src/test/java/org/apache/abdera/test/ext/TestSuite.java

Copied: incubator/abdera/java/trunk/extensions/src/main/java/org/apache/abdera/ext/history/FeedPagingHelper.java
(from r470978, incubator/abdera/java/trunk/extensions/src/main/java/org/apache/abdera/ext/history/FeedHistoryHelper.java)
URL: http://svn.apache.org/viewvc/incubator/abdera/java/trunk/extensions/src/main/java/org/apache/abdera/ext/history/FeedPagingHelper.java?view=diff&rev=471003&p1=incubator/abdera/java/trunk/extensions/src/main/java/org/apache/abdera/ext/history/FeedHistoryHelper.java&r1=470978&p2=incubator/abdera/java/trunk/extensions/src/main/java/org/apache/abdera/ext/history/FeedPagingHelper.java&r2=471003
==============================================================================
--- incubator/abdera/java/trunk/extensions/src/main/java/org/apache/abdera/ext/history/FeedHistoryHelper.java
(original)
+++ incubator/abdera/java/trunk/extensions/src/main/java/org/apache/abdera/ext/history/FeedPagingHelper.java
Fri Nov  3 13:46:44 2006
@@ -26,19 +26,32 @@
 import org.apache.abdera.util.iri.IRISyntaxException;
 
 /**
- * Initial support for Mark Nottingham's Feed History draft 
+ * Initial support for Mark Nottingham's Feed Paging and Archiving draft 
  * (http://ietfreport.isoc.org/all-ids/draft-nottingham-atompub-feed-history-07.txt)
  */
-public class FeedHistoryHelper {
+public class FeedPagingHelper {
 
   public static final String FHNS = "http://purl.org/syndication/history/1.0";
   public static final QName COMPLETE = new QName(FHNS, "complete");
   public static final QName ARCHIVE = new QName(FHNS, "archive");
   
+  /**
+   * Returns true if the feed is "complete". According to the Feed Paging
+   * and Archiving specification, in a complete feed, "any entry not actually 
+   * in the feed document SHOULD NOT be considered to be part of that feed."
+   * @param feed The feed to check
+   */
   public static boolean isComplete(Feed feed) {
     return (feed.getExtension(COMPLETE) != null);
   }
   
+  /**
+   * Flag the feed as being complete.  According to the Feed Paging
+   * and Archiving specification, in a complete feed, "any entry not actually 
+   * in the feed document SHOULD NOT be considered to be part of that feed."
+   * @param feed The Feed to mark as complete
+   * @param complete True if the feed is complete
+   */
   public static void setComplete(Feed feed, boolean complete) {
     if (complete) {
       if (!isComplete(feed)) feed.addExtension(COMPLETE);
@@ -50,6 +63,11 @@
     }
   }
   
+  /**
+   * Flag the feed as being an archive.
+   * @param feed The Feed to mark as an archive
+   * @param archive True if the feed is an archive
+   */
   public static void setArchive(Feed feed, boolean archive) {
     if (archive) {
       if (!isArchive(feed)) feed.addExtension(ARCHIVE);
@@ -61,10 +79,19 @@
     }
   }
 
+  /**
+   * Return true if the feed has been marked as an archive
+   * @param feed The feed to check
+   */
   public static boolean isArchive(Feed feed) {
     return feed.getExtension(ARCHIVE) != null;
   }
   
+  /**
+   * Return true if the feed contains any next, previous, first or last 
+   * paging link relations
+   * @param feed The feed to check
+   */
   public static boolean isPaged(Feed feed) {
     return feed.getLink("next") != null ||
            feed.getLink("previous") != null ||
@@ -72,6 +99,12 @@
            feed.getLink("last") != null;
   }
   
+  /**
+   * Adds a next link relation to the feed
+   * @param feed The feed 
+   * @param iri The IRI of the next feed document
+   * @returns The newly created Link
+   */
   public static Link setNext(Feed feed, String iri) throws IRISyntaxException {
     Link link = feed.getLink("next");
     if (link != null) {
@@ -82,6 +115,12 @@
     return link;
   }
   
+  /**
+   * Adds a previous link relation to the feed
+   * @param feed The feed 
+   * @param iri The IRI of the previous feed document
+   * @returns The newly created Link
+   */
   public static Link setPrevious(Feed feed, String iri) throws IRISyntaxException {
     Link link = feed.getLink("previous");
     if (link != null) {
@@ -92,6 +131,12 @@
     return link;
   }
   
+  /**
+   * Adds a first link relation to the feed
+   * @param feed The feed 
+   * @param iri The IRI of the first feed document
+   * @returns The newly created Link
+   */
   public static Link setFirst(Feed feed, String iri) throws IRISyntaxException {
     Link link = feed.getLink("first");
     if (link != null) {
@@ -102,6 +147,12 @@
     return link;
   }
   
+  /**
+   * Adds a last link relation to the feed
+   * @param feed The feed 
+   * @param iri The IRI of the last feed document
+   * @returns The newly created Link
+   */
   public static Link setLast(Feed feed, String iri) throws IRISyntaxException {
     Link link = feed.getLink("last");
     if (link != null) {
@@ -112,6 +163,12 @@
     return link;
   }
   
+  /**
+   * Adds a next-archive link relation to the feed
+   * @param feed The feed 
+   * @param iri The IRI of the next archive feed document
+   * @returns The newly created Link
+   */
   public static Link setNextArchive(Feed feed, String iri) throws IRISyntaxException {
     Link link = feed.getLink("next-archive");
     if (link == null) { // try the full IANA URI version
@@ -125,6 +182,12 @@
     return link;
   }
   
+  /**
+   * Adds a prev-archive link relation to the feed
+   * @param feed The feed 
+   * @param iri The IRI of the previous archive feed document
+   * @returns The newly created Link
+   */
   public static Link setPreviousArchive(Feed feed, String iri) throws IRISyntaxException
{
     Link link = feed.getLink("prev-archive");
     if (link == null) { // try the full IANA URI version
@@ -138,6 +201,12 @@
     return link;
   }
   
+  /**
+   * Adds a current link relation to the feed
+   * @param feed The feed 
+   * @param iri The IRI of the current feed document
+   * @returns The newly created Link
+   */
   public static Link setCurrent(Feed feed, String iri) throws IRISyntaxException {
     Link link = feed.getLink("current");
     if (link == null) { // try the full IANA URI version
@@ -151,26 +220,41 @@
     return link;
   }
   
+  /**
+   * Returns the IRI of the next link relation
+   */
   public static IRI getNext(Feed feed) throws IRISyntaxException {
     Link link = feed.getLink("next");
     return (link != null) ? link.getResolvedHref() : null;
   }
   
+  /**
+   * Returns the IRI of the previous link relation
+   */
   public static IRI getPrevious(Feed feed) throws IRISyntaxException {
     Link link = feed.getLink("previous");
     return (link != null) ? link.getResolvedHref() : null;
   }
   
+  /**
+   * Returns the IRI of the first link relation
+   */
   public static IRI getFirst(Feed feed) throws IRISyntaxException {
     Link link = feed.getLink("first");
     return (link != null) ? link.getResolvedHref() : null;
   }
   
+  /**
+   * Returns the IRI of the last link relation
+   */
   public static IRI getLast(Feed feed) throws IRISyntaxException {
     Link link = feed.getLink("last");
     return (link != null) ? link.getResolvedHref() : null;
   }
   
+  /**
+   * Returns the IRI of the prev-archive link relation
+   */
   public static IRI getPreviousArchive(Feed feed) throws IRISyntaxException {
     Link link = feed.getLink("prev-archive");
     if (link == null) { // try the full IANA URI version
@@ -179,6 +263,9 @@
     return (link != null) ? link.getResolvedHref() : null;
   }
   
+  /**
+   * Returns the IRI of the next-archive link relation
+   */
   public static IRI getNextArchive(Feed feed) throws IRISyntaxException {
     Link link = feed.getLink("next-archive");
     if (link == null) { // try the full IANA URI version
@@ -187,6 +274,9 @@
     return (link != null) ? link.getResolvedHref() : null;
   }
   
+  /**
+   * Returns the IRI of the current link relation
+   */
   public static IRI getCurrent(Feed feed) throws IRISyntaxException {
     Link link = feed.getLink("current");
     if (link == null) { // try the full IANA URI version

Modified: incubator/abdera/java/trunk/extensions/src/test/java/org/apache/abdera/test/ext/TestSuite.java
URL: http://svn.apache.org/viewvc/incubator/abdera/java/trunk/extensions/src/test/java/org/apache/abdera/test/ext/TestSuite.java?view=diff&rev=471003&r1=471002&r2=471003
==============================================================================
--- incubator/abdera/java/trunk/extensions/src/test/java/org/apache/abdera/test/ext/TestSuite.java
(original)
+++ incubator/abdera/java/trunk/extensions/src/test/java/org/apache/abdera/test/ext/TestSuite.java
Fri Nov  3 13:46:44 2006
@@ -18,6 +18,7 @@
 package org.apache.abdera.test.ext;
 
 import org.apache.abdera.test.ext.opensearch.*;
+import org.apache.abdera.test.ext.history.FeedPagingTest;
 
 public class TestSuite extends junit.framework.TestSuite {
   public static void main(String[] args)
@@ -28,5 +29,6 @@
   public TestSuite()
   {
     addTestSuite(OpenSearchTest.class);
+    addTestSuite(FeedPagingTest.class);
   }
 }

Copied: incubator/abdera/java/trunk/extensions/src/test/java/org/apache/abdera/test/ext/history/FeedPagingTest.java
(from r470978, incubator/abdera/java/trunk/extensions/src/test/java/org/apache/abdera/test/ext/history/HistoryTest.java)
URL: http://svn.apache.org/viewvc/incubator/abdera/java/trunk/extensions/src/test/java/org/apache/abdera/test/ext/history/FeedPagingTest.java?view=diff&rev=471003&p1=incubator/abdera/java/trunk/extensions/src/test/java/org/apache/abdera/test/ext/history/HistoryTest.java&r1=470978&p2=incubator/abdera/java/trunk/extensions/src/test/java/org/apache/abdera/test/ext/history/FeedPagingTest.java&r2=471003
==============================================================================
--- incubator/abdera/java/trunk/extensions/src/test/java/org/apache/abdera/test/ext/history/HistoryTest.java
(original)
+++ incubator/abdera/java/trunk/extensions/src/test/java/org/apache/abdera/test/ext/history/FeedPagingTest.java
Fri Nov  3 13:46:44 2006
@@ -18,12 +18,12 @@
 package org.apache.abdera.test.ext.history;
 
 import org.apache.abdera.Abdera;
-import org.apache.abdera.ext.history.FeedHistoryHelper;
+import org.apache.abdera.ext.history.FeedPagingHelper;
 import org.apache.abdera.model.Feed;
 
 import junit.framework.TestCase;
 
-public class HistoryTest extends TestCase {
+public class FeedPagingTest extends TestCase {
 
   public static void testHistory() throws Exception {
     
@@ -31,43 +31,43 @@
     
     Feed feed = abdera.getFactory().newFeed();
 
-    FeedHistoryHelper.setComplete(feed, true);
-    FeedHistoryHelper.setArchive(feed, true);
+    FeedPagingHelper.setComplete(feed, true);
+    FeedPagingHelper.setArchive(feed, true);
 
-    FeedHistoryHelper.setNext(feed, "http://example.org/foo");
-    FeedHistoryHelper.setNext(feed, "http://example.org/bar");
+    FeedPagingHelper.setNext(feed, "http://example.org/foo");
+    FeedPagingHelper.setNext(feed, "http://example.org/bar");
     
-    FeedHistoryHelper.setPrevious(feed, "http://example.org/foo");
-    FeedHistoryHelper.setPrevious(feed, "http://example.org/bar");
+    FeedPagingHelper.setPrevious(feed, "http://example.org/foo");
+    FeedPagingHelper.setPrevious(feed, "http://example.org/bar");
     
-    FeedHistoryHelper.setLast(feed, "http://example.org/foo");
-    FeedHistoryHelper.setLast(feed, "http://example.org/bar");
+    FeedPagingHelper.setLast(feed, "http://example.org/foo");
+    FeedPagingHelper.setLast(feed, "http://example.org/bar");
 
-    FeedHistoryHelper.setFirst(feed, "http://example.org/foo");
-    FeedHistoryHelper.setFirst(feed, "http://example.org/bar");
+    FeedPagingHelper.setFirst(feed, "http://example.org/foo");
+    FeedPagingHelper.setFirst(feed, "http://example.org/bar");
 
-    FeedHistoryHelper.setPreviousArchive(feed, "http://example.org/foo");
-    FeedHistoryHelper.setPreviousArchive(feed, "http://example.org/bar");
+    FeedPagingHelper.setPreviousArchive(feed, "http://example.org/foo");
+    FeedPagingHelper.setPreviousArchive(feed, "http://example.org/bar");
     
-    FeedHistoryHelper.setNextArchive(feed, "http://example.org/foo");
-    FeedHistoryHelper.setNextArchive(feed, "http://example.org/bar");
+    FeedPagingHelper.setNextArchive(feed, "http://example.org/foo");
+    FeedPagingHelper.setNextArchive(feed, "http://example.org/bar");
 
-    FeedHistoryHelper.setCurrent(feed, "http://example.org/foo");
-    FeedHistoryHelper.setCurrent(feed, "http://example.org/bar");
+    FeedPagingHelper.setCurrent(feed, "http://example.org/foo");
+    FeedPagingHelper.setCurrent(feed, "http://example.org/bar");
     
-    assertTrue(FeedHistoryHelper.isPaged(feed));
-    assertTrue(FeedHistoryHelper.isComplete(feed));
-    assertTrue(FeedHistoryHelper.isArchive(feed));
+    assertTrue(FeedPagingHelper.isPaged(feed));
+    assertTrue(FeedPagingHelper.isComplete(feed));
+    assertTrue(FeedPagingHelper.isArchive(feed));
     
-    assertNotNull(FeedHistoryHelper.getNext(feed));
-    assertNotNull(FeedHistoryHelper.getPrevious(feed));
-    assertNotNull(FeedHistoryHelper.getLast(feed));
-    assertNotNull(FeedHistoryHelper.getFirst(feed));
-    assertNotNull(FeedHistoryHelper.getNextArchive(feed));
-    assertNotNull(FeedHistoryHelper.getPreviousArchive(feed));
-    assertNotNull(FeedHistoryHelper.getCurrent(feed));
+    assertNotNull(FeedPagingHelper.getNext(feed));
+    assertNotNull(FeedPagingHelper.getPrevious(feed));
+    assertNotNull(FeedPagingHelper.getLast(feed));
+    assertNotNull(FeedPagingHelper.getFirst(feed));
+    assertNotNull(FeedPagingHelper.getNextArchive(feed));
+    assertNotNull(FeedPagingHelper.getPreviousArchive(feed));
+    assertNotNull(FeedPagingHelper.getCurrent(feed));
     
-    assertEquals(FeedHistoryHelper.getNext(feed).toString(),"http://example.org/bar");
+    assertEquals(FeedPagingHelper.getNext(feed).toString(),"http://example.org/bar");
   }
   
 }



Mime
View raw message