You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@shindig.apache.org by wo...@apache.org on 2011/03/10 23:41:40 UTC

svn commit: r1080381 [1/2] - in /shindig/trunk: config/ content/sampledata/ java/social-api/src/main/java/org/apache/shindig/social/core/model/ java/social-api/src/main/java/org/apache/shindig/social/core/util/atom/ java/social-api/src/main/java/org/ap...

Author: woodser
Date: Thu Mar 10 22:41:38 2011
New Revision: 1080381

URL: http://svn.apache.org/viewvc?rev=1080381&view=rev
Log:
ActivitStreams revision: https://issues.apache.org/jira/browse/SHINDIG-1511
- new way of doing tests using test fixtures *much cleaner*
- updated data component based on AS spec
- serialization for updated data components
- miscellaneous improvements to handler, service, etc 

Added:
    shindig/trunk/java/social-api/src/test/java/org/apache/shindig/social/dataservice/integration/TestUtils.java
    shindig/trunk/java/social-api/src/test/java/org/apache/shindig/social/dataservice/integration/fixtures/
    shindig/trunk/java/social-api/src/test/java/org/apache/shindig/social/dataservice/integration/fixtures/ActivityEntryAtomId.xml
    shindig/trunk/java/social-api/src/test/java/org/apache/shindig/social/dataservice/integration/fixtures/ActivityEntryAtomIds.xml
    shindig/trunk/java/social-api/src/test/java/org/apache/shindig/social/dataservice/integration/fixtures/ActivityEntryJsonCreated.json
    shindig/trunk/java/social-api/src/test/java/org/apache/shindig/social/dataservice/integration/fixtures/ActivityEntryJsonDelete.json
    shindig/trunk/java/social-api/src/test/java/org/apache/shindig/social/dataservice/integration/fixtures/ActivityEntryJsonGroup.json
    shindig/trunk/java/social-api/src/test/java/org/apache/shindig/social/dataservice/integration/fixtures/ActivityEntryJsonId.json
    shindig/trunk/java/social-api/src/test/java/org/apache/shindig/social/dataservice/integration/fixtures/ActivityEntryJsonIds.json
    shindig/trunk/java/social-api/src/test/java/org/apache/shindig/social/dataservice/integration/fixtures/ActivityEntryJsonUpdated.json
    shindig/trunk/java/social-api/src/test/java/org/apache/shindig/social/dataservice/integration/fixtures/ActivityEntryXmlId.xml
    shindig/trunk/java/social-api/src/test/java/org/apache/shindig/social/dataservice/integration/fixtures/ActivityEntryXmlIds.xml
    shindig/trunk/java/social-api/src/test/java/org/apache/shindig/social/dataservice/integration/fixtures/ActivityStreamsSupportedFields.json
Removed:
    shindig/trunk/java/social-api/src/main/java/org/apache/shindig/social/core/model/ActionLinkImpl.java
    shindig/trunk/java/social-api/src/main/java/org/apache/shindig/social/core/model/StandardLinkImpl.java
    shindig/trunk/java/social-api/src/main/java/org/apache/shindig/social/opensocial/model/ActionLink.java
    shindig/trunk/java/social-api/src/main/java/org/apache/shindig/social/opensocial/model/StandardLink.java
Modified:
    shindig/trunk/config/container.js
    shindig/trunk/content/sampledata/canonicaldb.json
    shindig/trunk/java/social-api/src/main/java/org/apache/shindig/social/core/model/ActivityEntryImpl.java
    shindig/trunk/java/social-api/src/main/java/org/apache/shindig/social/core/model/ActivityObjectImpl.java
    shindig/trunk/java/social-api/src/main/java/org/apache/shindig/social/core/model/MediaLinkImpl.java
    shindig/trunk/java/social-api/src/main/java/org/apache/shindig/social/core/util/atom/AtomEntry.java
    shindig/trunk/java/social-api/src/main/java/org/apache/shindig/social/core/util/xstream/XStream081Configuration.java
    shindig/trunk/java/social-api/src/main/java/org/apache/shindig/social/opensocial/model/ActivityEntry.java
    shindig/trunk/java/social-api/src/main/java/org/apache/shindig/social/opensocial/model/ActivityObject.java
    shindig/trunk/java/social-api/src/main/java/org/apache/shindig/social/opensocial/model/MediaLink.java
    shindig/trunk/java/social-api/src/main/java/org/apache/shindig/social/opensocial/service/ActivityStreamHandler.java
    shindig/trunk/java/social-api/src/main/java/org/apache/shindig/social/opensocial/spi/ActivityStreamService.java
    shindig/trunk/java/social-api/src/main/java/org/apache/shindig/social/sample/spi/JsonDbOpensocialService.java
    shindig/trunk/java/social-api/src/test/java/org/apache/shindig/social/dataservice/integration/RestfulAtomActivityEntryTest.java
    shindig/trunk/java/social-api/src/test/java/org/apache/shindig/social/dataservice/integration/RestfulJsonActivityEntryTest.java
    shindig/trunk/java/social-api/src/test/java/org/apache/shindig/social/dataservice/integration/RestfulXmlActivityEntryTest.java
    shindig/trunk/java/social-api/src/test/java/org/apache/shindig/social/opensocial/service/ActivityStreamHandlerTest.java
    shindig/trunk/java/social-api/src/test/java/org/apache/shindig/social/sample/spi/JsonDbOpensocialServiceTest.java

Modified: shindig/trunk/config/container.js
URL: http://svn.apache.org/viewvc/shindig/trunk/config/container.js?rev=1080381&r1=1080380&r2=1080381&view=diff
==============================================================================
--- shindig/trunk/config/container.js (original)
+++ shindig/trunk/config/container.js Thu Mar 10 22:41:38 2011
@@ -256,8 +256,8 @@
        "activity" : ["appId", "body", "bodyId", "externalId", "id", "mediaItems", "postedTime", "priority", 
                      "streamFaviconUrl", "streamSourceUrl", "streamTitle", "streamUrl", "templateParams", "title",
                      "url", "userId"],
-       "activityEntry" : ["icon", "postedTime", "actor", "verb", "object", "target", "generator", "provider", "title",
-                          "body", "standardLinks", "to", "cc", "bcc"],
+       "activityEntry" : ["actor", "body", "generator", "icon", "object", "postedTime", "provider", "target", "title",
+                          "updatedTime", "verb"],
        "album" : ["id", "thumbnailUrl", "title", "description", "location", "ownerId"],
        "mediaItem" : ["album_id", "created", "description", "duration", "file_size", "id", "language", "last_updated",
                       "location", "mime_type", "num_comments", "num_views", "num_votes", "rating", "start_time",

Modified: shindig/trunk/content/sampledata/canonicaldb.json
URL: http://svn.apache.org/viewvc/shindig/trunk/content/sampledata/canonicaldb.json?rev=1080381&r1=1080380&r2=1080381&view=diff
==============================================================================
--- shindig/trunk/content/sampledata/canonicaldb.json (original)
+++ shindig/trunk/content/sampledata/canonicaldb.json Thu Mar 10 22:41:38 2011
@@ -351,47 +351,57 @@
 },
 "activityEntries" : {
 	"john.doe": [{
-		"title": "John posted a photo",
-		"body": "John Doe posted a photo to the album Germany 2009",
-		"postedTime": "2010-04-27T06:02:36+0000",
-		"actor": {
-			"id": "john.doe",
-			"displayName": "John Doe"
-		},
-		"to": ["jane.doe", "canonical"],
-		"cc": ["george.doe"],
-		"verb": "post",
-		"links": {
-			"myRel1": 
-				[{"href": "http://www.example.com/johnsalbum/1.jpg", "type": "image/jpg"},
-				{"href": "http://www.example.com/johnsalbum/2.jpg", "type": "image/jpg"}],
-			"myRel2":
-				[{"href": "http://www.example.com/johnsalbum/3.jpg", "type": "image/jpg"},
-				{"href": "http://www.example.com/johnsalbum/4.jpg", "type": "image/jpg"}]
-		},
-		"object": {
-			"id": "object1",
-			"displayName": "Frozen Eric",
-			"link": "http://www.example.com/johnsalbum",
-			"objectType": "picture",
-			"image": {
-				"url": "http://www.example.com/johnsalbum/cover.jpg",
-				"type": "http://activitystrea.ms/schema/1.0/picture",
-				"width": 400,
-				"height": 300,
-				"duration": 93
-			},
-			"actionLinks": [
-				{
-					"target": "http://example.com/johnsalbum/frozen.jpg",
-					"caption": "Frozen at the top of the German Alps"
-				}, {
-					"target": "http://example.com/johnsalbum/sign.jpg",
-					"caption": "Sign of Garmisch-Partenkirchen"
-				}
-			]
-		}
-	}, {
+      "verb": "post",
+      "postedTime": "2011-02-10T15:04:55Z",	
+      "generator": {
+        "url": "http://example.org/activities-app"
+      },
+      "provider": {
+        "url": "http://example.org/activity-stream"
+      },
+      "title": "John Doe posted a new video to his album.",
+      "target": {
+        "url": "http://example.org/album/",
+        "objectType": "http://activitystrea.ms/schema/1.0/photo-album",
+        "id": "tag:example.org,2011:abc123",
+        "displayName": "John's Photo Album",
+        "image": {
+          "url": "http://example.org/album/thumbnail.jpg",
+          "width": 250,
+          "height": 250
+        }
+      },
+      "object" : {
+        "url": "http://example.org/album/my_fluffy_cat.jpg",
+        "objectType": "http://activitystrea.ms/schema/1.0/photo",
+        "id": "object1",
+        "summary": "<body>My activity summary.</body>",
+        "image": {
+          "url": "http://example.org/album/my_fluffy_cat_thumb.jpg",
+          "width": 250,
+          "height": 250
+        },
+        "upstreamDuplicates": ["upstreamId1", "upstreamId2"],
+	    "attachedObjects": [{
+	     "url": "http://example.org/attached1",
+	      "id": "attached1"
+	    }, {
+	      "url": "http://example.org/attached2",
+	      "id": "attached2"
+	    }]
+      },
+      "actor": {
+        "url": "http://example.org/john",
+        "objectType": "person",
+        "id": "john.doe",
+        "image": {
+          "url": "http://example.org/john/image",
+          "width": 250,
+          "height": 250
+        },
+        "displayName": "John Doe"
+      }
+    }, {
 		"title": "Super simple ActivityEntry",
 		"actor": {
 			"id": "john.doe",

Modified: shindig/trunk/java/social-api/src/main/java/org/apache/shindig/social/core/model/ActivityEntryImpl.java
URL: http://svn.apache.org/viewvc/shindig/trunk/java/social-api/src/main/java/org/apache/shindig/social/core/model/ActivityEntryImpl.java?rev=1080381&r1=1080380&r2=1080381&view=diff
==============================================================================
--- shindig/trunk/java/social-api/src/main/java/org/apache/shindig/social/core/model/ActivityEntryImpl.java (original)
+++ shindig/trunk/java/social-api/src/main/java/org/apache/shindig/social/core/model/ActivityEntryImpl.java Thu Mar 10 22:41:38 2011
@@ -18,34 +18,26 @@
 
 package org.apache.shindig.social.core.model;
 
-import java.util.List;
-import java.util.Map;
-
 import org.apache.shindig.social.opensocial.model.ActivityEntry;
 import org.apache.shindig.social.opensocial.model.ActivityObject;
 import org.apache.shindig.social.opensocial.model.MediaLink;
-import org.apache.shindig.social.opensocial.model.StandardLink;
 
 /**
  * A simple bean implementation of an ActivityStream Entry.
- * 
  */
 public class ActivityEntryImpl implements ActivityEntry {
-
-  private MediaLink icon;
-  private String postedTime;
+  
   private ActivityObject actor;
-  private String verb;
-  private ActivityObject object;
-  private ActivityObject target;
+  private String body;
   private ActivityObject generator;
+  private MediaLink icon;
+  private ActivityObject object;
+  private String postedTime;
   private ActivityObject provider;
+  private ActivityObject target;
   private String title;
-  private String body;
-  private Map<String, List<StandardLink>> links;
-  private List<String> to;
-  private List<String> cc;
-  private List<String> bcc;
+  private String updatedTime;
+  private String verb;
 
   /**
    * Create a new empty ActivityEntry
@@ -54,88 +46,88 @@ public class ActivityEntryImpl implement
   }
 
   /** {@inheritDoc} */
-  public MediaLink getIcon() {
-    return icon;
+  public ActivityObject getActor() {
+    return this.actor;
   }
 
   /** {@inheritDoc} */
-  public void setIcon(MediaLink icon) {
-    this.icon = icon;
+  public void setActor(ActivityObject actor) {
+    this.actor = actor;
   }
 
   /** {@inheritDoc} */
-  public String getPostedTime() {
-    return postedTime;
+  public String getBody() {
+    return this.body;
   }
 
   /** {@inheritDoc} */
-  public void setPostedTime(String postedTime) {
-    this.postedTime = postedTime;
+  public void setBody(String body) {
+    this.body = body;
   }
 
   /** {@inheritDoc} */
-  public ActivityObject getActor() {
-    return actor;
+  public ActivityObject getGenerator() {
+    return this.generator;
   }
 
   /** {@inheritDoc} */
-  public void setActor(ActivityObject actor) {
-    this.actor = actor;
+  public void setGenerator(ActivityObject generator) {
+    this.generator = generator;
   }
 
   /** {@inheritDoc} */
-  public String getVerb() {
-    return verb;
+  public MediaLink getIcon() {
+    return this.icon;
   }
 
   /** {@inheritDoc} */
-  public void setVerb(String verb) {
-    this.verb = verb;
+  public void setIcon(MediaLink icon) {
+    this.icon = icon;
   }
 
   /** {@inheritDoc} */
   public ActivityObject getObject() {
-    return object;
+    return this.object;
   }
 
   /** {@inheritDoc} */
   public void setObject(ActivityObject object) {
-    this.object = object;
+    this.object = object; 
   }
 
   /** {@inheritDoc} */
-  public ActivityObject getTarget() {
-    return target;
+  public String getPostedTime() {
+    return this.postedTime;
   }
 
   /** {@inheritDoc} */
-  public void setTarget(ActivityObject target) {
-    this.target = target;
+  public void setPostedTime(String postedTime) {
+    this.postedTime = postedTime;
   }
 
   /** {@inheritDoc} */
-  public ActivityObject getGenerator() {
-    return generator;
+  public ActivityObject getProvider() {
+    return this.provider;
   }
 
   /** {@inheritDoc} */
-  public void setGenerator(ActivityObject generator) {
-    this.generator = generator;
+  public void setProvider(ActivityObject provider) {
+    this.provider = provider;
   }
 
   /** {@inheritDoc} */
-  public ActivityObject getProvider() {
-    return provider;
+  public ActivityObject getTarget() {
+    return this.target;
   }
 
   /** {@inheritDoc} */
-  public void setProvider(ActivityObject provider) {
-    this.provider = provider;
+  public void setTarget(ActivityObject target) {
+    this.target = target;
   }
 
   /** {@inheritDoc} */
   public String getTitle() {
-    return title;
+    return this.title;
   }
 
   /** {@inheritDoc} */
@@ -144,52 +136,22 @@ public class ActivityEntryImpl implement
   }
 
   /** {@inheritDoc} */
-  public String getBody() {
-    return body;
-  }
-
-  /** {@inheritDoc} */
-  public void setBody(String body) {
-    this.body = body;
+  public String getUpdatedTime() {
+    return this.updatedTime;
   }
 
   /** {@inheritDoc} */
-  public Map<String, List<StandardLink>> getLinks() {
-    return links;
+  public void setUpdatedTime(String updatedTime) {
+    this.updatedTime = updatedTime;
   }
 
   /** {@inheritDoc} */
-  public void setLinks(Map<String, List<StandardLink>> links) {
-    this.links = links;
-  }
-  
-  /** {@inheritDoc} */
-  public List<String> getTo() {
-    return to;
-  }
-  
-  /** {@inheritDoc} */
-  public void setTo(List<String> to) {
-    this.to = to;
-  }
-  
-  /** {@inheritDoc} */
-  public List<String> getCc() {
-    return cc;
-  }
-  
-  /** {@inheritDoc} */
-  public void setCc(List<String> cc) {
-    this.cc = cc;
+  public String getVerb() {
+    return this.verb;
   }
 
   /** {@inheritDoc} */
-  public List<String> getBcc() {
-    return bcc;
-  }
-  
-  /** {@inheritDoc} */
-  public void setBcc(List<String> bcc) {
-    this.bcc = bcc;
+  public void setVerb(String verb) {
+    this.verb = verb;
   }
 }

Modified: shindig/trunk/java/social-api/src/main/java/org/apache/shindig/social/core/model/ActivityObjectImpl.java
URL: http://svn.apache.org/viewvc/shindig/trunk/java/social-api/src/main/java/org/apache/shindig/social/core/model/ActivityObjectImpl.java?rev=1080381&r1=1080380&r2=1080381&view=diff
==============================================================================
--- shindig/trunk/java/social-api/src/main/java/org/apache/shindig/social/core/model/ActivityObjectImpl.java (original)
+++ shindig/trunk/java/social-api/src/main/java/org/apache/shindig/social/core/model/ActivityObjectImpl.java Thu Mar 10 22:41:38 2011
@@ -19,33 +19,25 @@
 package org.apache.shindig.social.core.model;
 
 import java.util.List;
-import java.util.Map;
 
-import org.apache.shindig.social.opensocial.model.ActionLink;
 import org.apache.shindig.social.opensocial.model.ActivityObject;
 import org.apache.shindig.social.opensocial.model.MediaLink;
-import org.apache.shindig.social.opensocial.model.StandardLink;
 
 /**
  * <p>ActivityObjectImpl class.</p>
- *
  */
 public class ActivityObjectImpl implements ActivityObject {
   
-  private String id;
+  private List<ActivityObject> attachedObjects;
   private String displayName;
-  private String summary;
+  private List<String> downstreamDuplicates;
+  private String embedCode;
+  private String id;
   private MediaLink image;
-  private String link;
   private String objectType;
-  private ActivityObject inReplyTo;
-  private List<ActivityObject> attachedObjects;
-  private List<ActivityObject> replies;
-  private List<ActivityObject> reactions;
-  private List<ActionLink> actionLinks;
+  private String summary;
   private List<String> upstreamDuplicates;
-  private List<String> downstreamDuplicates;
-  private Map<String, List<StandardLink>> links;
+  private String url;
   
   /**
    * A simple implementation of an ActivtyObject
@@ -54,18 +46,18 @@ public class ActivityObjectImpl implemen
   }
 
   /** {@inheritDoc} */
-  public String getId() {
-    return id;
+  public List<ActivityObject> getAttachedObjects() {
+    return this.attachedObjects;
   }
 
   /** {@inheritDoc} */
-  public void setId(String id) {
-    this.id = id;
+  public void setAttachedObjects(List<ActivityObject> attachedObjects) {
+    this.attachedObjects = attachedObjects;
   }
 
   /** {@inheritDoc} */
   public String getDisplayName() {
-    return displayName;
+    return this.displayName;
   }
 
   /** {@inheritDoc} */
@@ -74,98 +66,58 @@ public class ActivityObjectImpl implemen
   }
 
   /** {@inheritDoc} */
-  public String getSummary() {
-    return summary;
-  }
-
-  /** {@inheritDoc} */
-  public void setSummary(String summary) {
-    this.summary = summary;
-  }
-
-  /** {@inheritDoc} */
-  public MediaLink getImage() {
-    return image;
-  }
-
-  /** {@inheritDoc} */
-  public void setImage(MediaLink image) {
-    this.image = image;
-  }
-
-  /** {@inheritDoc} */
-  public String getLink() {
-    return link;
-  }
-
-  /** {@inheritDoc} */
-  public void setLink(String link) {
-    this.link = link;
-  }
-
-  /** {@inheritDoc} */
-  public String getObjectType() {
-    return objectType;
-  }
-
-  /** {@inheritDoc} */
-  public void setObjectType(String objectType) {
-    this.objectType = objectType;
-  }
-
-  /** {@inheritDoc} */
-  public ActivityObject getInReplyTo() {
-    return inReplyTo;
+  public List<String> getDownstreamDuplicates() {
+    return this.downstreamDuplicates;
   }
 
   /** {@inheritDoc} */
-  public void setInReplyTo(ActivityObject inReplyTo) {
-    this.inReplyTo = inReplyTo;
+  public void setDownstreamDuplicates(List<String> downstreamDuplicates) {
+    this.downstreamDuplicates = downstreamDuplicates;
   }
 
   /** {@inheritDoc} */
-  public List<ActivityObject> getAttachedObjects() {
-    return attachedObjects;
+  public String getEmbedCode() {
+    return this.embedCode;
   }
 
   /** {@inheritDoc} */
-  public void setAttachedObjects(List<ActivityObject> attachedObjects) {
-    this.attachedObjects = attachedObjects;
+  public void setEmbedCode(String embedCode) {
+    this.embedCode = embedCode;
   }
 
   /** {@inheritDoc} */
-  public List<ActivityObject> getReplies() {
-    return replies;
+  public String getId() {
+    return this.id;
   }
 
   /** {@inheritDoc} */
-  public void setReplies(List<ActivityObject> replies) {
-    this.replies = replies;
+  public void setId(String id) {
+    this.id = id;
   }
 
   /** {@inheritDoc} */
-  public List<ActivityObject> getReactions() {
-    return reactions;
+  public MediaLink getImage() {
+    return this.image;
   }
 
   /** {@inheritDoc} */
-  public void setReactions(List<ActivityObject> reactions) {
-    this.reactions = reactions;
+  public void setImage(MediaLink image) {
+    this.image = image;
   }
 
   /** {@inheritDoc} */
-  public List<ActionLink> getActionLinks() {
-    return actionLinks;
+  public String getObjectType() {
+    return this.objectType;
   }
 
   /** {@inheritDoc} */
-  public void setActionLinks(List<ActionLink> actionLinks) {
-    this.actionLinks = actionLinks;
+  public void setObjectType(String objectType) {
+    this.objectType = objectType;
   }
 
   /** {@inheritDoc} */
   public List<String> getUpstreamDuplicates() {
-    return upstreamDuplicates;
+    return this.upstreamDuplicates;
   }
 
   /** {@inheritDoc} */
@@ -174,22 +126,22 @@ public class ActivityObjectImpl implemen
   }
 
   /** {@inheritDoc} */
-  public List<String> getDownstreamDuplicates() {
-    return downstreamDuplicates;
+  public String getSummary() {
+    return this.summary;
   }
 
   /** {@inheritDoc} */
-  public void setDownstreamDuplicates(List<String> downstreamDuplicates) {
-    this.downstreamDuplicates = downstreamDuplicates;
+  public void setSummary(String summary) {
+    this.summary = summary;
   }
 
   /** {@inheritDoc} */
-  public Map<String, List<StandardLink>> getLinks() {
-    return links;
+  public String getUrl() {
+    return this.url;
   }
 
   /** {@inheritDoc} */
-  public void setLinks(Map<String, List<StandardLink>> links) {
-    this.links = links;
+  public void setUrl(String url) {
+    this.url = url;
   }
-}
+}
\ No newline at end of file

Modified: shindig/trunk/java/social-api/src/main/java/org/apache/shindig/social/core/model/MediaLinkImpl.java
URL: http://svn.apache.org/viewvc/shindig/trunk/java/social-api/src/main/java/org/apache/shindig/social/core/model/MediaLinkImpl.java?rev=1080381&r1=1080380&r2=1080381&view=diff
==============================================================================
--- shindig/trunk/java/social-api/src/main/java/org/apache/shindig/social/core/model/MediaLinkImpl.java (original)
+++ shindig/trunk/java/social-api/src/main/java/org/apache/shindig/social/core/model/MediaLinkImpl.java Thu Mar 10 22:41:38 2011
@@ -25,11 +25,10 @@ import org.apache.shindig.social.opensoc
  */
 public class MediaLinkImpl implements MediaLink {
   
-  private String url;
-  private String type;
-  private Integer width;
-  private Integer height;
   private Integer duration;
+  private Integer height;
+  private String url;
+  private Integer width;  
   
   /**
    * Create a new MediaLink
@@ -38,52 +37,42 @@ public class MediaLinkImpl implements Me
   }
 
   /** {@inheritDoc} */
-  public String getUrl() {
-    return url;
-  }
-
-  /** {@inheritDoc} */
-  public void setUrl(String url) {
-    this.url = url;
-  }
-  
-  /** {@inheritDoc} */
-  public String getType() {
-    return type;
+  public Integer getDuration() {
+    return duration;
   }
 
   /** {@inheritDoc} */
-  public void setType(String type) {
-    this.type = type;
+  public void setDuration(Integer duration) {
+    this.duration = duration;
   }
 
   /** {@inheritDoc} */
-  public Integer getWidth() {
-    return width;
+  public Integer getHeight() {
+    return height;
   }
 
   /** {@inheritDoc} */
-  public void setWidth(Integer width) {
-    this.width = width;
+  public void setHeight(Integer height) {
+    this.height = height;
   }
 
   /** {@inheritDoc} */
-  public Integer getHeight() {
-    return height;
+  public String getUrl() {
+    return url;
   }
 
   /** {@inheritDoc} */
-  public void setHeight(Integer height) {
-    this.height = height;
+  public void setUrl(String url) {
+    this.url = url;
   }
 
   /** {@inheritDoc} */
-  public Integer getDuration() {
-    return duration;
+  public Integer getWidth() {
+    return width;
   }
 
   /** {@inheritDoc} */
-  public void setDuration(Integer duration) {
-    this.duration = duration;
+  public void setWidth(Integer width) {
+    this.width = width;
   }
 }

Modified: shindig/trunk/java/social-api/src/main/java/org/apache/shindig/social/core/util/atom/AtomEntry.java
URL: http://svn.apache.org/viewvc/shindig/trunk/java/social-api/src/main/java/org/apache/shindig/social/core/util/atom/AtomEntry.java?rev=1080381&r1=1080380&r2=1080381&view=diff
==============================================================================
--- shindig/trunk/java/social-api/src/main/java/org/apache/shindig/social/core/util/atom/AtomEntry.java (original)
+++ shindig/trunk/java/social-api/src/main/java/org/apache/shindig/social/core/util/atom/AtomEntry.java Thu Mar 10 22:41:38 2011
@@ -89,7 +89,7 @@ public class AtomEntry {
       ActivityEntry activity = (ActivityEntry)o;
       id = activity.getObject().getId();
       title = activity.getTitle();
-      summary = activity.getBody();
+      summary = activity.getObject().getSummary();
       author = new AtomAuthor(activity);
       content = new AtomContent(activity);
       try {

Modified: shindig/trunk/java/social-api/src/main/java/org/apache/shindig/social/core/util/xstream/XStream081Configuration.java
URL: http://svn.apache.org/viewvc/shindig/trunk/java/social-api/src/main/java/org/apache/shindig/social/core/util/xstream/XStream081Configuration.java?rev=1080381&r1=1080380&r2=1080381&view=diff
==============================================================================
--- shindig/trunk/java/social-api/src/main/java/org/apache/shindig/social/core/util/xstream/XStream081Configuration.java (original)
+++ shindig/trunk/java/social-api/src/main/java/org/apache/shindig/social/core/util/xstream/XStream081Configuration.java Thu Mar 10 22:41:38 2011
@@ -46,7 +46,6 @@ import org.apache.shindig.social.core.ut
 import org.apache.shindig.social.core.util.atom.AtomKeyValue;
 import org.apache.shindig.social.core.util.atom.AtomLinkConverter;
 import org.apache.shindig.social.opensocial.model.Account;
-import org.apache.shindig.social.opensocial.model.ActionLink;
 import org.apache.shindig.social.opensocial.model.Activity;
 import org.apache.shindig.social.opensocial.model.ActivityEntry;
 import org.apache.shindig.social.opensocial.model.ActivityObject;
@@ -60,7 +59,6 @@ import org.apache.shindig.social.opensoc
 import org.apache.shindig.social.opensocial.model.Name;
 import org.apache.shindig.social.opensocial.model.Organization;
 import org.apache.shindig.social.opensocial.model.Person;
-import org.apache.shindig.social.opensocial.model.StandardLink;
 import org.apache.shindig.social.opensocial.model.Url;
 
 import com.google.common.base.Objects;
@@ -164,8 +162,6 @@ public class XStream081Configuration imp
         new ClassFieldMapping("activity", Activity.class),
         new ClassFieldMapping("activityEntry", ActivityEntry.class),
         new ClassFieldMapping("object", ActivityObject.class),
-        new ClassFieldMapping("link", StandardLink.class),
-        new ClassFieldMapping("actionLink", ActionLink.class),
         new ClassFieldMapping("mediaLink", MediaLink.class),
         new ClassFieldMapping("account", Account.class),
         new ClassFieldMapping("address", Address.class),
@@ -204,8 +200,6 @@ public class XStream081Configuration imp
         new ClassFieldMapping("activity", Activity.class),
         new ClassFieldMapping("activityEntry", ActivityEntry.class),
         new ClassFieldMapping("object", ActivityObject.class),
-        new ClassFieldMapping("link", StandardLink.class),
-        new ClassFieldMapping("actionLink", ActionLink.class),
         new ClassFieldMapping("mediaLink", MediaLink.class),
         new ClassFieldMapping("account", Account.class),
         new ClassFieldMapping("address", Address.class),
@@ -245,8 +239,6 @@ public class XStream081Configuration imp
         .put("activity", Activity.class)
         .put("activityEntry", ActivityEntry.class)
         .put("object", ActivityObject.class)
-        .put("link", StandardLink.class)
-        .put("actionLink", ActionLink.class)
         .put("mediaLink", MediaLink.class)
         .put("account", Account.class)
         .put("address", Address.class)
@@ -295,9 +287,8 @@ public class XStream081Configuration imp
         new ImplicitCollectionFieldMapping(Message.class, "collectionIds", String.class, "collectionsIds"),
         new ImplicitCollectionFieldMapping(Message.class, "replies", String.class, "replies"),
         
-        new ImplicitCollectionFieldMapping(ActivityEntry.class, "to", String.class, "to"),
-        new ImplicitCollectionFieldMapping(ActivityEntry.class, "cc", String.class, "cc"),
-        new ImplicitCollectionFieldMapping(ActivityEntry.class, "bcc", String.class, "bcc"),
+        new ImplicitCollectionFieldMapping(ActivityObject.class, "downstreamDuplicates", String.class, "downstreamDuplicates"),
+        new ImplicitCollectionFieldMapping(ActivityObject.class, "upstreamDuplicates", String.class, "upstreamDuplicates"),
 
         new ImplicitCollectionFieldMapping(Activity.class, "mediaItems", MediaItem.class, "mediaItems"))
     );

Modified: shindig/trunk/java/social-api/src/main/java/org/apache/shindig/social/opensocial/model/ActivityEntry.java
URL: http://svn.apache.org/viewvc/shindig/trunk/java/social-api/src/main/java/org/apache/shindig/social/opensocial/model/ActivityEntry.java?rev=1080381&r1=1080380&r2=1080381&view=diff
==============================================================================
--- shindig/trunk/java/social-api/src/main/java/org/apache/shindig/social/opensocial/model/ActivityEntry.java (original)
+++ shindig/trunk/java/social-api/src/main/java/org/apache/shindig/social/opensocial/model/ActivityEntry.java Thu Mar 10 22:41:38 2011
@@ -18,9 +18,6 @@
 
 package org.apache.shindig.social.opensocial.model;
 
-import java.util.List;
-import java.util.Map;
-
 import org.apache.shindig.protocol.model.Exportablebean;
 import org.apache.shindig.social.core.model.ActivityEntryImpl;
 
@@ -28,11 +25,7 @@ import com.google.inject.ImplementedBy;
 
 /**
  * <p>ActivityEntry interface.</p>
- * TODO: comment a description for this class
- * TODO: ensure verbs are up to date
- * TODO: comment all classes
  */
-
 @ImplementedBy(ActivityEntryImpl.class)
 @Exportablebean
 public interface ActivityEntry {
@@ -41,20 +34,17 @@ public interface ActivityEntry {
    * Fields that represent JSON elements for an activity entry.
    */
   public static enum Field {
-    ICON("icon"),
-    POSTED_TIME("postedTime"),
     ACTOR("actor"),
-    VERB("verb"),
-    OBJECT("object"),
-    TARGET("target"),
+    BODY("body"),
     GENERATOR("generator"),
+    ICON("icon"),
+    OBJECT("object"),
+    POSTED_TIME("postedTime"),
     PROVIDER("provider"),
+    TARGET("target"),
     TITLE("title"),
-    BODY("body"),
-    LINKS("links"),
-    TO("to"),
-    CC("cc"),
-    BCC("bcc");
+    UPDATED_TIME("updatedTime"),
+    VERB("verb");
     
     /**
      * The name of the JSON element.
@@ -81,156 +71,116 @@ public interface ActivityEntry {
   }
   
   /**
-   * Possible verbs for an activity stream entry.
-   */
-  public static enum Verb {
-    MARK_AS_FAVORITE("markAsFavorite"),
-    START_FOLLOWING("startFollowing"),
-    MARK_AS_LIKED("markAsLiked"),
-    MAKE_FRIEND("makeFriend"),
-    JOIN("join"),
-    PLAY("play"),
-    POST("post"),
-    SAVE("save"),
-    SHARE("share"),
-    TAG("tag"),
-    UPDATE("update");
-    
-    /**
-     * The name of the JSON element.
-     */
-    private final String jsonString;
-    
-    /**
-     * Constructs the field base for the JSON element.
-     * 
-     * @param jsonString the name of the element
-     */
-    private Verb(String jsonString) {
-      this.jsonString = jsonString;
-    }
-    
-    /**
-     * Returns the name of the JSON element.
-     * 
-     * @return String the name of the JSON element
-     */
-    public String toString() {
-      return jsonString;
-    }
-  }
-  
-  /**
-   * <p>getIcon</p>
+   * <p>getActor</p>
    *
-   * @return a {@link org.apache.shindig.extras.as.opensocial.model.MediaLink} object.
+   * @return a {@link org.apache.shindig.social.opensocial.model.ActivityObject} object.
    */
-  MediaLink getIcon();
+  ActivityObject getActor();
 
   /**
-   * <p>setIcon</p>
+   * <p>setActor</p>
    *
-   * @param icon a {@link org.apache.shindig.extras.as.opensocial.model.MediaLink} object.
+   * @param actor a {@link org.apache.shindig.social.opensocial.model.ActivityObject} object.
    */
-  void setIcon(MediaLink icon);
+  void setActor(ActivityObject actor);
 
   /**
-   * <p>getPostedTime</p>
+   * <p>getBody</p>
    *
    * @return a {@link java.lang.String} object.
    */
-  String getPostedTime();
+  String getBody();
 
   /**
-   * <p>setPostedTime</p>
+   * <p>setBody</p>
    *
-   * @param postedTime a {@link java.lang.String} object.
+   * @param body a {@link java.lang.String} object.
    */
-  void setPostedTime(String postedTime);
-
+  void setBody(String body);
+  
   /**
-   * <p>getActor</p>
+   * <p>getGenerator</p>
    *
-   * @return a {@link org.apache.shindig.extras.as.opensocial.model.ActivityObject} object.
+   * @return a {@link org.apache.shindig.social.opensocial.model.ActivityObject} object.
    */
-  ActivityObject getActor();
+  ActivityObject getGenerator();
 
   /**
-   * <p>setActor</p>
+   * <p>setGenerator</p>
    *
-   * @param actor a {@link org.apache.shindig.extras.as.opensocial.model.ActivityObject} object.
+   * @param generator a {@link org.apache.shindig.social.opensocial.model.ActivityObject} object.
    */
-  void setActor(ActivityObject actor);
-
+  void setGenerator(ActivityObject generator);
+  
   /**
-   * <p>getVerb</p>
+   * <p>getIcon</p>
    *
-   * @return a {@link java.util.List} object.
+   * @return a {@link org.apache.shindig.social.opensocial.model.MediaLink} object.
    */
-  String getVerb();
+  MediaLink getIcon();
 
   /**
-   * <p>setVerb</p>
+   * <p>setIcon</p>
    *
-   * @param verb a {@link java.util.List} object.
+   * @param icon a {@link org.apache.shindig.social.opensocial.model.MediaLink} object.
    */
-  void setVerb(String verb);
+  void setIcon(MediaLink icon);
 
   /**
    * <p>getObject</p>
    *
-   * @return a {@link org.apache.shindig.extras.as.opensocial.model.ActivityObject} object.
+   * @return a {@link org.apache.shindig.social.opensocial.model.ActivityObject} object.
    */
   ActivityObject getObject();
 
   /**
    * <p>setObject</p>
    *
-   * @param object a {@link org.apache.shindig.extras.as.opensocial.model.ActivityObject} object.
+   * @param object a {@link org.apache.shindig.social.opensocial.model.ActivityObject} object.
    */
   void setObject(ActivityObject object);
-  
+
   /**
-   * <p>getTarget</p>
+   * <p>getPostedTime</p>
    *
-   * @return a {@link org.apache.shindig.extras.as.opensocial.model.ActivityObject} object.
+   * @return a {@link java.lang.String} object.
    */
-  ActivityObject getTarget();
-  
+  String getPostedTime();
+
   /**
-   * <p>setTarget</p>
+   * <p>setPostedTime</p>
    *
-   * @param target a {@link org.apache.shindig.extras.as.opensocial.model.ActivityObject} object.
+   * @param postedTime a {@link java.lang.String} object.
    */
-  void setTarget(ActivityObject target);
+  void setPostedTime(String postedTime);
   
   /**
-   * <p>getGenerator</p>
+   * <p>getProvider</p>
    *
-   * @return a {@link org.apache.shindig.extras.as.opensocial.model.ActivityObject} object.
+   * @return a {@link org.apache.shindig.social.opensocial.model.ActivityObject} object.
    */
-  ActivityObject getGenerator();
+  ActivityObject getProvider();
 
   /**
-   * <p>setGenerator</p>
+   * <p>setServiceProvider</p>
    *
-   * @param generator a {@link org.apache.shindig.extras.as.opensocial.model.ActivityObject} object.
+   * @param provider a {@link org.apache.shindig.social.opensocial.model.ActivityObject} object.
    */
-  void setGenerator(ActivityObject generator);
-
+  void setProvider(ActivityObject provider);
+  
   /**
-   * <p>getProvider</p>
+   * <p>getTarget</p>
    *
-   * @return a {@link org.apache.shindig.extras.as.opensocial.model.ActivityObject} object.
+   * @return a {@link org.apache.shindig.social.opensocial.model.ActivityObject} object.
    */
-  ActivityObject getProvider();
-
+  ActivityObject getTarget();
+  
   /**
-   * <p>setServiceProvider</p>
+   * <p>setTarget</p>
    *
-   * @param provider a {@link org.apache.shindig.extras.as.opensocial.model.ActivityObject} object.
+   * @param target a {@link org.apache.shindig.social.opensocial.model.ActivityObject} object.
    */
-  void setProvider(ActivityObject provider);
+  void setTarget(ActivityObject target);
 
   /**
    * <p>getTitle</p>
@@ -245,74 +195,32 @@ public interface ActivityEntry {
    * @param title a {@link java.lang.String} object.
    */
   void setTitle(String title);
-
+  
   /**
-   * <p>getBody</p>
+   * <p>getUpdatedTime</p>
    *
    * @return a {@link java.lang.String} object.
    */
-  String getBody();
+  String getUpdatedTime();
 
   /**
-   * <p>setBody</p>
+   * <p>setUpdatedTime</p>
    *
-   * @param body a {@link java.lang.String} object.
+   * @param postedTime a {@link java.lang.String} object.
    */
-  void setBody(String body);
+  void setUpdatedTime(String updatedTime);
 
   /**
-   * <p>links</p>
+   * <p>getVerb</p>
    *
-   * @return a {@link java.util.Map} object.
+   * @return a {@link java.lang.String} object.
    */
-  Map<String, List<StandardLink>> getLinks();
+  String getVerb();
 
   /**
-   * <p>setLinks</p>
-   *
-   * @param links a {@link java.util.Map} object.
-   */
-  void setLinks(Map<String, List<StandardLink>> links);
-  
-  /**
-   * <p>getTo</p>
-   *
-   * @return a List<String> of target recipients
-   */
-  List<String> getTo();
-  
-  /**
-   * <p>setTo</p>
-   *
-   * @param to is the list of target recipients
-   */
-  void setTo(List<String> to);
-  
-  /**
-   * <p>getCC</p>
-   *
-   * @return a List<String> of carbon-copy recipients
-   */
-  List<String> getCc();
-  
-  /**
-   * <p>setCC</p>
-   *
-   * @param cc is the list of carbon-copy recipients
-   */
-  void setCc(List<String> cc);
-  
-  /**
-   * <p>getBCC</p>
-   *
-   * @return a List<String> of BCC recipients
-   */
-  List<String> getBcc();
-  
-  /**
-   * <p>setBCC</p>
+   * <p>setVerb</p>
    *
-   * @param bcc is the list of BCC recipients
+   * @param verb a {@link java.lang.String} object.
    */
-  void setBcc(List<String> bcc);
+  void setVerb(String verb);
 }

Modified: shindig/trunk/java/social-api/src/main/java/org/apache/shindig/social/opensocial/model/ActivityObject.java
URL: http://svn.apache.org/viewvc/shindig/trunk/java/social-api/src/main/java/org/apache/shindig/social/opensocial/model/ActivityObject.java?rev=1080381&r1=1080380&r2=1080381&view=diff
==============================================================================
--- shindig/trunk/java/social-api/src/main/java/org/apache/shindig/social/opensocial/model/ActivityObject.java (original)
+++ shindig/trunk/java/social-api/src/main/java/org/apache/shindig/social/opensocial/model/ActivityObject.java Thu Mar 10 22:41:38 2011
@@ -19,7 +19,6 @@
 package org.apache.shindig.social.opensocial.model;
 
 import java.util.List;
-import java.util.Map;
 
 import org.apache.shindig.protocol.model.Exportablebean;
 import org.apache.shindig.social.core.model.ActivityObjectImpl;
@@ -27,7 +26,7 @@ import org.apache.shindig.social.core.mo
 import com.google.inject.ImplementedBy;
 
 /**
- * A representation of an ActivityStream object, a thing which participates in an Activity.
+ * A representation of an Activity's object.
  */
 @ImplementedBy(ActivityObjectImpl.class)
 @Exportablebean
@@ -37,20 +36,16 @@ public interface ActivityObject {
    * Fields that represent JSON elements for an activity entry.
    */
   public static enum Field {
-    ID("id"),
+    ATTACHED_OBJECTS("attachedObjects"),
     DISPLAY_NAME("displayName"),
-    SUMMARY("summary"),
+    DOWNSTREAM_DUPLICATES("downstreamDuplicates"),
+    EMBED_CODE("embedCode"),
+    ID("id"),
     IMAGE("image"),
-    LINK("link"),
     OBJECT_TYPE("objectType"),
-    IN_REPLY_TO("inReplyTo"),
-    ATTACHED_OBJECTS("attachedObjects"),
-    REPLIES("replies"),
-    REACTIONS("reactions"),
-    ACTION_LINKS("actionLinks"),
+    SUMMARY("summary"),
     UPSTREAM_DUPLICATES("upstreamDuplicates"),
-    DOWNSTREAM_DUPLICATES("downstreamDuplicates"),
-    LINKS("links");
+    URL("url");
     
     /*
      * The name of the JSON element.
@@ -77,21 +72,21 @@ public interface ActivityObject {
   }
   
   /**
-   * Gets the absolute URI that uniquely identifies the object
+   * Gets the list of Attached Activities for this entry
    *
-   * @return a non-null string
+   * @return a list of ActivityObjects
    */
-  String getId();
+  List<ActivityObject> getAttachedObjects();
 
   /**
-   * Set the absolute URI that uniquely identifies the object
+   * Sets the list of Attached Activities for this entry
    *
-   * @param id a non-null string
+   * @param attachedObjects a list of ActivityObjects
    */
-  void setId(String id);
+  void setAttachedObjects(List<ActivityObject> attachedObjects);
 
   /**
-   * @return the human-readable name fo the object
+   * @return the human-readable name of the object
    */
   String getDisplayName();
 
@@ -102,129 +97,74 @@ public interface ActivityObject {
   void setDisplayName(String displayName);
 
   /**
-   * Gets the human-readable summary for this object.
-   * @return the summary
-   */
-  String getSummary();
-
-  /**
-   * Sets the human-readable summary for this object.
-   *
-   * @param summary a summary
-   */
-  void setSummary(String summary);
-
-  /**
-   * Get the link to a representative image.
-   *
-   * @return a {@link org.apache.shindig.extras.as.opensocial.model.MediaLink} object.
-   */
-  MediaLink getImage();
-
-  /**
-   * Set the link to a representative image.
-   *
-   * @param image a {@link org.apache.shindig.extras.as.opensocial.model.MediaLink} object.
-   */
-  void setImage(MediaLink image);
-
-  /**
-   * Get the permanent link
-   *
-   * @return a permalink string, possibly null
-   */
-  String getLink();
-
-  /**
-   * Set the permanent link
-   *
-   * @param permalink a permalink string, possibly null
-   */
-  void setLink(String link);
-
-  /**
-   * Returns the ActivityObject's object type.
-   *
-   * @return String representing the object type
-   */
-  String getObjectType();
-
-  /**
-   * Set's the ActivityObject's object type.
-   *
-   * @param objectType is the object type
-   */
-  void setObjectType(String objectType);
-
-  /**
-   * Get the Activity this item is a response to
+   * Get the list of downstream duplicates.
    *
-   * @return a {@link org.apache.shindig.extras.as.opensocial.model.ActivityObject} 
+   * @return a list of strings
    */
-  ActivityObject getInReplyTo();
+  List<String> getDownstreamDuplicates();
 
   /**
-   * Set the Activity this item is a response to
+   * Set the list of downstream duplicates
    *
-   * @param inReplyTo a {@link org.apache.shindig.extras.as.opensocial.model.ActivityObject} object.
+   * @param downstreamDuplicates a list of strings containing duplicate IDs
    */
-  void setInReplyTo(ActivityObject inReplyTo);
+  void setDownstreamDuplicates(List<String> downstreamDuplicates);
 
   /**
-   * Gets the list of Attached Activities for this entry
-   *
-   * @return a list of ActivityObjects
+   * Returns the object's embedCode property.
+   * 
+   * @return String is the object's embedCode property.
    */
-  List<ActivityObject> getAttachedObjects();
-
+  String getEmbedCode();
+  
   /**
-   * Sets the list of Attached Activities for this entry
-   *
-   * @param attachedObjects a list of ActivityObjects
+   * Sets the objet's embedCode property.
+   * 
+   * @param embedCode is the value to set embedCode to
    */
-  void setAttachedObjects(List<ActivityObject> attachedObjects);
+  void setEmbedCode(String embedCode);
 
   /**
-   * Gets the list of reply Activities for this entry
+   * Gets the absolute URI that uniquely identifies the object
    *
-   * @return a list of ActivityObjects
+   * @return a non-null string
    */
-  List<ActivityObject> getReplies();
+  String getId();
 
   /**
-   * Sets the list of reply Activities for this entry
+   * Set the absolute URI that uniquely identifies the object
    *
-   * @param replies a list of ActivityObjects
+   * @param id a non-null string
    */
-  void setReplies(List<ActivityObject> replies);
+  void setId(String id);
 
   /**
-   * Gets the list of reaction Activities for this entry
+   * Get the link to a representative image.
    *
-   * @return a list of ActivityObjects
+   * @return a {@link org.apache.shindig.extras.as.opensocial.model.MediaLink} object.
    */
-  List<ActivityObject> getReactions();
+  MediaLink getImage();
 
   /**
-   * Sets the list of reaction Activities for this entry
+   * Set the link to a representative image.
    *
-   * @param reactions a list of ActivityObjects
+   * @param image a {@link org.apache.shindig.extras.as.opensocial.model.MediaLink} object.
    */
-  void setReactions(List<ActivityObject> reactions);
+  void setImage(MediaLink image);
 
   /**
-   * Returns the ActionLinks for this object
+   * Returns the ActivityObject's object type.
    *
-   * @return List<ActionLink> is the list of ActionLink objects
+   * @return String representing the object type
    */
-  List<ActionLink> getActionLinks();
+  String getObjectType();
 
   /**
-   * Sets the ActionLinks for this object
+   * Set's the ActivityObject's object type.
    *
-   * @param actionLinks is the list of ActionLinks
+   * @param objectType is the object type
    */
-  void setActionLinks(List<ActionLink> actionLinks);
+  void setObjectType(String objectType);
 
   /**
    * Get the list of upstream duplicates.
@@ -241,30 +181,30 @@ public interface ActivityObject {
   void setUpstreamDuplicates(List<String> upstreamDuplicates);
 
   /**
-   * Get the list of downstream duplicates.
-   *
-   * @return a list of strings
+   * Gets the human-readable summary for this object.
+   * @return the summary
    */
-  List<String> getDownstreamDuplicates();
+  String getSummary();
 
   /**
-   * Set the list of downstream duplicates
+   * Sets the human-readable summary for this object.
    *
-   * @param downstreamDuplicates a list of strings containing duplicate IDs
+   * @param summary a summary
    */
-  void setDownstreamDuplicates(List<String> downstreamDuplicates);
-
+  void setSummary(String summary);
+  
+  
   /**
-   * Return the Object's StandardLinks
-   *
-   * @return Map<String, List<StandardLink>> is the list of StandardLinks
+   * Returns the object's URL.
+   * 
+   * @return String is the object's URL
    */
-  Map<String, List<StandardLink>> getLinks();
-
+  String getUrl();
+  
   /**
-   * Set the standard links
-   *
-   * @param links the list of standard links
+   * Sets the object's URL.
+   * 
+   * @param url is the value to set the object's URL
    */
-  void setLinks(Map<String, List<StandardLink>> links);
+  void setUrl(String url);
 }

Modified: shindig/trunk/java/social-api/src/main/java/org/apache/shindig/social/opensocial/model/MediaLink.java
URL: http://svn.apache.org/viewvc/shindig/trunk/java/social-api/src/main/java/org/apache/shindig/social/opensocial/model/MediaLink.java?rev=1080381&r1=1080380&r2=1080381&view=diff
==============================================================================
--- shindig/trunk/java/social-api/src/main/java/org/apache/shindig/social/opensocial/model/MediaLink.java (original)
+++ shindig/trunk/java/social-api/src/main/java/org/apache/shindig/social/opensocial/model/MediaLink.java Thu Mar 10 22:41:38 2011
@@ -22,12 +22,8 @@ import org.apache.shindig.social.core.mo
 
 import com.google.inject.ImplementedBy;
 
-/*
- * TODO: comment this class.
- */
 /**
  * <p>MediaLink interface.</p>
- *
  */
 @ImplementedBy(MediaLinkImpl.class)
 @Exportablebean
@@ -37,11 +33,10 @@ public interface MediaLink {
    * Fields that represent the JSON elements.
    */
   public static enum Field {
-    URL("url"),
-    TYPE("type"),
-    WIDTH("width"),
+    DURATION("duration"),
     HEIGHT("height"),
-    DURATION("duration");
+    URL("url"),
+    WIDTH("width");
     
     /**
      * The name of the JSON element.
@@ -68,72 +63,58 @@ public interface MediaLink {
   }
   
   /**
-   * Returns the target URL of this MediaLink
+   * Returns the duration of this media.
    *
-   * @return a target
+   * @return Integer is the target's duration
    */
-  String getUrl();
+  Integer getDuration();
 
   /**
-   * Sets the target URL for this MediaLink
+   * Sets the duration of this media.
    *
-   * @param target a target link
-   */
-  void setUrl(String url);
-  
-  /**
-   * Returns the Media's type.
-   * 
-   * @return String indicates the target Media's type
-   */
-  String getType();
-  
-  /**
-   * Sets the Media's type.
-   * 
-   * @param type is target Media's type
+   * @param duration is the target's duration
    */
-  void setType(String type);
+  void setDuration(Integer duration);
 
   /**
-   * <p>getWidth</p>
+   * Sets the height of this media.
    *
-   * @return Integer the target's width
+   * @return Integer the target's height
    */
-  Integer getWidth();
+  Integer getHeight();
 
   /**
-   * Sets the Width of this mediaLink
+   * Sets the height of this media.
    *
-   * @param width is the target's width
+   * @param height is the target's height
    */
-  void setWidth(Integer width);
+  void setHeight(Integer height);
 
   /**
-   * Sets the Height of this mediaLink
+   * Returns the target URL of this MediaLink.
    *
-   * @return Integer the target's height
+   * @return a target
    */
-  Integer getHeight();
+  String getUrl();
 
   /**
-   * Sets the Height of this mediaLink
+   * Sets the target URL for this MediaLink.
    *
-   * @param height is the target's height
+   * @param target a target link
    */
-  void setHeight(Integer height);
+  void setUrl(String url);
 
   /**
-   * Returns the duration of this mediaLink
+   * <p>Returns the width of this media.</p>
    *
-   * @return Integer is the target's duration
+   * @return Integer the target's width
    */
-  Integer getDuration();
+  Integer getWidth();
 
   /**
-   * Sets the duration of this mediaLink
+   * Sets the width of this media.
    *
-   * @param duration is the target's duration
+   * @param width is the target's width
    */
-  void setDuration(Integer duration);
+  void setWidth(Integer width);
 }

Modified: shindig/trunk/java/social-api/src/main/java/org/apache/shindig/social/opensocial/service/ActivityStreamHandler.java
URL: http://svn.apache.org/viewvc/shindig/trunk/java/social-api/src/main/java/org/apache/shindig/social/opensocial/service/ActivityStreamHandler.java?rev=1080381&r1=1080380&r2=1080381&view=diff
==============================================================================
--- shindig/trunk/java/social-api/src/main/java/org/apache/shindig/social/opensocial/service/ActivityStreamHandler.java (original)
+++ shindig/trunk/java/social-api/src/main/java/org/apache/shindig/social/opensocial/service/ActivityStreamHandler.java Thu Mar 10 22:41:38 2011
@@ -38,17 +38,16 @@ import com.google.common.collect.Iterabl
 import com.google.inject.Inject;
 
 /**
- * <p>ActivityStreamsHandler class.</p>
- *
+ * <p>ActivityStreamHandler class.</p>
  */
-@Service(name = "activitystreams", path="/{userId}+/{groupId}/{appId}/{activityEntryId}+")
+@Service(name = "activitystreams", path="/{userId}+/{groupId}/{appId}/{activityId}+")
 public class ActivityStreamHandler {
 
   private final ActivityStreamService service;
   private final ContainerConfig config;
 
   /**
-   * <p>Constructor for ActivityStreamsHandler.</p>
+   * <p>Constructor for ActivityStreamHandler.</p>
    *
    * @param service a {@link org.apache.shindig.social.opensocial.spi.ActivityStreamService} object.
    * @param config a {@link org.apache.shindig.config.ContainerConfig} object.
@@ -60,9 +59,9 @@ public class ActivityStreamHandler {
   }
 
   /**
-   * Allowed end-points /activitiestreams/{userId}/@self/{actvityId}+
+   * Allowed end-points /activitystreams/{userId}/@self/{appId}/{activityId}+
    *
-   * examples: /activitiestreams/john.doe/@self/1
+   * Examples: /activitystreams/john.doe/@self/1/object1,object2
    *
    * @param request a {@link org.apache.shindig.social.opensocial.service.SocialRequestItem} object.
    * @return a {@link java.util.concurrent.Future} object.
@@ -73,64 +72,73 @@ public class ActivityStreamHandler {
       throws ProtocolException {
 
     Set<UserId> userIds = request.getUsers();
-    Set<String> activityEntryIds = ImmutableSet.copyOf(request.getListParameter("activityEntryId"));
+    Set<String> activityIds = ImmutableSet.copyOf(request.getListParameter("activityId"));
 
     HandlerPreconditions.requireNotEmpty(userIds, "No userId specified");
     HandlerPreconditions.requireSingular(userIds, "Multiple userIds not supported");
-    // Throws exceptions if userIds contains more than one element or zero elements
+    HandlerPreconditions.requireNotEmpty(activityIds, "At least one activity ID must be specified");
+    
     return service.deleteActivityEntries(Iterables.getOnlyElement(userIds), request.getGroup(),
-        request.getAppId(), activityEntryIds, request.getToken());
+        request.getAppId(), activityIds, request.getToken());
   }
 
   /**
-   * Allowed end-points /activitiestreams/{userId}/@self
+   * Allowed end-points /activitystreams/{userId}/@self/{appId}/{activityId}
    *
-   * examples: /activitiestreams/john.doe/@self - postBody is an activity object
-   *
-   * TODO: REST end-point
+   * Examples: /activitystreams/john.doe/@self/1/object2 - postBody is an activity object
    *
    * @param request a {@link org.apache.shindig.social.opensocial.service.SocialRequestItem} object.
    * @return a {@link java.util.concurrent.Future} object.
    * @throws org.apache.shindig.protocol.ProtocolException if any.
    */
-  @Operation(httpMethods="PUT", bodyParam = "activityEntry")
+  @Operation(httpMethods="PUT", bodyParam = "activity")
   public Future<?> update(SocialRequestItem request) throws ProtocolException {
-    return create(request);
+    Set<UserId> userIds = request.getUsers();
+    List<String> activityIds = request.getListParameter("activityId");
+
+    HandlerPreconditions.requireNotEmpty(userIds, "No userId specified");
+    HandlerPreconditions.requireSingular(userIds, "Multiple userIds not supported");
+    HandlerPreconditions.requireSingular(activityIds, "Must specify exactly one activity ID");
+
+    return service.updateActivityEntry(Iterables.getOnlyElement(userIds), request.getGroup(),
+        request.getAppId(), request.getFields(),
+        request.getTypedParameter("activity", ActivityEntry.class),
+        activityIds.iterator().next(),
+        request.getToken());
   }
 
   /**
-   * Allowed end-points /activitiestreams/{userId}/@self
+   * Allowed end-points /activitystreams/{userId}/@self/{appId}
    *
-   * examples: /activitiestreams/john.doe/@self - postBody is an activity object
-   *
-   * TODO: REST end-point
+   * Examples: /activitystreams/john.doe/@self/{appId} - postBody is an activity object
    *
    * @param request a {@link org.apache.shindig.social.opensocial.service.SocialRequestItem} object.
    * @return a {@link java.util.concurrent.Future} object.
    * @throws org.apache.shindig.protocol.ProtocolException if any.
    */
-  @Operation(httpMethods="POST", bodyParam = "activityEntry")
+  @Operation(httpMethods="POST", bodyParam = "activity")
   public Future<?> create(SocialRequestItem request) throws ProtocolException {
     Set<UserId> userIds = request.getUsers();
-    List<String> activityEntryIds = request.getListParameter("activityEntryId");
+    List<String> activityIds = request.getListParameter("activityId");
 
     HandlerPreconditions.requireNotEmpty(userIds, "No userId specified");
     HandlerPreconditions.requireSingular(userIds, "Multiple userIds not supported");
-    // TODO(lryan) This seems reasonable to allow on PUT but we don't have an update verb.
-    HandlerPreconditions.requireEmpty(activityEntryIds, "Cannot specify activityEntryId in create");
+    HandlerPreconditions.requireEmpty(activityIds, "Cannot specify activity ID in create");
 
     return service.createActivityEntry(Iterables.getOnlyElement(userIds), request.getGroup(),
         request.getAppId(), request.getFields(),
-        request.getTypedParameter("activityEntry", ActivityEntry.class),
+        request.getTypedParameter("activity", ActivityEntry.class),
         request.getToken());
   }
 
   /**
-   * Allowed end-points /activitiestreams/{userId}/{groupId}/{optionalActvityId}+
-   * /activitiestreams/{userId}+/{groupId}
-   *
-   * examples: /activitiestreams/john.doe/@self/1 /activitiestreams/john.doe/@self
-   * /activitiestreams/john.doe,jane.doe/@friends
+   * Allowed end-points:
+   *   /activitystreams/{userId}/{groupId}/{optionalActvityId}+
+   *   /activitystreams/{userId}+/{groupId}
+   *
+   * Examples:
+   *   /activitystreams/john.doe/@self/1
+   *   /activitystreams/john.doe,jane.doe/@friends
    *
    * @param request a {@link org.apache.shindig.social.opensocial.service.SocialRequestItem} object.
    * @return a {@link java.util.concurrent.Future} object.
@@ -140,14 +148,14 @@ public class ActivityStreamHandler {
   public Future<?> get(SocialRequestItem request)
       throws ProtocolException {
     Set<UserId> userIds = request.getUsers();
-    Set<String> optionalActivityIds = ImmutableSet.copyOf(request.getListParameter("activityEntryId"));
+    Set<String> optionalActivityIds = ImmutableSet.copyOf(request.getListParameter("activityId"));
 
     CollectionOptions options = new CollectionOptions(request);
 
     // Preconditions
     HandlerPreconditions.requireNotEmpty(userIds, "No userId specified");
     if (userIds.size() > 1 && !optionalActivityIds.isEmpty()) {
-      throw new IllegalArgumentException("Cannot fetch same activityEntryIds for multiple userIds");
+      throw new IllegalArgumentException("Cannot fetch activities by ID for multiple users");
     }
 
     if (!optionalActivityIds.isEmpty()) {

Modified: shindig/trunk/java/social-api/src/main/java/org/apache/shindig/social/opensocial/spi/ActivityStreamService.java
URL: http://svn.apache.org/viewvc/shindig/trunk/java/social-api/src/main/java/org/apache/shindig/social/opensocial/spi/ActivityStreamService.java?rev=1080381&r1=1080380&r2=1080381&view=diff
==============================================================================
--- shindig/trunk/java/social-api/src/main/java/org/apache/shindig/social/opensocial/spi/ActivityStreamService.java (original)
+++ shindig/trunk/java/social-api/src/main/java/org/apache/shindig/social/opensocial/spi/ActivityStreamService.java Thu Mar 10 22:41:38 2011
@@ -26,7 +26,7 @@ import org.apache.shindig.protocol.Restf
 import org.apache.shindig.social.opensocial.model.ActivityEntry;
 
 /**
- * The ActivityService interface defines the service provider interface to retrieve activities from
+ * The ActivityStreamService interface defines the service provider interface to retrieve activities from
  * the underlying SNS.
  */
 public interface ActivityStreamService {
@@ -96,6 +96,23 @@ public interface ActivityStreamService {
    */
   Future<Void> deleteActivityEntries(UserId userId, GroupId groupId, String appId,
       Set<String> activityIds, SecurityToken token) throws ProtocolException;
+  
+  /**
+   * Updates the specified Activity.
+   * 
+   * @param userId      The id of the person to update the activity for
+   * @param groupId     The group
+   * @param appId       The app id
+   * @param fields      The fields to return
+   * @param activity    The updated activity
+   * @param activityId  The id of the existing activity to update
+   * @param token       A valid SecurityToken
+   * @return a response item containing any errors
+   * @throws org.apache.shindig.protocol.ProtocolException if any
+   */
+  Future<Void> updateActivityEntry(UserId userId, GroupId groupId, String appId,
+      Set<String> fields, ActivityEntry activity, String activityId,
+      SecurityToken token) throws ProtocolException;
 
   /**
    * Creates the passed in activity for the passed in user and group. Once createActivity is called,

Modified: shindig/trunk/java/social-api/src/main/java/org/apache/shindig/social/sample/spi/JsonDbOpensocialService.java
URL: http://svn.apache.org/viewvc/shindig/trunk/java/social-api/src/main/java/org/apache/shindig/social/sample/spi/JsonDbOpensocialService.java?rev=1080381&r1=1080380&r2=1080381&view=diff
==============================================================================
--- shindig/trunk/java/social-api/src/main/java/org/apache/shindig/social/sample/spi/JsonDbOpensocialService.java (original)
+++ shindig/trunk/java/social-api/src/main/java/org/apache/shindig/social/sample/spi/JsonDbOpensocialService.java Thu Mar 10 22:41:38 2011
@@ -1173,6 +1173,46 @@ public class JsonDbOpensocialService imp
   
   // Are fields really needed here?
   /** {@inheritDoc} */
+  public Future<Void> updateActivityEntry(UserId userId, GroupId groupId, String appId,
+        Set<String> fields, ActivityEntry activityEntry, String activityId, SecurityToken token) throws ProtocolException {
+    try {
+      JSONObject jsonEntry = convertFromActivityEntry(activityEntry, fields);
+      JSONObject jsonEntryObject = jsonEntry.getJSONObject(ActivityEntry.Field.OBJECT.toString());
+      if (!jsonEntryObject.has(ActivityObject.Field.ID.toString())) {
+        if (activityId != null) {
+          jsonEntryObject.put(ActivityObject.Field.ID.toString(), activityId);
+        } else {
+          jsonEntryObject.put(ActivityObject.Field.ID.toString(), System.currentTimeMillis());
+        }
+        jsonEntry.put(ActivityEntry.Field.OBJECT.toString(), jsonEntryObject);
+      }
+      String objectId = jsonEntry.getJSONObject(ActivityEntry.Field.OBJECT.toString()).getString(ActivityObject.Field.ID.toString());
+
+      JSONArray jsonArray;
+      if (db.getJSONObject(ACTIVITYSTREAMS_TABLE).has(userId.getUserId(token))) {
+        jsonArray = db.getJSONObject(ACTIVITYSTREAMS_TABLE).getJSONArray(userId.getUserId(token));
+      } else {
+        jsonArray = new JSONArray();
+        db.getJSONObject(ACTIVITYSTREAMS_TABLE).put(userId.getUserId(token), jsonArray);
+      }
+      
+      // Find & replace activity
+      for (int i = 0; i < jsonArray.length(); i++) {
+        JSONObject entry = jsonArray.getJSONObject(i);
+        if (entry.getJSONObject(ActivityEntry.Field.OBJECT.toString())
+            .getString(ActivityObject.Field.ID.toString()).equals(objectId)) {
+          jsonArray.put(i, jsonEntry);
+          return ImmediateFuture.newInstance(null);
+        }
+      }
+      throw new ProtocolException(HttpServletResponse.SC_BAD_REQUEST, "Activity not found: " + objectId);
+    } catch (JSONException je) {
+      throw new ProtocolException(HttpServletResponse.SC_INTERNAL_SERVER_ERROR, je.getMessage(), je);
+    }
+  }
+  
+  // Are fields really needed here?
+  /** {@inheritDoc} */
   public Future<Void> createActivityEntry(UserId userId, GroupId groupId, String appId,
         Set<String> fields, ActivityEntry activityEntry, SecurityToken token) throws ProtocolException {
     try {
@@ -1182,6 +1222,7 @@ public class JsonDbOpensocialService imp
         jsonEntryObject.put(ActivityObject.Field.ID.toString(), System.currentTimeMillis());
         jsonEntry.put(ActivityEntry.Field.OBJECT.toString(), jsonEntryObject);
       }
+      String objectId = jsonEntry.getJSONObject(ActivityEntry.Field.OBJECT.toString()).getString(ActivityObject.Field.ID.toString());
 
       JSONArray jsonArray;
       if (db.getJSONObject(ACTIVITYSTREAMS_TABLE).has(userId.getUserId(token))) {
@@ -1191,16 +1232,15 @@ public class JsonDbOpensocialService imp
         db.getJSONObject(ACTIVITYSTREAMS_TABLE).put(userId.getUserId(token), jsonArray);
       }
       
-      // Check for object's ID in array; replace entry if found
-      boolean found = false;
+      // Ensure activity does not already exist
       for (int i = 0; i < jsonArray.length(); i++) {
         JSONObject entry = jsonArray.getJSONObject(i);
-        if (entry.getJSONObject("object").getString("id").equals(jsonEntry.getJSONObject("object").getString("id"))) {
-          jsonArray.put(i, jsonEntry);
-          found = true;
+        if (entry.getJSONObject(ActivityEntry.Field.OBJECT.toString())
+            .getString(ActivityObject.Field.ID.toString()).equals(objectId)) {
+          throw new ProtocolException(HttpServletResponse.SC_BAD_REQUEST, "Activity already exists: " + objectId);
         }
       }
-      if (!found) jsonArray.put(jsonEntry);
+      jsonArray.put(jsonEntry);
       return ImmediateFuture.newInstance(null);
     } catch (JSONException je) {
       throw new ProtocolException(HttpServletResponse.SC_INTERNAL_SERVER_ERROR, je.getMessage(), je);
@@ -1258,7 +1298,7 @@ public class JsonDbOpensocialService imp
         }
       }
 
-      throw new ProtocolException(HttpServletResponse.SC_BAD_REQUEST, "ActivityEntry not found");
+      throw new ProtocolException(HttpServletResponse.SC_BAD_REQUEST, "Activity not found: " + activityId);
     } catch (JSONException je) {
       throw new ProtocolException(HttpServletResponse.SC_INTERNAL_SERVER_ERROR, je.getMessage(), je);
     }
@@ -1311,7 +1351,7 @@ public class JsonDbOpensocialService imp
             }
           }
           if (!found) {
-            throw new ProtocolException(HttpServletResponse.SC_NOT_FOUND, "ActivityEntry not found: " + activityId);
+            throw new ProtocolException(HttpServletResponse.SC_NOT_FOUND, "Activity not found: " + activityId);
           }
         }
       }

Modified: shindig/trunk/java/social-api/src/test/java/org/apache/shindig/social/dataservice/integration/RestfulAtomActivityEntryTest.java
URL: http://svn.apache.org/viewvc/shindig/trunk/java/social-api/src/test/java/org/apache/shindig/social/dataservice/integration/RestfulAtomActivityEntryTest.java?rev=1080381&r1=1080380&r2=1080381&view=diff
==============================================================================
--- shindig/trunk/java/social-api/src/test/java/org/apache/shindig/social/dataservice/integration/RestfulAtomActivityEntryTest.java (original)
+++ shindig/trunk/java/social-api/src/test/java/org/apache/shindig/social/dataservice/integration/RestfulAtomActivityEntryTest.java Thu Mar 10 22:41:38 2011
@@ -1,127 +1,31 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations under the License.
- */
 package org.apache.shindig.social.dataservice.integration;
 
-import java.io.StringReader;
-
-import javax.xml.parsers.DocumentBuilder;
-import javax.xml.parsers.DocumentBuilderFactory;
-import javax.xml.xpath.XPath;
-import javax.xml.xpath.XPathConstants;
-import javax.xml.xpath.XPathExpressionException;
-import javax.xml.xpath.XPathFactory;
-
-import org.apache.shindig.social.opensocial.model.ActivityEntry;
-import org.junit.Before;
+import org.apache.shindig.protocol.ContentTypes;
 import org.junit.Test;
-import org.w3c.dom.Document;
-import org.w3c.dom.Node;
-import org.w3c.dom.NodeList;
-import org.xml.sax.InputSource;
 
-public class RestfulAtomActivityEntryTest extends AbstractLargeRestfulTests {
+/**
+ * Tests the ATOM serialization of ActivityStreams.
+ */
+public class RestfulAtomActivityEntryTest extends AbstractLargeRestfulTests{
   
-  private static XPath xpath = XPathFactory.newInstance().newXPath();
+  private static final String FIXTURE_LOC = "src/test/java/org/apache/shindig/social/dataservice/integration/fixtures/";
   
-  private ActivityEntry johnsEntry1;
-  private ActivityEntry johnsEntry2;
-
-
-  @Before
-  public void restfulXmlActivityEntryTestBefore() throws Exception {
-    johnsEntry1 = RestfulXmlActivityEntryTest.generateEntry1();
-    johnsEntry2 = RestfulXmlActivityEntryTest.generateEntry2();
-  }
-
-  /**
-   * Tests GET for a single ActivityEntry.
-   * 
-   * @throws Exception if test encounters an error
-   */
-  @Test
-  public void testGetActivityEntryAtom() throws Exception {
-    String resp = getResponse("/activitystreams/john.doe/@self/@app/object1", "GET", "atom", "application/atom+xml");
-    
-    // TODO: Uncomment this if ActivityEntry added to opensocial.xsd
-    //XSDValidator.validateOpenSocial(resp);
-    
-    // Build XML Document
-    DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
-    DocumentBuilder db = dbf.newDocumentBuilder();
-    Document doc = db.parse(new InputSource(new StringReader(resp)));
-    
-    // Test ActivityEntry
-    Node entryNode = (Node)xpath.evaluate("/feed/entry", doc, XPathConstants.NODE);
-    assertNotNull("ActivityEntry should not be null", entryNode);
-    assertActivityEntriesAtomEqual(johnsEntry1, entryNode);
-  }
-
-  /**
-   * Tests GET for a list of ActivityEntries.
-   *
-   * @throws Exception if test encounters an error
-   */
   @Test
-  public void testGetActivityEntriesAtom() throws Exception {
-    String resp = getResponse("/activitystreams/john.doe/@self", "GET", "atom", "application/atom+xml");
-    
-    // TODO: Uncomment this if ActivityEntry added to opensocial.xsd
-    //XSDValidator.validateOpenSocial(resp);
-    
-    // Build XML Document
-    DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
-    DocumentBuilder db = dbf.newDocumentBuilder();
-    Document doc = db.parse(new InputSource(new StringReader(resp)));
-    
-    // Test ActivityEntries
-    NodeList entries = (NodeList)xpath.evaluate("/feed/entry", doc, XPathConstants.NODESET);
-    assertEquals(2, entries.getLength());
-    if (johnsEntry1.getObject().getId().equals(xpath.evaluate("content/activityEntry/object/id", entries.item(0)))) {
-      assertActivityEntriesAtomEqual(johnsEntry1, entries.item(0));
-      assertActivityEntriesAtomEqual(johnsEntry2, entries.item(1));
-    } else {
-      assertActivityEntriesAtomEqual(johnsEntry2, entries.item(0));
-      assertActivityEntriesAtomEqual(johnsEntry1, entries.item(1));
-    }
+  public void testGetActivityEntryAtomById() throws Exception {
+    String resp = getResponse("/activitystreams/john.doe/@self/1/object1", "GET", null, ContentTypes.OUTPUT_ATOM_CONTENT_TYPE);
+    String expected = TestUtils.loadTestFixture(FIXTURE_LOC + "ActivityEntryAtomId.xml");
+    assertTrue(TestUtils.xmlsEqual(expected, resp));
   }
   
   @Test
-  public void testCreateActivityAtom() throws Exception {
-    // TODO: REST POST with format = XML or ATOM doens't work; mapping with List or Map doesn't work
+  public void testGetActivityEntryAtomByIds() throws Exception {
+    String resp = getResponse("/activitystreams/john.doe/@self/1/object1,object2", "GET", null, ContentTypes.OUTPUT_ATOM_CONTENT_TYPE);
+    String expected = TestUtils.loadTestFixture(FIXTURE_LOC + "ActivityEntryAtomIds.xml");
+    assertTrue(TestUtils.xmlsEqual(expected, resp));
   }
   
-  /**
-   * Asserts that an ActivityEntry is equivalent to its ATOM counterpart.
-   * 
-   * @param entry is the ActivityEntry to compare to an ATOM node
-   * @param atomNode is the ATOM node to compare to the ActivityEntry
-   * @throws XPathExpressionException 
-   */
-  private static void assertActivityEntriesAtomEqual(ActivityEntry entry, Node atomNode) throws XPathExpressionException {
-    // Test single level fields
-    RestfulXmlActivityEntryTest.assertEqualsOrNull(entry.getObject().getId(), xpath.evaluate("id", atomNode));
-    RestfulXmlActivityEntryTest.assertEqualsOrNull(entry.getTitle(), xpath.evaluate("title", atomNode));
-    RestfulXmlActivityEntryTest.assertEqualsOrNull(entry.getBody(), xpath.evaluate("summary", atomNode));
-    RestfulXmlActivityEntryTest.assertEqualsOrNull(entry.getActor().getId(), xpath.evaluate("author/uri", atomNode));
-    RestfulXmlActivityEntryTest.assertEqualsOrNull(entry.getActor().getDisplayName(), xpath.evaluate("author/name", atomNode));
-
-    // Test the ATOM's ActivityEntry within content
-    Node entryNode = (Node)xpath.evaluate("content/activityEntry", atomNode, XPathConstants.NODE);
-    RestfulXmlActivityEntryTest.assertActivityEntriesEqual(entry, entryNode);
+  @Test
+  public void testCreateActivityEntryAtom() throws Exception {
+    // TODO: Creating activity from ATOM not fully supported
   }
 }

Modified: shindig/trunk/java/social-api/src/test/java/org/apache/shindig/social/dataservice/integration/RestfulJsonActivityEntryTest.java
URL: http://svn.apache.org/viewvc/shindig/trunk/java/social-api/src/test/java/org/apache/shindig/social/dataservice/integration/RestfulJsonActivityEntryTest.java?rev=1080381&r1=1080380&r2=1080381&view=diff
==============================================================================
--- shindig/trunk/java/social-api/src/test/java/org/apache/shindig/social/dataservice/integration/RestfulJsonActivityEntryTest.java (original)
+++ shindig/trunk/java/social-api/src/test/java/org/apache/shindig/social/dataservice/integration/RestfulJsonActivityEntryTest.java Thu Mar 10 22:41:38 2011
@@ -1,203 +1,83 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations under the License.
- */
 package org.apache.shindig.social.dataservice.integration;
 
 import org.apache.shindig.protocol.ContentTypes;
-import org.apache.shindig.social.core.model.ActivityEntryImpl;
-import org.apache.shindig.social.core.model.ActivityObjectImpl;
-import org.apache.shindig.social.opensocial.model.ActivityEntry;
-import org.apache.shindig.social.opensocial.model.ActivityObject;
-import org.json.JSONArray;
-import org.json.JSONException;
-import org.json.JSONObject;
-import org.junit.Before;
 import org.junit.Test;
 
-public class RestfulJsonActivityEntryTest extends AbstractLargeRestfulTests {
-  ActivityEntry johnsEntry;
-
-  @Before
-  public void restfulJsonActivityEntryTestBefore() throws Exception {
-    ActivityObject actor = new ActivityObjectImpl();
-    actor.setId("john.doe");
-    actor.setDisplayName("John Doe");
-    
-    ActivityObject object = new ActivityObjectImpl();
-    object.setId("object1");
-    object.setDisplayName("Frozen Eric");
-    
-    johnsEntry = new ActivityEntryImpl();
-    johnsEntry.setTitle("John posted a photo");
-    johnsEntry.setBody("John Doe posted a photo to the album Germany 2009");
-    johnsEntry.setActor(actor);
-    johnsEntry.setObject(object);
+/**
+ * Tests the ActivityStreams REST API by comparing test fixtures to actual
+ * server responses.
+ * 
+ * TODO: naming consistency with activity & activityEntry
+ * TODO: test server errors with invalid requests e.g. "400 Activity not found: objectXYZ"
+ */
+public class RestfulJsonActivityEntryTest extends AbstractLargeRestfulTests{
+  
+  private static final String FIXTURE_LOC = "src/test/java/org/apache/shindig/social/dataservice/integration/fixtures/";
+  
+  @Test
+  public void testGetActivityEntryJsonById() throws Exception {
+    String resp = getResponse("/activitystreams/john.doe/@self/1/object1", "GET", null, ContentTypes.OUTPUT_JSON_CONTENT_TYPE);
+    String expected = TestUtils.loadTestFixture(FIXTURE_LOC + "ActivityEntryJsonId.json");
+    assertTrue(TestUtils.jsonsEqual(expected, resp));
   }
-
-  /**
-   * Expected response for an activity in json:
-   * { 'entry' : {
-   *     'title' : 'John posted a photo',
-   *     'body' : 'John Doe posted a photo to the album German 2009',
-   *     'actor' : {
-   *       'id' : 'john.doe',
-   *       'displayName' : 'John Doe'
-   *     },
-   *     'object' : {
-   *       'id' : 'object1',
-   *       'displayName' : 'Frozen Eric'
-   *     }
-   *   }
-   * }
-   *
-   * @throws Exception if test encounters an error
-   */
-  @Test
-  public void testGetActivityEntryJson() throws Exception {
-    String resp = getResponse("/activitystreams/john.doe/@self/@app/object1", "GET", null,
-        ContentTypes.OUTPUT_JSON_CONTENT_TYPE);
-    JSONObject result = getJson(resp);
-    assertActivityEntriesEqual(johnsEntry, result.getJSONObject("entry"));
+  
+  @Test
+  public void testGetActivityEntryJsonByIds() throws Exception {
+    String resp = getResponse("/activitystreams/john.doe/@self/1/object1,object2", "GET", null, ContentTypes.OUTPUT_JSON_CONTENT_TYPE);
+    String expected = TestUtils.loadTestFixture(FIXTURE_LOC + "ActivityEntryJsonIds.json");
+    assertTrue(TestUtils.jsonsEqual(expected, resp));
   }
-
-  /**
-   * Expected response for a list of activities in json:
-   *
-   * {
-   *  "totalResults" : 2,
-   *  "startIndex" : 0
-   *  "itemsPerPage" : 10 // Note: the js doesn't support paging. Should rest?
-   *  "entry" : [
-   *     {<entry>} // layed out like above
-   *  ]
-   * }
-   *
-   * @throws Exception if test encounters an error
-   */
-  @Test
-  public void testGetActivityEntriesJson() throws Exception {
-    String resp = getResponse("/activitystreams/john.doe/@self", "GET", null,
-        ContentTypes.OUTPUT_JSON_CONTENT_TYPE);
-    JSONObject result = getJson(resp);
-
-    assertEquals(2, result.getInt("totalResults"));
-    assertEquals(0, result.getInt("startIndex"));
-    assertActivityEntriesEqual(johnsEntry, result.getJSONArray("entry").getJSONObject(0));
+  
+  @Test
+  public void testGetActivityEntryJsonByGroup() throws Exception {
+    String expected = TestUtils.loadTestFixture(FIXTURE_LOC + "ActivityEntryJsonGroup.json");
+    
+    // Test @self
+    String resp = getResponse("/activitystreams/john.doe/@self/1", "GET", null, ContentTypes.OUTPUT_JSON_CONTENT_TYPE);
+    assertTrue(TestUtils.jsonsEqual(expected, resp));
+    
+    // Test @friends with multiple people
+    resp = getResponse("/activitystreams/jane.doe,canonical/@friends", "GET", null, ContentTypes.OUTPUT_JSON_CONTENT_TYPE);
+    assertTrue(TestUtils.jsonsEqual(expected, resp));  // same two activities returned
   }
-
-  /**
-   * Expected response for a list of activities in json:
-   *
-   * {
-   *  "totalResults" : 2,
-   *  "startIndex" : 0
-   *  "itemsPerPage" : 10 // Note: the js doesn't support paging. Should rest?
-   *  "entry" : [
-   *     {<entry>} // layed out like above, except for jane.doe
-   *  ]
-   * }
-   *
-   * @throws Exception if test encounters an error
-   */
-  @Test
-  public void testGetFriendsActivityEntriesJson() throws Exception {
-    String resp = getResponse("/activitystreams/jane.doe/@friends", "GET", null,
-        ContentTypes.OUTPUT_JSON_CONTENT_TYPE);
-    JSONObject result = getJson(resp);
-
-    assertEquals(2, result.getInt("totalResults"));
-    assertEquals(0, result.getInt("startIndex"));
+  
+  @Test
+  public void testDeleteActivityEntryJson() throws Exception {
+    // First delete object1, then retrieve & test
+    getResponse("/activitystreams/john.doe/@self/1/object1", "DELETE", null, ContentTypes.OUTPUT_JSON_CONTENT_TYPE);
+    String resp = getResponse("/activitystreams/john.doe/@self/1", "GET", null, ContentTypes.OUTPUT_JSON_CONTENT_TYPE);
+    String expected = TestUtils.loadTestFixture(FIXTURE_LOC + "ActivityEntryJsonDelete.json");;
+    assertTrue(TestUtils.jsonsEqual(expected, resp));
   }
-
-  private void assertActivityEntriesEqual(ActivityEntry entry, JSONObject result)
-      throws JSONException {
-    assertEquals(entry.getTitle(), result.getString("title"));
-    assertEquals(entry.getBody(), result.getString("body"));
-    assertEquals(entry.getActor().getId(), result.getJSONObject("actor").getString("id"));
-    assertEquals(entry.getActor().getDisplayName(), result.getJSONObject("actor").getString("displayName"));
-    assertEquals(entry.getObject().getId(), result.getJSONObject("object").getString("id"));
-    assertEquals(entry.getObject().getDisplayName(), result.getJSONObject("object").getString("displayName"));
+  
+  @Test
+  public void testUpdateActivityEntryJson() throws Exception {
+    // Update activity
+    String postData = "{title : 'Super Updated Activity', actor: {id: 'john.doe'}, object : {id: 'object2'}}";
+    getResponse("/activitystreams/john.doe/@self/1/object2", "PUT", postData, null, ContentTypes.OUTPUT_JSON_CONTENT_TYPE);
+    
+    // Retrieve updated activity & test
+    String resp = getResponse("/activitystreams/john.doe/@self/1", "GET", null, ContentTypes.OUTPUT_JSON_CONTENT_TYPE);
+    String expected = TestUtils.loadTestFixture(FIXTURE_LOC + "ActivityEntryJsonUpdated.json");;
+    assertTrue(TestUtils.jsonsEqual(expected, resp));
   }
-
+  
   @Test
-  public void testCreateActivityEntry() throws Exception {
-    // Create the activity entry
-    String postData = "{title : 'hi mom!', body : 'and dad.', object : {id: '1'}}";
-    getResponse("/activitystreams/john.doe/@self", "POST", postData, null,
-        ContentTypes.OUTPUT_JSON_CONTENT_TYPE);
-
-    // Verify it can be retrieved
-    String resp = getResponse("/activitystreams/john.doe/@self", "GET", null,
-        ContentTypes.OUTPUT_JSON_CONTENT_TYPE);
-    JSONObject result = getJson(resp);
-    assertEquals(3, result.getInt("totalResults"));
-    assertEquals(0, result.getInt("startIndex"));
-
-    JSONArray entries = result.getJSONArray("entry");
-    int newEntryIndex = 0;
-    if (entries.getJSONObject(1).getJSONObject("object").getString("id").equals("1")) {
-      newEntryIndex = 1;
-    }
-    if (entries.getJSONObject(2).getJSONObject("object").getString("id").equals("1")) {
-      newEntryIndex = 2;
-    }
-
-    JSONObject jsonEntry = entries.getJSONObject(newEntryIndex);
-    assertEquals("hi mom!", jsonEntry.getString("title"));
-    assertEquals("and dad.", jsonEntry.getString("body"));
-    assertEquals("1", jsonEntry.getJSONObject("object").getString("id"));
+  public void testCreateActivityEntryJson() throws Exception {
+    // Create activity
+    String postData = "{title : 'Super Created Activity', actor: {id: 'john.doe'}, object : {id: 'objectCreated'}}";
+    getResponse("/activitystreams/john.doe/@self/1", "POST", postData, null, ContentTypes.OUTPUT_JSON_CONTENT_TYPE);
+    
+    // Retrieve created activity & test
+    String resp = getResponse("/activitystreams/john.doe/@self/1/objectCreated", "GET", null, ContentTypes.OUTPUT_JSON_CONTENT_TYPE);
+    String expected = TestUtils.loadTestFixture(FIXTURE_LOC + "ActivityEntryJsonCreated.json");;
+    assertTrue(TestUtils.jsonsEqual(expected, resp));
   }
   
   @Test
-  public void testUpdateActivityEntry() throws Exception {
-    // Create an activity entry
-    String postData = "{title : 'hi mom!', body : 'and dad.', object : {id: '1'}}";
-    getResponse("/activitystreams/john.doe/@self", "POST", postData, null,
-        ContentTypes.OUTPUT_JSON_CONTENT_TYPE);
-    
-    // Verify it can be retrieved
-    String resp = getResponse("/activitystreams/john.doe/@self", "GET", null,
-        ContentTypes.OUTPUT_JSON_CONTENT_TYPE);
-    JSONObject result = getJson(resp);
-    assertEquals(3, result.getInt("totalResults"));
-    assertEquals(0, result.getInt("startIndex"));
-    
-    // Update activity entry
-    postData = "{title: 'hi mom2!', body: 'and dad2.', object: {id: '1'}}";
-    getResponse("/activitystreams/john.doe/@self", "PUT", postData, null,
-        ContentTypes.OUTPUT_JSON_CONTENT_TYPE);
-    
-    // Retrieve activities and verify PUT was successful
-    resp = getResponse("/activitystreams/john.doe/@self", "GET", null,
-        ContentTypes.OUTPUT_JSON_CONTENT_TYPE);
-    result = getJson(resp);
-    assertEquals(3, result.getInt("totalResults"));
-    assertEquals(0, result.getInt("startIndex"));
-    
-    // Find updated entry and test
-    JSONArray entries = result.getJSONArray("entry");
-    for(int i = 0; i < entries.length(); i++) {
-      JSONObject entry = entries.getJSONObject(i);
-      if (entry.getJSONObject("object").getString("id").equals("1")) {
-        assertEquals("hi mom2!", entry.getString("title"));
-        assertEquals("and dad2.", entry.getString("body"));
-      }
-    }
+  public void testGetActivityEntrySupportedFields() throws Exception {
+    String resp = getResponse("/activitystreams/@supportedFields", "GET", null, ContentTypes.OUTPUT_JSON_CONTENT_TYPE);
+    String expected = TestUtils.loadTestFixture(FIXTURE_LOC + "ActivityStreamsSupportedFields.json");;
+    assertTrue(TestUtils.jsonsEqual(expected, resp));
   }
-
-  // TODO: Add tests for the fields= parameter
-}
+}
\ No newline at end of file