Blame view

php/WebServices/Tests/Suite/TestIsAlive_01.php 1003 Bytes
0c8a11ef   Benjamin Renard   Tests suits for W...
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
<?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) {
06f00a57   Benjamin Renard   Remove debug stuff
20
		if (empty($result)) {
0c8a11ef   Benjamin Renard   Tests suits for W...
21
22
23
24
			return array(
				'success' => FALSE,
				'message' => 'Empty result',
			);
06f00a57   Benjamin Renard   Remove debug stuff
25
		}
0c8a11ef   Benjamin Renard   Tests suits for W...
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
		$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',
		);
	}
}

?>