Author: chabotc
Date: Thu Dec 11 11:03:31 2008
New Revision: 725782
URL: http://svn.apache.org/viewvc?rev=725782&view=rev
Log:
SHINDIG-779 by Pan Jie - Fix JsonDb for app data service
Modified:
incubator/shindig/trunk/php/src/social/sample/JsonDbOpensocialService.php
incubator/shindig/trunk/php/test/common/BasicRemoteContentTest.php
incubator/shindig/trunk/php/test/social/OutputAtomConverterTest.php
incubator/shindig/trunk/php/test/social/OutputXmlConverterTest.php
Modified:
incubator/shindig/trunk/php/src/social/sample/JsonDbOpensocialService.php
URL:
http://svn.apache.org/viewvc/incubator/shindig/trunk/php/src/social/sample/JsonDbOpensocialService.php?rev=725782&r1=725781&r2=725782&view=diff
==============================================================================
--- incubator/shindig/trunk/php/src/social/sample/JsonDbOpensocialService.php
(original)
+++ incubator/shindig/trunk/php/src/social/sample/JsonDbOpensocialService.php
Thu Dec 11 11:03:31 2008
@@ -264,6 +264,9 @@
}
public function getPersonData($userId, GroupId $groupId, $appId, $fields,
SecurityToken $token) {
+ if (! isset($fields[0])) {
+ $fields[0] = '@all';
+ }
$db = $this->getDb();
$allData = $this->getAllData();
$friendsTable = $db[self::$FRIEND_LINK_TABLE];
@@ -311,6 +314,14 @@
}
public function deletePersonData($userId, GroupId $groupId, $appId, $fields,
SecurityToken $token) {
+ $db = $this->getDb();
+ $allData = $this->getAllData();
+ if ($fields == null || $fields[0] == '*') {
+ $allData[$userId->getUserId($token)] = null;
+ $db[self::$DATA_TABLE] = $allData;
+ $this->saveDb($db);
+ return null;
+ }
foreach ($fields as $key => $present) {
if (! $this->isValidKey($key)) {
throw new SocialSpiException("The person app data key had invalid
characters", ResponseError::$BAD_REQUEST);
Modified: incubator/shindig/trunk/php/test/common/BasicRemoteContentTest.php
URL:
http://svn.apache.org/viewvc/incubator/shindig/trunk/php/test/common/BasicRemoteContentTest.php?rev=725782&r1=725781&r2=725782&view=diff
==============================================================================
--- incubator/shindig/trunk/php/test/common/BasicRemoteContentTest.php
(original)
+++ incubator/shindig/trunk/php/test/common/BasicRemoteContentTest.php Thu Dec
11 11:03:31 2008
@@ -142,6 +142,8 @@
$request = new
RemoteContentRequest('http://adwordsapi.blogspot.com/atom.xml');
$context = new TestContext();
$ret = $this->BasicRemoteContent->fetch($request, $context);
+ print_r($ret);
+ die();
$content = $ret->getResponseContent();
$this->assertNotEquals(null, $content);
}
Modified: incubator/shindig/trunk/php/test/social/OutputAtomConverterTest.php
URL:
http://svn.apache.org/viewvc/incubator/shindig/trunk/php/test/social/OutputAtomConverterTest.php?rev=725782&r1=725781&r2=725782&view=diff
==============================================================================
--- incubator/shindig/trunk/php/test/social/OutputAtomConverterTest.php
(original)
+++ incubator/shindig/trunk/php/test/social/OutputAtomConverterTest.php Thu Dec
11 11:03:31 2008
@@ -60,23 +60,22 @@
ob_start();
$outputConverter->outputResponse($responseItem, $requestItem);
$output = ob_get_clean();
- $expected = '<?xml version="1.0" encoding="UTF-8"?>
-<entry xmlns="http://www.w3.org/2005/Atom">
+ $expected = '<entry xmlns="http://www.w3.org/2005/Atom">
<title>person entry for shindig:1</title>
<author>
<uri>urn:guid:1</uri>
<name>shindig:1</name>
</author>
<id>urn:guid:1</id>
- <updated>2008-11-17T11:24:39-08:00</updated>
+
+ <updated>2008-12-11T19:58:31+01:00</updated>
<content type="application/xml">
<person xmlns="http://ns.opensocial.org/2008/opensocial">
- <entry>
- <isOwner></isOwner>
- <isViewer></isViewer>
- <displayName>1 1</displayName>
- <id>1</id>
- </entry>
+ <isOwner></isOwner>
+ <isViewer></isViewer>
+ <displayName>1 1</displayName>
+ <id>1</id>
+
</person>
</content>
</entry>
Modified: incubator/shindig/trunk/php/test/social/OutputXmlConverterTest.php
URL:
http://svn.apache.org/viewvc/incubator/shindig/trunk/php/test/social/OutputXmlConverterTest.php?rev=725782&r1=725781&r2=725782&view=diff
==============================================================================
--- incubator/shindig/trunk/php/test/social/OutputXmlConverterTest.php
(original)
+++ incubator/shindig/trunk/php/test/social/OutputXmlConverterTest.php Thu Dec
11 11:03:31 2008
@@ -62,14 +62,12 @@
$output = ob_get_clean();
$expected = '<?xml version="1.0" encoding="UTF-8"?>
<response>
- <person>
- <entry>
- <isOwner></isOwner>
- <isViewer></isViewer>
- <displayName>1 1</displayName>
- <id>1</id>
- </entry>
- </person>
+ <entry>
+ <isOwner></isOwner>
+ <isViewer></isViewer>
+ <displayName>1 1</displayName>
+ <id>1</id>
+ </entry>
</response>
';
$this->assertEquals($expected, $output);