You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@shindig.apache.org by li...@apache.org on 2010/09/21 02:37:23 UTC
svn commit: r999171 - in /shindig/trunk/php: config/container.php pom.xml
src/social/sample/JsonDbOpensocialService.php test/common/CacheFileTest.php
test/misc/invalidation/count.php test/social/InputMessagesConverterTest.php
Author: lindner
Date: Tue Sep 21 00:37:23 2010
New Revision: 999171
URL: http://svn.apache.org/viewvc?rev=999171&view=rev
Log:
Fixes for phpunit and hudson
* use new antrun syntax
* use sys_get_temp_dir() where necessary
* correct working version of ant-trax
Modified:
shindig/trunk/php/config/container.php
shindig/trunk/php/pom.xml
shindig/trunk/php/src/social/sample/JsonDbOpensocialService.php
shindig/trunk/php/test/common/CacheFileTest.php
shindig/trunk/php/test/misc/invalidation/count.php
shindig/trunk/php/test/social/InputMessagesConverterTest.php
Modified: shindig/trunk/php/config/container.php
URL: http://svn.apache.org/viewvc/shindig/trunk/php/config/container.php?rev=999171&r1=999170&r2=999171&view=diff
==============================================================================
--- shindig/trunk/php/config/container.php (original)
+++ shindig/trunk/php/config/container.php Tue Sep 21 00:37:23 2010
@@ -227,7 +227,7 @@ $shindigConfig = array(
'cache_memcache_pconnect' => true,
'cache_time' => 24 * 60 * 60,
// If you use CacheStorageFile as caching backend, this is the directory where it stores the temporary files
- 'cache_root' => '/tmp/shindig',
+ 'cache_root' => sys_get_temp_dir() . '/shindig',
// connection timeout setting for all curl requests, set this time something low if you want errors reported
// quicker to the end user, and high (between 10 and 20) if your on a slow connection
Modified: shindig/trunk/php/pom.xml
URL: http://svn.apache.org/viewvc/shindig/trunk/php/pom.xml?rev=999171&r1=999170&r2=999171&view=diff
==============================================================================
--- shindig/trunk/php/pom.xml (original)
+++ shindig/trunk/php/pom.xml Tue Sep 21 00:37:23 2010
@@ -56,9 +56,10 @@
<artifactId>maven-antrun-plugin</artifactId>
<dependencies>
<dependency>
+ <!-- note that 1.8.0 has problems generating xslt output... -->
<groupId>org.apache.ant</groupId>
<artifactId>ant-trax</artifactId>
- <version>1.8.0</version>
+ <version>1.7.0</version>
</dependency>
<dependency>
<groupId>net.sf.saxon</groupId>
@@ -73,12 +74,13 @@
<phase>process-sources</phase>
<goals><goal>run</goal></goals>
<configuration>
- <tasks>
+ <target>
<apply executable="php">
<arg value="-l" />
+ <arg value="-n" />
<fileset dir="." includes="src/**/*.php" />
</apply>
- </tasks>
+ </target>
</configuration>
</execution>
<!-- phpdocs -->
@@ -87,7 +89,7 @@
<phase>pre-site</phase>
<goals><goal>run</goal></goals>
<configuration>
- <tasks>
+ <target>
<mkdir dir="target/site/phpdoc" />
<exec executable="phpdoc" failonerror="true">
<arg value="-d" />
@@ -99,7 +101,7 @@
<arg value="--title" />
<arg value="Apache Shindig ${version}" />
</exec>
- </tasks>
+ </target>
</configuration>
</execution>
@@ -111,19 +113,22 @@
<goal>run</goal>
</goals>
<configuration>
- <tasks>
+ <target>
<mkdir dir="${surefire.reports}" />
<mkdir dir="${coverage.report}" />
+ <mkdir dir="target/tmp" />
<exec executable="phpunit" dir=".">
+ <arg line=" --verbose" />
<arg line=" --log-junit ${surefire.reports}/phpunit-testresults.xml" />
<arg line=" --coverage-html ${coverage.report}" />
<arg line=" test/ShindigAllTests.php" />
+ <env key="TMPDIR" value="${basedir}/target/tmp"/>
</exec>
<xslt in="${surefire.reports}/phpunit-testresults.xml" out="${surefire.reports}/xslt.info"
- style="test/config/phpunit_to_surefire.xslt" processor="trax">
- <param name="outputDir" expression="${surefire.reports}" />
+ style="test/config/phpunit_to_surefire.xslt">
+ <param name="outputDir" expression="." />
</xslt>
- </tasks>
+ </target>
</configuration>
</execution>
</executions>
Modified: shindig/trunk/php/src/social/sample/JsonDbOpensocialService.php
URL: http://svn.apache.org/viewvc/shindig/trunk/php/src/social/sample/JsonDbOpensocialService.php?rev=999171&r1=999170&r2=999171&view=diff
==============================================================================
--- shindig/trunk/php/src/social/sample/JsonDbOpensocialService.php (original)
+++ shindig/trunk/php/src/social/sample/JsonDbOpensocialService.php Tue Sep 21 00:37:23 2010
@@ -84,11 +84,13 @@ class JsonDbOpensocialService implements
private $allMessageCollections = null;
- private $jsonDbFileName = 'ShindigDb.json';
+ protected function getDbFilename() {
+ return sys_get_temp_dir() . '/' . 'ShindigDb' + getenv("BUILD_TAG") . '.json';
+ }
public function getDb() {
try {
- $fileName = sys_get_temp_dir() . '/' . $this->jsonDbFileName;
+ $fileName = $this->getDbFilename();
if (file_exists($fileName)) {
if (! is_readable($fileName)) {
throw new SocialSpiException("Could not read temp json db file: $fileName, check permissions", ResponseError::$INTERNAL_ERROR);
@@ -119,13 +121,13 @@ class JsonDbOpensocialService implements
}
private function saveDb($db) {
- if (! @file_put_contents(sys_get_temp_dir() . '/' . $this->jsonDbFileName, json_encode($db))) {
- throw new Exception("Could not save json db: " . sys_get_temp_dir() . '/' . $this->jsonDbFileName);
+ if (! @file_put_contents($this->getDbFilename(), json_encode($db))) {
+ throw new Exception("Could not save json db: " . $this->getDbFileName());
}
}
public function resetDb() {
- @unlink(sys_get_temp_dir() . '/' . $this->jsonDbFileName);
+ @unlink($this->getDbFilename());
}
private function getAllPeople() {
Modified: shindig/trunk/php/test/common/CacheFileTest.php
URL: http://svn.apache.org/viewvc/shindig/trunk/php/test/common/CacheFileTest.php?rev=999171&r1=999170&r2=999171&view=diff
==============================================================================
--- shindig/trunk/php/test/common/CacheFileTest.php (original)
+++ shindig/trunk/php/test/common/CacheFileTest.php Tue Sep 21 00:37:23 2010
@@ -76,7 +76,7 @@ class CacheFileTest extends PHPUnit_Fram
* Tests cache->delete()
*/
public function testDelete() {
- @rmdir("/tmp/shindig/TestCache/te");
+ @rmdir(sys_get_temp_dir() . "/shindig/TestCache/te");
$this->cache->set("test", "testing");
$this->assertTrue(false != $this->cache->get("test"));
$this->cache->delete("test");
@@ -134,24 +134,24 @@ class CacheFileTest extends PHPUnit_Fram
* Tests cache->set()
*/
public function testSetException() {
- @rmdir("/tmp/shindig/TestCache/te");
- $this->assertTrue(touch("/tmp/shindig/TestCache/te"));
+ @rmdir(sys_get_temp_dir() . "/shindig/TestCache/te");
+ $this->assertTrue(touch(sys_get_temp_dir() . "/shindig/TestCache/te"));
$this->setExpectedException("CacheException");
try {
$this->cache->set("test", "testing");
} catch (Exception $e) {
- $this->assertTrue(unlink("/tmp/shindig/TestCache/te"));
+ $this->assertTrue(unlink(sys_get_temp_dir() . "/shindig/TestCache/te"));
throw $e;
}
- unlink("/tmp/shindig/TestCache/te");
+ unlink(sys_get_temp_dir() . "/shindig/TestCache/te");
}
/**
* Tests cache->invalidate()
*/
public function testInvalidation() {
- @unlink("/tmp/shindig/TestCache/te/test");
- @rmdir("/tmp/shindig/TestCache/te");
+ @unlink(sys_get_temp_dir() . "/shindig/TestCache/te/test");
+ @rmdir(sys_get_temp_dir() . "/shindig/TestCache/te");
$this->cache->set("test", "testing");
$this->cache->invalidate("test");
$this->assertEquals(false, $this->cache->get("test"));
@@ -163,4 +163,4 @@ class CacheFileTest extends PHPUnit_Fram
$this->assertEquals($expected, $output);
$this->cache->delete("test");
}
-}
\ No newline at end of file
+}
Modified: shindig/trunk/php/test/misc/invalidation/count.php
URL: http://svn.apache.org/viewvc/shindig/trunk/php/test/misc/invalidation/count.php?rev=999171&r1=999170&r2=999171&view=diff
==============================================================================
--- shindig/trunk/php/test/misc/invalidation/count.php (original)
+++ shindig/trunk/php/test/misc/invalidation/count.php Tue Sep 21 00:37:23 2010
@@ -19,7 +19,7 @@
*/
@date_default_timezone_set(@date_default_timezone_get());
-$filename = '/tmp/shindig_test_misc_invalidation_count';
+$filename = sys_get_temp_dir() . '/shindig_test_misc_invalidation_count';
if (file_exists($filename)) {
$count = file_get_contents($filename);
@@ -31,4 +31,4 @@ if (file_exists($filename)) {
$count += 1;
echo "Count: $count at time: " . date('Y-m-d H:i:s');
-file_put_contents($filename, $count);
\ No newline at end of file
+file_put_contents($filename, $count);
Modified: shindig/trunk/php/test/social/InputMessagesConverterTest.php
URL: http://svn.apache.org/viewvc/shindig/trunk/php/test/social/InputMessagesConverterTest.php?rev=999171&r1=999170&r2=999171&view=diff
==============================================================================
--- shindig/trunk/php/test/social/InputMessagesConverterTest.php (original)
+++ shindig/trunk/php/test/social/InputMessagesConverterTest.php Tue Sep 21 00:37:23 2010
@@ -70,7 +70,7 @@ class InputMessagesConverterTest extends
"body" : "Click here to review your invitation"
}';
$message = $this->inputConverter->convertJson($json);
- file_put_contents('/tmp/message.txt', print_r($json, true));
+ file_put_contents(sys_get_temp_dir() . '/message.txt', print_r($json, true));
$this->assertEquals('msgid', $message['id']);
$this->assertEquals('You have an invitation from Joe', $message['title']);
$this->assertEquals('Click here to review your invitation', $message['body']);