TestIsAlive_01.php 1003 Bytes
<?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',
		);
	}
}

?>