Support for search/browse testing added.

This commit is contained in:
tomas 2005-01-24 01:26:12 +00:00
parent 2e351ca72f
commit c029bd42bf
2 changed files with 93 additions and 27 deletions

View File

@ -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="<?xml version=\"1.0\"?>
<audioClip><metadata xmlns=\"http://www.streamonthefly.org/\"
xmlns:dc=\"http://purl.org/dc/elements/1.1/\"
xmlns:dcterms=\"http://purl.org/dc/terms/\">
<dcterms:extent>00:00:11</dcterms:extent></metadata></audioClip>"
<dc:title>Media title testRunner</dc:title>
<dcterms:extent>00:00:11</dcterms:extent>
</metadata></audioClip>"
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

View File

@ -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);
}
}
?>