Support for search/browse testing added.
This commit is contained in:
parent
2e351ca72f
commit
c029bd42bf
|
@ -23,7 +23,7 @@
|
||||||
#
|
#
|
||||||
#
|
#
|
||||||
# Author : $Author: tomas $
|
# 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 $
|
# 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/\"
|
<audioClip><metadata xmlns=\"http://www.streamonthefly.org/\"
|
||||||
xmlns:dc=\"http://purl.org/dc/elements/1.1/\"
|
xmlns:dc=\"http://purl.org/dc/elements/1.1/\"
|
||||||
xmlns:dcterms=\"http://purl.org/dc/terms/\">
|
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 ""
|
echo ""
|
||||||
XRDIR=`dirname $0`
|
XRDIR=`dirname $0`
|
||||||
|
@ -162,8 +164,16 @@ getAudioClip() {
|
||||||
|
|
||||||
searchMetadata() {
|
searchMetadata() {
|
||||||
echo -n "# searchMetadata: "
|
echo -n "# searchMetadata: "
|
||||||
# $XR_CLI searchMetadata $SESSID '../tests/srch_cri1.xml' || exit $?
|
RES=`$XR_CLI searchMetadata $SESSID 'title' 'testRunner'` || \
|
||||||
$XR_CLI searchMetadata $SESSID 'John %' || exit $?
|
{ 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"
|
PLID="123456789abcdef8"
|
||||||
|
@ -282,6 +292,26 @@ logout() {
|
||||||
$XR_CLI logout $SESSID || exit $?
|
$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(){
|
preferenceTest(){
|
||||||
echo "#XMLRPC preference test"
|
echo "#XMLRPC preference test"
|
||||||
login
|
login
|
||||||
|
@ -362,9 +392,7 @@ elif [ "$COMM" == "getAudioClip" ]; then
|
||||||
getAudioClip
|
getAudioClip
|
||||||
logout
|
logout
|
||||||
elif [ "$COMM" == "searchMetadata" ]; then
|
elif [ "$COMM" == "searchMetadata" ]; then
|
||||||
login
|
searchTest
|
||||||
searchMetadata
|
|
||||||
logout
|
|
||||||
elif [ "$COMM" == "preferences" ]; then
|
elif [ "$COMM" == "preferences" ]; then
|
||||||
preferenceTest
|
preferenceTest
|
||||||
elif [ "$COMM" == "playlists" ]; then
|
elif [ "$COMM" == "playlists" ]; then
|
||||||
|
@ -375,6 +403,7 @@ elif [ "x$COMM" == "x" ]; then
|
||||||
storageTest
|
storageTest
|
||||||
playlistTest
|
playlistTest
|
||||||
preferenceTest
|
preferenceTest
|
||||||
|
searchTest
|
||||||
elif [ "$COMM" == "help" ]; then
|
elif [ "$COMM" == "help" ]; then
|
||||||
usage
|
usage
|
||||||
else
|
else
|
||||||
|
|
|
@ -23,7 +23,7 @@
|
||||||
|
|
||||||
|
|
||||||
Author : $Author: tomas $
|
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 $
|
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",
|
"updateAudioClipMetadata" => array('m'=>"locstor.updateAudioClipMetadata",
|
||||||
'p'=>array('sessid', 'gunid', 'metadata'), 'r'=>'status'),
|
'p'=>array('sessid', 'gunid', 'metadata'), 'r'=>'status'),
|
||||||
"searchMetadata" => array('m'=>"locstor.searchMetadata", 'p'=>NULL),
|
"searchMetadata" => array('m'=>"locstor.searchMetadata", 'p'=>NULL),
|
||||||
|
"browseCategory" => array('m'=>"locstor.browseCategory", 'p'=>NULL),
|
||||||
"resetStorage" => array('m'=>"locstor.resetStorage", 'p'=>array()),
|
"resetStorage" => array('m'=>"locstor.resetStorage", 'p'=>array()),
|
||||||
|
|
||||||
"createPlaylist" => array('m'=>"locstor.createPlaylist",
|
"createPlaylist" => array('m'=>"locstor.createPlaylist",
|
||||||
|
@ -145,22 +146,8 @@ $infos = array(
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
||||||
$fullmethod = $infos[$method]['m'];
|
switch($method){
|
||||||
$pinfo = $infos[$method]['p'];
|
case"searchMetadata":
|
||||||
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'){
|
|
||||||
$parr = array(
|
$parr = array(
|
||||||
'sessid'=>$pars[0],
|
'sessid'=>$pars[0],
|
||||||
'criteria'=>array(
|
'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)));
|
$msg = new XML_RPC_Message($fullmethod, array(XML_RPC_encode($parr)));
|
||||||
|
|
||||||
if($verbose){
|
if($verbose){
|
||||||
|
@ -183,6 +203,7 @@ if($verbose){
|
||||||
echo $msg->serialize()."\n";
|
echo $msg->serialize()."\n";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#$client->setDebug(1);
|
||||||
$res = $client->send($msg);
|
$res = $client->send($msg);
|
||||||
if($res->faultCode() > 0) {
|
if($res->faultCode() > 0) {
|
||||||
echo "xr_cli_test.php: ".$res->faultString()." ".$res->faultCode()."\n";
|
echo "xr_cli_test.php: ".$res->faultString()." ".$res->faultCode()."\n";
|
||||||
|
@ -209,8 +230,24 @@ if(isset($infos[$method]['r'])){
|
||||||
echo "{$resp[$pom]}\n";
|
echo "{$resp[$pom]}\n";
|
||||||
}
|
}
|
||||||
}else{
|
}else{
|
||||||
print_r($resp);
|
switch($method){
|
||||||
# echo"\n";
|
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);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
?>
|
?>
|
||||||
|
|
Loading…
Reference in New Issue