abdera-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jmsn...@apache.org
Subject svn commit: r1201318 - in /abdera/abdera2: activities/src/main/java/org/apache/abdera2/activities/client/ activities/src/main/java/org/apache/abdera2/activities/extra/ activities/src/main/java/org/apache/abdera2/activities/model/ common/src/main/java/o...
Date Sat, 12 Nov 2011 20:16:14 GMT
Author: jmsnell
Date: Sat Nov 12 20:16:13 2011
New Revision: 1201318

URL: http://svn.apache.org/viewvc?rev=1201318&view=rev
Log: (empty)

Modified:
    abdera/abdera2/activities/src/main/java/org/apache/abdera2/activities/client/ActivitiesClient.java
    abdera/abdera2/activities/src/main/java/org/apache/abdera2/activities/client/ActivitiesClientBatchPusher.java
    abdera/abdera2/activities/src/main/java/org/apache/abdera2/activities/client/ActivitiesClientPusher.java
    abdera/abdera2/activities/src/main/java/org/apache/abdera2/activities/client/ActivitiesSession.java
    abdera/abdera2/activities/src/main/java/org/apache/abdera2/activities/client/ActivityEntity.java
    abdera/abdera2/activities/src/main/java/org/apache/abdera2/activities/extra/ASContext.java
    abdera/abdera2/activities/src/main/java/org/apache/abdera2/activities/extra/Extra.java
    abdera/abdera2/activities/src/main/java/org/apache/abdera2/activities/extra/PusherCollectionWriter.java
    abdera/abdera2/activities/src/main/java/org/apache/abdera2/activities/model/Verb.java
    abdera/abdera2/common/src/main/java/org/apache/abdera2/common/misc/MorePredicates.java
    abdera/abdera2/test/pom.xml

Modified: abdera/abdera2/activities/src/main/java/org/apache/abdera2/activities/client/ActivitiesClient.java
URL: http://svn.apache.org/viewvc/abdera/abdera2/activities/src/main/java/org/apache/abdera2/activities/client/ActivitiesClient.java?rev=1201318&r1=1201317&r2=1201318&view=diff
==============================================================================
--- abdera/abdera2/activities/src/main/java/org/apache/abdera2/activities/client/ActivitiesClient.java
(original)
+++ abdera/abdera2/activities/src/main/java/org/apache/abdera2/activities/client/ActivitiesClient.java
Sat Nov 12 20:16:13 2011
@@ -21,6 +21,8 @@ import org.apache.abdera2.activities.mod
 import org.apache.abdera2.activities.model.ASObject;
 import org.apache.abdera2.activities.model.Activity;
 import org.apache.abdera2.activities.model.Collection;
+import org.apache.abdera2.activities.model.IO;
+import org.apache.abdera2.protocol.client.BasicCachingClient;
 import org.apache.abdera2.protocol.client.BasicClient;
 import org.apache.abdera2.protocol.client.Client;
 import org.apache.abdera2.protocol.client.ClientWrapper;
@@ -28,7 +30,7 @@ import org.apache.abdera2.protocol.clien
 import org.apache.abdera2.protocol.client.Session;
 
 /**
- * Extension of the base Abdera Client that provides utility methods
+ * Extension of the base Abdera Client that provides methods
  * for working with Activity Stream objects. The ActivityClient acts 
  * as a decorator for the base Abdera Client. 
  */
@@ -36,44 +38,97 @@ import org.apache.abdera2.protocol.clien
 public class ActivitiesClient 
   extends ClientWrapper {
 
+  /**
+   * Creates a new Activity Client that wraps a new BasicClient
+   */
+  public static ActivitiesClient create() {
+    return new ActivitiesClient();
+  }
+  
+  /**
+   * Creates a new Activity Client that wraps the given client
+   */
+  public static ActivitiesClient create(Client client) {
+    return new ActivitiesClient(client);
+  }
+  
+  /**
+   * Creates a new Activity Client that wraps a new BasicCachingClient
+   */
+  public static ActivitiesClient createCaching() {
+    return new ActivitiesClient(new BasicCachingClient());
+  }
+  
+  /**
+   * Creates a new Activity Client that wraps a new BasicClient
+   */
   public ActivitiesClient() {
     super(new BasicClient());
   }
   
+  /**
+   * Creates a new Activity Client that wraps the given Client
+   */
   public ActivitiesClient(Client client) {
     super(client);
   }
 
-  @Override
+  /**
+   * Creates a new Session for this Client. Session objects provide
+   * the interface for all HTTP methods and track the state of 
+   * individual sessions
+   */
   public <T extends Session> T newSession() {
     return (T)new ActivitiesSession(this);
   }
+  
+  public <T extends Session> T newSession(IO io) {
+    return (T)new ActivitiesSession(this,io);
+  }
 
+  /**
+   * Shortcut utility method that retrieves and parses an Activity Streams document
+   */
   public <M extends ASObject,T extends Collection<M>>ASDocument<T> getCollection(String
uri) {
     ActivitiesSession session = newSession();
     return session.<M,T>getCollection(uri);
   }
   
+  /**
+   * Shortcut utility method that retrieves and parses an Activity Streams document
+   */
   public <M extends ASObject,T extends Collection<M>>ASDocument<T> getCollection(String
uri, RequestOptions options) {
     ActivitiesSession session = newSession();
     return session.<M,T>getCollection(uri,options);
   }
   
+  /**
+   * Shortcut utility method that retrieves and parses an Activity Streams document
+   */
   public <T extends Activity>ASDocument<T> getActivity(String uri) {
     ActivitiesSession session = newSession();
     return session.<T>getActivity(uri);
   }
   
+  /**
+   * Shortcut utility method that retrieves and parses an Activity Streams document
+   */
   public <T extends Activity>ASDocument<T> getActivity(String uri, RequestOptions
options) {
     ActivitiesSession session = newSession();
     return session.<T>getActivity(uri,options);
   }
   
+  /**
+   * Shortcut utility method that retrieves and parses an Activity Streams document
+   */
   public <T extends ASObject>ASDocument<T> getObject(String uri) {
     ActivitiesSession session = newSession();
     return session.<T>getObject(uri);
   }
   
+  /**
+   * Shortcut utility method that retrieves and parses an Activity Streams document
+   */
   public <T extends ASObject>ASDocument<T> getObject(String uri, RequestOptions
options) {
     ActivitiesSession session = newSession();
     return session.<T>getObject(uri,options);

Modified: abdera/abdera2/activities/src/main/java/org/apache/abdera2/activities/client/ActivitiesClientBatchPusher.java
URL: http://svn.apache.org/viewvc/abdera/abdera2/activities/src/main/java/org/apache/abdera2/activities/client/ActivitiesClientBatchPusher.java?rev=1201318&r1=1201317&r2=1201318&view=diff
==============================================================================
--- abdera/abdera2/activities/src/main/java/org/apache/abdera2/activities/client/ActivitiesClientBatchPusher.java
(original)
+++ abdera/abdera2/activities/src/main/java/org/apache/abdera2/activities/client/ActivitiesClientBatchPusher.java
Sat Nov 12 20:16:13 2011
@@ -19,6 +19,7 @@ package org.apache.abdera2.activities.cl
 
 import org.apache.abdera2.activities.model.ASObject;
 import org.apache.abdera2.activities.model.Collection;
+import org.apache.abdera2.common.pusher.Pusher;
 import org.apache.abdera2.protocol.client.RequestOptions;
 
 /**
@@ -30,40 +31,65 @@ import org.apache.abdera2.protocol.clien
 public class ActivitiesClientBatchPusher<T extends ASObject> 
   extends ActivitiesClientPusher<T> {
 
-  public ActivitiesClientBatchPusher(String iri, ActivitiesSession session,
-      RequestOptions options) {
+  public static <T extends ASObject>Pusher<T> create(String iri) {
+    return new ActivitiesClientBatchPusher<T>(iri);
+  }
+  
+  public static <T extends ASObject>Pusher<T> create(
+    String iri,
+    RequestOptions options) {
+    return new ActivitiesClientBatchPusher<T>(iri,options);
+  }
+  
+  public static <T extends ASObject>Pusher<T> create(
+    String iri,
+    ActivitiesSession session) {
+    return new ActivitiesClientBatchPusher<T>(iri,session);
+  }
+  
+  public static <T extends ASObject>Pusher<T> create(
+    String iri,
+    ActivitiesSession session,
+    RequestOptions options) {
+    return new ActivitiesClientBatchPusher<T>(iri,session,options);
+  }
+  
+  public ActivitiesClientBatchPusher(
+    String iri, 
+    ActivitiesSession session,
+    RequestOptions options) {
     super(iri, session, options);
   }
 
-  public ActivitiesClientBatchPusher(String iri, ActivitiesSession session) {
+  public ActivitiesClientBatchPusher(
+    String iri, 
+    ActivitiesSession session) {
     super(iri, session);
   }
 
-  public ActivitiesClientBatchPusher(String iri, RequestOptions options) {
+  public ActivitiesClientBatchPusher(
+    String iri, 
+    RequestOptions options) {
     super(iri, options);
   }
 
-  public ActivitiesClientBatchPusher(String iri) {
+  public ActivitiesClientBatchPusher(
+    String iri) {
     super(iri);
   }
 
   @Override
   public void pushAll(final Iterable<T> t) {
-    exec.execute(
-        new Runnable() {
-          public void run() {
-            try {
-              handle(
-                session.post(
-                  iri, 
-                  Collection.<T>makeCollection(t), 
-                  options));
-            } catch (Throwable ex) {
-              handle(ex);
-            }
-          }
-        }
-      );
+    try {
+      session.post(
+        iri, 
+        Collection.<T>makeCollection(t), 
+        options,
+        exec,
+        this);
+    } catch (Throwable x) {
+      handle(x);
+    }
   }
 
 }

Modified: abdera/abdera2/activities/src/main/java/org/apache/abdera2/activities/client/ActivitiesClientPusher.java
URL: http://svn.apache.org/viewvc/abdera/abdera2/activities/src/main/java/org/apache/abdera2/activities/client/ActivitiesClientPusher.java?rev=1201318&r1=1201317&r2=1201318&view=diff
==============================================================================
--- abdera/abdera2/activities/src/main/java/org/apache/abdera2/activities/client/ActivitiesClientPusher.java
(original)
+++ abdera/abdera2/activities/src/main/java/org/apache/abdera2/activities/client/ActivitiesClientPusher.java
Sat Nov 12 20:16:13 2011
@@ -17,28 +17,57 @@
  */
 package org.apache.abdera2.activities.client;
 
-import java.util.concurrent.Executor;
-import java.util.concurrent.Executors;
+import java.util.concurrent.ExecutorService;
 
 import org.apache.abdera2.activities.model.ASObject;
 import org.apache.abdera2.common.pusher.Pusher;
+import org.apache.abdera2.protocol.client.Session.Listener;
 import org.apache.abdera2.protocol.client.ClientResponse;
 import org.apache.abdera2.protocol.client.RequestOptions;
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
+import static org.apache.abdera2.common.misc.MoreExecutors2.getExitingExecutor;
 
 /**
  * Utility that wraps an ActivitiesClient and uses the pusher 
  * interface to asynchronously send those off to somewhere else
- * using POST requests. 
+ * using POST requests. The default behavior is to attempt to 
+ * push the item once and forget about it, the status of the 
+ * request will not be checked. Subclasses can customize that 
+ * behavior as necessary
  */
 public class ActivitiesClientPusher<T extends ASObject> 
-  implements Pusher<T> {
-  private final static Log log = LogFactory.getLog(ActivitiesClientPusher.class);
+  implements Pusher<T>, Listener<ClientResponse> {
+  private final static Log log = 
+    LogFactory.getLog(
+      ActivitiesClientPusher.class);
+  
+  public static <T extends ASObject>Pusher<T> create(String iri) {
+    return new ActivitiesClientPusher<T>(iri);
+  }
+  
+  public static <T extends ASObject>Pusher<T> create(
+    String iri,
+    RequestOptions options) {
+    return new ActivitiesClientPusher<T>(iri,options);
+  }
+  
+  public static <T extends ASObject>Pusher<T> create(
+    String iri,
+    ActivitiesSession session) {
+    return new ActivitiesClientPusher<T>(iri,session);
+  }
+  
+  public static <T extends ASObject>Pusher<T> create(
+    String iri,
+    ActivitiesSession session,
+    RequestOptions options) {
+    return new ActivitiesClientPusher<T>(iri,session,options);
+  }
   
   protected final ActivitiesSession session;
   protected final String iri;
-  protected final Executor exec;
+  protected final ExecutorService exec;
   protected final RequestOptions options;
 
   public ActivitiesClientPusher(String iri) {
@@ -69,27 +98,16 @@ public class ActivitiesClientPusher<T ex
     this.exec = initExecutor();
   }
   
-  protected Executor initExecutor() {
-    return Executors.newSingleThreadExecutor();
+  protected ExecutorService initExecutor() {
+    return getExitingExecutor();
   }
   
   public void push(final T t) {
-    exec.execute(
-      new Runnable() {
-        public void run() {
-          try {
-            handle(session.post(iri, t, options));
-          } catch (Throwable ex) {
-            handle(ex);
-          }
-        }
-      }
-    );
-  }
-  
-  protected void handle(ClientResponse resp) {
-    // by default, do nothing, fire'n'forget
-    resp.release();
+    try {
+      session.post(iri,t,options,exec,this);
+    } catch (Throwable x) {
+      handle(x);
+    }
   }
   
   protected void handle(Throwable t) {
@@ -101,4 +119,8 @@ public class ActivitiesClientPusher<T ex
     for (T i : t) push(i);
   }
 
+  public void onResponse(ClientResponse resp) {
+    resp.release();
+  }
+
 }

Modified: abdera/abdera2/activities/src/main/java/org/apache/abdera2/activities/client/ActivitiesSession.java
URL: http://svn.apache.org/viewvc/abdera/abdera2/activities/src/main/java/org/apache/abdera2/activities/client/ActivitiesSession.java?rev=1201318&r1=1201317&r2=1201318&view=diff
==============================================================================
--- abdera/abdera2/activities/src/main/java/org/apache/abdera2/activities/client/ActivitiesSession.java
(original)
+++ abdera/abdera2/activities/src/main/java/org/apache/abdera2/activities/client/ActivitiesSession.java
Sat Nov 12 20:16:13 2011
@@ -46,10 +46,16 @@ import org.joda.time.DateTime;
 public class ActivitiesSession 
   extends Session {
 
-  private static final IO io = IO.get();
+  private final IO io;
+  
+  protected ActivitiesSession(Client client, IO io) {
+    super(client);
+    this.io = io;
+  }
   
   protected ActivitiesSession(Client client) {
     super(client);
+    this.io = IO.get();
   }
 
   public IO getIO() {
@@ -145,10 +151,10 @@ public class ActivitiesSession 
   }
   
   public <M extends ASObject, T extends Collection<M>>ASDocument<T> getCollection(String
uri, RequestOptions options) {
-    return ActivitiesSession.<M,T>getCollectionFromResp(get(uri, options));
+    return ActivitiesSession.<M,T>getCollectionFromResp(io,get(uri, options));
   }
   
-  static <M extends ASObject, T extends Collection<M>>ASDocument<T> getCollectionFromResp(ClientResponse
cr) {
+  static <M extends ASObject, T extends Collection<M>>ASDocument<T> getCollectionFromResp(IO
io, ClientResponse cr) {
     try {
       if (cr != null) {
         switch(cr.getType()) {
@@ -193,10 +199,10 @@ public class ActivitiesSession 
   }
   
   public <T extends Activity>ASDocument<T> getActivity(String uri, RequestOptions
options) {
-    return getActivityFromResponse(get(uri, options));
+    return getActivityFromResponse(io,get(uri, options));
   }
   
-  static <T extends Activity>ASDocument<T> getActivityFromResponse(ClientResponse
cr) {
+  static <T extends Activity>ASDocument<T> getActivityFromResponse(IO io,ClientResponse
cr) {
     try {
       if (cr != null) {
         switch(cr.getType()) {
@@ -241,10 +247,10 @@ public class ActivitiesSession 
   }
 
   public <T extends ASObject>ASDocument<T> getObject(String uri, RequestOptions
options) {
-    return getObjectFromResponse(get(uri, options));
+    return getObjectFromResponse(io,get(uri, options));
   }
   
-  static <T extends ASObject>ASDocument<T> getObjectFromResponse(ClientResponse
cr) {
+  static <T extends ASObject>ASDocument<T> getObjectFromResponse(IO io,ClientResponse
cr) {
     try {
       if (cr != null) {
         switch(cr.getType()) {
@@ -357,39 +363,68 @@ public class ActivitiesSession 
 
   static abstract class ASListener<T extends ClientResponse, X extends ASBase> 
     implements Listener<T> {
+      protected final IO io;
+      protected ASListener(IO io) {
+        this.io = io;
+      }
       protected abstract void onResponse(ASDocument<X> doc);
   }
   
   public static abstract class CollectionListener<T extends ClientResponse,X extends ASObject>

     extends ASListener<T,Collection<X>> {
+    protected CollectionListener(IO io) {
+     super(io);
+    }
     public void onResponse(T resp) {
-      onResponse(ActivitiesSession.<X,Collection<X>>getCollectionFromResp(resp));
+      onResponse(ActivitiesSession.<X,Collection<X>>getCollectionFromResp(io,resp));
     }
   }
   
   public static abstract class SimpleActivityCollectionListener 
-    extends CollectionListener<ClientResponse,Activity>{}
+    extends CollectionListener<ClientResponse,Activity>{
+    protected SimpleActivityCollectionListener(IO io) {
+      super(io);
+     }
+  }
   
   public static abstract class SimpleObjectCollectionListener 
-    extends CollectionListener<ClientResponse,ASObject>{}
+    extends CollectionListener<ClientResponse,ASObject>{
+    protected SimpleObjectCollectionListener(IO io) {
+      super(io);
+     }
+  }
   
   public static abstract class SimpleActivityListener 
-    extends ActivityListener<ClientResponse,Activity>{}
+    extends ActivityListener<ClientResponse,Activity>{
+    protected SimpleActivityListener(IO io) {
+      super(io);
+     }
+  }
   
   public static abstract class SimpleObjectListener 
-    extends ObjectListener<ClientResponse,ASObject>{}
+    extends ObjectListener<ClientResponse,ASObject>{
+    protected SimpleObjectListener(IO io) {
+      super(io);
+     }
+  }
   
   public static abstract class ActivityListener<T extends ClientResponse,X extends Activity>

     extends ASListener<T,X> {
+    protected ActivityListener(IO io) {
+      super(io);
+     }
     public void onResponse(T resp) {
-      onResponse(ActivitiesSession.<X>getActivityFromResponse(resp));
+      onResponse(ActivitiesSession.<X>getActivityFromResponse(io,resp));
     }
   }
   
   public static abstract class ObjectListener<T extends ClientResponse,X extends ASObject>

     extends ASListener<T,X> {
+    protected ObjectListener(IO io) {
+      super(io);
+     }
     public void onResponse(T resp) {
-      onResponse(ActivitiesSession.<X>getObjectFromResponse(resp));
+      onResponse(ActivitiesSession.<X>getObjectFromResponse(io,resp));
     }
   }
 }

Modified: abdera/abdera2/activities/src/main/java/org/apache/abdera2/activities/client/ActivityEntity.java
URL: http://svn.apache.org/viewvc/abdera/abdera2/activities/src/main/java/org/apache/abdera2/activities/client/ActivityEntity.java?rev=1201318&r1=1201317&r2=1201318&view=diff
==============================================================================
--- abdera/abdera2/activities/src/main/java/org/apache/abdera2/activities/client/ActivityEntity.java
(original)
+++ abdera/abdera2/activities/src/main/java/org/apache/abdera2/activities/client/ActivityEntity.java
Sat Nov 12 20:16:13 2011
@@ -29,9 +29,6 @@ import org.apache.http.HttpEntity;
 import org.apache.http.entity.BasicHttpEntity;
 import org.apache.http.message.BasicHeader;
 
-/**
- * Required for the Apache Commons HTTP AbderaClient.
- */
 public class ActivityEntity
   extends BasicHttpEntity 
   implements HttpEntity {
@@ -98,7 +95,9 @@ public class ActivityEntity
     }
 
     public void writeTo(OutputStream out) throws IOException {
-      base.writeTo(out);
+      if (buf == null)
+        base.writeTo(out);
+      else out.write(buf);
     }
     
     public InputStream getContent() {

Modified: abdera/abdera2/activities/src/main/java/org/apache/abdera2/activities/extra/ASContext.java
URL: http://svn.apache.org/viewvc/abdera/abdera2/activities/src/main/java/org/apache/abdera2/activities/extra/ASContext.java?rev=1201318&r1=1201317&r2=1201318&view=diff
==============================================================================
--- abdera/abdera2/activities/src/main/java/org/apache/abdera2/activities/extra/ASContext.java
(original)
+++ abdera/abdera2/activities/src/main/java/org/apache/abdera2/activities/extra/ASContext.java
Sat Nov 12 20:16:13 2011
@@ -63,10 +63,6 @@ public final class ASContext 
       (T)base.getProperty(var);
   }
 
-  public void clear() {
-    throw new UnsupportedOperationException();
-  }
-
   public boolean contains(String var) {
     return base.has(var);
   }
@@ -76,7 +72,7 @@ public final class ASContext 
   }
   
   @SuppressWarnings("rawtypes")
-  public static class IterableWrapper 
+  static class IterableWrapper 
     implements Iterable {
 
     private final Iterable i;
@@ -91,8 +87,13 @@ public final class ASContext 
     
   }
   
+  /**
+   * This and IterableWrapper ensure that all ASBase values
+   * within an ASBase are wrapped as ASContext instances 
+   * for purposes of URI Template expansion
+   */
   @SuppressWarnings("rawtypes")
-  public static class IteratorWrapper 
+  static class IteratorWrapper 
     implements Iterator {
 
     private final Iterator i;
@@ -108,7 +109,7 @@ public final class ASContext 
     public Object next() {
       Object obj = i.next();
       if (obj instanceof ASBase) 
-        return new ASContext((ASBase)obj);
+        return ASContext.create((ASBase)obj);
       if (obj instanceof Iterable)
         return new IterableWrapper((Iterable)obj);
       return obj;

Modified: abdera/abdera2/activities/src/main/java/org/apache/abdera2/activities/extra/Extra.java
URL: http://svn.apache.org/viewvc/abdera/abdera2/activities/src/main/java/org/apache/abdera2/activities/extra/Extra.java?rev=1201318&r1=1201317&r2=1201318&view=diff
==============================================================================
--- abdera/abdera2/activities/src/main/java/org/apache/abdera2/activities/extra/Extra.java
(original)
+++ abdera/abdera2/activities/src/main/java/org/apache/abdera2/activities/extra/Extra.java
Sat Nov 12 20:16:13 2011
@@ -41,18 +41,14 @@ import org.joda.time.DateTime;
 import com.google.common.base.CaseFormat;
 import com.google.common.base.Equivalence;
 import com.google.common.base.Predicate;
-import com.google.common.base.Predicates;
 import com.google.common.collect.Iterables;
 
-
+import static com.google.common.base.Predicates.*;
 import static org.apache.abdera2.activities.model.objects.Objects.*;
 import static org.apache.abdera2.common.misc.Comparisons.*;
+import static org.apache.abdera2.common.misc.MorePredicates.*;
 import static com.google.common.base.Preconditions.*;
 
-
-/**
- * Miscellaneous extensions
- */
 @SuppressWarnings({"unchecked","rawtypes"})
 public final class Extra {
 
@@ -66,7 +62,18 @@ public final class Extra {
     return PropertySelector.<Activity>create(
       Activity.class, 
       "getVerb", 
-      Predicates.equalTo(verb));
+      equalTo(verb));
+  }
+  
+  /**
+   * Returns a Selector that tests whether the provided
+   * activity uses the given ObjectType
+   */
+  public static Selector<ASObject> isObjectType(String name) {
+    return PropertySelector.<ASObject>create(
+      ASObject.class,
+      "getObjectType",
+      equalsIgnoreCase(name));
   }
   
   /**
@@ -649,7 +656,7 @@ public final class Extra {
         Iterable<String> bids = b.getKnownIds();
         Iterable<String> cids = 
           Iterables.filter(
-            aids, Predicates.in((Set<String>)bids));
+            aids, in((Set<String>)bids));
         // if cids is empty, it's not a duplicate, so return false
         // if cids isn't empty, they are likely duplicates, return true
         return !Iterables.isEmpty(cids);

Modified: abdera/abdera2/activities/src/main/java/org/apache/abdera2/activities/extra/PusherCollectionWriter.java
URL: http://svn.apache.org/viewvc/abdera/abdera2/activities/src/main/java/org/apache/abdera2/activities/extra/PusherCollectionWriter.java?rev=1201318&r1=1201317&r2=1201318&view=diff
==============================================================================
--- abdera/abdera2/activities/src/main/java/org/apache/abdera2/activities/extra/PusherCollectionWriter.java
(original)
+++ abdera/abdera2/activities/src/main/java/org/apache/abdera2/activities/extra/PusherCollectionWriter.java
Sat Nov 12 20:16:13 2011
@@ -75,7 +75,7 @@ public final class PusherCollectionWrite
   }
 
   public <X extends CollectionWriter> X writeObject(
-      org.apache.abdera2.activities.model.ASObject.Builder<?, ?> object) {
+      ASObject.Builder<?, ?> object) {
     return writeObject(object.get());
   }
   

Modified: abdera/abdera2/activities/src/main/java/org/apache/abdera2/activities/model/Verb.java
URL: http://svn.apache.org/viewvc/abdera/abdera2/activities/src/main/java/org/apache/abdera2/activities/model/Verb.java?rev=1201318&r1=1201317&r2=1201318&view=diff
==============================================================================
--- abdera/abdera2/activities/src/main/java/org/apache/abdera2/activities/model/Verb.java
(original)
+++ abdera/abdera2/activities/src/main/java/org/apache/abdera2/activities/model/Verb.java
Sat Nov 12 20:16:13 2011
@@ -99,12 +99,10 @@ public abstract class Verb {
     return name;
   }
 
-  @Override
   public int hashCode() {
-    return MoreFunctions.genHashCode(1,name);
+    return MoreFunctions.genHashCode(1,name.toLowerCase());
   }
 
-  @Override
   public boolean equals(Object obj) {
     if (this == obj)
       return true;
@@ -116,7 +114,7 @@ public abstract class Verb {
     if (name == null) {
       if (other.name != null)
         return false;
-    } else if (!name.equals(other.name))
+    } else if (!name.equalsIgnoreCase(other.name))
       return false;
     return true;
   }

Modified: abdera/abdera2/common/src/main/java/org/apache/abdera2/common/misc/MorePredicates.java
URL: http://svn.apache.org/viewvc/abdera/abdera2/common/src/main/java/org/apache/abdera2/common/misc/MorePredicates.java?rev=1201318&r1=1201317&r2=1201318&view=diff
==============================================================================
--- abdera/abdera2/common/src/main/java/org/apache/abdera2/common/misc/MorePredicates.java
(original)
+++ abdera/abdera2/common/src/main/java/org/apache/abdera2/common/misc/MorePredicates.java
Sat Nov 12 20:16:13 2011
@@ -28,6 +28,7 @@ import org.apache.abdera2.common.text.Co
 
 import com.google.common.base.Predicates;
 
+import static org.apache.abdera2.common.misc.Comparisons.*;
 import static com.google.common.base.Preconditions.*;
 
 public final class MorePredicates {
@@ -37,8 +38,8 @@ public final class MorePredicates {
   public static Selector<String> equalsIgnoreCase(final String val) {
     return new AbstractSelector<String>() {
       public boolean select(Object input) {
-        checkNotNull(input);
-        checkNotNull(val);
+        if (bothAreNull(val, input)) return true;
+        if (onlyOneIsNull(val, input)) return false;
         return input.toString().equalsIgnoreCase(val);
       }
     };

Modified: abdera/abdera2/test/pom.xml
URL: http://svn.apache.org/viewvc/abdera/abdera2/test/pom.xml?rev=1201318&r1=1201317&r2=1201318&view=diff
==============================================================================
--- abdera/abdera2/test/pom.xml (original)
+++ abdera/abdera2/test/pom.xml Sat Nov 12 20:16:13 2011
@@ -27,11 +27,15 @@
   </parent>  
 
   <artifactId>abdera2-test</artifactId>
-  <packaging>jar</packaging>
+  <packaging>bundle</packaging>
   <name>Abdera2 Tests</name>
   <version>2.0-SNAPSHOT</version>  
   <description>Abdera Tests</description>
 
+  <properties>
+    <topDir>${basedir}/..</topDir> 
+  </properties>
+
   <build>
   <testSourceDirectory>src/main/java</testSourceDirectory>
   </build>



Mime
View raw message