[Fusionforge-commits] FusionForge branch feature/plugin-repositoryapi-6.0 updated. v6.0.5-32-g388d48b

Roland Mas lolando at libremir.placard.fr.eu.org
Mon Mar 6 13:42:35 CET 2017


This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "FusionForge".

The branch, feature/plugin-repositoryapi-6.0 has been updated
       via  388d48bb5cc5d5d8556e0de98b4ef1541f16fcc3 (commit)
      from  aabcdeb72ec27be4e7dc8db9119f737c9abc8ffd (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
https://scm.fusionforge.org/anonscm/gitweb/?p=fusionforge/fusionforge.git;a=commitdiff;h=388d48bb5cc5d5d8556e0de98b4ef1541f16fcc3

commit 388d48bb5cc5d5d8556e0de98b4ef1541f16fcc3
Author: Roland Mas <lolando at debian.org>
Date:   Mon Mar 6 13:39:47 2017 +0100

    Return effective time range for repository activities
    
    Clients can specify a time range when requesting repository
    activities, but it can get truncated if the server deems it to be too
    long.  However, the client previously had no way to detect that.  So
    this commit changes the return value of the
    repositoryapi_repositoryActivity method to include the effective time
    range that was used.

diff --git a/src/plugins/repositoryapi/include/repositoryapiPlugin.class.php b/src/plugins/repositoryapi/include/repositoryapiPlugin.class.php
index 34f451a..4151d36 100644
--- a/src/plugins/repositoryapi/include/repositoryapiPlugin.class.php
+++ b/src/plugins/repositoryapi/include/repositoryapiPlugin.class.php
@@ -3,7 +3,6 @@
 /**
  * repositoryapiPlugin Class
  *
- *
  * Copyright 2016-2017, Roland Mas
  * https://fusionforge.org
  *
@@ -101,6 +100,18 @@ class repositoryapiPlugin extends Plugin {
 			array(array('ref'=>'SOAP-ENC:arrayType','wsdl:arrayType'=>'tns:RepositoryAPIActivity[]')),
 			'tns:RepositoryAPIActivity');
                
+		$server->wsdl->addComplexType(
+			'RepositoryAPIActivityReturn',
+			'complexType',
+			'struct',
+			'sequence',
+			'',
+			array(
+				'effective_t0'=>'xsd:int',
+				'effective_t1'=>'xsd:int',
+				'activities' => array('name'=>'activities', 'type' => 'tns:ArrayOfRepositoryAPIActivity'),
+				)
+			);
 		$server->register(
 			'repositoryapi_repositoryActivity',
 			array('session_ser'=>'xsd:string',
@@ -109,7 +120,7 @@ class repositoryapiPlugin extends Plugin {
 				  'limit'=>'xsd:int',
 				  'offset'=>'xsd:int',
 				),
-			array('return'=>'tns:ArrayOfRepositoryAPIActivity'),
+			array('return'=>'tns:RepositoryAPIActivityReturn'),
 			$uri,
                        $uri.'#repositoryapi_repositoryActivity','rpc','encoded');
 
@@ -212,7 +223,13 @@ function &repositoryapi_repositoryActivity($session_ser, $t0, $t1, $limit=0, $of
 		}
 	}
 
-	return $results;
+	$return = array(
+		'effective_t0' => $t0,
+		'effective_t1' => $t1,
+		'activities' => $results,
+		);
+
+	return $return;
 }
 
 // Local Variables:
diff --git a/tests/func/60_PluginsRepositoryAPI/repositoryapiTest.php b/tests/func/60_PluginsRepositoryAPI/repositoryapiTest.php
index dc8f3e2..0c0c6c2 100644
--- a/tests/func/60_PluginsRepositoryAPI/repositoryapiTest.php
+++ b/tests/func/60_PluginsRepositoryAPI/repositoryapiTest.php
@@ -1,8 +1,6 @@
 <?php
 /**
- * Copyright 2011, Roland Mas
- * Copyright 2013, Franck Villaume - TrivialDev
- * Copyright (C) 2015  Inria (Sylvain Beucler)
+ * Copyright 2016-2017, Roland Mas
  *
  * This file is part of FusionForge.
  *
@@ -195,18 +193,18 @@ class RepositoryAPI extends FForge_SeleniumTestCase
 		// Get activities for repositories		
 		$response = $soapclient->repositoryapi_repositoryActivity($session,$t0,time(),0,0);
 		$this->assertNotEquals(NULL,$response);
-		$this->assertEquals(5,count($response));
+		$this->assertEquals(5,count($response->activities));
 		// Check limit/offset
 		$response = $soapclient->repositoryapi_repositoryActivity($session,$t0,time(),2,0);
 		$this->assertNotEquals(NULL,$response);
-		$this->assertEquals(2,count($response));
+		$this->assertEquals(2,count($response->activities));
 		$response = $soapclient->repositoryapi_repositoryActivity($session,$t0,time(),0,2);
 		$this->assertNotEquals(NULL,$response);
-		$this->assertEquals(3,count($response));
+		$this->assertEquals(3,count($response->activities));
 		// Check time range
 		sleep(15);
 		$response = $soapclient->repositoryapi_repositoryActivity($session,time()-10,time(),0,0);
 		$this->assertNotEquals(NULL,$response);
-		$this->assertEquals(0,count($response));
+		$this->assertEquals(0,count($response->activities));
 	}
 }

-----------------------------------------------------------------------

Summary of changes:
 .../include/repositoryapiPlugin.class.php          | 23 +++++++++++++++++++---
 .../60_PluginsRepositoryAPI/repositoryapiTest.php  | 12 +++++------
 2 files changed, 25 insertions(+), 10 deletions(-)


hooks/post-receive
-- 
FusionForge



More information about the Fusionforge-commits mailing list