Finalized web services (unit tests, sample client) and dehardcoded the GetVersion() verb

SVN:trunk[618]
This commit is contained in:
Romain Quetiez
2010-07-21 13:04:23 +00:00
parent eb29f4084e
commit ef91a2e0db
3 changed files with 40 additions and 8 deletions

View File

@@ -1274,8 +1274,8 @@ class TestItopWebServices extends TestWebServices
$aWebServices = array(
array(
'verb' => 'GetVersion',
'expected result' => '0.8',
'explain result' => 'n/a',
'expected result' => WebServices::GetVersion(),
'explain result' => 'no comment!',
'args' => array(),
),
array(
@@ -1316,7 +1316,7 @@ $aWebServices = array(
),
array(
'verb' => 'CreateIncidentTicket',
'expected result' => false,
'expected result' => true,
'explain result' => 'caller not specified',
'args' => array(
'admin', /* sLogin */
@@ -1435,7 +1435,7 @@ $aWebServices = array(
),
array(
'verb' => 'CreateIncidentTicket',
'expected result' => false,
'expected result' => true,
'explain result' => 'caller unknown',
'args' => array(
'admin', /* sLogin */
@@ -1590,6 +1590,10 @@ class TestSoap extends TestSoapWebService
}
if ($res != $aWebService['expected result'])
{
echo "Expecting:<br/>\n";
var_dump($aWebService['expected result']);
echo "Obtained:<br/>\n";
var_dump($res);
throw new UnitTestException("Expecting result '{$aWebService['expected result']}', but got '$res'");
}
}
@@ -1616,6 +1620,23 @@ class TestWebServicesDirect extends TestBizModel
echo "<pre>\n";
print_r($oRes);
echo "</pre>\n";
if ($oRes instanceof SOAPResult)
{
$res = $oRes->status;
}
else
{
$res = $oRes;
}
if ($res != $aWebService['expected result'])
{
echo "Expecting:<br/>\n";
var_dump($aWebService['expected result']);
echo "Obtained:<br/>\n";
var_dump($res);
throw new UnitTestException("Expecting result '{$aWebService['expected result']}', but got '$res'");
}
}
return true;
}

View File

@@ -56,7 +56,7 @@ try
'HW found shutdown', /* description */
null, /* caller */
new SOAPExternalKeySearch(array(new SOAPSearchCondition('name', 'Demo'))), /* customer */
new SOAPExternalKeySearch(array(new SOAPSearchCondition('name', 'NW Mgmt'))), /* service */
new SOAPExternalKeySearch(array(new SOAPSearchCondition('name', 'NW Management'))), /* service */
new SOAPExternalKeySearch(array(new SOAPSearchCondition('name', 'Troubleshooting'))), /* service subcategory */
'', /* product */
new SOAPExternalKeySearch(array(new SOAPSearchCondition('name', 'NW support'))), /* workgroup */

View File

@@ -498,8 +498,9 @@ class WebServices
}
static protected function SoapStructToExternalKeySearch(SoapExternalKeySearch $oExternalKeySearch)
static protected function SoapStructToExternalKeySearch($oExternalKeySearch)
{
if (is_null($oExternalKeySearch)) return null;
if ($oExternalKeySearch->IsVoid()) return null;
$aRes = array();
@@ -538,9 +539,19 @@ class WebServices
*
* @return WebServiceResult
*/
public function GetVersion()
static public function GetVersion()
{
return "0.8";
if (ITOP_REVISION == '$WCREV$')
{
$sVersionString = ITOP_VERSION.' [dev]';
}
else
{
// This is a build made from SVN, let display the full information
$sVersionString = ITOP_VERSION."-".ITOP_REVISION." ".ITOP_BUILD_DATE;
}
return $sVersionString;
}
public function CreateIncidentTicket($sLogin, $sPassword, $sTitle, $sDescription, $oCallerDesc, $oCustomerDesc, $oServiceDesc, $oServiceSubcategoryDesc, $sProduct, $oWorkgroupDesc, $aSOAPImpactedCIs, $sImpact, $sUrgency)