You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@shindig.apache.org by do...@apache.org on 2008/08/28 19:25:59 UTC
svn commit: r689904 - in /incubator/shindig/trunk:
features/opensocial-current/
java/social-api/src/main/java/org/apache/shindig/social/opensocial/service/
java/social-api/src/test/java/org/apache/shindig/social/dataservice/integration/
java/social-api...
Author: doll
Date: Thu Aug 28 10:25:59 2008
New Revision: 689904
URL: http://svn.apache.org/viewvc?rev=689904&view=rev
Log:
0.8.1 change
The activity urls now have appId in them.
Also added jsonactivity.js to the opensocial feature as it was somehow missing.
SocialActivitiesWorld.xml now works in the sample container.
Modified:
incubator/shindig/trunk/features/opensocial-current/feature.xml
incubator/shindig/trunk/java/social-api/src/main/java/org/apache/shindig/social/opensocial/service/ActivityHandler.java
incubator/shindig/trunk/java/social-api/src/test/java/org/apache/shindig/social/dataservice/integration/RestfulJsonActivityTest.java
incubator/shindig/trunk/java/social-api/src/test/java/org/apache/shindig/social/opensocial/service/ActivityHandlerTest.java
Modified: incubator/shindig/trunk/features/opensocial-current/feature.xml
URL: http://svn.apache.org/viewvc/incubator/shindig/trunk/features/opensocial-current/feature.xml?rev=689904&r1=689903&r2=689904&view=diff
==============================================================================
--- incubator/shindig/trunk/features/opensocial-current/feature.xml (original)
+++ incubator/shindig/trunk/features/opensocial-current/feature.xml Thu Aug 28 10:25:59 2008
@@ -24,6 +24,7 @@
<!-- Must include the "caja" feature to display samplecontainer -->
<!-- gadgets when "use caja" is checked -->
<gadget>
+ <script src="jsonactivity.js"></script>
<script src="jsonperson.js"></script>
<script src="restfulcontainer.js"></script>
<script src="jsonrpccontainer.js"></script>
@@ -45,7 +46,7 @@
JsonRpcContainer.call(this, configParams.path,
configParams.domain, configParams.supportedFields);
};
- ShindigContainer.inherits(JsonRpcContainer);
+ ShindigContainer.inherits(JsonRpcContainer);
} else {
ShindigContainer = function() {
RestfulContainer.call(this, configParams.path,
Modified: incubator/shindig/trunk/java/social-api/src/main/java/org/apache/shindig/social/opensocial/service/ActivityHandler.java
URL: http://svn.apache.org/viewvc/incubator/shindig/trunk/java/social-api/src/main/java/org/apache/shindig/social/opensocial/service/ActivityHandler.java?rev=689904&r1=689903&r2=689904&view=diff
==============================================================================
--- incubator/shindig/trunk/java/social-api/src/main/java/org/apache/shindig/social/opensocial/service/ActivityHandler.java (original)
+++ incubator/shindig/trunk/java/social-api/src/main/java/org/apache/shindig/social/opensocial/service/ActivityHandler.java Thu Aug 28 10:25:59 2008
@@ -30,14 +30,10 @@
import java.util.concurrent.Future;
public class ActivityHandler extends DataRequestHandler {
-
private final ActivityService service;
- // TODO: The appId should come from the url. The spec needs to be fixed!
- private static final String ACTIVITY_ID_PATH = "/activities/{userId}+/{groupId}/{activityId}+";
-
- // Note: not what the spec says
- private static final String GROUP_PATH = "/activities/{userId}+/{groupId}/{appId}";
+ private static final String ACTIVITY_ID_PATH
+ = "/activities/{userId}+/{groupId}/{appId}/{activityId}+";
@Inject
public ActivityHandler(ActivityService service) {
@@ -77,7 +73,7 @@
* examples: /activities/john.doe/@self - postBody is an activity object
*/
protected Future<? extends ResponseItem> handlePost(RequestItem request) {
- request.applyUrlTemplate(GROUP_PATH);
+ request.applyUrlTemplate(ACTIVITY_ID_PATH);
Set<UserId> userIds = request.getUsers();
List<String> activityIds = request.getListParameter("activityId");
@@ -114,9 +110,9 @@
if (!optionalActivityIds.isEmpty()) {
if (optionalActivityIds.size() == 1) {
- return service
- .getActivity(userIds.iterator().next(), request.getGroup(), request.getAppId(),
- request.getFields(), optionalActivityIds.iterator().next(), request.getToken());
+ return service.getActivity(userIds.iterator().next(), request.getGroup(),
+ request.getAppId(), request.getFields(), optionalActivityIds.iterator().next(),
+ request.getToken());
} else {
return service.getActivities(userIds.iterator().next(), request.getGroup(),
request.getAppId(), request.getFields(), optionalActivityIds, request.getToken());
Modified: incubator/shindig/trunk/java/social-api/src/test/java/org/apache/shindig/social/dataservice/integration/RestfulJsonActivityTest.java
URL: http://svn.apache.org/viewvc/incubator/shindig/trunk/java/social-api/src/test/java/org/apache/shindig/social/dataservice/integration/RestfulJsonActivityTest.java?rev=689904&r1=689903&r2=689904&view=diff
==============================================================================
--- incubator/shindig/trunk/java/social-api/src/test/java/org/apache/shindig/social/dataservice/integration/RestfulJsonActivityTest.java (original)
+++ incubator/shindig/trunk/java/social-api/src/test/java/org/apache/shindig/social/dataservice/integration/RestfulJsonActivityTest.java Thu Aug 28 10:25:59 2008
@@ -50,7 +50,7 @@
*/
@Test
public void testGetActivityJson() throws Exception {
- String resp = getJsonResponse("/activities/john.doe/@self/1", "GET");
+ String resp = getJsonResponse("/activities/john.doe/@self/@app/1", "GET");
JSONObject result = getJson(resp);
assertActivitiesEqual(johnsActivity, result.getJSONObject("entry"));
}
Modified: incubator/shindig/trunk/java/social-api/src/test/java/org/apache/shindig/social/opensocial/service/ActivityHandlerTest.java
URL: http://svn.apache.org/viewvc/incubator/shindig/trunk/java/social-api/src/test/java/org/apache/shindig/social/opensocial/service/ActivityHandlerTest.java?rev=689904&r1=689903&r2=689904&view=diff
==============================================================================
--- incubator/shindig/trunk/java/social-api/src/test/java/org/apache/shindig/social/opensocial/service/ActivityHandlerTest.java (original)
+++ incubator/shindig/trunk/java/social-api/src/test/java/org/apache/shindig/social/opensocial/service/ActivityHandlerTest.java Thu Aug 28 10:25:59 2008
@@ -53,6 +53,7 @@
@Override
protected void setUp() throws Exception {
token = new FakeGadgetToken();
+ token.setAppId("appId");
converter = EasyMock.createMock(BeanJsonConverter.class);
activityService = EasyMock.createMock(ActivityService.class);
@@ -103,13 +104,13 @@
}
public void testHandleGetPlural() throws Exception {
- setPath("/activities/john.doe,jane.doe/@self");
+ setPath("/activities/john.doe,jane.doe/@self/@app");
RestfulCollection<Activity> data = new RestfulCollection<Activity>(null, null);
Set<UserId> userIdSet = Sets.newLinkedHashSet(JOHN_DOE);
userIdSet.add(new UserId(UserId.Type.userId, "jane.doe"));
EasyMock.expect(activityService.getActivities(userIdSet,
- new GroupId(GroupId.Type.self, null), null, Sets.<String>newHashSet(), token)).andReturn(
+ new GroupId(GroupId.Type.self, null), "appId", Sets.<String>newHashSet(), token)).andReturn(
ImmediateFuture.newInstance(data));
replay();
@@ -118,12 +119,12 @@
}
public void testHandleGetActivityById() throws Exception {
- setPath("/people/john.doe/@friends/jane.doe");
+ setPath("/people/john.doe/@friends/@app/1");
RestfulItem<Activity> data = new RestfulItem<Activity>(null, null);
EasyMock.expect(activityService.getActivity(JOHN_DOE.iterator().next(),
new GroupId(GroupId.Type.friends, null),
- null, Sets.<String>newHashSet(), "jane.doe", token)).andReturn(
+ "appId", Sets.<String>newHashSet(), "1", token)).andReturn(
ImmediateFuture.newInstance(data));
replay();
@@ -134,14 +135,14 @@
private ResponseItem setupPostData() {
String jsonActivity = "{title: hi mom!, etc etc}";
- setPathAndPostData("/people/john.doe/@self", jsonActivity);
+ setPathAndPostData("/people/john.doe/@self/@app", jsonActivity);
Activity activity = new ActivityImpl();
EasyMock.expect(converter.convertToObject(jsonActivity, Activity.class)).andReturn(activity);
ResponseItem data = new ResponseItem(null, null);
EasyMock.expect(activityService.createActivity(JOHN_DOE.iterator().next(),
- new GroupId(GroupId.Type.self, null), null, Sets.<String>newHashSet(),
+ new GroupId(GroupId.Type.self, null), "appId", Sets.<String>newHashSet(),
activity, token)).andReturn(ImmediateFuture.newInstance(data));
replay();
return data;
@@ -160,11 +161,11 @@
}
public void testHandleDelete() throws Exception {
- setPath("/people/john.doe/@self/1");
+ setPath("/people/john.doe/@self/@app/1");
ResponseItem data = new ResponseItem(null, null);
EasyMock.expect(activityService.deleteActivities(JOHN_DOE.iterator().next(),
- new GroupId(GroupId.Type.self, null), null, Sets.newHashSet("1"), token)).andReturn(
+ new GroupId(GroupId.Type.self, null), "appId", Sets.newHashSet("1"), token)).andReturn(
ImmediateFuture.newInstance(data));
replay();