TestIsAlive_01.php
1003 Bytes
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
<?php
require_once "Base/TestAbstract.php";
class TestIsAlive_01 extends TestAbstract
{
public function getAPI() {
return "isAlive";
}
public function getParams() {
return array();
}
public function getDescription() {
return "Used to check whether AMDA services are available or not.";
}
protected function checkRESTResult($result) {
if (empty($result)) {
return array(
'success' => FALSE,
'message' => 'Empty result',
);
}
$json_res = json_decode($result, TRUE);
if (!$json_res) {
return array(
'success' => FALSE,
'message' => 'Result is not in JSON format',
);
}
if (empty($json_res['alive'])) {
return array(
'success' => FALSE,
'message' => 'Service is not alive',
);
}
return array(
'success' => TRUE,
);
}
protected function checkSOAPResult($result) {
if ($result) {
return array(
'success' => TRUE,
);
}
return array(
'success' => FALSE,
'message' => 'Service is not alive',
);
}
}
?>