abdera-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jmsn...@apache.org
Subject svn commit: r1186541 [8/8] - in /abdera/abdera2: ./ .settings/ activities/ activities/.settings/ activities/src/main/java/org/apache/abdera2/activities/client/ activities/src/main/java/org/apache/abdera2/activities/extra/ activities/src/main/java/org/a...
Date Wed, 19 Oct 2011 22:33:52 GMT
Modified: abdera/abdera2/test/src/main/java/org/apache/abdera2/test/activities/server/SampleBasicAdapter.java
URL: http://svn.apache.org/viewvc/abdera/abdera2/test/src/main/java/org/apache/abdera2/test/activities/server/SampleBasicAdapter.java?rev=1186541&r1=1186540&r2=1186541&view=diff
==============================================================================
--- abdera/abdera2/test/src/main/java/org/apache/abdera2/test/activities/server/SampleBasicAdapter.java (original)
+++ abdera/abdera2/test/src/main/java/org/apache/abdera2/test/activities/server/SampleBasicAdapter.java Wed Oct 19 22:33:04 2011
@@ -17,8 +17,6 @@ package org.apache.abdera2.test.activiti
  * directory of this distribution.
  */
 
-
-import java.util.Date;
 import java.util.LinkedList;
 import java.util.List;
 import java.util.logging.Logger;
@@ -91,7 +89,7 @@ public class SampleBasicAdapter extends 
         String entryId = getObjectIdFromUri(object.getId().toString());
         if (c != -1) entryId += c;
         if (object.getUpdated() == null) {
-            object.setUpdated(new Date());
+            object.setUpdatedNow();
         }
         addEditLinkToObject(object);
         storeObject(entryId, object);
@@ -105,7 +103,7 @@ public class SampleBasicAdapter extends 
             throw new Exception(ERROR_INVALID_ENTRY);
         
         if (object.getUpdated() == null) {
-            object.setUpdated(new Date());
+            object.setUpdatedNow();
         }
         addEditLinkToObject(object);
         storeObject((String)entryId, object);

Modified: abdera/abdera2/test/src/main/java/org/apache/abdera2/test/client/AppTest.java
URL: http://svn.apache.org/viewvc/abdera/abdera2/test/src/main/java/org/apache/abdera2/test/client/AppTest.java?rev=1186541&r1=1186540&r2=1186541&view=diff
==============================================================================
--- abdera/abdera2/test/src/main/java/org/apache/abdera2/test/client/AppTest.java (original)
+++ abdera/abdera2/test/src/main/java/org/apache/abdera2/test/client/AppTest.java Wed Oct 19 22:33:04 2011
@@ -62,6 +62,7 @@ import org.apache.abdera2.common.http.En
 import org.apache.abdera2.common.mediatype.MimeTypeHelper;
 import org.apache.abdera2.test.JettyUtil;
 import org.apache.abdera2.writer.WriterOptions;
+import org.joda.time.DateTime;
 import org.junit.AfterClass;
 import org.junit.BeforeClass;
 import org.junit.Test;
@@ -125,7 +126,7 @@ public class AppTest {
             Feed feed = getFactory().newFeed();
             feed.setId(base + "/collections/entries");
             feed.setTitle("Entries");
-            feed.setUpdated(new Date());
+            feed.setUpdated(DateTime.now());
             feed.addLink(base + "/collections/entries");
             feed.addLink(base + "/collections/entries", "self");
             feed.addAuthor("James");
@@ -240,7 +241,7 @@ public class AppTest {
                                     AppTest.INSTANCE.getBase() + "/collections/entries/"
                                         + feed.getRoot().getEntries().size();
                                 entry.setId(newID);
-                                entry.setUpdated(new Date());
+                                entry.setUpdated(DateTime.now());
                                 entry.addLink(entry.getId().toString(), "edit");
                                 entry.addLink(entry.getId().toString(), "self");
                                 feed.getRoot().insertEntry(entry);
@@ -261,7 +262,7 @@ public class AppTest {
                             String slug = request.getHeader("Slug");
                             entry.setId(newID);
                             entry.setTitle(slug);
-                            entry.setUpdated(new Date());
+                            entry.setUpdated(DateTime.now());
                             entry.setSummary(slug);
                             entry.addLink(entry.getId().toString(), "edit");
                             entry.addLink(AppTest.INSTANCE.getBase() + "/collections/media/" + n, "edit-media")
@@ -306,7 +307,7 @@ public class AppTest {
                             if (doc.getRoot() instanceof Entry) {
                                 Entry newentry = (Entry)doc.getRoot().clone();
                                 if (newentry.getId().equals(entry.getId())) {
-                                    newentry.setUpdated(new Date());
+                                    newentry.setUpdated(DateTime.now());
                                     entry.discard();
                                     feed.getRoot().insertEntry(newentry);
                                     response.setStatus(HttpServletResponse.SC_NO_CONTENT);
@@ -327,7 +328,7 @@ public class AppTest {
                         String media = read(request.getInputStream());
                         this.media.put(uri, media);
                         Entry entry = feed.getRoot().getEntries().get(target);
-                        entry.setUpdated(new Date());
+                        entry.setUpdated(DateTime.now());
                         response.setStatus(HttpServletResponse.SC_NO_CONTENT);
                         return;
                     }

Modified: abdera/abdera2/test/src/main/java/org/apache/abdera2/test/client/CacheTest.java
URL: http://svn.apache.org/viewvc/abdera/abdera2/test/src/main/java/org/apache/abdera2/test/client/CacheTest.java?rev=1186541&r1=1186540&r2=1186541&view=diff
==============================================================================
--- abdera/abdera2/test/src/main/java/org/apache/abdera2/test/client/CacheTest.java (original)
+++ abdera/abdera2/test/src/main/java/org/apache/abdera2/test/client/CacheTest.java Wed Oct 19 22:33:04 2011
@@ -391,10 +391,10 @@ public class CacheTest {
         options = getRequestOptions(session, 3);
         switch (type) {
             case NOCACHE:
-                options.setCacheControl(CacheControl.NOCACHE().setNoCache(false));
+                options.setCacheControl(CacheControl.NONNOCACHE());
                 break;
             case NOSTORE:
-              options.setCacheControl(CacheControl.NOSTORE().setNoStore(false));
+              options.setCacheControl(CacheControl.NONNOSTORE());
                 break;
             case MAXAGE0:
               options.setCacheControl(CacheControl.MAXAGE(60));

Modified: abdera/abdera2/test/src/main/java/org/apache/abdera2/test/common/geo/GeoTest.java
URL: http://svn.apache.org/viewvc/abdera/abdera2/test/src/main/java/org/apache/abdera2/test/common/geo/GeoTest.java?rev=1186541&r1=1186540&r2=1186541&view=diff
==============================================================================
--- abdera/abdera2/test/src/main/java/org/apache/abdera2/test/common/geo/GeoTest.java (original)
+++ abdera/abdera2/test/src/main/java/org/apache/abdera2/test/common/geo/GeoTest.java Wed Oct 19 22:33:04 2011
@@ -2,16 +2,12 @@ package org.apache.abdera2.test.common.g
 
 import org.apache.abdera2.common.geo.Box;
 import org.apache.abdera2.common.geo.Coordinate;
-import org.apache.abdera2.common.geo.Coordinates;
 import org.apache.abdera2.common.geo.IsoPosition;
 import org.apache.abdera2.common.geo.Line;
-import org.apache.abdera2.common.geo.Multiple;
 import org.apache.abdera2.common.geo.Point;
 import org.apache.abdera2.common.geo.Polygon;
 import org.junit.Test;
 import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertTrue;
 
 public class GeoTest {
 
@@ -28,7 +24,7 @@ public class GeoTest {
   public void boxTest() {
     Coordinate c1 = new Coordinate(1.0,2.0);
     Coordinate c2 = new Coordinate(3.0,4.0);
-    Box box = new Box(c1,c2);
+    Box box = Box.at(c1,c2);
     assertEquals(c1,box.getLowerCorner());
     assertEquals(c2,box.getUpperCorner());
   }
@@ -39,59 +35,31 @@ public class GeoTest {
     assertEquals(1.0,c1.getLatitude(),0);
     assertEquals(2.0,c1.getLongitude(),0);
   }
-  
-  @Test
-  public void coordinatesTest() {
-    Coordinates cs = new Coordinates();
-    cs.add(new Coordinate(1.0,2.0));
-    cs.add(new Coordinate(3.0,4.0));
-    cs.add(new Coordinate(5.0,6.0));
-    assertEquals(3,cs.size());
-    assertTrue(cs.contains(3.0,4.0));
-    cs.remove(1.0,2.0);
-    assertFalse(cs.contains(1.0,2.0));
-    assertEquals(2,cs.size());
-  }
-  
+
   @Test
   public void lineTest() {
-    Coordinates cs = new Coordinates();
-    cs.add(new Coordinate(1.0,2.0));
-    cs.add(new Coordinate(3.0,4.0));
-    cs.add(new Coordinate(5.0,6.0));
-    Line line = new Line(cs);
-    line.verify();
-  }
-  
-  @SuppressWarnings("unused")
-  @Test
-  public void multipleTest() {
-    Coordinates cs = new Coordinates();
-    cs.add(new Coordinate(1.0,2.0));
-    cs.add(new Coordinate(3.0,4.0));
-    cs.add(new Coordinate(5.0,6.0));
-    Multiple mult = new Multiple(cs) {
-      private static final long serialVersionUID = 2214118656567387273L;};
-    int n = 0;
-    for (Coordinate c : mult) n++;
-    assertEquals(3,n);
+    Line.with(
+      Coordinate.at(1.0,2.0),
+      Coordinate.at(3.0,4.0),
+      Coordinate.at(5.0,6.0)
+    );
   }
   
+  
   @Test
   public void pointTest() {
     Coordinate c = new Coordinate(1.0,2.0);
-    Point point = new Point(c);
+    Point point = Point.at(c);
     assertEquals(1.0,point.getCoordinate().getLatitude(),0);
   }
   
   @Test
   public void polygonTest() {
-    Coordinates cs = new Coordinates();
-    cs.add(new Coordinate(1.0,2.0));
-    cs.add(new Coordinate(3.0,4.0));
-    cs.add(new Coordinate(5.0,6.0));
-    Polygon poly = new Polygon(cs);
-    poly.verify();
+    Polygon.with(
+      Coordinate.at(1.0,2.0),
+      Coordinate.at(3.0,4.0),
+      Coordinate.at(5.0,6.0)
+    );
   }
   
 }

Modified: abdera/abdera2/test/src/main/java/org/apache/abdera2/test/common/http/CacheControlTest.java
URL: http://svn.apache.org/viewvc/abdera/abdera2/test/src/main/java/org/apache/abdera2/test/common/http/CacheControlTest.java?rev=1186541&r1=1186540&r2=1186541&view=diff
==============================================================================
--- abdera/abdera2/test/src/main/java/org/apache/abdera2/test/common/http/CacheControlTest.java (original)
+++ abdera/abdera2/test/src/main/java/org/apache/abdera2/test/common/http/CacheControlTest.java Wed Oct 19 22:33:04 2011
@@ -6,71 +6,72 @@ import static org.junit.Assert.assertTru
 import org.apache.abdera2.common.http.CacheControl;
 import org.junit.Test;
 
+import com.google.common.collect.Iterables;
+
 public class CacheControlTest {
 
   public static final String CC = "private=\"A\", public, no-cache=\"A\", no-store, no-transform, only-if-cached, must-revalidate, proxy-revalidate, max-age=10, max-stale=10, min-fresh=10, stale-if-error=10, stale-while-revalidate=10, a=\"b\"";
   
   @Test
   public void testCacheControl() {
-    CacheControl cc = new CacheControl();
-    cc.setExtension("a", "b");
+    CacheControl cc = 
+      CacheControl
+        .make()
+        .extension("a", "b")
+        .maxAge(10)
+        .maxStale(10)
+        .minFresh(10)
+        .mustRevalidate(true)
+        .noCache(true)
+        .noCacheHeaders("A")
+        .noStore(true)
+        .noTransform(true)
+        .onlyIfCached(true)
+        .isPrivate(true)
+        .privateHeaders("A")
+        .proxyRevalidate(true)
+        .isPublic(true)
+        .staleIfError(10)
+        .staleWhileRevalidate(10).get();
     assertEquals("b",cc.getExtension("a"));
-    cc.setMaxAge(10);
     assertEquals(10,cc.getMaxAge());
-    cc.setMaxStale(10);
     assertEquals(10,cc.getMaxStale());
-    cc.setMinFresh(10);
     assertEquals(10,cc.getMinFresh());
-    cc.setMustRevalidate(true);
     assertTrue(cc.isMustRevalidate());
-    cc.setNoCache(true);
     assertTrue(cc.isNoCache());
-    cc.setNoCacheHeaders("A");
-    String[] hs = cc.getNoCacheHeaders();
-    assertEquals(1,hs.length);
-    assertEquals("A",hs[0]);
-    cc.setNoStore(true);
+    Iterable<String> hs = cc.getNoCacheHeaders();
+    hs = cc.getNoCacheHeaders();
+    assertTrue(!Iterables.isEmpty(hs));
     assertTrue(cc.isNoStore());
-    cc.setNoTransform(true);
     assertTrue(cc.isNoTransform());
-    cc.setOnlyIfCached(true);
     assertTrue(cc.isOnlyIfCached());
-    cc.setPrivate(true);
     assertTrue(cc.isPrivate());
-    cc.setPrivateHeaders("A");
-    hs = cc.getNoCacheHeaders();
-    assertEquals(1,hs.length);
-    assertEquals("A",hs[0]);
-    cc.setProxyRevalidate(true);
+    hs = cc.getPrivateHeaders();
+    assertTrue(!Iterables.isEmpty(hs));
     assertTrue(cc.isProxyRevalidate());
-    cc.setPublic(true);
     assertTrue(cc.isPublic());
-    cc.setStaleIfError(10);
     assertEquals(10,cc.getStaleIfError());
-    cc.setStaleWhileRevalidate(10);
     assertEquals(10,cc.getStaleWhileRevalidate());
     assertEquals(CC,cc.toString());
   }
   
   @Test
   public void testCacheControl2() {
-    CacheControl cc = new CacheControl(CC);
+    CacheControl cc = CacheControl.parse(CC);
     assertEquals("b",cc.getExtension("a"));
     assertEquals(10,cc.getMaxAge());
     assertEquals(10,cc.getMaxStale());
     assertEquals(10,cc.getMinFresh());
     assertTrue(cc.isMustRevalidate());
     assertTrue(cc.isNoCache());
-    String[] hs = cc.getNoCacheHeaders();
-    assertEquals(1,hs.length);
-    assertEquals("A",hs[0]);
+    Iterable<String> hs = cc.getNoCacheHeaders();
+    assertTrue(!Iterables.isEmpty(hs));
     assertTrue(cc.isNoStore());
     assertTrue(cc.isNoTransform());
     assertTrue(cc.isOnlyIfCached());
     assertTrue(cc.isPrivate());
     hs = cc.getNoCacheHeaders();
-    assertEquals(1,hs.length);
-    assertEquals("A",hs[0]);
+    assertTrue(!Iterables.isEmpty(hs));
     assertTrue(cc.isProxyRevalidate());
     assertTrue(cc.isPublic());
     assertEquals(10,cc.getStaleIfError());

Modified: abdera/abdera2/test/src/main/java/org/apache/abdera2/test/common/misc/MiscTest.java
URL: http://svn.apache.org/viewvc/abdera/abdera2/test/src/main/java/org/apache/abdera2/test/common/misc/MiscTest.java?rev=1186541&r1=1186540&r2=1186541&view=diff
==============================================================================
--- abdera/abdera2/test/src/main/java/org/apache/abdera2/test/common/misc/MiscTest.java (original)
+++ abdera/abdera2/test/src/main/java/org/apache/abdera2/test/common/misc/MiscTest.java Wed Oct 19 22:33:04 2011
@@ -4,16 +4,17 @@ import static org.junit.Assert.assertEqu
 import static org.junit.Assert.assertFalse;
 import static org.junit.Assert.assertTrue;
 
+import java.util.Iterator;
 import java.util.LinkedHashSet;
 import java.util.Set;
 
-import org.apache.abdera2.common.misc.MultiIterator;
 import org.apache.abdera2.common.misc.PoolManager;
 import org.junit.Test;
 
+import com.google.common.collect.Iterators;
+
 public class MiscTest {
 
-  @SuppressWarnings("unchecked")
   @Test
   public void multiIteratorTest() {
     Set<String> a1 = new LinkedHashSet<String>();
@@ -24,8 +25,8 @@ public class MiscTest {
     a2.add("d");
     a2.add("e");
     a2.add("f");
-    MultiIterator<String> mi = 
-      new MultiIterator<String>(a1.iterator(),a2.iterator());
+    Iterator<String> mi = 
+      Iterators.concat(a1.iterator(),a2.iterator());
     assertEquals("a",mi.next());
     assertEquals("b",mi.next());
     assertEquals("c",mi.next());

Modified: abdera/abdera2/test/src/main/java/org/apache/abdera2/test/common/text/CharUtilsTest.java
URL: http://svn.apache.org/viewvc/abdera/abdera2/test/src/main/java/org/apache/abdera2/test/common/text/CharUtilsTest.java?rev=1186541&r1=1186540&r2=1186541&view=diff
==============================================================================
--- abdera/abdera2/test/src/main/java/org/apache/abdera2/test/common/text/CharUtilsTest.java (original)
+++ abdera/abdera2/test/src/main/java/org/apache/abdera2/test/common/text/CharUtilsTest.java Wed Oct 19 22:33:04 2011
@@ -1,6 +1,8 @@
 package org.apache.abdera2.test.common.text;
 
-import org.apache.abdera2.common.text.CharUtils;
+import org.apache.abdera2.common.text.CharUtils.Profile;
+import org.apache.abdera2.common.text.CodepointMatcher;
+import org.apache.abdera2.common.text.CodepointMatchers;
 import org.apache.abdera2.common.text.InvalidCharacterException;
 import org.junit.Test;
 
@@ -11,35 +13,37 @@ public class CharUtilsTest {
 
   @Test
   public void isAlphaTest() {
+    CodepointMatcher cm = CodepointMatchers.isAlpha();
     for (char c = 'A'; c <= 'Z'; c++)
-      assertTrue(CharUtils.isAlpha(c));
+      assertTrue(cm.apply(c));
     for (char c = 'a'; c <= 'z'; c++)
-      assertTrue(CharUtils.isAlpha(c));
-    assertFalse(CharUtils.isAlpha('1'));
+      assertTrue(cm.apply(c));
+    assertFalse(cm.apply('1'));
   }
   
   @Test
   public void isDigitTest() {
-    assertTrue(CharUtils.isDigit('0'));
-    assertTrue(CharUtils.isDigit('1'));
-    assertTrue(CharUtils.isDigit('2'));
-    assertTrue(CharUtils.isDigit('3'));
-    assertTrue(CharUtils.isDigit('4'));
-    assertTrue(CharUtils.isDigit('5'));
-    assertTrue(CharUtils.isDigit('6'));
-    assertTrue(CharUtils.isDigit('7'));
-    assertTrue(CharUtils.isDigit('8'));
-    assertTrue(CharUtils.isDigit('9'));
-    assertFalse(CharUtils.isDigit('A'));
+    CodepointMatcher cm = CodepointMatchers.isDigit();
+    assertTrue(cm.apply('0'));
+    assertTrue(cm.apply('1'));
+    assertTrue(cm.apply('2'));
+    assertTrue(cm.apply('3'));
+    assertTrue(cm.apply('4'));
+    assertTrue(cm.apply('5'));
+    assertTrue(cm.apply('6'));
+    assertTrue(cm.apply('7'));
+    assertTrue(cm.apply('8'));
+    assertTrue(cm.apply('9'));
+    assertFalse(cm.apply('A'));
   }
   
   @Test
   public void verifyTest() {
-    CharUtils.verify(new char[] {'t','e','s','t','1'}, CharUtils.Profile.ALPHANUM);
+    Profile.ALPHANUM.verify("test1");
   }
   
   @Test(expected=InvalidCharacterException.class)
   public void verifyFailureTest() {
-    CharUtils.verify(new char[] {'t','e','s','t','1',','}, CharUtils.Profile.ALPHANUM);
+    Profile.ALPHANUM.verify("test1,");
   }
 }

Modified: abdera/abdera2/test/src/main/java/org/apache/abdera2/test/ext/features/FeatureTest.java
URL: http://svn.apache.org/viewvc/abdera/abdera2/test/src/main/java/org/apache/abdera2/test/ext/features/FeatureTest.java?rev=1186541&r1=1186540&r2=1186541&view=diff
==============================================================================
--- abdera/abdera2/test/src/main/java/org/apache/abdera2/test/ext/features/FeatureTest.java (original)
+++ abdera/abdera2/test/src/main/java/org/apache/abdera2/test/ext/features/FeatureTest.java Wed Oct 19 22:33:04 2011
@@ -63,6 +63,7 @@ public class FeatureTest {
 
     }
 
+    @SuppressWarnings("rawtypes")
     @Test
     public void testSelectors() throws Exception {
 

Modified: abdera/abdera2/test/src/main/java/org/apache/abdera2/test/ext/serializer/SerializerTest.java
URL: http://svn.apache.org/viewvc/abdera/abdera2/test/src/main/java/org/apache/abdera2/test/ext/serializer/SerializerTest.java?rev=1186541&r1=1186540&r2=1186541&view=diff
==============================================================================
--- abdera/abdera2/test/src/main/java/org/apache/abdera2/test/ext/serializer/SerializerTest.java (original)
+++ abdera/abdera2/test/src/main/java/org/apache/abdera2/test/ext/serializer/SerializerTest.java Wed Oct 19 22:33:04 2011
@@ -18,6 +18,7 @@
 package org.apache.abdera2.test.ext.serializer;
 
 import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertTrue;
 
 import java.io.ByteArrayInputStream;
 import java.io.ByteArrayOutputStream;
@@ -25,6 +26,7 @@ import java.util.Calendar;
 import java.util.Date;
 
 import org.apache.abdera2.Abdera;
+import org.apache.abdera2.common.date.DateTimes;
 import org.apache.abdera2.ext.serializer.ConventionSerializationContext;
 import org.apache.abdera2.ext.serializer.annotation.Author;
 import org.apache.abdera2.ext.serializer.annotation.ID;
@@ -60,8 +62,8 @@ public class SerializerTest {
         Entry entry = doc.getRoot();
         assertEquals("tag:example.org,2008:foo", entry.getId().toString());
         assertEquals("This is the title", entry.getTitle());
-        assertEquals(date_now, entry.getUpdated());
-        assertEquals(cal_now.getTime(), entry.getPublished());
+        assertTrue(DateTimes.equivalent(entry.getUpdated(),date_now));
+        assertTrue(DateTimes.equivalent(entry.getPublished(),cal_now));
         assertEquals("James", entry.getAuthor().getName());
         assertEquals("this is the summary", entry.getSummary());
         assertEquals("http://example.org/foo", entry.getAlternateLink().getResolvedHref().toString());
@@ -113,8 +115,8 @@ public class SerializerTest {
         Entry entry = doc.getRoot();
         assertEquals("tag:example.org,2008:foo", entry.getId().toString());
         assertEquals("This is the title", entry.getTitle());
-        assertEquals(date_now, entry.getUpdated());
-        assertEquals(date_now, entry.getPublished());
+        assertTrue(DateTimes.equivalent(entry.getUpdated(),date_now));
+        assertTrue(DateTimes.equivalent(entry.getPublished(),date_now));
         assertEquals("James", entry.getAuthor().getName());
         assertEquals("this is the summary", entry.getSummary());
         assertEquals("http://example.org/foo", entry.getAlternateLink().getResolvedHref().toString());

Modified: abdera/abdera2/test/src/main/java/org/apache/abdera2/test/ext/sharing/SharingTest.java
URL: http://svn.apache.org/viewvc/abdera/abdera2/test/src/main/java/org/apache/abdera2/test/ext/sharing/SharingTest.java?rev=1186541&r1=1186540&r2=1186541&view=diff
==============================================================================
--- abdera/abdera2/test/src/main/java/org/apache/abdera2/test/ext/sharing/SharingTest.java (original)
+++ abdera/abdera2/test/src/main/java/org/apache/abdera2/test/ext/sharing/SharingTest.java Wed Oct 19 22:33:04 2011
@@ -41,7 +41,7 @@ import org.apache.abdera2.model.Document
 import org.apache.abdera2.model.Entry;
 import org.apache.abdera2.model.Feed;
 import org.junit.Test;
-import org.apache.abdera2.common.date.DateTime;
+import org.apache.abdera2.common.date.DateTimes;
 
 public class SharingTest {
 
@@ -107,8 +107,8 @@ public class SharingTest {
         Sharing sharing = SharingHelper.getSharing(feed, false);
         assertNotNull(sharing);
 
-        Date since = DateTime.parse("2005-02-13T18:30:02Z");
-        Date until = DateTime.parse("2005-05-23T18:30:02Z");
+        Date since = DateTimes.parse("2005-02-13T18:30:02Z");
+        Date until = DateTimes.parse("2005-05-23T18:30:02Z");
 
         assertEquals(since, sharing.getSince());
         assertEquals(until, sharing.getUntil());
@@ -131,9 +131,9 @@ public class SharingTest {
 
         assertEquals(3, sync.getHistory().size());
 
-        Date d1 = DateTime.parse("2005-05-21T11:43:33Z");
-        Date d2 = DateTime.parse("2005-05-21T10:43:33Z");
-        Date d3 = DateTime.parse("2005-05-21T09:43:33Z");
+        Date d1 = DateTimes.parse("2005-05-21T11:43:33Z");
+        Date d2 = DateTimes.parse("2005-05-21T10:43:33Z");
+        Date d3 = DateTimes.parse("2005-05-21T09:43:33Z");
 
         History history = sync.getHistory().get(0);
         assertEquals(3, history.getSequence());

Modified: abdera/abdera2/test/src/main/java/org/apache/abdera2/test/parser/EncodingTest.java
URL: http://svn.apache.org/viewvc/abdera/abdera2/test/src/main/java/org/apache/abdera2/test/parser/EncodingTest.java?rev=1186541&r1=1186540&r2=1186541&view=diff
==============================================================================
--- abdera/abdera2/test/src/main/java/org/apache/abdera2/test/parser/EncodingTest.java (original)
+++ abdera/abdera2/test/src/main/java/org/apache/abdera2/test/parser/EncodingTest.java Wed Oct 19 22:33:04 2011
@@ -24,7 +24,6 @@ import java.io.ByteArrayInputStream;
 import java.io.ByteArrayOutputStream;
 import java.io.OutputStream;
 import java.io.StringReader;
-import java.util.Date;
 
 import org.apache.abdera2.Abdera;
 import org.apache.abdera2.common.io.Compression;
@@ -36,6 +35,7 @@ import org.apache.abdera2.model.Entry;
 import org.apache.abdera2.parser.Parser;
 import org.apache.abdera2.parser.ParserOptions;
 import org.apache.abdera2.writer.WriterOptions;
+import org.joda.time.DateTime;
 import org.junit.Test;
 
 public class EncodingTest {
@@ -46,7 +46,7 @@ public class EncodingTest {
         Entry entry = abdera.newEntry();
         entry.setId("http://example.com/entry/1");
         entry.setTitle("Whatever");
-        entry.setUpdated(new Date());
+        entry.setUpdated(DateTime.now());
         Content content = entry.getFactory().newContent(Content.Type.XML);
         String s = "<x>" + new Character((char)224) + "</x>";
         content.setValue(s);

Modified: abdera/abdera2/test/src/main/java/org/apache/abdera2/test/parser/ParserTest.java
URL: http://svn.apache.org/viewvc/abdera/abdera2/test/src/main/java/org/apache/abdera2/test/parser/ParserTest.java?rev=1186541&r1=1186540&r2=1186541&view=diff
==============================================================================
--- abdera/abdera2/test/src/main/java/org/apache/abdera2/test/parser/ParserTest.java (original)
+++ abdera/abdera2/test/src/main/java/org/apache/abdera2/test/parser/ParserTest.java Wed Oct 19 22:33:04 2011
@@ -13,6 +13,7 @@ import org.apache.abdera2.parser.Parser;
 import org.apache.abdera2.parser.ParserFactory;
 import org.apache.abdera2.parser.ParserOptions;
 import org.apache.abdera2.parser.filter.BlackListParseFilter;
+import org.apache.abdera2.parser.filter.ParseFilter;
 import org.junit.Test;
 
 public class ParserTest {
@@ -36,8 +37,11 @@ public class ParserTest {
     assertEquals("b", d.getQName().getLocalPart());
     
     // Test Parse Filtering
-    BlackListParseFilter filter = new BlackListParseFilter();
-    filter.add(new QName("b"));
+    ParseFilter filter = 
+      BlackListParseFilter
+        .make()
+        .add(new QName("b"))
+        .get();
     options.setParseFilter(filter);
     
     doc = parser.parse(new StringReader(s),options);

Modified: abdera/abdera2/test/src/main/java/org/apache/abdera2/test/parser/axiom/AtomConformanceTest.java
URL: http://svn.apache.org/viewvc/abdera/abdera2/test/src/main/java/org/apache/abdera2/test/parser/axiom/AtomConformanceTest.java?rev=1186541&r1=1186540&r2=1186541&view=diff
==============================================================================
--- abdera/abdera2/test/src/main/java/org/apache/abdera2/test/parser/axiom/AtomConformanceTest.java (original)
+++ abdera/abdera2/test/src/main/java/org/apache/abdera2/test/parser/axiom/AtomConformanceTest.java Wed Oct 19 22:33:04 2011
@@ -182,7 +182,7 @@ public class AtomConformanceTest extends
                         .getValue());
                     assertEquals(Text.Type.TEXT, entry.getTitleType());
                     assertEquals(Text.Type.TEXT, entry.getSummaryType());
-                    assertNotNull(entry.getUpdatedElement().getValue());
+                    assertNotNull(entry.getUpdated());
                     assertEquals(1, entry.getLinks(Link.REL_ALTERNATE).size());
                     break;
                 case 2:
@@ -190,7 +190,7 @@ public class AtomConformanceTest extends
                         .getValue());
                     assertEquals(Text.Type.TEXT, entry.getTitleType());
                     assertEquals(Text.Type.TEXT, entry.getSummaryType());
-                    assertNotNull(entry.getUpdatedElement().getValue());
+                    assertNotNull(entry.getUpdated());
                     assertEquals(1, entry.getLinks(Link.REL_ALTERNATE).size());
                     break;
                 case 3:

Modified: abdera/abdera2/test/src/main/java/org/apache/abdera2/test/parser/axiom/FOMTest.java
URL: http://svn.apache.org/viewvc/abdera/abdera2/test/src/main/java/org/apache/abdera2/test/parser/axiom/FOMTest.java?rev=1186541&r1=1186540&r2=1186541&view=diff
==============================================================================
--- abdera/abdera2/test/src/main/java/org/apache/abdera2/test/parser/axiom/FOMTest.java (original)
+++ abdera/abdera2/test/src/main/java/org/apache/abdera2/test/parser/axiom/FOMTest.java Wed Oct 19 22:33:04 2011
@@ -40,8 +40,8 @@ import javax.xml.transform.stream.Stream
 
 import org.apache.abdera2.Abdera;
 import org.apache.abdera2.factory.Factory;
-import org.apache.abdera2.parser.filter.SetParseFilter;
 import org.apache.abdera2.common.Constants;
+import org.apache.abdera2.common.date.DateTimes;
 import org.apache.abdera2.common.iri.IRI;
 import org.apache.abdera2.common.lang.Lang;
 import org.apache.abdera2.model.Category;
@@ -67,6 +67,7 @@ import org.apache.abdera2.parser.ParserF
 import org.apache.abdera2.parser.ParserOptions;
 import org.apache.abdera2.extra.AbderaSource;
 import org.apache.abdera2.parser.filter.BlackListParseFilter;
+import org.apache.abdera2.parser.filter.ParseFilter;
 import org.apache.abdera2.parser.filter.WhiteListParseFilter;
 import org.apache.abdera2.writer.Writer;
 import org.apache.abdera2.writer.WriterFactory;
@@ -171,11 +172,14 @@ public class FOMTest {
     @Test
     public void testWhiteListParseFilter() throws Exception {
 
-        SetParseFilter filter = new WhiteListParseFilter();
-        filter.add(Constants.FEED);
-        filter.add(Constants.ENTRY);
-        filter.add(Constants.TITLE);
-        filter.add(Constants.ID);
+        ParseFilter filter = 
+          WhiteListParseFilter
+            .make()
+            .add(Constants.FEED)
+            .add(Constants.ENTRY)
+            .add(Constants.TITLE)
+            .add(Constants.ID)
+            .get();
         ParserOptions options = getParser().getDefaultParserOptions();
         options.setParseFilter(filter);
 
@@ -206,8 +210,11 @@ public class FOMTest {
     @Test
     public void testBlackListParseFilter() throws Exception {
 
-        SetParseFilter filter = new BlackListParseFilter();
-        filter.add(Constants.UPDATED);
+        ParseFilter filter = 
+          BlackListParseFilter
+            .make()
+            .add(Constants.UPDATED)
+            .get();
         ParserOptions options = getParser().getDefaultParserOptions();
         options.setParseFilter(filter);
 
@@ -336,24 +343,24 @@ public class FOMTest {
         assertTrue(control.isDraft());
         Date now = new Date();
         DateTime dateTime = factory.newDateTime(Constants.UPDATED, null);
-        dateTime.setValue(org.apache.abdera2.common.date.DateTime.valueOf(now));
+        dateTime.setValue(new org.joda.time.DateTime(now));
         assertEquals(now, dateTime.getDate());
         Calendar cal = Calendar.getInstance();
         dateTime = factory.newDateTime(Constants.UPDATED, null);
         dateTime.setCalendar(cal);
-        assertEquals(cal, dateTime.getCalendar());
+        assertTrue(DateTimes.equivalent(dateTime.getValue(), cal));
         dateTime = factory.newDateTime(Constants.UPDATED, null);
         dateTime.setDate(now);
-        assertEquals(now, dateTime.getDate());
+        assertTrue(DateTimes.equivalent(now, dateTime.getDate()));
         dateTime = factory.newDateTime(Constants.UPDATED, null);
         assertNotNull(dateTime);
         dateTime = factory.newDateTime(Constants.UPDATED, null);
         dateTime.setTime(now.getTime());
-        assertEquals(now.getTime(), dateTime.getTime());
+        assertTrue(DateTimes.equivalent(now.getTime(), dateTime.getTime()));
         dateTime = factory.newDateTime(Constants.UPDATED, null);
-        dateTime.setString(org.apache.abdera2.common.date.DateTime.format(now));
-        assertEquals(org.apache.abdera2.common.date.DateTime.format(now), dateTime.getString());
-        assertEquals(now, dateTime.getDate());
+        dateTime.setString(DateTimes.format(now));
+        assertTrue(DateTimes.equivalent(DateTimes.format(now), dateTime.getString()));
+        assertTrue(DateTimes.equivalent(now, dateTime.getDate()));
         Generator generator = factory.newDefaultGenerator();
         assertNotNull(generator);
         Div div = factory.newDiv();
@@ -500,24 +507,24 @@ public class FOMTest {
         assertEquals("c", person.getUri().toString());
         now = new Date();
         dateTime = factory.newPublished();
-        dateTime.setValue(org.apache.abdera2.common.date.DateTime.valueOf(now));
-        assertEquals(now, dateTime.getDate());
+        dateTime.setValue(new org.joda.time.DateTime(now));
+        assertTrue(DateTimes.equivalent(now, dateTime.getDate()));
         cal = Calendar.getInstance();
         dateTime = factory.newPublished();
         dateTime.setCalendar(cal);
-        assertEquals(cal, dateTime.getCalendar());
+        assertTrue(DateTimes.equivalent(cal, dateTime.getCalendar()));
         dateTime = factory.newPublished();
         dateTime.setDate(now);
-        assertEquals(now, dateTime.getDate());
+        assertTrue(DateTimes.equivalent(now, dateTime.getDate()));
         dateTime = factory.newPublished();
         assertNotNull(dateTime);
         dateTime = factory.newPublished();
         dateTime.setTime(now.getTime());
-        assertEquals(now.getTime(), dateTime.getTime());
+        assertTrue(DateTimes.equivalent(now.getTime(), dateTime.getTime()));
         dateTime = factory.newPublished();
-        dateTime.setString(org.apache.abdera2.common.date.DateTime.format(now));
-        assertEquals(org.apache.abdera2.common.date.DateTime.format(now), dateTime.getString());
-        assertEquals(now, dateTime.getDate());
+        dateTime.setString(DateTimes.format(now));
+        assertTrue(DateTimes.equivalent(DateTimes.format(now), dateTime.getString()));
+        assertTrue(DateTimes.equivalent(now, dateTime.getDate()));
         Service service = factory.newService();
         assertNotNull(service);
         Source source = factory.newSource();
@@ -560,24 +567,24 @@ public class FOMTest {
         assertEquals(Content.Type.TEXT, content.getContentType());
         now = new Date();
         dateTime = factory.newUpdated();
-        dateTime.setValue(org.apache.abdera2.common.date.DateTime.valueOf(now));
-        assertEquals(now, dateTime.getDate());
+        dateTime.setValue(new org.joda.time.DateTime(now));
+        assertTrue(DateTimes.equivalent(now, dateTime.getDate()));
         cal = Calendar.getInstance();
         dateTime = factory.newUpdated();
         dateTime.setCalendar(cal);
-        assertEquals(cal, dateTime.getCalendar());
+        assertTrue(DateTimes.equivalent(cal, dateTime.getCalendar()));
         dateTime = factory.newUpdated();
         dateTime.setDate(now);
-        assertEquals(now, dateTime.getDate());
+        assertTrue(DateTimes.equivalent(now, dateTime.getDate()));
         dateTime = factory.newUpdated();
         assertNotNull(dateTime);
         dateTime = factory.newUpdated();
         dateTime.setTime(now.getTime());
-        assertEquals(now.getTime(), dateTime.getTime());
+        assertTrue(DateTimes.equivalent(now.getTime(), dateTime.getTime()));
         dateTime = factory.newUpdated();
-        dateTime.setString(org.apache.abdera2.common.date.DateTime.format(now));
-        assertEquals(org.apache.abdera2.common.date.DateTime.format(now), dateTime.getString());
-        assertEquals(now, dateTime.getDate());
+        dateTime.setString(DateTimes.format(now));
+        assertTrue(DateTimes.equivalent(DateTimes.format(now), dateTime.getString()));
+        assertTrue(DateTimes.equivalent(now, dateTime.getDate()));
         iri = factory.newUri();
         assertNotNull(iri);
         iri = factory.newUri();

Modified: abdera/abdera2/test/src/main/java/org/apache/abdera2/test/parser/axiom/FeedValidatorTest.java
URL: http://svn.apache.org/viewvc/abdera/abdera2/test/src/main/java/org/apache/abdera2/test/parser/axiom/FeedValidatorTest.java?rev=1186541&r1=1186540&r2=1186541&view=diff
==============================================================================
--- abdera/abdera2/test/src/main/java/org/apache/abdera2/test/parser/axiom/FeedValidatorTest.java (original)
+++ abdera/abdera2/test/src/main/java/org/apache/abdera2/test/parser/axiom/FeedValidatorTest.java Wed Oct 19 22:33:04 2011
@@ -29,9 +29,11 @@ import java.io.InputStream;
 import java.util.Calendar;
 import java.util.Date;
 import java.util.List;
+import java.util.Locale;
 
 import javax.activation.DataHandler;
 
+import org.apache.abdera2.common.date.DateTimes;
 import org.apache.abdera2.common.iri.IRI;
 import org.apache.abdera2.common.iri.IRISyntaxException;
 import org.apache.abdera2.model.Category;
@@ -103,11 +105,11 @@ public class FeedValidatorTest extends B
         assertEquals(0, links.size());
         assertNotNull(feed.getUpdatedElement());
         DateTime dte = feed.getUpdatedElement();
-        org.apache.abdera2.common.date.DateTime dt = dte.getValue();
+        org.joda.time.DateTime dt = dte.getValue();
         assertNotNull(dt);
-        Calendar c = dt.getCalendar();
-        org.apache.abdera2.common.date.DateTime cdt = new org.apache.abdera2.common.date.DateTime(c);
-        assertEquals(dt.getTime(), cdt.getTime());
+        Calendar c = dt.toCalendar(Locale.getDefault());
+        org.joda.time.DateTime cdt = new org.joda.time.DateTime(c);
+        assertEquals(dt.getMillis(), cdt.getMillis());
         Person person = feed.getAuthor();
         assertNotNull(person);
         assertEquals("John Doe", person.getName());
@@ -145,9 +147,9 @@ public class FeedValidatorTest extends B
             dte = entry.getUpdatedElement();
             dt = dte.getValue();
             assertNotNull(dt);
-            c = dt.getCalendar();
-            cdt = new org.apache.abdera2.common.date.DateTime(c);
-            assertEquals(cdt.getTime(), dt.getTime());
+            c = dt.toCalendar(Locale.getDefault());
+            cdt = new org.joda.time.DateTime(c);
+            assertEquals(cdt.getMillis(), dt.getMillis());
             Text summary = entry.getSummaryElement();
             assertNotNull(summary);
             assertEquals(Text.Type.TEXT, summary.getTextType());
@@ -174,7 +176,7 @@ public class FeedValidatorTest extends B
         assertNotNull(feed.getSubtitleElement().getValue());
         assertNotNull(feed.getUpdatedElement());
         assertNotNull(feed.getUpdatedElement().getValue());
-        assertNotNull(feed.getUpdatedElement().getValue().getDate());
+        assertNotNull(feed.getUpdatedElement().getValue().toDate());
         assertNotNull(feed.getIdElement());
         assertTrue(feed.getIdElement() instanceof IRIElement);
         assertEquals(new IRI("tag:example.org,2003:3"), feed.getIdElement().getValue());
@@ -314,7 +316,7 @@ public class FeedValidatorTest extends B
         assertNotNull(entry.getIdElement().getValue());
         assertNotNull(entry.getUpdatedElement());
         assertNotNull(entry.getUpdatedElement().getValue());
-        assertNotNull(entry.getUpdatedElement().getValue().getDate());
+        assertNotNull(entry.getUpdatedElement().getValue().toDate());
         assertNotNull(entry.getSummaryElement());
         assertEquals(Text.Type.TEXT, entry.getSummaryElement().getTextType());
         assertNotNull(entry.getAuthor());
@@ -370,8 +372,8 @@ public class FeedValidatorTest extends B
             DateTime updated = entry.getUpdatedElement();
             assertNotNull(updated);
             assertNotNull(updated.getValue());
-            assertNotNull(updated.getValue().getDate());
-            assertEquals(103, updated.getValue().getDate().getYear());
+            assertNotNull(updated.getValue().toDate());
+            assertEquals(103, updated.getValue().toDate().getYear());
         }
     }
 
@@ -1195,10 +1197,11 @@ public class FeedValidatorTest extends B
         Document<Feed> doc = get(uri);
         if (doc == null)
             return;
-        Date d = org.apache.abdera2.common.date.DateTime.parse("2003-12-13T18:30:02Z");
+        org.joda.time.DateTime dt = 
+          new org.joda.time.DateTime("2003-12-13T18:30:02.000Z");
         for (Entry entry : doc.getRoot().getEntries()) {
-            Date date = entry.getUpdated();
-            assertEquals(d, date);
+            org.joda.time.DateTime date = entry.getUpdated();
+            assertTrue(DateTimes.equivalent(dt,date));
         }
     }
 
@@ -1219,72 +1222,65 @@ public class FeedValidatorTest extends B
         }
     }
 
-    @Test
+    @Test (expected=org.joda.time.IllegalFieldValueException.class)
     public void testSection33PublishedBadDay() throws Exception {
         // http://feedvalidator.org/testcases/atom/3.3/published_bad_day.xml
         IRI uri = baseURI.resolve("3.3/published_bad_day.xml");
         Document<Feed> doc = get(uri);
         if (doc == null)
             return;
-        Date d = org.apache.abdera2.common.date.DateTime.parse("2003-07-32T15:51:30-05:00");
-        assertEquals(d, doc.getRoot().getEntries().get(0).getPublished());
+        doc.getRoot().getEntries().get(0).getPublished();
     }
 
-    @Test
+    @Test (expected=org.joda.time.IllegalFieldValueException.class)
     public void testSection33PublishedBadDay2() throws Exception {
         // http://feedvalidator.org/testcases/atom/3.3/published_bad_day2.xml
         IRI uri = baseURI.resolve("3.3/published_bad_day2.xml");
         Document<Feed> doc = get(uri);
         if (doc == null)
             return;
-        // this is an invalid date, but we don't care because we're not doing
-        // validation. Better run those feeds through the feed validator :-)
-        Date d = org.apache.abdera2.common.date.DateTime.parse("2003-06-31T15:51:30-05:00");
-        assertEquals(d, doc.getRoot().getEntries().get(0).getPublished());
+        // joda-time will catch that this is a bad date and report it
+        doc.getRoot().getEntries().get(0).getPublished();
     }
 
-    @Test
+    @Test (expected=org.joda.time.IllegalFieldValueException.class)
     public void testSection33PublishedBadHours() throws Exception {
         // http://feedvalidator.org/testcases/atom/3.3/published_bad_hours.xml
         IRI uri = baseURI.resolve("3.3/published_bad_hours.xml");
         Document<Feed> doc = get(uri);
         if (doc == null)
             return;
-        Date d = org.apache.abdera2.common.date.DateTime.parse("2003-07-01T25:51:30-05:00");
-        assertEquals(d, doc.getRoot().getEntries().get(0).getPublished());
+        doc.getRoot().getEntries().get(0).getPublished();
     }
 
-    @Test
+    @Test(expected=org.joda.time.IllegalFieldValueException.class)
     public void testSecton33PublishedBadMinutes() throws Exception {
         // http://feedvalidator.org/testcases/atom/3.3/published_bad_minutes.xml
         IRI uri = baseURI.resolve("3.3/published_bad_minutes.xml");
         Document<Feed> doc = get(uri);
         if (doc == null)
             return;
-        Date d = org.apache.abdera2.common.date.DateTime.parse("2003-07-01T01:61:30-05:00");
-        assertEquals(d, doc.getRoot().getEntries().get(0).getPublished());
+        doc.getRoot().getEntries().get(0).getPublished();
     }
 
-    @Test
+    @Test(expected=org.joda.time.IllegalFieldValueException.class)
     public void testSection33PublishedBadMonth() throws Exception {
         // http://feedvalidator.org/testcases/atom/3.3/published_bad_month.xml
         IRI uri = baseURI.resolve("3.3/published_bad_month.xml");
         Document<Feed> doc = get(uri);
         if (doc == null)
             return;
-        Date d = org.apache.abdera2.common.date.DateTime.parse("2003-13-01T15:51:30-05:00");
-        assertEquals(d, doc.getRoot().getEntries().get(0).getPublished());
+        doc.getRoot().getEntries().get(0).getPublished();
     }
 
-    @Test
+    @Test(expected=org.joda.time.IllegalFieldValueException.class)
     public void testSection33PublishedBadSeconds() throws Exception {
         // http://feedvalidator.org/testcases/atom/3.3/published_bad_seconds.xml
         IRI uri = baseURI.resolve("3.3/published_bad_seconds.xml");
         Document<Feed> doc = get(uri);
         if (doc == null)
             return;
-        Date d = org.apache.abdera2.common.date.DateTime.parse("2003-07-01T01:55:61-05:00");
-        assertEquals(d, doc.getRoot().getEntries().get(0).getPublished());
+        doc.getRoot().getEntries().get(0).getPublished();
     }
 
     @Test
@@ -1690,8 +1686,9 @@ public class FeedValidatorTest extends B
         Document<Feed> doc = get(uri);
         if (doc == null)
             return;
-        Date d = org.apache.abdera2.common.date.DateTime.parse("2103-12-13T18:30:02Z");
-        assertEquals(d, doc.getRoot().getEntries().get(0).getUpdated());
+        org.joda.time.DateTime dt = 
+          org.joda.time.DateTime.parse("2103-12-13T18:30:02.000Z");
+        assertEquals(dt, doc.getRoot().getEntries().get(0).getUpdated());
     }
 
     @Test
@@ -1701,7 +1698,8 @@ public class FeedValidatorTest extends B
         Document<Feed> doc = get(uri);
         if (doc == null)
             return;
-        Date d = org.apache.abdera2.common.date.DateTime.parse("0103-12-13T18:30:02Z");
+        org.joda.time.DateTime d = 
+          org.joda.time.DateTime.parse("0103-12-13T18:30:02.000Z");
         assertEquals(d, doc.getRoot().getEntries().get(0).getUpdated());
     }
 
@@ -2018,7 +2016,8 @@ public class FeedValidatorTest extends B
         Document<Feed> doc = get(uri);
         if (doc == null)
             return;
-        Date d = org.apache.abdera2.common.date.DateTime.parse("2003-12-13T18:30:02Z");
+        org.joda.time.DateTime d = 
+          org.joda.time.DateTime.parse("2003-12-13T18:30:02.000Z");
         assertEquals(d, doc.getRoot().getUpdated());
     }
 
@@ -2352,7 +2351,7 @@ public class FeedValidatorTest extends B
         Document<Feed> doc = get(uri);
         if (doc == null)
             return;
-        Date d = org.apache.abdera2.common.date.DateTime.parse("2003-12-11T11:13:56Z");
+        org.joda.time.DateTime d = org.joda.time.DateTime.parse("2003-12-11T11:13:56.000Z");
         assertEquals(d, doc.getRoot().getEntries().get(0).getPublished());
     }
 
@@ -2409,7 +2408,8 @@ public class FeedValidatorTest extends B
         if (doc == null)
             return;
         Entry entry = doc.getRoot().getEntries().get(0);
-        Date d = org.apache.abdera2.common.date.DateTime.parse("2003-12-13T18:30:02Z");
+        org.joda.time.DateTime d = 
+          org.joda.time.DateTime.parse("2003-12-13T18:30:02.000Z");
         assertEquals(d, entry.getUpdated());
     }
 
@@ -3784,7 +3784,8 @@ public class FeedValidatorTest extends B
         if (doc == null)
             return;
         Entry entry = doc.getRoot().getEntries().get(0);
-        Date d = org.apache.abdera2.common.date.DateTime.parse("2003-12-13T17:46:27Z");
+        org.joda.time.DateTime d = 
+          org.joda.time.DateTime.parse("2003-12-13T17:46:27.000Z");
         assertEquals(d, entry.getSource().getUpdated());
     }
 

Modified: abdera/abdera2/test/src/main/java/org/apache/abdera2/test/security/DigitalSignatureTest.java
URL: http://svn.apache.org/viewvc/abdera/abdera2/test/src/main/java/org/apache/abdera2/test/security/DigitalSignatureTest.java?rev=1186541&r1=1186540&r2=1186541&view=diff
==============================================================================
--- abdera/abdera2/test/src/main/java/org/apache/abdera2/test/security/DigitalSignatureTest.java (original)
+++ abdera/abdera2/test/src/main/java/org/apache/abdera2/test/security/DigitalSignatureTest.java Wed Oct 19 22:33:04 2011
@@ -38,6 +38,7 @@ import org.apache.abdera2.model.Entry;
 import org.apache.abdera2.security.Security;
 import org.apache.abdera2.security.Signature;
 import org.apache.abdera2.security.SignatureOptions;
+import org.joda.time.DateTime;
 import org.junit.Test;
 
 public class DigitalSignatureTest {
@@ -72,7 +73,7 @@ public class DigitalSignatureTest {
 
         Entry entry = factory.newEntry();
         entry.setId("http://example.org/foo/entry");
-        entry.setUpdated(new java.util.Date());
+        entry.setUpdated(DateTime.now());
         entry.setTitle("This is an entry");
         entry.setContentAsXhtml("This <b>is</b> <i>markup</i>");
         entry.addAuthor("James");

Modified: abdera/abdera2/test/src/main/java/org/apache/abdera2/test/security/EncryptionTest.java
URL: http://svn.apache.org/viewvc/abdera/abdera2/test/src/main/java/org/apache/abdera2/test/security/EncryptionTest.java?rev=1186541&r1=1186540&r2=1186541&view=diff
==============================================================================
--- abdera/abdera2/test/src/main/java/org/apache/abdera2/test/security/EncryptionTest.java (original)
+++ abdera/abdera2/test/src/main/java/org/apache/abdera2/test/security/EncryptionTest.java Wed Oct 19 22:33:04 2011
@@ -33,6 +33,7 @@ import org.apache.abdera2.model.Entry;
 import org.apache.abdera2.security.Security;
 import org.apache.abdera2.security.Encryption;
 import org.apache.abdera2.security.EncryptionOptions;
+import org.joda.time.DateTime;
 import org.junit.Test;
 
 public class EncryptionTest {
@@ -68,7 +69,7 @@ public class EncryptionTest {
 
         Entry entry = factory.newEntry();
         entry.setId("http://example.org/foo/entry");
-        entry.setUpdated(new java.util.Date());
+        entry.setUpdated(DateTime.now());
         entry.setTitle("This is an entry");
         entry.setContentAsXhtml("This <b>is</b> <i>markup</i>");
         entry.addAuthor("James");

Modified: abdera/abdera2/test/src/main/java/org/apache/abdera2/test/security/filter/SecurityFilterTest.java
URL: http://svn.apache.org/viewvc/abdera/abdera2/test/src/main/java/org/apache/abdera2/test/security/filter/SecurityFilterTest.java?rev=1186541&r1=1186540&r2=1186541&view=diff
==============================================================================
--- abdera/abdera2/test/src/main/java/org/apache/abdera2/test/security/filter/SecurityFilterTest.java (original)
+++ abdera/abdera2/test/src/main/java/org/apache/abdera2/test/security/filter/SecurityFilterTest.java Wed Oct 19 22:33:04 2011
@@ -25,7 +25,6 @@ import java.io.InputStream;
 import java.security.KeyStore;
 import java.security.PrivateKey;
 import java.security.cert.X509Certificate;
-import java.util.Date;
 
 import org.apache.abdera2.Abdera;
 import org.apache.abdera2.common.http.ResponseType;
@@ -39,6 +38,7 @@ import org.apache.abdera2.security.Secur
 import org.apache.abdera2.security.Signature;
 import org.apache.abdera2.security.SignatureOptions;
 import org.apache.abdera2.test.security.DigitalSignatureTest;
+import org.joda.time.DateTime;
 import org.junit.AfterClass;
 import org.junit.BeforeClass;
 import org.junit.Test;
@@ -89,7 +89,7 @@ public class SecurityFilterTest {
         entry.setTitle("test entry");
         entry.setContent("Test Content");
         entry.addLink("http://example.org");
-        entry.setUpdated(new Date());
+        entry.setUpdated(DateTime.now());
         entry.addAuthor("James");
         AbderaSession session = (AbderaSession) client.newSession();
         AbderaClientResponse resp = (AbderaClientResponse) session.post("http://localhost:9002/feed", entry);

Modified: abdera/abdera2/test/src/main/java/org/apache/abdera2/test/security/filter/SimpleAdapter.java
URL: http://svn.apache.org/viewvc/abdera/abdera2/test/src/main/java/org/apache/abdera2/test/security/filter/SimpleAdapter.java?rev=1186541&r1=1186540&r2=1186541&view=diff
==============================================================================
--- abdera/abdera2/test/src/main/java/org/apache/abdera2/test/security/filter/SimpleAdapter.java (original)
+++ abdera/abdera2/test/src/main/java/org/apache/abdera2/test/security/filter/SimpleAdapter.java Wed Oct 19 22:33:04 2011
@@ -18,7 +18,6 @@
 package org.apache.abdera2.test.security.filter;
 
 import java.io.IOException;
-import java.util.Date;
 import java.util.HashMap;
 import java.util.Map;
 
@@ -41,6 +40,7 @@ import org.apache.abdera2.protocol.serve
 import org.apache.abdera2.protocol.server.impl.AbstractAtompubCollectionAdapter;
 import org.apache.abdera2.protocol.server.impl.AbstractAtompubProvider;
 import org.apache.abdera2.writer.StreamWriter;
+import org.joda.time.DateTime;
 
 @SuppressWarnings("unchecked")
 public class SimpleAdapter extends AbstractAtompubCollectionAdapter {
@@ -128,7 +128,7 @@ public class SimpleAdapter extends Abstr
                 setEntryDetails(request, entry, abdera.getFactory().newUuidUri());
                 Feed feed = getFeedDocument(request).getRoot();
                 feed.insertEntry(entry);
-                feed.setUpdated(new Date());
+                feed.setUpdated(DateTime.now());
                 FOMResponseContext<?> rc =
                     (FOMResponseContext<?>)AbstractAtompubProvider.returnBase(entry_doc, 201, entry.getEdited());
                 return rc.setLocation(ProviderHelper.resolveBase(request).resolve(entry.getEditLinkResolvedHref())
@@ -147,7 +147,7 @@ public class SimpleAdapter extends Abstr
     }
 
     private void setEntryDetails(RequestContext request, Entry entry, String id) {
-        entry.setUpdated(new Date());
+        entry.setUpdated(DateTime.now());
         entry.setEdited(entry.getUpdated());
         entry.getIdElement().setValue(id);
         entry.addLink(getEntryLink(request, entry.getId().toASCIIString()), "edit");
@@ -177,7 +177,7 @@ public class SimpleAdapter extends Abstr
                     orig_entry.discard();
                     Feed feed = getFeedDocument(request).getRoot();
                     feed.insertEntry(entry);
-                    feed.setUpdated(new Date());
+                    feed.setUpdated(DateTime.now());
                     return ProviderHelper.nocontent();
                 } else {
                     return ProviderHelper.badrequest(request);

Modified: abdera/abdera2/test/src/main/java/org/apache/abdera2/test/server/basic/BasicTest.java
URL: http://svn.apache.org/viewvc/abdera/abdera2/test/src/main/java/org/apache/abdera2/test/server/basic/BasicTest.java?rev=1186541&r1=1186540&r2=1186541&view=diff
==============================================================================
--- abdera/abdera2/test/src/main/java/org/apache/abdera2/test/server/basic/BasicTest.java (original)
+++ abdera/abdera2/test/src/main/java/org/apache/abdera2/test/server/basic/BasicTest.java Wed Oct 19 22:33:04 2011
@@ -23,7 +23,6 @@ import static org.junit.Assert.assertTru
 
 import java.io.ByteArrayInputStream;
 import java.io.IOException;
-import java.util.Date;
 
 import org.apache.abdera2.Abdera;
 import org.apache.abdera2.model.Base;
@@ -46,6 +45,7 @@ import org.apache.abdera2.common.http.Re
 import org.apache.abdera2.common.mediatype.MimeTypeHelper;
 import org.apache.abdera2.writer.Writer;
 import org.apache.abdera2.writer.WriterFactory;
+import org.joda.time.DateTime;
 import org.junit.AfterClass;
 import org.junit.BeforeClass;
 import org.junit.Test;
@@ -107,7 +107,7 @@ public class BasicTest {
         entry.setTitle("test entry");
         entry.setContent("Test Content");
         entry.addLink("http://example.org");
-        entry.setUpdated(new Date());
+        entry.setUpdated(DateTime.now());
         entry.addAuthor("James");
         AbderaSession session = (AbderaSession) client.newSession();
         AbderaClientResponse resp = (AbderaClientResponse) session.post("http://localhost:9002/sample", entry);

Modified: abdera/abdera2/test/src/main/java/org/apache/abdera2/test/server/basic/SampleBasicAdapter.java
URL: http://svn.apache.org/viewvc/abdera/abdera2/test/src/main/java/org/apache/abdera2/test/server/basic/SampleBasicAdapter.java?rev=1186541&r1=1186540&r2=1186541&view=diff
==============================================================================
--- abdera/abdera2/test/src/main/java/org/apache/abdera2/test/server/basic/SampleBasicAdapter.java (original)
+++ abdera/abdera2/test/src/main/java/org/apache/abdera2/test/server/basic/SampleBasicAdapter.java Wed Oct 19 22:33:04 2011
@@ -19,7 +19,6 @@ package org.apache.abdera2.test.server.b
 
 import java.io.ByteArrayInputStream;
 import java.io.ByteArrayOutputStream;
-import java.util.Date;
 import java.util.HashMap;
 import java.util.Set;
 import java.util.logging.Logger;
@@ -33,6 +32,7 @@ import org.apache.abdera2.model.Entry;
 import org.apache.abdera2.model.Feed;
 import org.apache.abdera2.protocol.server.provider.basic.BasicAdapter;
 import org.apache.abdera2.protocol.server.provider.managed.FeedConfiguration;
+import org.joda.time.DateTime;
 
 public class SampleBasicAdapter extends BasicAdapter {
 
@@ -76,7 +76,7 @@ public class SampleBasicAdapter extends 
         }
         // add an "updated" element if one was not provided
         if (entry.getUpdated() == null) {
-            entry.setUpdated(new Date());
+            entry.setUpdated(DateTime.now());
         }
         addEditLinkToEntry(entry);
         storeEntry(entryId, entry);
@@ -91,7 +91,7 @@ public class SampleBasicAdapter extends 
         entries.remove(entryId);
         // add an "updated" element if one was not provided
         if (entry.getUpdated() == null) {
-            entry.setUpdated(new Date());
+            entry.setUpdated(DateTime.now());
         }
         addEditLinkToEntry(entry);
         storeEntry((String)entryId, entry);

Modified: abdera/abdera2/test/src/main/java/org/apache/abdera2/test/server/custom/CustomProvider.java
URL: http://svn.apache.org/viewvc/abdera/abdera2/test/src/main/java/org/apache/abdera2/test/server/custom/CustomProvider.java?rev=1186541&r1=1186540&r2=1186541&view=diff
==============================================================================
--- abdera/abdera2/test/src/main/java/org/apache/abdera2/test/server/custom/CustomProvider.java (original)
+++ abdera/abdera2/test/src/main/java/org/apache/abdera2/test/server/custom/CustomProvider.java Wed Oct 19 22:33:04 2011
@@ -17,11 +17,11 @@
  */
 package org.apache.abdera2.test.server.custom;
 
+import org.apache.abdera2.common.misc.Chain;
 import org.apache.abdera2.common.protocol.RequestContext;
 import org.apache.abdera2.common.protocol.BaseRequestContextWrapper;
 import org.apache.abdera2.common.protocol.ResponseContext;
 import org.apache.abdera2.common.protocol.Filter;
-import org.apache.abdera2.common.protocol.FilterChain;
 import org.apache.abdera2.common.protocol.RegexTargetResolver;
 import org.apache.abdera2.common.protocol.TargetType;
 import org.apache.abdera2.common.protocol.TemplateManagerTargetBuilder;
@@ -34,9 +34,7 @@ public class CustomProvider extends Abst
     private final SimpleAdapter adapter;
 
     public CustomProvider() {
-
         this.adapter = new SimpleAdapter();
-
         RegexTargetResolver<RequestContext> resolver = 
           new RegexTargetResolver<RequestContext>()
             .setPattern("/atom(\\?[^#]*)?", TargetType.TYPE_SERVICE)
@@ -44,23 +42,21 @@ public class CustomProvider extends Abst
             .setPattern("/atom/([^/#?;]+)(\\?[^#]*)?", TargetType.TYPE_COLLECTION, "collection")
             .setPattern("/atom/([^/#?]+)/([^/#?]+)(\\?[^#]*)?", TargetType.TYPE_ENTRY, "collection", "entry");
         setTargetResolver(resolver);
-
-        TemplateManagerTargetBuilder<TargetType> tmb = 
-          new TemplateManagerTargetBuilder<TargetType>();
-        
-        tmb.add(TargetType.TYPE_SERVICE, "{target_base}/atom");
-        tmb.add(TargetType.TYPE_COLLECTION,
-                         "{target_base}/atom/{collection}{?q,c,s,p,l,i,o}");
-        tmb.add(TargetType.TYPE_CATEGORIES, "{target_base}/atom/{collection};categories");
-        tmb.add(TargetType.TYPE_ENTRY, "{target_base}/atom/{collection}/{entry}");
-
+        TemplateManagerTargetBuilder<TargetType> tmb =
+          (TemplateManagerTargetBuilder<TargetType>) 
+            TemplateManagerTargetBuilder
+              .<TargetType>make()
+              .add(TargetType.TYPE_SERVICE, "{target_base}/atom")
+              .add(TargetType.TYPE_COLLECTION,
+                           "{target_base}/atom/{collection}{?q,c,s,p,l,i,o}")
+              .add(TargetType.TYPE_CATEGORIES, "{target_base}/atom/{collection};categories")
+              .add(TargetType.TYPE_ENTRY, "{target_base}/atom/{collection}/{entry}")
+              .get();
         setTargetBuilder(tmb);
-        
         SimpleWorkspaceInfo workspace = new SimpleWorkspaceInfo();
         workspace.setTitle("A Simple Workspace");
         workspace.addCollection(adapter);
         addWorkspace(workspace);
-
         addFilter(new SimpleFilter());
     }
 
@@ -69,12 +65,11 @@ public class CustomProvider extends Abst
     }
 
     public class SimpleFilter implements Filter {
-        @SuppressWarnings("unchecked")
-        public <S extends ResponseContext>S filter(RequestContext request, FilterChain chain) {
+        public ResponseContext apply(RequestContext request, Chain<RequestContext,ResponseContext> chain) {
             BaseRequestContextWrapper rcw = new BaseRequestContextWrapper(request);
             rcw.setAttribute("offset", 10);
             rcw.setAttribute("count", 10);
-            return (S)chain.next(rcw);
+            return chain.next(rcw);
         }
     }
 

Modified: abdera/abdera2/test/src/main/java/org/apache/abdera2/test/server/custom/CustomProviderTest.java
URL: http://svn.apache.org/viewvc/abdera/abdera2/test/src/main/java/org/apache/abdera2/test/server/custom/CustomProviderTest.java?rev=1186541&r1=1186540&r2=1186541&view=diff
==============================================================================
--- abdera/abdera2/test/src/main/java/org/apache/abdera2/test/server/custom/CustomProviderTest.java (original)
+++ abdera/abdera2/test/src/main/java/org/apache/abdera2/test/server/custom/CustomProviderTest.java Wed Oct 19 22:33:04 2011
@@ -24,7 +24,6 @@ import static org.junit.Assert.assertTru
 
 import java.io.ByteArrayInputStream;
 import java.io.IOException;
-import java.util.Date;
 
 import org.apache.abdera2.Abdera;
 import org.apache.abdera2.model.Base;
@@ -45,6 +44,7 @@ import org.apache.abdera2.test.server.Je
 import org.apache.abdera2.common.Constants;
 import org.apache.abdera2.common.http.ResponseType;
 import org.apache.abdera2.common.mediatype.MimeTypeHelper;
+import org.joda.time.DateTime;
 import org.junit.AfterClass;
 import org.junit.BeforeClass;
 import org.junit.Test;
@@ -143,7 +143,7 @@ public class CustomProviderTest {
         entry.setTitle("test entry");
         entry.setContent("Test Content");
         entry.addLink("http://example.org");
-        entry.setUpdated(new Date());
+        entry.setUpdated(DateTime.now());
         entry.addAuthor("James");
         AbderaClientResponse resp = (AbderaClientResponse) session.post(BASE + "/feed", entry);
         assertNotNull(resp);

Modified: abdera/abdera2/test/src/main/java/org/apache/abdera2/test/server/custom/SimpleAdapter.java
URL: http://svn.apache.org/viewvc/abdera/abdera2/test/src/main/java/org/apache/abdera2/test/server/custom/SimpleAdapter.java?rev=1186541&r1=1186540&r2=1186541&view=diff
==============================================================================
--- abdera/abdera2/test/src/main/java/org/apache/abdera2/test/server/custom/SimpleAdapter.java (original)
+++ abdera/abdera2/test/src/main/java/org/apache/abdera2/test/server/custom/SimpleAdapter.java Wed Oct 19 22:33:04 2011
@@ -18,7 +18,6 @@
 package org.apache.abdera2.test.server.custom;
 
 import java.io.IOException;
-import java.util.Date;
 import java.util.HashMap;
 import java.util.Map;
 
@@ -41,6 +40,7 @@ import org.apache.abdera2.protocol.serve
 import org.apache.abdera2.protocol.server.impl.AbstractAtompubCollectionAdapter;
 import org.apache.abdera2.protocol.server.impl.AbstractAtompubProvider;
 import org.apache.abdera2.writer.StreamWriter;
+import org.joda.time.DateTime;
 
 @SuppressWarnings("unchecked")
 public class SimpleAdapter extends AbstractAtompubCollectionAdapter {
@@ -124,7 +124,7 @@ public class SimpleAdapter extends Abstr
                 setEntryDetails(request, entry, abdera.getFactory().newUuidUri());
                 Feed feed = getFeedDocument(request).getRoot();
                 feed.insertEntry(entry);
-                feed.setUpdated(new Date());
+                feed.setUpdated(DateTime.now());
                 FOMResponseContext<?> rc =
                     (FOMResponseContext<?>)AbstractAtompubProvider.returnBase(entry_doc, 201, entry.getEdited());
                 return rc.setLocation(ProviderHelper.resolveBase(request).resolve(entry.getEditLinkResolvedHref())
@@ -143,7 +143,7 @@ public class SimpleAdapter extends Abstr
     }
 
     private void setEntryDetails(RequestContext request, Entry entry, String id) {
-        entry.setUpdated(new Date());
+        entry.setUpdated(DateTime.now());
         entry.setEdited(entry.getUpdated());
         entry.getIdElement().setValue(id);
         entry.addLink(getEntryLink(request, entry.getId().toASCIIString()), "edit");
@@ -173,7 +173,7 @@ public class SimpleAdapter extends Abstr
                     orig_entry.discard();
                     Feed feed = getFeedDocument(request).getRoot();
                     feed.insertEntry(entry);
-                    feed.setUpdated(new Date());
+                    feed.setUpdated(DateTime.now());
                     return ProviderHelper.nocontent();
                 } else {
                     return ProviderHelper.badrequest(request);

Modified: abdera/abdera2/test/src/main/java/org/apache/abdera2/test/server/customer/CustomerAdapter.java
URL: http://svn.apache.org/viewvc/abdera/abdera2/test/src/main/java/org/apache/abdera2/test/server/customer/CustomerAdapter.java?rev=1186541&r1=1186540&r2=1186541&view=diff
==============================================================================
--- abdera/abdera2/test/src/main/java/org/apache/abdera2/test/server/customer/CustomerAdapter.java (original)
+++ abdera/abdera2/test/src/main/java/org/apache/abdera2/test/server/customer/CustomerAdapter.java Wed Oct 19 22:33:04 2011
@@ -18,7 +18,7 @@
 package org.apache.abdera2.test.server.customer;
 
 import java.util.Arrays;
-import java.util.Date;
+//import java.util.Date;
 import java.util.HashMap;
 import java.util.List;
 import java.util.Map;
@@ -37,6 +37,7 @@ import org.apache.abdera2.model.Element;
 import org.apache.abdera2.model.Person;
 import org.apache.abdera2.protocol.server.context.AtompubRequestContext;
 import org.apache.abdera2.protocol.server.impl.AbstractEntityCollectionAdapter;
+import org.joda.time.DateTime;
 
 public class CustomerAdapter extends AbstractEntityCollectionAdapter<Customer> {
     private static final String ID_PREFIX = "urn:acme:customer:";
@@ -60,7 +61,7 @@ public class CustomerAdapter extends Abs
     public Customer postEntry(String title,
                               IRI id,
                               String summary,
-                              Date updated,
+                              org.joda.time.DateTime updated,
                               List<Person> authors,
                               Content content,
                               RequestContext request) throws ResponseContextException {
@@ -148,14 +149,14 @@ public class CustomerAdapter extends Abs
         return entry.getName();
     }
 
-    public Date getUpdated(Customer entry) {
-        return new Date();
+    public org.joda.time.DateTime getUpdated(Customer entry) {
+        return org.joda.time.DateTime.now();
     }
 
     @Override
     public void putEntry(Customer entry,
                          String title,
-                         Date updated,
+                         DateTime updated,
                          List<Person> authors,
                          String summary,
                          Content content,

Modified: abdera/abdera2/test/src/main/java/org/apache/abdera2/test/server/customer/CustomerAdapterTest.java
URL: http://svn.apache.org/viewvc/abdera/abdera2/test/src/main/java/org/apache/abdera2/test/server/customer/CustomerAdapterTest.java?rev=1186541&r1=1186540&r2=1186541&view=diff
==============================================================================
--- abdera/abdera2/test/src/main/java/org/apache/abdera2/test/server/customer/CustomerAdapterTest.java (original)
+++ abdera/abdera2/test/src/main/java/org/apache/abdera2/test/server/customer/CustomerAdapterTest.java Wed Oct 19 22:33:04 2011
@@ -22,7 +22,6 @@ import static org.junit.Assert.assertNot
 import static org.junit.Assert.assertTrue;
 
 import java.io.IOException;
-import java.util.Date;
 
 import javax.xml.namespace.QName;
 
@@ -51,6 +50,7 @@ import org.apache.abdera2.common.protoco
 import org.apache.abdera2.writer.Writer;
 import org.apache.abdera2.writer.WriterFactory;
 import org.eclipse.jetty.servlet.ServletHolder;
+import org.joda.time.DateTime;
 import org.junit.After;
 import org.junit.Test;
 
@@ -129,7 +129,7 @@ public class CustomerAdapterTest {
 
         Entry entry = factory.newEntry();
         entry.setTitle("This is ignored right now");
-        entry.setUpdated(new Date());
+        entry.setUpdated(DateTime.now());
         entry.addAuthor("Acme Industries");
         entry.setId(factory.newUuidUri());
         entry.setSummary("Customer document");



Mime
View raw message