From c029bd42bf386d2a3e2844031198b9f1ae7889f0 Mon Sep 17 00:00:00 2001 From: tomas Date: Mon, 24 Jan 2005 01:26:12 +0000 Subject: [PATCH] Support for search/browse testing added. --- .../storageServer/var/xmlrpc/testRunner.sh | 43 +++++++++-- .../storageServer/var/xmlrpc/xr_cli_test.php | 77 ++++++++++++++----- 2 files changed, 93 insertions(+), 27 deletions(-) diff --git a/livesupport/modules/storageServer/var/xmlrpc/testRunner.sh b/livesupport/modules/storageServer/var/xmlrpc/testRunner.sh index 43ec72685..e9a037881 100755 --- a/livesupport/modules/storageServer/var/xmlrpc/testRunner.sh +++ b/livesupport/modules/storageServer/var/xmlrpc/testRunner.sh @@ -23,7 +23,7 @@ # # # Author : $Author: tomas $ -# Version : $Revision: 1.18 $ +# Version : $Revision: 1.19 $ # Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/modules/storageServer/var/xmlrpc/testRunner.sh,v $ #------------------------------------------------------------------------------- @@ -40,7 +40,9 @@ METADATA=" -00:00:11" +Media title testRunner +00:00:11 +" echo "" XRDIR=`dirname $0` @@ -162,8 +164,16 @@ getAudioClip() { searchMetadata() { echo -n "# searchMetadata: " -# $XR_CLI searchMetadata $SESSID '../tests/srch_cri1.xml' || exit $? - $XR_CLI searchMetadata $SESSID 'John %' || exit $? + RES=`$XR_CLI searchMetadata $SESSID 'title' 'testRunner'` || \ + { ERN=$?; echo $RES; exit $ERN; } + echo $RES +} + +browseCategory() { + echo -n "# browseCategory: " + RES=`$XR_CLI browseCategory $SESSID 'title' 'title' 'testRunner'` || \ + { ERN=$?; echo $RES; exit $ERN; } + echo $RES } PLID="123456789abcdef8" @@ -282,6 +292,26 @@ logout() { $XR_CLI logout $SESSID || exit $? } +searchTest() { + login + storeAudioClip + GUNID=$RGUNID + searchMetadata + if [ "$RES" == "AC(1): $GUNID | PL(0): " ]; then + echo "match: OK" + else + echo "results doesn't match ($RES)"; deleteAudioClip; exit 1; + fi + browseCategory + if [ "$RES" == "RES(1): Media title testRunner" ]; then + echo "match: OK" + else + echo "results doesn't match ($RES)"; deleteAudioClip; exit 1; + fi + deleteAudioClip + logout +} + preferenceTest(){ echo "#XMLRPC preference test" login @@ -362,9 +392,7 @@ elif [ "$COMM" == "getAudioClip" ]; then getAudioClip logout elif [ "$COMM" == "searchMetadata" ]; then - login - searchMetadata - logout + searchTest elif [ "$COMM" == "preferences" ]; then preferenceTest elif [ "$COMM" == "playlists" ]; then @@ -375,6 +403,7 @@ elif [ "x$COMM" == "x" ]; then storageTest playlistTest preferenceTest + searchTest elif [ "$COMM" == "help" ]; then usage else diff --git a/livesupport/modules/storageServer/var/xmlrpc/xr_cli_test.php b/livesupport/modules/storageServer/var/xmlrpc/xr_cli_test.php index 66e9d06f6..9cc68106d 100644 --- a/livesupport/modules/storageServer/var/xmlrpc/xr_cli_test.php +++ b/livesupport/modules/storageServer/var/xmlrpc/xr_cli_test.php @@ -23,7 +23,7 @@ Author : $Author: tomas $ - Version : $Revision: 1.4 $ + Version : $Revision: 1.5 $ Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/modules/storageServer/var/xmlrpc/xr_cli_test.php,v $ ------------------------------------------------------------------------------*/ @@ -102,6 +102,7 @@ $infos = array( "updateAudioClipMetadata" => array('m'=>"locstor.updateAudioClipMetadata", 'p'=>array('sessid', 'gunid', 'metadata'), 'r'=>'status'), "searchMetadata" => array('m'=>"locstor.searchMetadata", 'p'=>NULL), + "browseCategory" => array('m'=>"locstor.browseCategory", 'p'=>NULL), "resetStorage" => array('m'=>"locstor.resetStorage", 'p'=>array()), "createPlaylist" => array('m'=>"locstor.createPlaylist", @@ -145,22 +146,8 @@ $infos = array( ); -$fullmethod = $infos[$method]['m']; -$pinfo = $infos[$method]['p']; -if(is_null($pinfo)){ - $parr = NULL; -}elseif(!is_array($pinfo)){ - $parr = $pars[0]; - #echo "pinfo not null and not array.\n"; exit; -}elseif(count($pinfo) == 0){ - $parr = array(); -}else{ - $parr = array(); $i=0; - foreach($pinfo as $it){ - $parr[$it] = $pars[$i++]; - } -} -if($method == 'searchMetadata'){ +switch($method){ +case"searchMetadata": $parr = array( 'sessid'=>$pars[0], 'criteria'=>array( @@ -173,7 +160,40 @@ if($method == 'searchMetadata'){ ) ), ); -} + break; +case"browseCategory": + $parr = array( + 'sessid'=>$pars[0], + 'category'=>$pars[1], + 'criteria'=>array( + 'filetype'=>'audioclip', + 'operator'=>'and', + 'limit'=> 0, + 'offset'=> 0, + 'conditions'=>array( + array('cat'=>$pars[2], 'op'=>'partial', 'val'=>$pars[3]) + ) + ), + ); + break; +default: + $pinfo = $infos[$method]['p']; + if(is_null($pinfo)){ + $parr = NULL; + }elseif(!is_array($pinfo)){ + $parr = $pars[0]; + #echo "pinfo not null and not array.\n"; exit; + }elseif(count($pinfo) == 0){ + $parr = array(); + }else{ + $parr = array(); $i=0; + foreach($pinfo as $it){ + $parr[$it] = $pars[$i++]; + } + } +} // switch + +$fullmethod = $infos[$method]['m']; $msg = new XML_RPC_Message($fullmethod, array(XML_RPC_encode($parr))); if($verbose){ @@ -183,6 +203,7 @@ if($verbose){ echo $msg->serialize()."\n"; } +#$client->setDebug(1); $res = $client->send($msg); if($res->faultCode() > 0) { echo "xr_cli_test.php: ".$res->faultString()." ".$res->faultCode()."\n"; @@ -209,8 +230,24 @@ if(isset($infos[$method]['r'])){ echo "{$resp[$pom]}\n"; } }else{ - print_r($resp); -# echo"\n"; + switch($method){ + case"searchMetadata": + echo + "AC({$resp['audioClipCnt']}): ". + join(", ", $resp['audioClipResults']). + " | PL({$resp['playlistCnt']}): ". + join(", ", $resp['playlistResults']). + "\n"; + break; + case"browseCategory": + echo + "RES({$resp['cnt']}): ". + join(", ", $resp['results']). + "\n"; + break; + default: + print_r($resp); + } } ?>