testWebServer.php
6.47 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
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
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
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
<?php
require_once("../Client/WSClientSOAP.php");
//require_once("../Client/WSClientREST.php");
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;
//Test getTimeTablesList function without userID & password
// $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;
//Test getTimeTablesList function with userID & password
$res = $client->getTimeTablesList("budnik", "Sacre-Cour");
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;
//Test getTimeTable function without userID & password
// $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;
//Test getTimeTable function with userID & password
$res = $client->getTimeTable("tt_0", "budnik", "Sacre-Cour");
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;
//Test getParameterList function for impex user
// $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;
//Test getParameterList function with userID & password
$res = $client->getParameterList("budnik", "Sacre-Cour");
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;
}
//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;
//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);
}
}
}
$clientSOAP = new WSClientSOAP("http://apus.irap.omp.eu/NEWAMDA/public/wsdl/Methods_AMDA.wsdl");
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);*/
?>