mirror of
https://github.com/Icinga/icingaweb2.git
synced 2025-07-31 01:34:09 +02:00
Fix statusdat tests and implementation
After moving StatusDat to monitoring/Backends and changing the inheritance to Library/Icinga/Data, a few changes must be reflected in the tests: - Move tests to monitoring module - Change $this->backend references in StatusDat Queries to $this->ds - Added LibraryLoader to ease requiring of libaries (to be discussed) refs #4417 refs #4179
This commit is contained in:
parent
cea7cdbcaf
commit
5827cb37cb
@ -1,71 +0,0 @@
|
|||||||
<?php
|
|
||||||
// {{{ICINGA_LICENSE_HEADER}}}
|
|
||||||
/**
|
|
||||||
* This file is part of Icinga 2 Web.
|
|
||||||
*
|
|
||||||
* Icinga 2 Web - Head for multiple monitoring backends.
|
|
||||||
* Copyright (C) 2013 Icinga Development Team
|
|
||||||
*
|
|
||||||
* This program is free software; you can redistribute it and/or
|
|
||||||
* modify it under the terms of the GNU General Public License
|
|
||||||
* as published by the Free Software Foundation; either version 2
|
|
||||||
* of the License, or (at your option) any later version.
|
|
||||||
*
|
|
||||||
* This program is distributed in the hope that it will be useful,
|
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
* GNU General Public License for more details.
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU General Public License
|
|
||||||
* along with this program; if not, write to the Free Software
|
|
||||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
|
||||||
*
|
|
||||||
* @copyright 2013 Icinga Development Team <info@icinga.org>
|
|
||||||
* @license http://www.gnu.org/licenses/gpl-2.0.txt GPL, version 2
|
|
||||||
* @author Icinga Development Team <info@icinga.org>
|
|
||||||
*/
|
|
||||||
// {{{ICINGA_LICENSE_HEADER}}}
|
|
||||||
|
|
||||||
namespace Icinga\Protocol\Statusdat;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Class ObjectContainer
|
|
||||||
* @package Icinga\Protocol\Statusdat
|
|
||||||
*/
|
|
||||||
class ObjectContainer extends \stdClass
|
|
||||||
{
|
|
||||||
/**
|
|
||||||
* @var \stdClass
|
|
||||||
*/
|
|
||||||
public $ref;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @var IReader
|
|
||||||
*/
|
|
||||||
public $reader;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @param \stdClass $obj
|
|
||||||
* @param IReader $reader
|
|
||||||
*/
|
|
||||||
public function __construct(\stdClass &$obj, IReader &$reader)
|
|
||||||
{
|
|
||||||
$this->ref = & $obj;
|
|
||||||
$this->reader = & $reader;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @param $attribute
|
|
||||||
* @return \stdClass
|
|
||||||
*/
|
|
||||||
public function __get($attribute)
|
|
||||||
{
|
|
||||||
$exploded = explode(".", $attribute);
|
|
||||||
$result = $this->ref;
|
|
||||||
foreach ($exploded as $elem) {
|
|
||||||
|
|
||||||
$result = $result->$elem;
|
|
||||||
}
|
|
||||||
return $result;
|
|
||||||
}
|
|
||||||
}
|
|
@ -29,12 +29,12 @@
|
|||||||
namespace Icinga\Protocol\Statusdat;
|
namespace Icinga\Protocol\Statusdat;
|
||||||
|
|
||||||
use Icinga\Protocol;
|
use Icinga\Protocol;
|
||||||
|
use Icinga\Data\AbstractQuery;
|
||||||
/**
|
/**
|
||||||
* Class Query
|
* Class Query
|
||||||
* @package Icinga\Protocol\Statusdat
|
* @package Icinga\Protocol\Statusdat
|
||||||
*/
|
*/
|
||||||
class Query extends Protocol\AbstractQuery
|
class Query extends AbstractQuery
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* @var array
|
* @var array
|
||||||
@ -49,7 +49,8 @@ class Query extends Protocol\AbstractQuery
|
|||||||
"servicegroups" => array("servicegroup"),
|
"servicegroups" => array("servicegroup"),
|
||||||
"comments" => array("servicecomment", "hostcomment"),
|
"comments" => array("servicecomment", "hostcomment"),
|
||||||
"hostcomments" => array("hostcomment"),
|
"hostcomments" => array("hostcomment"),
|
||||||
"servicecomments" => array("servicecomment")
|
"servicecomments" => array("servicecomment"),
|
||||||
|
"status" => array("host", "service")
|
||||||
);
|
);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -65,7 +66,7 @@ class Query extends Protocol\AbstractQuery
|
|||||||
/**
|
/**
|
||||||
* @var array
|
* @var array
|
||||||
*/
|
*/
|
||||||
private $columns = array();
|
protected $columns = array();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @var null
|
* @var null
|
||||||
@ -80,7 +81,7 @@ class Query extends Protocol\AbstractQuery
|
|||||||
/**
|
/**
|
||||||
* @var array
|
* @var array
|
||||||
*/
|
*/
|
||||||
private $order_columns = array();
|
protected $order_columns = array();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @var array
|
* @var array
|
||||||
@ -169,7 +170,7 @@ class Query extends Protocol\AbstractQuery
|
|||||||
*/
|
*/
|
||||||
public function __construct(IReader $reader)
|
public function __construct(IReader $reader)
|
||||||
{
|
{
|
||||||
$this->reader = $reader;
|
$this->ds = $reader;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -266,7 +267,7 @@ class Query extends Protocol\AbstractQuery
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$state = $this->reader->getObjects();
|
$state = $this->ds->getObjects();
|
||||||
$result = array();
|
$result = array();
|
||||||
foreach (self::$VALID_TARGETS[$this->source] as $target) {
|
foreach (self::$VALID_TARGETS[$this->source] as $target) {
|
||||||
$indexes = & array_keys($state[$target]);
|
$indexes = & array_keys($state[$target]);
|
||||||
@ -302,8 +303,8 @@ class Query extends Protocol\AbstractQuery
|
|||||||
*/
|
*/
|
||||||
private function orderResult($a, $b)
|
private function orderResult($a, $b)
|
||||||
{
|
{
|
||||||
$o1 = & $this->reader->getObjectByName($this->currentType, $a);
|
$o1 = & $this->ds->getObjectByName($this->currentType, $a);
|
||||||
$o2 = & $this->reader->getObjectByName($this->currentType, $b);
|
$o2 = & $this->ds->getObjectByName($this->currentType, $b);
|
||||||
$result = 0;
|
$result = 0;
|
||||||
foreach ($this->order_columns as $col) {
|
foreach ($this->order_columns as $col) {
|
||||||
|
|
||||||
@ -363,7 +364,7 @@ class Query extends Protocol\AbstractQuery
|
|||||||
$result = array();
|
$result = array();
|
||||||
foreach ($indices as $type => $subindices) {
|
foreach ($indices as $type => $subindices) {
|
||||||
foreach ($subindices as $objectIndex) {
|
foreach ($subindices as $objectIndex) {
|
||||||
$r = & $this->reader->getObjectByName($type, $objectIndex);
|
$r = & $this->ds->getObjectByName($type, $objectIndex);
|
||||||
$hash = "";
|
$hash = "";
|
||||||
$cols = array();
|
$cols = array();
|
||||||
foreach ($this->groupColumns as $col) {
|
foreach ($this->groupColumns as $col) {
|
||||||
@ -400,7 +401,7 @@ class Query extends Protocol\AbstractQuery
|
|||||||
$this->limitIndices($indices);
|
$this->limitIndices($indices);
|
||||||
|
|
||||||
$result = array();
|
$result = array();
|
||||||
$state = & $this->reader->getObjects();
|
$state = & $this->ds->getObjects();
|
||||||
foreach ($indices as $type => $subindices) {
|
foreach ($indices as $type => $subindices) {
|
||||||
|
|
||||||
foreach ($subindices as $index) {
|
foreach ($subindices as $index) {
|
||||||
|
@ -28,10 +28,10 @@
|
|||||||
|
|
||||||
namespace Icinga\Protocol\Statusdat;
|
namespace Icinga\Protocol\Statusdat;
|
||||||
|
|
||||||
use Icinga\Backend\MonitoringObjectList;
|
|
||||||
use Icinga\Exception as Exception;
|
use Icinga\Exception as Exception;
|
||||||
use Icinga\Benchmark as Benchmark;
|
use Icinga\Benchmark as Benchmark;
|
||||||
|
use Icinga\Protocol\Statusdat\View\MonitoringObjectList;
|
||||||
/**
|
/**
|
||||||
* Class Reader
|
* Class Reader
|
||||||
* @package Icinga\Protocol\Statusdat
|
* @package Icinga\Protocol\Statusdat
|
||||||
@ -91,9 +91,12 @@ class Reader implements IReader
|
|||||||
public function __construct($config = \Zend_Config, $parser = null, $noCache = false)
|
public function __construct($config = \Zend_Config, $parser = null, $noCache = false)
|
||||||
{
|
{
|
||||||
$this->noCache = $noCache;
|
$this->noCache = $noCache;
|
||||||
|
if (isset($config->no_cache)) {
|
||||||
|
$this->noCache = $config->no_cache;
|
||||||
|
}
|
||||||
$this->config = $config;
|
$this->config = $config;
|
||||||
$this->parser = $parser;
|
$this->parser = $parser;
|
||||||
if (!$noCache) {
|
if (!$this->noCache) {
|
||||||
$this->cache = $this->initializeCaches($config);
|
$this->cache = $this->initializeCaches($config);
|
||||||
if ($this->fromCache()) {
|
if ($this->fromCache()) {
|
||||||
$this->createHostServiceConnections();
|
$this->createHostServiceConnections();
|
||||||
@ -104,7 +107,7 @@ class Reader implements IReader
|
|||||||
$this->parseObjectsCacheFile();
|
$this->parseObjectsCacheFile();
|
||||||
}
|
}
|
||||||
if (!$this->hasRuntimeState) {
|
if (!$this->hasRuntimeState) {
|
||||||
;
|
|
||||||
}
|
}
|
||||||
$this->parseStatusDatFile();
|
$this->parseStatusDatFile();
|
||||||
if (!$noCache && $this->newState) {
|
if (!$noCache && $this->newState) {
|
||||||
@ -275,10 +278,7 @@ class Reader implements IReader
|
|||||||
*/
|
*/
|
||||||
public function fetchAll(Query $query)
|
public function fetchAll(Query $query)
|
||||||
{
|
{
|
||||||
return new MonitoringObjectList(
|
return $query->getResult();
|
||||||
$query->getResult(),
|
|
||||||
$query->getView()
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -318,4 +318,5 @@ class Reader implements IReader
|
|||||||
{
|
{
|
||||||
return isset($this->lastState[$type]) ? array_keys($this->lastState[$type]) : null;
|
return isset($this->lastState[$type]) ? array_keys($this->lastState[$type]) : null;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -0,0 +1,74 @@
|
|||||||
|
<?php
|
||||||
|
// {{{ICINGA_LICENSE_HEADER}}}
|
||||||
|
/**
|
||||||
|
* This file is part of Icinga 2 Web.
|
||||||
|
*
|
||||||
|
* Icinga 2 Web - Head for multiple monitoring backends.
|
||||||
|
* Copyright (C) 2013 Icinga Development Team
|
||||||
|
*
|
||||||
|
* This program is free software; you can redistribute it and/or
|
||||||
|
* modify it under the terms of the GNU General Public License
|
||||||
|
* as published by the Free Software Foundation; either version 2
|
||||||
|
* of the License, or (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program; if not, write to the Free Software
|
||||||
|
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||||
|
*
|
||||||
|
* @copyright 2013 Icinga Development Team <info@icinga.org>
|
||||||
|
* @license http://www.gnu.org/licenses/gpl-2.0.txt GPL, version 2
|
||||||
|
* @author Icinga Development Team <info@icinga.org>
|
||||||
|
*/
|
||||||
|
// {{{ICINGA_LICENSE_HEADER}}}
|
||||||
|
|
||||||
|
namespace Icinga\Protocol\Statusdat\View;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Class AbstractAccessorStrategy
|
||||||
|
* Basic interface for views.
|
||||||
|
* The name sound weirder than it is: Views define special get and exists operations for fields
|
||||||
|
* that are not directly available in a resultset, but exist under another name or can be
|
||||||
|
* accessed by loading an additional object during runtime.
|
||||||
|
*
|
||||||
|
* @see Icinga\Backend\DataView\ObjectRemappingView For an implementation of mapping field names
|
||||||
|
* to storage specific names, e.g. service_state being status.current_state in status.dat views.
|
||||||
|
*
|
||||||
|
* @see Icinga\Backend\MonitoringObjectList For the typical usage of this class. It is not wrapped
|
||||||
|
* around the monitoring object, so we don't use __get() or __set() and always have to give the
|
||||||
|
* item we'd like to access.
|
||||||
|
* @package Icinga\Backend\DataView
|
||||||
|
*/
|
||||||
|
interface AbstractAccessorStrategy
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Returns a field for the item, or throws an Exception if the field doesn't exist
|
||||||
|
*
|
||||||
|
* @param $item The item to access
|
||||||
|
* @param $field The field of the item that should be accessed
|
||||||
|
* @return string The content of the field
|
||||||
|
*
|
||||||
|
* @throws \InvalidArgumentException when the field does not exist
|
||||||
|
*/
|
||||||
|
public function get(&$item, $field);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the name that the field has in the specific backend. Might not be available for every field/view
|
||||||
|
* @param $field The field name that should be translated
|
||||||
|
* @return string The real name of this field
|
||||||
|
*/
|
||||||
|
public function getNormalizedFieldName($field);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns true if the field exists on the specific item, otherwise false
|
||||||
|
*
|
||||||
|
* @param $item The item to access
|
||||||
|
* @param $field The field to check on the $item
|
||||||
|
* @return bool True when the field exists, otherwise false
|
||||||
|
*/
|
||||||
|
public function exists(&$item, $field);
|
||||||
|
}
|
134
library/Icinga/Protocol/Statusdat/View/MonitoringObjectList.php
Executable file
134
library/Icinga/Protocol/Statusdat/View/MonitoringObjectList.php
Executable file
@ -0,0 +1,134 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Wrapper around an array of monitoring objects that can be enhanced with an optional
|
||||||
|
* object that extends AbstractAccessorStrategy. This will act as a dataview and provide
|
||||||
|
* normalized access to the underlying data (mapping properties, retrieving additional data)
|
||||||
|
*
|
||||||
|
* If not Accessor is set, this class just behaves like a normal Iterator and returns
|
||||||
|
* the underlying objects.
|
||||||
|
*
|
||||||
|
* If the dataset contains arrays instead of objects, they will be cast to objects.
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
namespace Icinga\Protocol\Statusdat\View;
|
||||||
|
|
||||||
|
class MonitoringObjectList implements \Iterator, \Countable, \ArrayAccess
|
||||||
|
{
|
||||||
|
private $dataSet = array();
|
||||||
|
private $position = 0;
|
||||||
|
private $dataView = null;
|
||||||
|
|
||||||
|
function __construct(array &$dataset, AbstractAccessorStrategy $dataView = null)
|
||||||
|
{
|
||||||
|
$this->dataSet = $dataset;
|
||||||
|
$this->position = 0;
|
||||||
|
$this->dataView = $dataView;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function count()
|
||||||
|
{
|
||||||
|
return count($this->dataSet);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function setPosition($pos)
|
||||||
|
{
|
||||||
|
$this->position = $pos;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* (PHP 5 >= 5.0.0)<br/>
|
||||||
|
* Return the current element
|
||||||
|
* @link http://php.net/manual/en/iterator.current.php
|
||||||
|
* @return mixed Can return any type.
|
||||||
|
*/
|
||||||
|
public function current()
|
||||||
|
{
|
||||||
|
if ($this->dataView)
|
||||||
|
return $this;
|
||||||
|
return $this->dataSet[$this->position];
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* (PHP 5 >= 5.0.0)<br/>
|
||||||
|
* Move forward to next element
|
||||||
|
* @link http://php.net/manual/en/iterator.next.php
|
||||||
|
* @return void Any returned value is ignored.
|
||||||
|
*/
|
||||||
|
public function next()
|
||||||
|
{
|
||||||
|
$this->position++;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* (PHP 5 >= 5.0.0)<br/>
|
||||||
|
* Return the key of the current element
|
||||||
|
* @link http://php.net/manual/en/iterator.key.php
|
||||||
|
* @return mixed scalar on success, or null on failure.
|
||||||
|
*/
|
||||||
|
public function key()
|
||||||
|
{
|
||||||
|
return $this->position;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* (PHP 5 >= 5.0.0)<br/>
|
||||||
|
* Checks if current position is valid
|
||||||
|
* @link http://php.net/manual/en/iterator.valid.php
|
||||||
|
* @return boolean The return value will be casted to boolean and then evaluated.
|
||||||
|
* Returns true on success or false on failure.
|
||||||
|
*/
|
||||||
|
public function valid()
|
||||||
|
{
|
||||||
|
return $this->position < count($this->dataSet);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* (PHP 5 >= 5.0.0)<br/>
|
||||||
|
* Rewind the Iterator to the first element
|
||||||
|
* @link http://php.net/manual/en/iterator.rewind.php
|
||||||
|
* @return void Any returned value is ignored.
|
||||||
|
*/
|
||||||
|
public function rewind()
|
||||||
|
{
|
||||||
|
$this->position = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function __isset($name)
|
||||||
|
{
|
||||||
|
return $this->dataView->exists($this->dataSet[$this->position],$name);
|
||||||
|
}
|
||||||
|
|
||||||
|
function __get($name)
|
||||||
|
{
|
||||||
|
return $this->dataView->get($this->dataSet[$this->position],$name);
|
||||||
|
}
|
||||||
|
|
||||||
|
function __set($name, $value)
|
||||||
|
{
|
||||||
|
throw new \Exception("Setting is currently not available for objects");
|
||||||
|
}
|
||||||
|
|
||||||
|
public function offsetExists($offset)
|
||||||
|
{
|
||||||
|
return count($this->dataSet) < $offset;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function offsetGet($offset)
|
||||||
|
{
|
||||||
|
$res = new MonitoringObjectList($this->dataSet, $this->dataView);
|
||||||
|
$res->position = $offset;
|
||||||
|
return $res;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function offsetSet($offset, $value)
|
||||||
|
{
|
||||||
|
// non mutable
|
||||||
|
}
|
||||||
|
|
||||||
|
public function offsetUnset($offset)
|
||||||
|
{
|
||||||
|
// non mutable
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
172
library/Icinga/Protocol/Statusdat/View/ObjectRemappingView.php
Executable file
172
library/Icinga/Protocol/Statusdat/View/ObjectRemappingView.php
Executable file
@ -0,0 +1,172 @@
|
|||||||
|
<?php
|
||||||
|
// {{{ICINGA_LICENSE_HEADER}}}
|
||||||
|
/**
|
||||||
|
* This file is part of Icinga 2 Web.
|
||||||
|
*
|
||||||
|
* Icinga 2 Web - Head for multiple monitoring backends.
|
||||||
|
* Copyright (C) 2013 Icinga Development Team
|
||||||
|
*
|
||||||
|
* This program is free software; you can redistribute it and/or
|
||||||
|
* modify it under the terms of the GNU General Public License
|
||||||
|
* as published by the Free Software Foundation; either version 2
|
||||||
|
* of the License, or (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program; if not, write to the Free Software
|
||||||
|
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||||
|
*
|
||||||
|
* @copyright 2013 Icinga Development Team <info@icinga.org>
|
||||||
|
* @license http://www.gnu.org/licenses/gpl-2.0.txt GPL, version 2
|
||||||
|
* @author Icinga Development Team <info@icinga.org>
|
||||||
|
*/
|
||||||
|
// {{{ICINGA_LICENSE_HEADER}}}
|
||||||
|
|
||||||
|
namespace Icinga\Protocol\Statusdat\View;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Class ObjectRemappingView
|
||||||
|
*
|
||||||
|
* Dataview that maps generic field names to storage specific fields or requests them via handlers.
|
||||||
|
*
|
||||||
|
* When accessing objects, every storage api returns them with other names. You can't simply say
|
||||||
|
* $object->service_state, because this field is, e.g. under status.current_state in the status.dat
|
||||||
|
* view, while IDO uses servicestate->current_state.
|
||||||
|
*
|
||||||
|
* This view is intended for normalizing these changes, so a request of service_state returns the
|
||||||
|
* right field for the backend. When implementing it, you have to fill the mappedParameters and/or
|
||||||
|
* the handlerParameters array. While mappedParameters simply translate logic field names to
|
||||||
|
* storage specific ones, handlerParameters determins functions that handle data retrieval for
|
||||||
|
* the specific fields.
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
class ObjectRemappingView implements AbstractAccessorStrategy
|
||||||
|
{
|
||||||
|
|
||||||
|
/**
|
||||||
|
* When implementing your own Mapper, this contains the static mapping rules.
|
||||||
|
* @see Icinga\Backend\Statusdat\DataView\StatusdatServiceView for an example
|
||||||
|
*
|
||||||
|
* @var array
|
||||||
|
*/
|
||||||
|
protected $mappedParameters = array();
|
||||||
|
|
||||||
|
private $functionMap = array(
|
||||||
|
"TO_DATE" => "toDateFormat"
|
||||||
|
);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* When implementing your own Mapper, this contains the handler for specific fields and allows you to lazy load
|
||||||
|
* different fields if necessary. The methods are strings that will be mapped to methods of this class
|
||||||
|
*
|
||||||
|
* @see Icinga\Backend\Statusdat\DataView\StatusdatServiceView for an example
|
||||||
|
*
|
||||||
|
* @var array
|
||||||
|
*/
|
||||||
|
protected $handlerParameters = array();
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @see Icinga\Backend\DataView\AbstractAccessorStrategy
|
||||||
|
*
|
||||||
|
* @param The $item
|
||||||
|
* @param The $field
|
||||||
|
* @return The|string
|
||||||
|
* @throws \InvalidArgumentException
|
||||||
|
*/
|
||||||
|
public function get(&$item, $field)
|
||||||
|
{
|
||||||
|
|
||||||
|
if (isset($item->$field)) {
|
||||||
|
return $item->$field;
|
||||||
|
}
|
||||||
|
if (isset($this->mappedParameters[$field])) {
|
||||||
|
return $this->getMappedParameter($item, $field);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (isset($this->handlerParameters[$field])) {
|
||||||
|
$hdl = $this->handlerParameters[$field];
|
||||||
|
return $this->$hdl($item);
|
||||||
|
}
|
||||||
|
throw new \InvalidArgumentException("Field $field does not exist for status.dat services");
|
||||||
|
}
|
||||||
|
|
||||||
|
private function applyPropertyFunction($function, $value)
|
||||||
|
{
|
||||||
|
if (!isset($this->functionMap[$function]))
|
||||||
|
return $value;
|
||||||
|
$fn = $this->functionMap[$function];
|
||||||
|
|
||||||
|
return $this->$fn($value);
|
||||||
|
}
|
||||||
|
|
||||||
|
private function toDateFormat($value)
|
||||||
|
{
|
||||||
|
if (is_numeric($value)) {
|
||||||
|
return date("Y-m-d H:i:s", intval($value));
|
||||||
|
} else {
|
||||||
|
return $value;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private function getMappedParameter(&$item, $field)
|
||||||
|
{
|
||||||
|
$matches = array();
|
||||||
|
$fieldDef = $this->mappedParameters[$field];
|
||||||
|
$function = false;
|
||||||
|
if (preg_match_all('/(?P<FUNCTION>\w+)\((?P<PARAMETER>.*)\)/', $fieldDef, $matches)) {
|
||||||
|
$function = $matches["FUNCTION"][0];
|
||||||
|
$fieldDef = $matches["PARAMETER"][0];
|
||||||
|
}
|
||||||
|
$mapped = explode(".", $fieldDef);
|
||||||
|
$res = $item;
|
||||||
|
|
||||||
|
foreach ($mapped as $map) {
|
||||||
|
if (!isset($res->$map)) {
|
||||||
|
return "";
|
||||||
|
}
|
||||||
|
$res = $res->$map;
|
||||||
|
}
|
||||||
|
if ($function) {
|
||||||
|
return $this->applyPropertyFunction($function, $res);
|
||||||
|
}
|
||||||
|
return $res;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @see Icinga\Backend\DataView\AbstractAccessorStrategy
|
||||||
|
*
|
||||||
|
* @param The $field
|
||||||
|
* @return The|string
|
||||||
|
*/
|
||||||
|
public function getNormalizedFieldName($field)
|
||||||
|
{
|
||||||
|
if (isset($this->mappedParameters[$field])) {
|
||||||
|
return $this->mappedParameters[$field];
|
||||||
|
}
|
||||||
|
return $field;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @see Icinga\Backend\DataView\AbstractAccessorStrategy
|
||||||
|
*
|
||||||
|
* @param The $item
|
||||||
|
* @param The $field
|
||||||
|
* @return bool
|
||||||
|
*/
|
||||||
|
public function exists(&$item, $field)
|
||||||
|
{
|
||||||
|
return (isset($item->$field)
|
||||||
|
|| isset($this->mappedParameters[$field])
|
||||||
|
|| isset($this->handlerParameters[$field])
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
@ -31,10 +31,12 @@ class Monitoring_ListController extends ModuleActionController
|
|||||||
'host_address',
|
'host_address',
|
||||||
'host_acknowledged',
|
'host_acknowledged',
|
||||||
'host_output',
|
'host_output',
|
||||||
|
'host_long_output',
|
||||||
'host_in_downtime',
|
'host_in_downtime',
|
||||||
'host_is_flapping',
|
'host_is_flapping',
|
||||||
'host_state_type',
|
'host_state_type',
|
||||||
'host_handled',
|
'host_handled',
|
||||||
|
'host_last_check',
|
||||||
'host_last_state_change',
|
'host_last_state_change',
|
||||||
'host_notifications_enabled',
|
'host_notifications_enabled',
|
||||||
'host_unhandled_service_count',
|
'host_unhandled_service_count',
|
||||||
@ -65,6 +67,7 @@ class Monitoring_ListController extends ModuleActionController
|
|||||||
if ($this->_getParam('view') === 'compact') {
|
if ($this->_getParam('view') === 'compact') {
|
||||||
$this->_helper->viewRenderer('hosts_compact');
|
$this->_helper->viewRenderer('hosts_compact');
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public function servicesAction()
|
public function servicesAction()
|
||||||
|
@ -133,14 +133,13 @@ class Zend_View_Helper_MonitoringProperties extends Zend_View_Helper_Abstract
|
|||||||
private function buildLatency(\stdClass $object)
|
private function buildLatency(\stdClass $object)
|
||||||
{
|
{
|
||||||
$val = '';
|
$val = '';
|
||||||
|
|
||||||
if ($this->buildCheckType($object) === self::CHECK_PASSIVE) {
|
if ($this->buildCheckType($object) === self::CHECK_PASSIVE) {
|
||||||
$val .= self::VALUE_NA;
|
$val .= self::VALUE_NA;
|
||||||
} else {
|
} else {
|
||||||
$val .= $this->floatFormatter($object->check_latency);
|
$val .= $this->floatFormatter($object->latency);
|
||||||
}
|
}
|
||||||
|
|
||||||
$val .= ' / '. $this->floatFormatter($object->check_execution_time). ' seconds';
|
$val .= ' / '. $this->floatFormatter($object->execution_time). ' seconds';
|
||||||
|
|
||||||
return $val;
|
return $val;
|
||||||
}
|
}
|
||||||
|
@ -170,7 +170,7 @@ abstract class GroupsummaryQuery extends Query
|
|||||||
*/
|
*/
|
||||||
public function init()
|
public function init()
|
||||||
{
|
{
|
||||||
$this->reader = $this->backend->getReader();
|
$this->reader = $this->ds->getReader();
|
||||||
$this->query = $this->reader->select()->from($this->base, array())->groupByFunction(
|
$this->query = $this->reader->select()->from($this->base, array())->groupByFunction(
|
||||||
"groupByProblemType",
|
"groupByProblemType",
|
||||||
$this
|
$this
|
||||||
|
@ -66,6 +66,7 @@ class MonitoringPropertiesTest extends \PHPUnit_Framework_TestCase
|
|||||||
$host = new HostStruct4Properties();
|
$host = new HostStruct4Properties();
|
||||||
$host->host_current_check_attempt = '5';
|
$host->host_current_check_attempt = '5';
|
||||||
|
|
||||||
|
|
||||||
$propertyHelper = new \Zend_View_Helper_MonitoringProperties();
|
$propertyHelper = new \Zend_View_Helper_MonitoringProperties();
|
||||||
$items = $propertyHelper->monitoringProperties($host);
|
$items = $propertyHelper->monitoringProperties($host);
|
||||||
|
|
||||||
@ -76,6 +77,7 @@ class MonitoringPropertiesTest extends \PHPUnit_Framework_TestCase
|
|||||||
|
|
||||||
public function testOutput2()
|
public function testOutput2()
|
||||||
{
|
{
|
||||||
|
date_default_timezone_set("UTC");
|
||||||
$host = new HostStruct4Properties();
|
$host = new HostStruct4Properties();
|
||||||
$host->host_current_check_attempt = '5';
|
$host->host_current_check_attempt = '5';
|
||||||
$host->host_active_checks_enabled = '1';
|
$host->host_active_checks_enabled = '1';
|
||||||
@ -93,7 +95,7 @@ class MonitoringPropertiesTest extends \PHPUnit_Framework_TestCase
|
|||||||
'Check type' => "ACTIVE",
|
'Check type' => "ACTIVE",
|
||||||
'Check latency / duration' => "0.1204 / 0.0000 seconds",
|
'Check latency / duration' => "0.1204 / 0.0000 seconds",
|
||||||
'Next scheduled active check' => "2013-07-04 11:29:43",
|
'Next scheduled active check' => "2013-07-04 11:29:43",
|
||||||
'Last state change' => "2013-07-04 13:24:43",
|
'Last state change' => "2013-07-04 11:24:43",
|
||||||
'Last notification' => "N/A (notification 0)",
|
'Last notification' => "N/A (notification 0)",
|
||||||
'Is this host flapping?' => "YES (12.37% state change)",
|
'Is this host flapping?' => "YES (12.37% state change)",
|
||||||
'In scheduled downtime?' => "YES",
|
'In scheduled downtime?' => "YES",
|
||||||
|
@ -1,17 +1,22 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
namespace Tests\Icinga\Backend\Statusdat;
|
namespace Tests\Monitoring\Backend\Statusdat;
|
||||||
use Tests\Icinga\Protocol\Statusdat\ReaderMock as ReaderMock;
|
use Tests\Icinga\Protocol\Statusdat\ReaderMock as ReaderMock;
|
||||||
require_once("Zend/Config.php");
|
use \Monitoring\Backend\Statusdat\Query\ServicegroupsummaryQuery;
|
||||||
require_once("./library/Icinga/Protocol/Statusdat/ReaderMock.php");
|
|
||||||
require_once("../../library/Icinga/Backend/Query.php");
|
|
||||||
require_once("../../library/Icinga/Backend/Criteria/Order.php");
|
|
||||||
require_once("../../library/Icinga/Backend/AbstractBackend.php");
|
|
||||||
require_once("../../library/Icinga/Backend/Statusdat/Query.php");
|
|
||||||
require_once("../../library/Icinga/Backend/Statusdat/GroupsummaryQuery.php");
|
|
||||||
require_once("../../library/Icinga/Backend/Statusdat/ServicegroupsummaryQuery.php");
|
|
||||||
|
|
||||||
class BackendMock extends \Icinga\Backend\AbstractBackend{
|
$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(realpath($base."/library/Monitoring/Backend/Statusdat/Query/ServicegroupsummaryQuery.php"));
|
||||||
|
|
||||||
|
class BackendMock extends \Monitoring\Backend\AbstractBackend
|
||||||
|
{
|
||||||
public $reader;
|
public $reader;
|
||||||
|
|
||||||
public function select() {
|
public function select() {
|
||||||
@ -27,12 +32,6 @@ class BackendMock extends \Icinga\Backend\AbstractBackend{
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
*
|
|
||||||
* Test class for Servicegroupsummaryquery
|
|
||||||
* Created Mon, 18 Feb 2013 14:33:21 +0000
|
|
||||||
*
|
|
||||||
**/
|
|
||||||
class ServicegroupsummaryqueryTest extends \PHPUnit_Framework_TestCase
|
class ServicegroupsummaryqueryTest extends \PHPUnit_Framework_TestCase
|
||||||
{
|
{
|
||||||
|
|
||||||
@ -40,7 +39,7 @@ class ServicegroupsummaryqueryTest extends \PHPUnit_Framework_TestCase
|
|||||||
{
|
{
|
||||||
$backend = new BackendMock();
|
$backend = new BackendMock();
|
||||||
$backend->setReader($this->getTestDataset());
|
$backend->setReader($this->getTestDataset());
|
||||||
$q = new \Icinga\Backend\Statusdat\ServicegroupsummaryQuery($backend);
|
$q = new ServicegroupsummaryQuery($backend);
|
||||||
$indices = array(
|
$indices = array(
|
||||||
"service" => array(
|
"service" => array(
|
||||||
"hosta;service1", "hosta;service2", "hosta;service3",
|
"hosta;service1", "hosta;service2", "hosta;service3",
|
@ -81,7 +81,7 @@ namespace Test\Monitoring\Testlib
|
|||||||
* }
|
* }
|
||||||
* }
|
* }
|
||||||
*/
|
*/
|
||||||
class MonitoringControllerTest extends \PHPUnit_Framework_TestCase
|
abstract class MonitoringControllerTest extends \PHPUnit_Framework_TestCase
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* The module directory for requiring modules (is relative to the source file)
|
* The module directory for requiring modules (is relative to the source file)
|
||||||
@ -159,7 +159,7 @@ namespace Test\Monitoring\Testlib
|
|||||||
if (!preg_match('/php$/', $view)) {
|
if (!preg_match('/php$/', $view)) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
require_once($module.$folder."/".$view);
|
require_once(realpath($module.$folder."/".$view));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -169,8 +169,8 @@ namespace Test\Monitoring\Testlib
|
|||||||
*/
|
*/
|
||||||
private function requireStatusDatQueries()
|
private function requireStatusDatQueries()
|
||||||
{
|
{
|
||||||
require_once('library/Monitoring/Backend/Statusdat.php');
|
require_once(realpath($this->moduleDir.'/library/Monitoring/Backend/Statusdat.php'));
|
||||||
require_once($this->moduleDir.'/library/Monitoring/Backend/Statusdat/Query/Query.php');
|
require_once(realpath($this->moduleDir.'/library/Monitoring/Backend/Statusdat/Query/Query.php'));
|
||||||
$this->requireFolder('library/Monitoring/Backend/Statusdat');
|
$this->requireFolder('library/Monitoring/Backend/Statusdat');
|
||||||
$this->requireFolder('library/Monitoring/Backend/Statusdat/Criteria');
|
$this->requireFolder('library/Monitoring/Backend/Statusdat/Criteria');
|
||||||
$this->requireFolder('library/Monitoring/Backend/Statusdat/Query');
|
$this->requireFolder('library/Monitoring/Backend/Statusdat/Query');
|
||||||
|
@ -4,6 +4,7 @@
|
|||||||
|
|
||||||
namespace Test\Monitoring\Testlib\Datasource\Strategies;
|
namespace Test\Monitoring\Testlib\Datasource\Strategies;
|
||||||
|
|
||||||
|
use Tests\Icinga\Protocol\Statusdat\StatusdatTestLoader;
|
||||||
/**
|
/**
|
||||||
* SetupStrategy for status dat.
|
* SetupStrategy for status dat.
|
||||||
*
|
*
|
||||||
@ -28,7 +29,7 @@ class StatusdatSetupStrategy implements SetupStrategy {
|
|||||||
if (is_dir($folder."/".$file)) {
|
if (is_dir($folder."/".$file)) {
|
||||||
$this->requireFolder($folder."/".$file);
|
$this->requireFolder($folder."/".$file);
|
||||||
} elseif (preg_match("/\.php/", $file)) {
|
} elseif (preg_match("/\.php/", $file)) {
|
||||||
require_once($folder."/".$file);
|
require_once(realpath($folder."/".$file));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -42,17 +43,8 @@ class StatusdatSetupStrategy implements SetupStrategy {
|
|||||||
*/
|
*/
|
||||||
private function requireStatusDat()
|
private function requireStatusDat()
|
||||||
{
|
{
|
||||||
$moduleDir = realpath(dirname(__FILE__)."/../../../../../");
|
require_once 'library/Icinga/Protocol/Statusdat/StatusdatTestLoader.php';
|
||||||
$appDir = realpath($moduleDir."/../../");
|
StatusdatTestLoader::requireLibrary();
|
||||||
$base = $appDir."/library/Icinga/Protocol/StatusDat";
|
|
||||||
require_once("Zend/Cache.php");
|
|
||||||
require_once("Zend/Log.php");
|
|
||||||
require_once($appDir."/library/Icinga/Application/Logger.php");
|
|
||||||
require_once($appDir."/library/Icinga/Protocol/AbstractQuery.php");
|
|
||||||
require_once($base."/Exception/ParsingException.php");
|
|
||||||
require_once($base."/Query/IQueryPart.php");
|
|
||||||
require_once($base."/IReader.php");
|
|
||||||
$this->requireFolder($base);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
46
test/php/library/Icinga/LibraryLoader.php
Normal file
46
test/php/library/Icinga/LibraryLoader.php
Normal file
@ -0,0 +1,46 @@
|
|||||||
|
<?php
|
||||||
|
namespace Test\Icinga;
|
||||||
|
|
||||||
|
abstract class LibraryLoader {
|
||||||
|
|
||||||
|
public static function getBasePath()
|
||||||
|
{
|
||||||
|
$path = realpath(dirname(__FILE__));
|
||||||
|
while (!preg_match('/.*test$/', $path) && $path != '/') {
|
||||||
|
$path = realpath($path.'/../');
|
||||||
|
}
|
||||||
|
return realpath($path.'/../');
|
||||||
|
}
|
||||||
|
|
||||||
|
public static function getLibraryPath()
|
||||||
|
{
|
||||||
|
return realpath(self::getBasePath().'/library/Icinga/');
|
||||||
|
}
|
||||||
|
|
||||||
|
public static function getModulePath($module = '')
|
||||||
|
{
|
||||||
|
return realpath(self::getBasePath().'/module/'.$module);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Require all php files in the folder $folder
|
||||||
|
*
|
||||||
|
* @param $folder The path to the folder containing PHP files
|
||||||
|
*/
|
||||||
|
public static function loadFolder($folder, $recursive = true)
|
||||||
|
{
|
||||||
|
$files = scandir($folder);
|
||||||
|
foreach ($files as $file) {
|
||||||
|
if ($recursive && is_dir(realpath($folder."/".$file))) {
|
||||||
|
self::loadFolder(realpath($folder."/".$file));
|
||||||
|
}
|
||||||
|
if (!preg_match('/php$/', $file)) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
require_once(realpath($folder.'/'.$file));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
abstract public static function requireLibrary();
|
||||||
|
|
||||||
|
}
|
@ -1,21 +1,22 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
namespace Tests\Icinga\Protocol\Statusdat;
|
namespace Tests\Icinga\Protocol\Statusdat;
|
||||||
require_once("Zend/Config.php");
|
require_once("Zend/Config.php");;
|
||||||
require_once("Zend/Log.php");
|
require_once("Zend/Log.php");;
|
||||||
|
|
||||||
require_once("../../library/Icinga/Protocol/Statusdat/IReader.php");
|
require_once(realpath("../../library/Icinga/Protocol/Statusdat/IReader.php"));;
|
||||||
require_once("../../library/Icinga/Protocol/Statusdat/Reader.php");
|
require_once(realpath("../../library/Icinga/Protocol/Statusdat/Reader.php"));;
|
||||||
require_once("../../library/Icinga/Protocol/Statusdat/Exception/ParsingException.php");
|
require_once(realpath("../../library/Icinga/Protocol/Statusdat/Exception/ParsingException.php"));;
|
||||||
require_once("../../library/Icinga/Exception/ProgrammingError.php");
|
require_once(realpath("../../library/Icinga/Exception/ProgrammingError.php"));;
|
||||||
require_once("../../library/Icinga/Protocol/Statusdat/Parser.php");
|
require_once(realpath("../../library/Icinga/Protocol/Statusdat/Parser.php"));;
|
||||||
require_once("../../library/Icinga/Protocol/AbstractQuery.php");
|
require_once(realpath("../../library/Icinga/Protocol/AbstractQuery.php"));;
|
||||||
require_once("../../library/Icinga/Protocol/Statusdat/Query.php");
|
require_once(realpath("../../library/Icinga/Data/AbstractQuery.php"));;
|
||||||
require_once("../../library/Icinga/Protocol/Statusdat/Query/IQueryPart.php");
|
require_once(realpath("../../library/Icinga/Protocol/Statusdat/Query.php"));;
|
||||||
require_once("../../library/Icinga/Protocol/Statusdat/Query/Group.php");
|
require_once(realpath("../../library/Icinga/Protocol/Statusdat/Query/IQueryPart.php"));;
|
||||||
require_once("../../library/Icinga/Protocol/Statusdat/Query/Expression.php");
|
require_once(realpath("../../library/Icinga/Protocol/Statusdat/Query/Group.php"));;
|
||||||
require_once("../../library/Icinga/Exception/ConfigurationError.php");
|
require_once(realpath("../../library/Icinga/Protocol/Statusdat/Query/Expression.php"));;
|
||||||
require_once("../../library/Icinga/Application/Logger.php");
|
require_once(realpath("../../library/Icinga/Exception/ConfigurationError.php"));;
|
||||||
|
require_once(realpath("../../library/Icinga/Application/Logger.php"));;
|
||||||
use \Icinga\Protocol\Statusdat as SD;
|
use \Icinga\Protocol\Statusdat as SD;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -1,9 +1,9 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
namespace Tests\Icinga\Protocol\Statusdat;
|
namespace Tests\Icinga\Protocol\Statusdat;
|
||||||
require_once("../../library/Icinga/Protocol/Statusdat/Exception/ParsingException.php");
|
require_once(realpath("../../library/Icinga/Protocol/Statusdat/Exception/ParsingException.php"));
|
||||||
require_once("../../library/Icinga/Exception/ProgrammingError.php");
|
require_once(realpath("../../library/Icinga/Exception/ProgrammingError.php"));
|
||||||
require_once("../../library/Icinga/Protocol/Statusdat/Parser.php");
|
require_once(realpath("../../library/Icinga/Protocol/Statusdat/Parser.php"));
|
||||||
use Icinga\Protocol\Statusdat\Parser;
|
use Icinga\Protocol\Statusdat\Parser;
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
|
@ -0,0 +1,32 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace Tests\Icinga\Protocol\Statusdat;
|
||||||
|
use Test\Icinga\LibraryLoader;
|
||||||
|
|
||||||
|
require_once(realpath(dirname(__FILE__)."/../../LibraryLoader.php"));
|
||||||
|
class StatusdatTestLoader extends LibraryLoader
|
||||||
|
{
|
||||||
|
public static function requireLibrary()
|
||||||
|
{
|
||||||
|
$libPath = LibraryLoader::getLibraryPath();
|
||||||
|
require_once($libPath."/Data/AbstractQuery.php");
|
||||||
|
require_once($libPath."/Data/DatasourceInterface.php");
|
||||||
|
$statusdat = realpath($libPath."/Protocol/Statusdat/");
|
||||||
|
|
||||||
|
require_once 'Zend/Config.php';
|
||||||
|
require_once 'Zend/Cache.php';
|
||||||
|
|
||||||
|
require_once($statusdat."/View/AbstractAccessorStrategy.php");
|
||||||
|
require_once($statusdat."/View/MonitoringObjectList.php");
|
||||||
|
require_once($statusdat."/View/ObjectRemappingView.php");
|
||||||
|
require_once($statusdat."/IReader.php");
|
||||||
|
require_once($statusdat."/RuntimeStateContainer.php");
|
||||||
|
require_once($statusdat."/Query.php");
|
||||||
|
require_once($statusdat."/Parser.php");
|
||||||
|
require_once($statusdat."/Reader.php");
|
||||||
|
require_once($statusdat."/Exception/ParsingException.php");
|
||||||
|
require_once($statusdat."/Query/IQueryPart.php");
|
||||||
|
require_once($statusdat."/Query/Expression.php");
|
||||||
|
require_once($statusdat."/Query/Group.php");
|
||||||
|
}
|
||||||
|
}
|
Loading…
x
Reference in New Issue
Block a user