TestGetDataset_11.php 1.49 KB
<?php

require_once "Base/TestDownloadBase.php";

class TestGetDataset_11 extends TestDownloadBase
{
	public function getAPI() {
		return "getDataset";
	}

	protected function needRESTAuth() {
		return TRUE;
	}

	public function getParams() {
		return array(
			"startTime" => "2008-01-01T00:00:00",
			"stopTime"  => "2008-01-01T01:00:00",
			"datasetID" => "mex-els-all",
			"sampling"  => 60,
		);
	}

	public function getDescription() {
		return "Get mex-els-all data. Sampling 60s.";
	}

	protected function checkResultInfo($info) {
		if ($info['structure'] != 'all-in-one-file') {
			return array(
				'success' => FALSE,
				'message' => 'Bad file structure ('.$info['structure'].')',
			);
		}
		if ($info['timeFormat'] != 'ISO 8601') {
			return array(
				'success' => FALSE,
				'message' => 'Bad time format ('.$info['timeFormat'].')',
			);
		}
		if (!isset($info['sampling'])) {
			return array(
				'success' => FALSE,
				'message' => 'Missing sampling time',
			);
		}
		else if ($info['sampling'] != 60) {
			return array(
				'success' => FALSE,
				'message' => 'Bad sampling time ('.$info['sampling'].')',
			);
		}
		if (!in_array('mex_els_spec_0', $info['parameters'])) {
			return array(
				'success' => FALSE,
				'message' => 'Missing mex_els_spec_0 in result file',
			);
		}
		if (!in_array('mex_els_spec_sum', $info['parameters'])) {
			return array(
				'success' => FALSE,
				'message' => 'Missing mex_els_spec_sum in result file',
			);
		}
		return array(
			'success' => TRUE,
		);
	}
}

?>