Author: awiner
Date: Fri Jun 5 20:36:52 2009
New Revision: 782127
URL: http://svn.apache.org/viewvc?rev=782127&view=rev
Log:
SHINDIG-1067: Return default appId when it is not specified in the request
- Patch from Sachin Shenoy
- Updates BaseRequestItem so that null is never returned from calls to
getAppId() (unless the token itself has no app ID)
Modified:
incubator/shindig/trunk/java/common/src/main/java/org/apache/shindig/protocol/BaseRequestItem.java
incubator/shindig/trunk/java/social-api/src/test/java/org/apache/shindig/social/opensocial/service/ActivityHandlerTest.java
incubator/shindig/trunk/java/social-api/src/test/java/org/apache/shindig/social/sample/spi/JsonDbOpensocialServiceTest.java
incubator/shindig/trunk/javascript/sampledata/canonicaldb.json
Modified:
incubator/shindig/trunk/java/common/src/main/java/org/apache/shindig/protocol/BaseRequestItem.java
URL:
http://svn.apache.org/viewvc/incubator/shindig/trunk/java/common/src/main/java/org/apache/shindig/protocol/BaseRequestItem.java?rev=782127&r1=782126&r2=782127&view=diff
==============================================================================
---
incubator/shindig/trunk/java/common/src/main/java/org/apache/shindig/protocol/BaseRequestItem.java
(original)
+++
incubator/shindig/trunk/java/common/src/main/java/org/apache/shindig/protocol/BaseRequestItem.java
Fri Jun 5 20:36:52 2009
@@ -101,7 +101,7 @@
public String getAppId() {
String appId = getParameter(APP_ID);
- if (appId != null && appId.equals(APP_SUBSTITUTION_TOKEN)) {
+ if (appId == null || appId.equals(APP_SUBSTITUTION_TOKEN)) {
return token.getAppId();
} else {
return appId;
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=782127&r1=782126&r2=782127&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
Fri Jun 5 20:36:52 2009
@@ -94,7 +94,7 @@
List<Activity> activityList = ImmutableList.of();
RestfulCollection<Activity> data = new
RestfulCollection<Activity>(activityList);
org.easymock.EasyMock.expect(activityService.getActivities(eq(JOHN_DOE),
- eq(new GroupId(group, null)), (String)isNull(),
eq(Sets.<String>newHashSet()),
+ eq(new GroupId(group, null)), eq("appId"),
eq(Sets.<String>newHashSet()),
org.easymock.EasyMock.isA(CollectionOptions.class), eq(token))).
andReturn(ImmediateFuture.newInstance(data));
Modified:
incubator/shindig/trunk/java/social-api/src/test/java/org/apache/shindig/social/sample/spi/JsonDbOpensocialServiceTest.java
URL:
http://svn.apache.org/viewvc/incubator/shindig/trunk/java/social-api/src/test/java/org/apache/shindig/social/sample/spi/JsonDbOpensocialServiceTest.java?rev=782127&r1=782126&r2=782127&view=diff
==============================================================================
---
incubator/shindig/trunk/java/social-api/src/test/java/org/apache/shindig/social/sample/spi/JsonDbOpensocialServiceTest.java
(original)
+++
incubator/shindig/trunk/java/social-api/src/test/java/org/apache/shindig/social/sample/spi/JsonDbOpensocialServiceTest.java
Fri Jun 5 20:36:52 2009
@@ -56,7 +56,7 @@
private static final UserId JANE_DOE = new UserId(UserId.Type.userId,
"jane.doe");
private static final GroupId SELF_GROUP = new GroupId(GroupId.Type.self,
null);
- private static final String APP_ID = "1";
+ private static final String APP_ID = "test";
private static final String CANONICAL_USER_ID = "canonical";
private SecurityToken token = new FakeGadgetToken();
@@ -174,7 +174,7 @@
public void testGetExpectedActivity() throws Exception {
Activity activity = db.getActivity(
CANON_USER, SELF_GROUP, APP_ID,
- Sets.newHashSet("appId", "body", "mediaItems"), APP_ID, new
FakeGadgetToken()).get();
+ Sets.newHashSet("appId", "body", "mediaItems"), "1", new
FakeGadgetToken()).get();
assertNotNull(activity);
// Check that some fields are fetched and others are not
assertNotNull(activity.getBody());
Modified: incubator/shindig/trunk/javascript/sampledata/canonicaldb.json
URL:
http://svn.apache.org/viewvc/incubator/shindig/trunk/javascript/sampledata/canonicaldb.json?rev=782127&r1=782126&r2=782127&view=diff
==============================================================================
--- incubator/shindig/trunk/javascript/sampledata/canonicaldb.json (original)
+++ incubator/shindig/trunk/javascript/sampledata/canonicaldb.json Fri Jun 5
20:36:52 2009
@@ -247,7 +247,7 @@
},
"activities" : {
"canonical" : [{
-"appId" : "1",
+"appId" : "test",
"body" : "Went rafting",
"bodyId" : "1",
"externalId" : "http://www.example.org/123456",
@@ -277,7 +277,7 @@
"url" : "http://www.example.org/canonical/activities/1",
"userId" : "canonical"
},{
-"appId" : "1",
+"appId" : "test",
"body" : "Went skiing",
"bodyId" : "1",
"externalId" : "http://www.example.org/123457",