Blame view

php/WebServices/Tests/testWebServer.php 6.62 KB
1ec5d7bd   Benjamin Renard   WS getParameter, ...
1
2
<?php 

31fb656e   Elena.Budnik   correct wsdl + te...
3
4
require_once("../Client/WSClientSOAP.php");
//require_once("../Client/WSClientREST.php");
1ec5d7bd   Benjamin Renard   WS getParameter, ...
5
6
7
8
9
10
11
12
13

function runSuiteTests($client)
{
	//Test isAlive function
	$res = $client->isAlive();
	if (!isset($res) || ($res != true))
		echo "[ERROR] - Error during call of isAlive function".PHP_EOL;
	else
		echo "[OK] - isAlive".PHP_EOL;
31fb656e   Elena.Budnik   correct wsdl + te...
14
 
1ec5d7bd   Benjamin Renard   WS getParameter, ...
15
	//Test getTimeTablesList function without userID & password
31fb656e   Elena.Budnik   correct wsdl + te...
16
17
18
19
20
21
// 	$res = $client->getTimeTablesList();
// 	if (!isset($res) || !$res->success)
// 		echo "[ERROR] - Error during call of getTimeTablesList function - Test 1".PHP_EOL;
// 	else
// 		echo "[OK] - getTimeTablesList - Test 1 - ".$res->TimeTablesList.PHP_EOL;
		 
1ec5d7bd   Benjamin Renard   WS getParameter, ...
22
	//Test getTimeTablesList function with userID & password
fc5106f5   Elena.Budnik   login/pwd hide
23
	$res = $client->getTimeTablesList(dduser, ddpass);
1ec5d7bd   Benjamin Renard   WS getParameter, ...
24
25
26
27
	if (!isset($res) || !$res->success)
		echo "[ERROR] - Error during call of getTimeTablesList function - Test 2".PHP_EOL;
	else
		echo "[OK] - getTimeTablesList - Test 2 - ".$res->TimeTablesList.PHP_EOL;
31fb656e   Elena.Budnik   correct wsdl + te...
28
 
1ec5d7bd   Benjamin Renard   WS getParameter, ...
29
	//Test getTimeTable function without userID & password
31fb656e   Elena.Budnik   correct wsdl + te...
30
31
32
33
34
35
// 	$res = $client->getTimeTable("sharedtt_0");
// 	if (!isset($res) || !$res->success)
// 		echo "[ERROR] - Error during call of getTimeTable function - Test 1".PHP_EOL;
// 	else
// 		echo "[OK] - getTimeTable - Test 1 - ".$res->ttFileURL.PHP_EOL;
		 
1ec5d7bd   Benjamin Renard   WS getParameter, ...
36
	//Test getTimeTable function with userID & password
fc5106f5   Elena.Budnik   login/pwd hide
37
	$res = $client->getTimeTable("tt_0", dduser, ddpass);
1ec5d7bd   Benjamin Renard   WS getParameter, ...
38
39
40
41
	if (!isset($res) || !$res->success)
		echo "[ERROR] - Error during call of getTimeTable function - Test 2".PHP_EOL;
	else
		echo "[OK] - getTimeTable - Test 2 - ".$res->ttFileURL.PHP_EOL;
31fb656e   Elena.Budnik   correct wsdl + te...
42
	 
1ec5d7bd   Benjamin Renard   WS getParameter, ...
43
	//Test getParameterList function for impex user
31fb656e   Elena.Budnik   correct wsdl + te...
44
45
46
47
48
49
// 	$res = $client->getParameterList("impex");
// 	if (!isset($res) || !$res->success)
// 		echo "[ERROR] - Error during call of getParameterList function - Test 1".PHP_EOL;
// 	else
// 		echo "[OK] - getParameterList - Test 1 - ".$res->ParameterList->LocalDataBaseParameters.PHP_EOL;
	 
1ec5d7bd   Benjamin Renard   WS getParameter, ...
50
	//Test getParameterList function with userID & password
fc5106f5   Elena.Budnik   login/pwd hide
51
	$res = $client->getParameterList(dduser, ddpass);
1ec5d7bd   Benjamin Renard   WS getParameter, ...
52
53
54
55
56
57
58
59
	if (!isset($res) || !$res->success)
		echo "[ERROR] - Error during call of getParameterList function - Test 2".PHP_EOL;
	else
	{
		echo "[OK] - getParameterList - Test 2 :".PHP_EOL;
		echo "		- UserDefinedParameters : ".$res->ParameterList->UserDefinedParameters.PHP_EOL;
		echo "		- LocalDataBaseParameters : ".$res->ParameterList->LocalDataBaseParameters.PHP_EOL;
	}
31fb656e   Elena.Budnik   correct wsdl + te...
60
	 
1ec5d7bd   Benjamin Renard   WS getParameter, ...
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
	//Test getObsDataTree function
	$res = $client->getObsDataTree();
	if (!isset($res) || !$res->success)
		echo "[ERROR] - Error during call of getObsDataTree function".PHP_EOL;
	else
		echo "[OK] - getObsDataTree - Test 1 - ".$res->WorkSpace->LocalDataBaseParameters.PHP_EOL;
	
	//Test getParameter function
	$res = $client->getParameter("2008-01-01T00:00:00", "2008-01-02T00:00:00", "imf", 0, "", "", WSOutputFileFormat::ASCII);
	if (!isset($res) || !$res->success)
		echo "[ERROR] - Error during call of getParameter function - Test 1".PHP_EOL;
	else
		echo "[OK] - getParameter - Test 1 - ".$res->dataFileURLs.PHP_EOL;
		
	//Test getParameter function
	$res = $client->getParameter("2008-01-01T00:00:00", "2008-01-02T00:00:00", "imf", 3600, "", "", WSOutputFileFormat::ASCII);
	if (!isset($res) || !$res->success)
		echo "[ERROR] - Error during call of getParameter function - Test 2".PHP_EOL;
	else
		echo "[OK] - getParameter - Test 2 - ".$res->dataFileURLs.PHP_EOL;
	
	//Test getParameter function
	$res = $client->getParameter("2008-01-01T00:00:00", "2008-01-02T00:00:00", "imf", 0, "", "", WSOutputFileFormat::VOTABLE);
	if (!isset($res) || !$res->success)
		echo "[ERROR] - Error during call of getParameter function - Test 3".PHP_EOL;
	else
		echo "[OK] - getParameter - Test 3 - ".$res->dataFileURLs.PHP_EOL;
	
	//Test getParameter function
	$res = $client->getParameter("2008-01-01T00:00:00", "2008-01-02T00:00:00", "imf", 3600, "", "", WSOutputFileFormat::VOTABLE);
	if (!isset($res) || !$res->success)
		echo "[ERROR] - Error during call of getParameter function - Test 4".PHP_EOL;
	else
		echo "[OK] - getParameter - Test 4 - ".$res->dataFileURLs.PHP_EOL;
	
	//Test getParameter function
	$res = $client->getParameter("2008-01-01T00:00:00", "2008-01-02T00:00:00", "imf", 0, "", "", WSOutputFileFormat::ASCII, WSOutputTimeFormat::TIMESTAMP);
	if (!isset($res) || !$res->success)
		echo "[ERROR] - Error during call of getParameter function - Test 5".PHP_EOL;
	else
		echo "[OK] - getParameter - Test 5 - ".$res->dataFileURLs.PHP_EOL;
	
	//Test getParameter function
	$res = $client->getParameter("2008-01-01T00:00:00", "2008-01-02T00:00:00", "imf", 0, "", "", WSOutputFileFormat::VOTABLE, WSOutputTimeFormat::ISO, 1);
	if (!isset($res) || !$res->success)
		echo "[ERROR] - Error during call of getParameter function - Test 6".PHP_EOL;
	else
		echo "[OK] - getParameter - Test 6 - ".$res->dataFileURLs.PHP_EOL;
	
	//Test getDataset function
	$res = $client->getDataset("2008-01-01T00:00:00", "2008-01-02T00:00:00", "ground:based:asy", 0, "", "", WSOutputFileFormat::ASCII);
	if (!isset($res) || !$res->success)
		echo "[ERROR] - Error during call of getDataset function".PHP_EOL;
	else
		echo "[OK] - getDataset - ".$res->dataFileURLs.PHP_EOL;
	
	//Test getOrbites function
	$res = $client->getOrbites("2008-01-01T00:00:00", "2008-01-02T00:00:00", WSSpacecraft::VEX, WSCoordinatesSytem::VSO, WSOrbitUnit::RV,
			0, "", "", WSOutputFileFormat::ASCII);
	if (!isset($res) || !$res->success)
		echo "[ERROR] - Error during call of getOrbites function".PHP_EOL;
	else
		echo "[OK] - getOrbites - ".$res->dataFileURLs.PHP_EOL;
363cacdd   Benjamin Renard   use new Kernel fo...
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
	
	//Test getPlot function
	$res = $client->getPlot("2008-01-01T00:00:00", "2009-01-01T00:00:00", "ACE");
	if (!isset($res) || !$res->success)
		echo "[ERROR] - Error during call of getPlot function".PHP_EOL;
	else
	{
		$plotDirectoryURL = $res->plotDirectoryURL;
		echo "[OK] - getPlot".PHP_EOL;
		while (true)
		{
			echo "    -> getResultPlot".PHP_EOL;
			$res = $client->getResultPlot($plotDirectoryURL);
			if (!isset($res))
			{
				echo "[ERROR] - Error during call of getResultPlot function".PHP_EOL;
				break;
			}
			else if ($res->success)
			{
				echo "    -> plotFileURL : ".$res->plotFileURL.PHP_EOL;
				break;
			}
			echo "    -> Result not ready => Wait 5s".PHP_EOL;
			sleep(5);
		}
	}
1ec5d7bd   Benjamin Renard   WS getParameter, ...
151
152
}

e48a45d7   Elena.Budnik   WebServices folder
153
$clientSOAP = new WSClientSOAP("http://apus.irap.omp.eu/NEWAMDA/public/wsdl/Methods_AMDA.wsdl");
1ec5d7bd   Benjamin Renard   WS getParameter, ...
154

fc5106f5   Elena.Budnik   login/pwd hide
155
156
157
158
159
160
161
if ( getenv('DDUSER') && getenv('DDPASS')) {
	define('dduser', getenv('DDUSER'));
	define('ddpass', getenv('DDPASS'));
}
else {
	die("Export env vars : DDUSER and DDPASS");
}
1ec5d7bd   Benjamin Renard   WS getParameter, ...
162
163
164
165
166
167
168
169
170
171
172
echo "==> Suite tests for SOAP client".PHP_EOL;
runSuiteTests($clientSOAP);

//REST client is obsolete
/*$clientREST = new WSClientREST("http://localhost/NEWAMDA-BENJAMIN/php/rest/");

echo "==> Suite tests for REST client".PHP_EOL;
runSuiteTests($clientREST);*/


?>