Fix interface changes of statusdat in tests

The StatusDat tests didn't run as they were outdated, now a
newer version is added

refs #4178
refs #4179
This commit is contained in:
Jannis Moßhammer 2013-07-22 13:47:09 +02:00
parent dac9b7be4b
commit 07f7e7ef23
7 changed files with 22 additions and 30 deletions

View File

@ -2,17 +2,14 @@
namespace Tests\Monitoring\Backend\Statusdat;
use Tests\Icinga\Protocol\Statusdat\ReaderMock as ReaderMock;
use \Monitoring\Backend\Statusdat\Query\ServicegroupsummaryQuery;
use Monitoring\Backend\Statusdat\Query\ServicegroupsummaryQuery;
use Tests\Icinga\Protocol\Statusdat\StatusdatTestLoader;
$base = dirname(__FILE__)."/../../../../..";
require_once("Zend/Config.php");
require_once($base."/../../test/php/library/Icinga/Protocol/Statusdat/ReaderMock.php");
require_once($base."/../../library/Icinga/Data/AbstractQuery.php");
require_once($base."/library/Monitoring/Backend/Statusdat/Criteria/Order.php");
require_once($base."/library/Monitoring/Backend/AbstractBackend.php");
require_once($base."/library/Monitoring/Backend/Statusdat/Query/Query.php");
require_once($base."/library/Monitoring/Backend/Statusdat/Query/GroupsummaryQuery.php");
require_once($base."/../../test/php/library/Icinga/Protocol/Statusdat/StatusdatTestLoader.php");
StatusdatTestLoader::requireLibrary();
require_once(realpath($base."/library/Monitoring/Backend/Statusdat/Query/GroupsummaryQuery.php"));
require_once(realpath($base."/library/Monitoring/Backend/Statusdat/Query/ServicegroupsummaryQuery.php"));
class BackendMock extends \Monitoring\Backend\AbstractBackend

View File

@ -4,19 +4,7 @@ namespace Tests\Icinga\Protocol\Statusdat;
require_once("Zend/Config.php");;
require_once("Zend/Log.php");;
require_once(realpath("../../library/Icinga/Protocol/Statusdat/IReader.php"));;
require_once(realpath("../../library/Icinga/Protocol/Statusdat/Reader.php"));;
require_once(realpath("../../library/Icinga/Protocol/Statusdat/Exception/ParsingException.php"));;
require_once(realpath("../../library/Icinga/Exception/ProgrammingError.php"));;
require_once(realpath("../../library/Icinga/Protocol/Statusdat/Parser.php"));;
require_once(realpath("../../library/Icinga/Protocol/AbstractQuery.php"));;
require_once(realpath("../../library/Icinga/Data/AbstractQuery.php"));;
require_once(realpath("../../library/Icinga/Protocol/Statusdat/Query.php"));;
require_once(realpath("../../library/Icinga/Protocol/Statusdat/Query/IQueryPart.php"));;
require_once(realpath("../../library/Icinga/Protocol/Statusdat/Query/Group.php"));;
require_once(realpath("../../library/Icinga/Protocol/Statusdat/Query/Expression.php"));;
require_once(realpath("../../library/Icinga/Exception/ConfigurationError.php"));;
require_once(realpath("../../library/Icinga/Application/Logger.php"));;
use \Icinga\Protocol\Statusdat as SD;
/**
@ -26,6 +14,8 @@ use \Icinga\Protocol\Statusdat as SD;
class StatusdatComponentTest extends \PHPUnit_Framework_TestCase
{
public function getReader() {
require_once(dirname(__FILE__)."/../StatusdatTestLoader.php");
StatusdatTestLoader::requireLibrary();
$reader = new SD\Reader(new \Zend_Config(array(
"status_file" => dirname(__FILE__)."/status.dat",
"objects_file" => dirname(__FILE__)."/objects.cache"

View File

@ -1,7 +1,7 @@
<?php
namespace Tests\Icinga\Protocol\Statusdat;
require_once("../../library/Icinga/Protocol/AbstractQuery.php");
require_once("../../library/Icinga/Data/AbstractQuery.php");
require_once("../../library/Icinga/Protocol/Statusdat/Query.php");
require_once(dirname(__FILE__)."/ReaderMock.php");

View File

@ -1,10 +1,11 @@
<?php
namespace Tests\Icinga\Protocol\Statusdat;
require_once("../../library/Icinga/Protocol/Statusdat/IReader.php");
require_once(realpath("../../library/Icinga/Data/DatasourceInterface.php"));
use Icinga\Data\DatasourceInterface;
use Icinga\Protocol\Statusdat\IReader;
class ReaderMock implements IReader
class ReaderMock implements IReader, DatasourceInterface
{
private $objects;
private $indices;
@ -31,6 +32,10 @@ class ReaderMock implements IReader
return $this;
}
public function select()
{
return $this;
}
public function getObjectByName($type, $idx)
{

View File

@ -1,12 +1,13 @@
<?php
namespace Tests\Icinga\Protocol\Statusdat;
require_once("../../library/Icinga/Protocol/Statusdat/IReader.php");
require_once("../../library/Icinga/Protocol/Statusdat/Reader.php");
require_once("../../library/Icinga/Exception/ConfigurationError.php");
require_once("StatusdatTestLoader.php");
use Icinga\Protocol\Statusdat\Reader as Reader;
StatusdatTestLoader::requireLibrary();
if (!defined('APPLICATION_PATH')) {
define("APPLICATION_PATH","./"); // TODO: test boostrap
}
@ -42,7 +43,6 @@ class ParserMock {
}
}
require("Zend/Cache.php");
class ReaderTest extends \PHPUnit_Framework_TestCase
{
protected function tearDown()

View File

@ -19,7 +19,7 @@ require_once '../../modules/monitoring/library/Monitoring/Backend/AbstractBacken
require_once '../../modules/monitoring/library/Monitoring/Backend/Statusdat/Query/Query.php';
require_once '../../modules/monitoring/library/Monitoring/Backend/Statusdat.php';
require_once '../../modules/monitoring/library/Monitoring/Backend/Statusdat/Query/StatusQuery.php';
require_once '../../modules/monitoring/library/Monitoring/Backend/Statusdat/DataView/StatusdatHostView.php';
require_once '../../modules/monitoring/library/Monitoring/Backend/Statusdat/DataView/HostStatusView.php';
require_once '../../modules/monitoring/library/Monitoring/View/MonitoringView.php';
require_once '../../modules/monitoring/library/Monitoring/View/StatusView.php';

View File

@ -24,7 +24,7 @@ require_once '../../modules/monitoring/library/Monitoring/Backend/AbstractBacken
require_once '../../modules/monitoring/library/Monitoring/Backend/Statusdat/Query/Query.php';
require_once '../../modules/monitoring/library/Monitoring/Backend/Statusdat.php';
require_once '../../modules/monitoring/library/Monitoring/Backend/Statusdat/Query/StatusQuery.php';
require_once '../../modules/monitoring/library/Monitoring/Backend/Statusdat/DataView/StatusdatHostView.php';
require_once '../../modules/monitoring/library/Monitoring/Backend/Statusdat/DataView/HostStatusView.php';
require_once '../../modules/monitoring/library/Monitoring/View/MonitoringView.php';
require_once '../../modules/monitoring/library/Monitoring/View/StatusView.php';
require_once '../../library/Icinga/Web/Paginator/ScrollingStyle/SlidingWithBorder.php';