From 22583aa08324f170f232193d7d9a053f9d92cd8d Mon Sep 17 00:00:00 2001 From: Thomas Gelf Date: Wed, 11 Jan 2017 14:04:45 +0100 Subject: [PATCH] BpConfig: renamed from BusinessProcess --- application/controllers/ProcessController.php | 14 ++++++------ application/forms/AddNodeForm.php | 8 +++---- application/forms/BpConfigForm.php | 6 ++--- application/forms/BpUploadForm.php | 8 +++---- application/forms/DeleteNodeForm.php | 8 +++---- application/forms/ProcessForm.php | 8 +++---- .../{BusinessProcess.php => BpConfig.php} | 4 ++-- library/Businessprocess/BpNode.php | 2 +- library/Businessprocess/HostNode.php | 2 +- library/Businessprocess/ImportedNode.php | 4 ++-- library/Businessprocess/Metadata.php | 1 + .../Modification/NodeAction.php | 10 ++++----- .../Modification/NodeAddChildrenAction.php | 6 ++--- .../Modification/NodeCreateAction.php | 6 ++--- .../Modification/NodeModifyAction.php | 6 ++--- .../Modification/NodeRemoveAction.php | 6 ++--- .../Modification/ProcessChanges.php | 6 ++--- library/Businessprocess/Node.php | 4 ++-- library/Businessprocess/Renderer/Renderer.php | 12 +++++----- .../Businessprocess/Renderer/TreeRenderer.php | 16 +++++++------- library/Businessprocess/ServiceNode.php | 2 +- library/Businessprocess/Simulation.php | 4 ++-- .../Businessprocess/State/MonitoringState.php | 10 ++++----- .../Storage/LegacyConfigParser.php | 22 +++++++++---------- .../Storage/LegacyConfigRenderer.php | 10 ++++----- .../Businessprocess/Storage/LegacyStorage.php | 4 ++-- library/Businessprocess/Storage/Storage.php | 8 +++---- library/Businessprocess/Test/BaseTestCase.php | 4 ++-- .../Component/RenderedProcessActionBar.php | 4 ++-- library/Businessprocess/Web/Controller.php | 4 ++-- .../library/Businessprocess/HostNodeTest.php | 6 ++--- .../Operators/AndOperatorTest.php | 16 +++++++------- .../Operators/MinOperatorTest.php | 6 ++--- .../Operators/NotOperatorTest.php | 6 ++--- .../Operators/OrOperatorTest.php | 6 ++--- .../Businessprocess/ServiceNodeTest.php | 4 ++-- .../Storage/LegacyStorageTest.php | 2 +- 37 files changed, 128 insertions(+), 127 deletions(-) rename library/Businessprocess/{BusinessProcess.php => BpConfig.php} (99%) diff --git a/application/controllers/ProcessController.php b/application/controllers/ProcessController.php index 1b5b50a..421b298 100644 --- a/application/controllers/ProcessController.php +++ b/application/controllers/ProcessController.php @@ -2,7 +2,7 @@ namespace Icinga\Module\Businessprocess\Controllers; -use Icinga\Module\Businessprocess\BusinessProcess; +use Icinga\Module\Businessprocess\BpConfig; use Icinga\Module\Businessprocess\State\MonitoringState; use Icinga\Module\Businessprocess\Storage\ConfigDiff; use Icinga\Module\Businessprocess\Html\Element; @@ -131,7 +131,7 @@ class ProcessController extends Controller } } - protected function getNode(BusinessProcess $bp) + protected function getNode(BpConfig $bp) { if ($nodeName = $this->params->get('node')) { return $bp->getNode($nodeName); @@ -158,7 +158,7 @@ class ProcessController extends Controller return $this->renderer; } - protected function getProcessTabs(BusinessProcess $bp, Renderer $renderer) + protected function getProcessTabs(BpConfig $bp, Renderer $renderer) { $tabs = $this->singleTab($bp->getTitle()); @@ -169,7 +169,7 @@ class ProcessController extends Controller return $tabs; } - protected function handleSimulations(BusinessProcess $bp) + protected function handleSimulations(BpConfig $bp) { $simulation = new Simulation($bp, $this->session()); @@ -187,7 +187,7 @@ class ProcessController extends Controller $bp->applySimulation($simulation); } - protected function loadActionForm(BusinessProcess $bp, Node $node = null) + protected function loadActionForm(BpConfig $bp, Node $node = null) { $action = $this->params->get('action'); $form = null; @@ -243,7 +243,7 @@ class ProcessController extends Controller } } - protected function showWarnings(BusinessProcess $bp) + protected function showWarnings(BpConfig $bp) { if ($bp->hasWarnings()) { $ul = Element::create('ul', array('class' => 'warning')); @@ -257,7 +257,7 @@ class ProcessController extends Controller } } - protected function showHints(BusinessProcess $bp) + protected function showHints(BpConfig $bp) { $ul = Element::create('ul', array('class' => 'error')); foreach ($bp->getErrors() as $error) { diff --git a/application/forms/AddNodeForm.php b/application/forms/AddNodeForm.php index 96606a0..4413421 100644 --- a/application/forms/AddNodeForm.php +++ b/application/forms/AddNodeForm.php @@ -3,7 +3,7 @@ namespace Icinga\Module\Businessprocess\Forms; use Icinga\Module\Businessprocess\BpNode; -use Icinga\Module\Businessprocess\BusinessProcess; +use Icinga\Module\Businessprocess\BpConfig; use Icinga\Module\Businessprocess\Modification\ProcessChanges; use Icinga\Module\Businessprocess\Web\Form\QuickForm; use Icinga\Module\Monitoring\Backend\MonitoringBackend; @@ -14,7 +14,7 @@ class AddNodeForm extends QuickForm /** @var MonitoringBackend */ protected $backend; - /** @var BusinessProcess */ + /** @var BpConfig */ protected $bp; /** @var BpNode */ @@ -234,10 +234,10 @@ class AddNodeForm extends QuickForm } /** - * @param BusinessProcess $process + * @param BpConfig $process * @return $this */ - public function setProcess(BusinessProcess $process) + public function setProcess(BpConfig $process) { $this->bp = $process; $this->setBackend($process->getBackend()); diff --git a/application/forms/BpConfigForm.php b/application/forms/BpConfigForm.php index 1f9e884..6c0f640 100644 --- a/application/forms/BpConfigForm.php +++ b/application/forms/BpConfigForm.php @@ -4,7 +4,7 @@ namespace Icinga\Module\Businessprocess\Forms; use Icinga\Application\Config; use Icinga\Authentication\Auth; -use Icinga\Module\Businessprocess\BusinessProcess; +use Icinga\Module\Businessprocess\BpConfig; use Icinga\Module\Businessprocess\Storage\Storage; use Icinga\Module\Businessprocess\Web\Form\QuickForm; @@ -15,7 +15,7 @@ class BpConfigForm extends QuickForm protected $backend; - /** @var BusinessProcess */ + /** @var BpConfig */ protected $config; protected $node; @@ -153,7 +153,7 @@ class BpConfigForm extends QuickForm if ($this->config === null) { // New config - $config = new BusinessProcess(); + $config = new BpConfig(); $config->setName($name); $config->getMetadata()->set('Owner', Auth::getInstance()->getUser()->getUsername()); $this->setSuccessUrl( diff --git a/application/forms/BpUploadForm.php b/application/forms/BpUploadForm.php index ee24582..54c39c4 100644 --- a/application/forms/BpUploadForm.php +++ b/application/forms/BpUploadForm.php @@ -3,7 +3,7 @@ namespace Icinga\Module\Businessprocess\Forms; use Icinga\Application\Config; -use Icinga\Module\Businessprocess\BusinessProcess; +use Icinga\Module\Businessprocess\BpConfig; use Icinga\Module\Businessprocess\Storage\LegacyStorage; use Icinga\Module\Businessprocess\Web\Form\QuickForm; use Icinga\Web\Notification; @@ -15,7 +15,7 @@ class BpUploadForm extends QuickForm protected $backend; - /** @var BusinessProcess */ + /** @var BpConfig */ protected $config; protected $node; @@ -133,7 +133,7 @@ class BpUploadForm extends QuickForm return $this; } - public function setProcessConfig(BusinessProcess $config) + public function setProcessConfig(BpConfig $config) { $this->config = $config; return $this; @@ -172,7 +172,7 @@ class BpUploadForm extends QuickForm if ($this->config === null) { // New config - $config = new BusinessProcess(); + $config = new BpConfig(); $config->setName($name); if ($title) { $config->setTitle($title); diff --git a/application/forms/DeleteNodeForm.php b/application/forms/DeleteNodeForm.php index b3f758a..d91f4d5 100644 --- a/application/forms/DeleteNodeForm.php +++ b/application/forms/DeleteNodeForm.php @@ -3,7 +3,7 @@ namespace Icinga\Module\Businessprocess\Forms; use Icinga\Module\Businessprocess\BpNode; -use Icinga\Module\Businessprocess\BusinessProcess; +use Icinga\Module\Businessprocess\BpConfig; use Icinga\Module\Businessprocess\Modification\ProcessChanges; use Icinga\Module\Businessprocess\Node; use Icinga\Module\Businessprocess\Web\Form\QuickForm; @@ -15,7 +15,7 @@ class DeleteNodeForm extends QuickForm /** @var MonitoringBackend */ protected $backend; - /** @var BusinessProcess */ + /** @var BpConfig */ protected $bp; /** @var Node */ @@ -89,10 +89,10 @@ class DeleteNodeForm extends QuickForm } /** - * @param BusinessProcess $process + * @param BpConfig $process * @return $this */ - public function setProcess(BusinessProcess $process) + public function setProcess(BpConfig $process) { $this->bp = $process; $this->setBackend($process->getBackend()); diff --git a/application/forms/ProcessForm.php b/application/forms/ProcessForm.php index d34ecfe..b3a5e7b 100644 --- a/application/forms/ProcessForm.php +++ b/application/forms/ProcessForm.php @@ -3,7 +3,7 @@ namespace Icinga\Module\Businessprocess\Forms; use Icinga\Module\Businessprocess\BpNode; -use Icinga\Module\Businessprocess\BusinessProcess; +use Icinga\Module\Businessprocess\BpConfig; use Icinga\Module\Businessprocess\Modification\ProcessChanges; use Icinga\Module\Businessprocess\Web\Form\QuickForm; use Icinga\Module\Monitoring\Backend\MonitoringBackend; @@ -15,7 +15,7 @@ class ProcessForm extends QuickForm /** @var MonitoringBackend */ protected $backend; - /** @var BusinessProcess */ + /** @var BpConfig */ protected $bp; /** @var BpNode */ @@ -115,10 +115,10 @@ class ProcessForm extends QuickForm } /** - * @param BusinessProcess $process + * @param BpConfig $process * @return $this */ - public function setProcess(BusinessProcess $process) + public function setProcess(BpConfig $process) { $this->bp = $process; $this->setBackend($process->getBackend()); diff --git a/library/Businessprocess/BusinessProcess.php b/library/Businessprocess/BpConfig.php similarity index 99% rename from library/Businessprocess/BusinessProcess.php rename to library/Businessprocess/BpConfig.php index bd2fa09..767e820 100644 --- a/library/Businessprocess/BusinessProcess.php +++ b/library/Businessprocess/BpConfig.php @@ -9,7 +9,7 @@ use Icinga\Module\Businessprocess\Modification\ProcessChanges; use Icinga\Module\Monitoring\Backend\MonitoringBackend; use Exception; -class BusinessProcess +class BpConfig { const SOFT_STATE = 0; @@ -476,7 +476,7 @@ class BusinessProcess $host = substr($name, 0, $pos); $service = substr($name, $pos + 1); // TODO: deactivated, this scares me, test it - if (false && $service === 'Hoststatus') { + if ($service === 'Hoststatus') { return $this->createHost($host); } else { return $this->createService($host, $service); diff --git a/library/Businessprocess/BpNode.php b/library/Businessprocess/BpNode.php index 7f1c5d0..efa8999 100644 --- a/library/Businessprocess/BpNode.php +++ b/library/Businessprocess/BpNode.php @@ -47,7 +47,7 @@ class BpNode extends Node protected $className = 'process'; - public function __construct(BusinessProcess $bp, $object) + public function __construct(BpConfig $bp, $object) { $this->bp = $bp; $this->name = $object->name; diff --git a/library/Businessprocess/HostNode.php b/library/Businessprocess/HostNode.php index b40e0f3..2e273c3 100644 --- a/library/Businessprocess/HostNode.php +++ b/library/Businessprocess/HostNode.php @@ -32,7 +32,7 @@ class HostNode extends MonitoredNode protected $className = 'host'; - public function __construct(BusinessProcess $bp, $object) + public function __construct(BpConfig $bp, $object) { $this->name = $object->hostname . ';Hoststatus'; $this->hostname = $object->hostname; diff --git a/library/Businessprocess/ImportedNode.php b/library/Businessprocess/ImportedNode.php index c41c272..e21a169 100644 --- a/library/Businessprocess/ImportedNode.php +++ b/library/Businessprocess/ImportedNode.php @@ -21,13 +21,13 @@ class ImportedNode extends Node protected $className = 'subtree'; - /** @var BusinessProcess */ + /** @var BpConfig */ protected $config; /** * @inheritdoc */ - public function __construct(BusinessProcess $bp, $object) + public function __construct(BpConfig $bp, $object) { $this->bp = $bp; $this->configName = $object->configName; diff --git a/library/Businessprocess/Metadata.php b/library/Businessprocess/Metadata.php index cfa9525..925c29d 100644 --- a/library/Businessprocess/Metadata.php +++ b/library/Businessprocess/Metadata.php @@ -9,6 +9,7 @@ use Icinga\User; class Metadata { + /** @var string Configuration name */ protected $name; protected $properties = array( diff --git a/library/Businessprocess/Modification/NodeAction.php b/library/Businessprocess/Modification/NodeAction.php index c895145..fc7ff00 100644 --- a/library/Businessprocess/Modification/NodeAction.php +++ b/library/Businessprocess/Modification/NodeAction.php @@ -2,7 +2,7 @@ namespace Icinga\Module\Businessprocess\Modification; -use Icinga\Module\Businessprocess\BusinessProcess; +use Icinga\Module\Businessprocess\BpConfig; use Icinga\Module\Businessprocess\Node; use Icinga\Exception\ProgrammingError; @@ -42,18 +42,18 @@ abstract class NodeAction /** * Every NodeAction must be able to apply itself to a BusinessProcess * - * @param BusinessProcess $bp + * @param BpConfig $bp * @return mixed */ - abstract public function applyTo(BusinessProcess $bp); + abstract public function applyTo(BpConfig $bp); /** * Every NodeAction must be able to tell whether it could be applied to a BusinessProcess * - * @param BusinessProcess $bp + * @param BpConfig $bp * @return bool */ - abstract public function appliesTo(BusinessProcess $bp); + abstract public function appliesTo(BpConfig $bp); /** * The name of the node this modification applies to diff --git a/library/Businessprocess/Modification/NodeAddChildrenAction.php b/library/Businessprocess/Modification/NodeAddChildrenAction.php index fdc70a4..c6e0444 100644 --- a/library/Businessprocess/Modification/NodeAddChildrenAction.php +++ b/library/Businessprocess/Modification/NodeAddChildrenAction.php @@ -3,7 +3,7 @@ namespace Icinga\Module\Businessprocess\Modification; use Icinga\Module\Businessprocess\BpNode; -use Icinga\Module\Businessprocess\BusinessProcess; +use Icinga\Module\Businessprocess\BpConfig; class NodeAddChildrenAction extends NodeAction { @@ -14,7 +14,7 @@ class NodeAddChildrenAction extends NodeAction /** * @inheritdoc */ - public function appliesTo(BusinessProcess $bp) + public function appliesTo(BpConfig $bp) { $name = $this->getNodeName(); @@ -28,7 +28,7 @@ class NodeAddChildrenAction extends NodeAction /** * @inheritdoc */ - public function applyTo(BusinessProcess $bp) + public function applyTo(BpConfig $bp) { /** @var BpNode $node */ if (! $this->hasNode()) { diff --git a/library/Businessprocess/Modification/NodeCreateAction.php b/library/Businessprocess/Modification/NodeCreateAction.php index 04ab474..ce4bdb1 100644 --- a/library/Businessprocess/Modification/NodeCreateAction.php +++ b/library/Businessprocess/Modification/NodeCreateAction.php @@ -2,7 +2,7 @@ namespace Icinga\Module\Businessprocess\Modification; -use Icinga\Module\Businessprocess\BusinessProcess; +use Icinga\Module\Businessprocess\BpConfig; use Icinga\Module\Businessprocess\BpNode; use Icinga\Module\Businessprocess\Node; @@ -70,7 +70,7 @@ class NodeCreateAction extends NodeAction /** * @inheritdoc */ - public function appliesTo(BusinessProcess $bp) + public function appliesTo(BpConfig $bp) { return ! $bp->hasNode($this->getNodeName()); } @@ -78,7 +78,7 @@ class NodeCreateAction extends NodeAction /** * @inheritdoc */ - public function applyTo(BusinessProcess $bp) + public function applyTo(BpConfig $bp) { $name = $this->getNodeName(); diff --git a/library/Businessprocess/Modification/NodeModifyAction.php b/library/Businessprocess/Modification/NodeModifyAction.php index 4e62c98..ff15856 100644 --- a/library/Businessprocess/Modification/NodeModifyAction.php +++ b/library/Businessprocess/Modification/NodeModifyAction.php @@ -2,7 +2,7 @@ namespace Icinga\Module\Businessprocess\Modification; -use Icinga\Module\Businessprocess\BusinessProcess; +use Icinga\Module\Businessprocess\BpConfig; use Icinga\Module\Businessprocess\Node; class NodeModifyAction extends NodeAction @@ -43,7 +43,7 @@ class NodeModifyAction extends NodeAction /** * @inheritdoc */ - public function appliesTo(BusinessProcess $bp) + public function appliesTo(BpConfig $bp) { $name = $this->getNodeName(); @@ -66,7 +66,7 @@ class NodeModifyAction extends NodeAction /** * @inheritdoc */ - public function applyTo(BusinessProcess $bp) + public function applyTo(BpConfig $bp) { $node = $bp->getNode($this->getNodeName()); diff --git a/library/Businessprocess/Modification/NodeRemoveAction.php b/library/Businessprocess/Modification/NodeRemoveAction.php index a8a27b1..0f9ffe3 100644 --- a/library/Businessprocess/Modification/NodeRemoveAction.php +++ b/library/Businessprocess/Modification/NodeRemoveAction.php @@ -2,7 +2,7 @@ namespace Icinga\Module\Businessprocess\Modification; -use Icinga\Module\Businessprocess\BusinessProcess; +use Icinga\Module\Businessprocess\BpConfig; /** * NodeRemoveAction @@ -38,7 +38,7 @@ class NodeRemoveAction extends NodeAction /** * @inheritdoc */ - public function appliesTo(BusinessProcess $bp) + public function appliesTo(BpConfig $bp) { $parent = $this->getParentName(); if ($parent === null) { @@ -51,7 +51,7 @@ class NodeRemoveAction extends NodeAction /** * @inheritdoc */ - public function applyTo(BusinessProcess $bp) + public function applyTo(BpConfig $bp) { $parent = $this->getParentName(); if ($parent === null) { diff --git a/library/Businessprocess/Modification/ProcessChanges.php b/library/Businessprocess/Modification/ProcessChanges.php index 0720460..b4ffbde 100644 --- a/library/Businessprocess/Modification/ProcessChanges.php +++ b/library/Businessprocess/Modification/ProcessChanges.php @@ -2,7 +2,7 @@ namespace Icinga\Module\Businessprocess\Modification; -use Icinga\Module\Businessprocess\BusinessProcess; +use Icinga\Module\Businessprocess\BpConfig; use Icinga\Module\Businessprocess\Node; use Icinga\Web\Session\SessionNamespace as Session; @@ -30,12 +30,12 @@ class ProcessChanges } /** - * @param BusinessProcess $bp + * @param BpConfig $bp * @param Session $session * * @return ProcessChanges */ - public static function construct(BusinessProcess $bp, Session $session) + public static function construct(BpConfig $bp, Session $session) { $key = 'changes.' . $bp->getName(); $changes = new ProcessChanges(); diff --git a/library/Businessprocess/Node.php b/library/Businessprocess/Node.php index 8af2d1b..f8a41f6 100644 --- a/library/Businessprocess/Node.php +++ b/library/Businessprocess/Node.php @@ -41,7 +41,7 @@ abstract class Node /** * Main business process object * - * @var BusinessProcess + * @var BpConfig */ protected $bp; @@ -102,7 +102,7 @@ abstract class Node 99 => 'PENDING' ); - abstract public function __construct(BusinessProcess $bp, $object); + abstract public function __construct(BpConfig $bp, $object); public function setMissing($missing = true) { diff --git a/library/Businessprocess/Renderer/Renderer.php b/library/Businessprocess/Renderer/Renderer.php index 655a108..1659c71 100644 --- a/library/Businessprocess/Renderer/Renderer.php +++ b/library/Businessprocess/Renderer/Renderer.php @@ -5,7 +5,7 @@ namespace Icinga\Module\Businessprocess\Renderer; use Icinga\Date\DateFormatter; use Icinga\Exception\ProgrammingError; use Icinga\Module\Businessprocess\BpNode; -use Icinga\Module\Businessprocess\BusinessProcess; +use Icinga\Module\Businessprocess\BpConfig; use Icinga\Module\Businessprocess\Html\Container; use Icinga\Module\Businessprocess\Html\Element; use Icinga\Module\Businessprocess\Html\Html; @@ -15,7 +15,7 @@ use Icinga\Module\Businessprocess\Web\Url; abstract class Renderer extends Html { - /** @var BusinessProcess */ + /** @var BpConfig */ protected $bp; /** @var BpNode */ @@ -39,17 +39,17 @@ abstract class Renderer extends Html /** * Renderer constructor. * - * @param BusinessProcess $bp + * @param BpConfig $bp * @param BpNode|null $parent */ - public function __construct(BusinessProcess $bp, BpNode $parent = null) + public function __construct(BpConfig $bp, BpNode $parent = null) { $this->bp = $bp; $this->parent = $parent; } /** - * @return BusinessProcess + * @return BpConfig */ public function getBusinessProcess() { @@ -299,7 +299,7 @@ abstract class Renderer extends Html )->setContent(DateFormatter::timeSince($time, $timeOnly)); } - protected function createUnboundParent(BusinessProcess $bp) + protected function createUnboundParent(BpConfig $bp) { $unbound = $bp->getUnboundNodes(); diff --git a/library/Businessprocess/Renderer/TreeRenderer.php b/library/Businessprocess/Renderer/TreeRenderer.php index b213e48..2b1ef26 100644 --- a/library/Businessprocess/Renderer/TreeRenderer.php +++ b/library/Businessprocess/Renderer/TreeRenderer.php @@ -3,7 +3,7 @@ namespace Icinga\Module\Businessprocess\Renderer; use Icinga\Module\Businessprocess\BpNode; -use Icinga\Module\Businessprocess\BusinessProcess; +use Icinga\Module\Businessprocess\BpConfig; use Icinga\Module\Businessprocess\Html\Container; use Icinga\Module\Businessprocess\Html\Element; use Icinga\Module\Businessprocess\Html\Icon; @@ -31,10 +31,10 @@ class TreeRenderer extends Renderer } /** - * @param BusinessProcess $bp + * @param BpConfig $bp * @return string */ - public function renderBp(BusinessProcess $bp) + public function renderBp(BpConfig $bp) { $html = array(); if ($this->wantsRootNodes()) { @@ -94,13 +94,13 @@ class TreeRenderer extends Renderer } /** - * @param BusinessProcess $bp + * @param BpConfig $bp * @param Node $node * @param array $path * * @return string */ - public function renderNode(BusinessProcess $bp, Node $node, $path = array()) + public function renderNode(BpConfig $bp, Node $node, $path = array()) { $table = Element::create( 'table', @@ -179,7 +179,7 @@ class TreeRenderer extends Renderer return $table; } - protected function getActionIcons(BusinessProcess $bp, Node $node) + protected function getActionIcons(BpConfig $bp, Node $node) { if ($node instanceof BpNode) { return $this->createEditAction($bp, $node); @@ -188,7 +188,7 @@ class TreeRenderer extends Renderer } } - protected function createEditAction(BusinessProcess $bp, BpNode $node) + protected function createEditAction(BpConfig $bp, BpNode $node) { return $this->actionIcon( 'wrench', @@ -200,7 +200,7 @@ class TreeRenderer extends Renderer ); } - protected function createSimulationAction(BusinessProcess $bp, Node $node) + protected function createSimulationAction(BpConfig $bp, Node $node) { return $this->actionIcon( 'magic', diff --git a/library/Businessprocess/ServiceNode.php b/library/Businessprocess/ServiceNode.php index 2a582e7..b827835 100644 --- a/library/Businessprocess/ServiceNode.php +++ b/library/Businessprocess/ServiceNode.php @@ -12,7 +12,7 @@ class ServiceNode extends MonitoredNode protected $className = 'service'; - public function __construct(BusinessProcess $bp, $object) + public function __construct(BpConfig $bp, $object) { $this->name = $object->hostname . ';' . $object->service; $this->hostname = $object->hostname; diff --git a/library/Businessprocess/Simulation.php b/library/Businessprocess/Simulation.php index 2d47470..ede70d2 100644 --- a/library/Businessprocess/Simulation.php +++ b/library/Businessprocess/Simulation.php @@ -13,7 +13,7 @@ class Simulation protected $session; /** - * @var BusinessProcess + * @var BpConfig */ protected $bp; @@ -27,7 +27,7 @@ class Simulation */ protected $simulations; - public function __construct(BusinessProcess $bp, SessionNamespace $session) + public function __construct(BpConfig $bp, SessionNamespace $session) { $this->bp = $bp; $this->session = $session; diff --git a/library/Businessprocess/State/MonitoringState.php b/library/Businessprocess/State/MonitoringState.php index e0e5d1b..68284d3 100644 --- a/library/Businessprocess/State/MonitoringState.php +++ b/library/Businessprocess/State/MonitoringState.php @@ -5,24 +5,24 @@ namespace Icinga\Module\Businessprocess\State; use Exception; use Icinga\Application\Benchmark; use Icinga\Data\Filter\Filter; -use Icinga\Module\Businessprocess\BusinessProcess; +use Icinga\Module\Businessprocess\BpConfig; use Icinga\Module\Monitoring\Backend\MonitoringBackend; class MonitoringState { - /** @var BusinessProcess */ + /** @var BpConfig */ protected $config; /** @var MonitoringBackend */ protected $backend; - private function __construct(BusinessProcess $config) + private function __construct(BpConfig $config) { $this->config = $config; $this->backend = $config->getBackend(); } - public static function apply(BusinessProcess $config) + public static function apply(BpConfig $config) { $self = new static($config); $self->retrieveStatesFromBackend(); @@ -101,7 +101,7 @@ class MonitoringState return $this; } - protected function handleDbRow($row, BusinessProcess $config) + protected function handleDbRow($row, BpConfig $config) { $key = $row->hostname; if (property_exists($row, 'service')) { diff --git a/library/Businessprocess/Storage/LegacyConfigParser.php b/library/Businessprocess/Storage/LegacyConfigParser.php index a8756f7..c49b627 100644 --- a/library/Businessprocess/Storage/LegacyConfigParser.php +++ b/library/Businessprocess/Storage/LegacyConfigParser.php @@ -6,7 +6,7 @@ use Icinga\Application\Benchmark; use Icinga\Exception\ConfigurationError; use Icinga\Exception\SystemPermissionException; use Icinga\Module\Businessprocess\BpNode; -use Icinga\Module\Businessprocess\BusinessProcess; +use Icinga\Module\Businessprocess\BpConfig; use Icinga\Module\Businessprocess\Metadata; class LegacyConfigParser @@ -19,7 +19,7 @@ class LegacyConfigParser protected $name; - /** @var BusinessProcess */ + /** @var BpConfig */ protected $config; /** @@ -30,12 +30,12 @@ class LegacyConfigParser private function __construct($name) { $this->name = $name; - $this->config = new BusinessProcess(); + $this->config = new BpConfig(); $this->config->setName($name); } /** - * @return BusinessProcess + * @return BpConfig */ public function getParsedConfig() { @@ -147,9 +147,9 @@ class LegacyConfigParser /** * @param $line - * @param BusinessProcess $bp + * @param BpConfig $bp */ - protected function parseDisplay(& $line, BusinessProcess $bp) + protected function parseDisplay(& $line, BpConfig $bp) { list($display, $name, $desc) = preg_split('~\s*;\s*~', substr($line, 8), 3); $bp->getBpNode($name)->setAlias($desc)->setDisplay($display); @@ -160,28 +160,28 @@ class LegacyConfigParser /** * @param $line - * @param BusinessProcess $bp + * @param BpConfig $bp */ - protected function parseExternalInfo(& $line, BusinessProcess $bp) + protected function parseExternalInfo(& $line, BpConfig $bp) { list($name, $script) = preg_split('~\s*;\s*~', substr($line, 14), 2); $bp->getBpNode($name)->setInfoCommand($script); } - protected function parseExtraInfo(& $line, BusinessProcess $bp) + protected function parseExtraInfo(& $line, BpConfig $bp) { // TODO: Not yet // list($name, $script) = preg_split('~\s*;\s*~', substr($line, 14), 2); // $this->getNode($name)->setExtraInfo($script); } - protected function parseInfoUrl(& $line, BusinessProcess $bp) + protected function parseInfoUrl(& $line, BpConfig $bp) { list($name, $url) = preg_split('~\s*;\s*~', substr($line, 9), 2); $bp->getBpNode($name)->setInfoUrl($url); } - protected function parseExtraLine(& $line, $typeLength, BusinessProcess $bp) + protected function parseExtraLine(& $line, $typeLength, BpConfig $bp) { $type = substr($line, 0, $typeLength); if (substr($type, 0, 7) === 'display') { diff --git a/library/Businessprocess/Storage/LegacyConfigRenderer.php b/library/Businessprocess/Storage/LegacyConfigRenderer.php index 0f08b2f..4bb7e18 100644 --- a/library/Businessprocess/Storage/LegacyConfigRenderer.php +++ b/library/Businessprocess/Storage/LegacyConfigRenderer.php @@ -3,7 +3,7 @@ namespace Icinga\Module\Businessprocess\Storage; use Icinga\Module\Businessprocess\BpNode; -use Icinga\Module\Businessprocess\BusinessProcess; +use Icinga\Module\Businessprocess\BpConfig; class LegacyConfigRenderer { @@ -13,9 +13,9 @@ class LegacyConfigRenderer /** * LecagyConfigRenderer constructor * - * @param BusinessProcess $config + * @param BpConfig $config */ - public function __construct(BusinessProcess $config) + public function __construct(BpConfig $config) { $this->config = $config; } @@ -29,10 +29,10 @@ class LegacyConfigRenderer } /** - * @param BusinessProcess $config + * @param BpConfig $config * @return mixed */ - public static function renderConfig(BusinessProcess $config) + public static function renderConfig(BpConfig $config) { $renderer = new static($config); return $renderer->render(); diff --git a/library/Businessprocess/Storage/LegacyStorage.php b/library/Businessprocess/Storage/LegacyStorage.php index 1f232eb..2c65347 100644 --- a/library/Businessprocess/Storage/LegacyStorage.php +++ b/library/Businessprocess/Storage/LegacyStorage.php @@ -4,7 +4,7 @@ namespace Icinga\Module\Businessprocess\Storage; use DirectoryIterator; use Icinga\Application\Icinga; -use Icinga\Module\Businessprocess\BusinessProcess; +use Icinga\Module\Businessprocess\BpConfig; use Icinga\Exception\SystemPermissionException; class LegacyStorage extends Storage @@ -125,7 +125,7 @@ class LegacyStorage extends Storage /** * @inheritdoc */ - public function storeProcess(BusinessProcess $process) + public function storeProcess(BpConfig $process) { file_put_contents( $this->getFilename($process->getName()), diff --git a/library/Businessprocess/Storage/Storage.php b/library/Businessprocess/Storage/Storage.php index 516a22c..de3d939 100644 --- a/library/Businessprocess/Storage/Storage.php +++ b/library/Businessprocess/Storage/Storage.php @@ -3,7 +3,7 @@ namespace Icinga\Module\Businessprocess\Storage; use Icinga\Data\ConfigObject; -use Icinga\Module\Businessprocess\BusinessProcess; +use Icinga\Module\Businessprocess\BpConfig; use Icinga\Module\Businessprocess\Metadata; abstract class Storage @@ -65,18 +65,18 @@ abstract class Storage /** * @param $name - * @return BusinessProcess + * @return BpConfig */ abstract public function loadProcess($name); /** * Store eventual changes applied to the given configuration * - * @param BusinessProcess $config + * @param BpConfig $config * * @return mixed */ - abstract public function storeProcess(BusinessProcess $config); + abstract public function storeProcess(BpConfig $config); /** * @param $name diff --git a/library/Businessprocess/Test/BaseTestCase.php b/library/Businessprocess/Test/BaseTestCase.php index 2113494..807905d 100644 --- a/library/Businessprocess/Test/BaseTestCase.php +++ b/library/Businessprocess/Test/BaseTestCase.php @@ -5,7 +5,7 @@ namespace Icinga\Module\Businessprocess\Test; use Icinga\Application\Config; use Icinga\Application\ApplicationBootstrap; use Icinga\Application\Icinga; -use Icinga\Module\Businessprocess\BusinessProcess; +use Icinga\Module\Businessprocess\BpConfig; use Icinga\Module\Businessprocess\Storage\LegacyStorage; use Icinga\Module\Businessprocess\Web\FakeRequest; use PHPUnit_Framework_TestCase; @@ -30,7 +30,7 @@ abstract class BaseTestCase extends PHPUnit_Framework_TestCase } /*** - * @return BusinessProcess + * @return BpConfig */ protected function makeLoop() { diff --git a/library/Businessprocess/Web/Component/RenderedProcessActionBar.php b/library/Businessprocess/Web/Component/RenderedProcessActionBar.php index 3d67e62..9bb5ad3 100644 --- a/library/Businessprocess/Web/Component/RenderedProcessActionBar.php +++ b/library/Businessprocess/Web/Component/RenderedProcessActionBar.php @@ -3,7 +3,7 @@ namespace Icinga\Module\Businessprocess\Web\Component; use Icinga\Authentication\Auth; -use Icinga\Module\Businessprocess\BusinessProcess; +use Icinga\Module\Businessprocess\BpConfig; use Icinga\Module\Businessprocess\Html\BaseElement; use Icinga\Module\Businessprocess\Html\Link; use Icinga\Module\Businessprocess\Renderer\Renderer; @@ -12,7 +12,7 @@ use Icinga\Module\Businessprocess\Web\Url; class RenderedProcessActionBar extends ActionBar { - public function __construct(BusinessProcess $config, Renderer $renderer, Auth $auth, Url $url) + public function __construct(BpConfig $config, Renderer $renderer, Auth $auth, Url $url) { $meta = $config->getMetadata(); diff --git a/library/Businessprocess/Web/Controller.php b/library/Businessprocess/Web/Controller.php index 7748d7f..3f82512 100644 --- a/library/Businessprocess/Web/Controller.php +++ b/library/Businessprocess/Web/Controller.php @@ -3,7 +3,7 @@ namespace Icinga\Module\Businessprocess\Web; use Icinga\Application\Icinga; -use Icinga\Module\Businessprocess\BusinessProcess; +use Icinga\Module\Businessprocess\BpConfig; use Icinga\Module\Businessprocess\Html\HtmlTag; use Icinga\Module\Businessprocess\Modification\ProcessChanges; use Icinga\Module\Businessprocess\Storage\LegacyStorage; @@ -22,7 +22,7 @@ class Controller extends ModuleController /** @var View */ public $view; - /** @var BusinessProcess */ + /** @var BpConfig */ protected $bp; /** @var Tabs */ diff --git a/test/php/library/Businessprocess/HostNodeTest.php b/test/php/library/Businessprocess/HostNodeTest.php index f8c6cd9..2214f67 100644 --- a/test/php/library/Businessprocess/HostNodeTest.php +++ b/test/php/library/Businessprocess/HostNodeTest.php @@ -2,7 +2,7 @@ namespace Tests\Icinga\Module\Businessprocess; -use Icinga\Module\Businessprocess\BusinessProcess; +use Icinga\Module\Businessprocess\BpConfig; use Icinga\Module\Businessprocess\HostNode; use Icinga\Module\Businessprocess\Test\BaseTestCase; @@ -46,7 +46,7 @@ class HostNodeTest extends BaseTestCase */ public function testWhetherSettingAnInvalidStateFails() { - $bp = new BusinessProcess(); + $bp = new BpConfig(); $host = $bp->createHost('localhost')->setState(98); $bp->createBp('p')->addChild($host)->getState(); } @@ -56,7 +56,7 @@ class HostNodeTest extends BaseTestCase */ protected function localhost() { - $bp = new BusinessProcess(); + $bp = new BpConfig(); return new HostNode($bp, (object) array( 'hostname' => 'localhost', 'state' => 0, diff --git a/test/php/library/Businessprocess/Operators/AndOperatorTest.php b/test/php/library/Businessprocess/Operators/AndOperatorTest.php index 8e88c39..c9b3047 100644 --- a/test/php/library/Businessprocess/Operators/AndOperatorTest.php +++ b/test/php/library/Businessprocess/Operators/AndOperatorTest.php @@ -2,7 +2,7 @@ namespace Tests\Icinga\Module\Businessprocess\Operator; -use Icinga\Module\Businessprocess\BusinessProcess; +use Icinga\Module\Businessprocess\BpConfig; use Icinga\Module\Businessprocess\Test\BaseTestCase; use Icinga\Module\Businessprocess\Storage\LegacyStorage; @@ -18,7 +18,7 @@ class AndOperatorTest extends BaseTestCase foreach ($expressions as $expression) { $this->assertInstanceOf( - 'Icinga\\Module\\Businessprocess\\Businessprocess', + 'Icinga\\Module\\Businessprocess\\BpConfig', $storage->loadFromString('dummy', $expression) ); } @@ -104,7 +104,7 @@ class AndOperatorTest extends BaseTestCase public function testWhetherSimpleAndOperationWorks() { - $bp = new BusinessProcess(); + $bp = new BpConfig(); $bp->throwErrors(); $host = $bp->createHost('localhost')->setState(1); $service = $bp->createService('localhost', 'ping')->setState(1); @@ -130,7 +130,7 @@ class AndOperatorTest extends BaseTestCase public function testWhetherSimpleOrOperationWorks() { - $bp = new BusinessProcess(); + $bp = new BpConfig(); $bp->throwErrors(); $host = $bp->createHost('localhost')->setState(1); $service = $bp->createService('localhost', 'ping')->setState(1); @@ -145,7 +145,7 @@ class AndOperatorTest extends BaseTestCase public function testWhetherPendingIsAccepted() { - $bp = new BusinessProcess(); + $bp = new BpConfig(); $host = $bp->createHost('localhost')->setState(99); $service = $bp->createService('localhost', 'ping')->setState(99); $p = $bp->createBp('p') @@ -160,7 +160,7 @@ class AndOperatorTest extends BaseTestCase public function testWhetherWarningIsWorseThanPending() { - $bp = new BusinessProcess(); + $bp = new BpConfig(); $host = $bp->createHost('localhost')->setState(99); $service = $bp->createService('localhost', 'ping')->setState(1); $p = $bp->createBp('p') @@ -175,7 +175,7 @@ class AndOperatorTest extends BaseTestCase public function testWhetherPendingIsWorseThanUpOrOk() { - $bp = new BusinessProcess(); + $bp = new BpConfig(); $host = $bp->createHost('localhost')->setState(99); $service = $bp->createService('localhost', 'ping')->setState(0); $p = $bp->createBp('p') @@ -198,7 +198,7 @@ class AndOperatorTest extends BaseTestCase } /** - * @return BusinessProcess + * @return BpConfig */ protected function getBp() { diff --git a/test/php/library/Businessprocess/Operators/MinOperatorTest.php b/test/php/library/Businessprocess/Operators/MinOperatorTest.php index 43126dd..713c478 100644 --- a/test/php/library/Businessprocess/Operators/MinOperatorTest.php +++ b/test/php/library/Businessprocess/Operators/MinOperatorTest.php @@ -2,7 +2,7 @@ namespace Tests\Icinga\Module\Businessprocess\Operator; -use Icinga\Module\Businessprocess\BusinessProcess; +use Icinga\Module\Businessprocess\BpConfig; use Icinga\Module\Businessprocess\Test\BaseTestCase; use Icinga\Module\Businessprocess\Storage\LegacyStorage; @@ -18,7 +18,7 @@ class MinOperatorTest extends BaseTestCase $this->getName(); foreach ($expressions as $expression) { $this->assertInstanceOf( - 'Icinga\\Module\\Businessprocess\\Businessprocess', + 'Icinga\\Module\\Businessprocess\\BpConfig', $storage->loadFromString('dummy', $expression) ); } @@ -102,7 +102,7 @@ class MinOperatorTest extends BaseTestCase } /** - * @return BusinessProcess + * @return BpConfig */ protected function getBp() { diff --git a/test/php/library/Businessprocess/Operators/NotOperatorTest.php b/test/php/library/Businessprocess/Operators/NotOperatorTest.php index 9711b1e..dad8042 100644 --- a/test/php/library/Businessprocess/Operators/NotOperatorTest.php +++ b/test/php/library/Businessprocess/Operators/NotOperatorTest.php @@ -2,7 +2,7 @@ namespace Tests\Icinga\Module\Businessprocess\Operator; -use Icinga\Module\Businessprocess\BusinessProcess; +use Icinga\Module\Businessprocess\BpConfig; use Icinga\Module\Businessprocess\Test\BaseTestCase; use Icinga\Module\Businessprocess\Storage\LegacyStorage; @@ -20,7 +20,7 @@ class NotOperatorTest extends BaseTestCase foreach ($expressions as $expression) { $this->assertInstanceOf( - 'Icinga\\Module\\Businessprocess\\Businessprocess', + 'Icinga\\Module\\Businessprocess\\BpConfig', $storage->loadFromString('dummy', $expression) ); } @@ -138,7 +138,7 @@ class NotOperatorTest extends BaseTestCase } /** - * @return BusinessProcess + * @return BpConfig */ protected function getBp() { diff --git a/test/php/library/Businessprocess/Operators/OrOperatorTest.php b/test/php/library/Businessprocess/Operators/OrOperatorTest.php index ac2f5f3..a9f5b1a 100644 --- a/test/php/library/Businessprocess/Operators/OrOperatorTest.php +++ b/test/php/library/Businessprocess/Operators/OrOperatorTest.php @@ -2,7 +2,7 @@ namespace Tests\Icinga\Module\Businessprocess\Operator; -use Icinga\Module\Businessprocess\BusinessProcess; +use Icinga\Module\Businessprocess\BpConfig; use Icinga\Module\Businessprocess\Test\BaseTestCase; use Icinga\Module\Businessprocess\Storage\LegacyStorage; @@ -18,7 +18,7 @@ class OrOperatorTest extends BaseTestCase foreach ($expressions as $expression) { $this->assertInstanceOf( - 'Icinga\\Module\\Businessprocess\\Businessprocess', + 'Icinga\\Module\\Businessprocess\\BpConfig', $storage->loadFromString('dummy', $expression) ); } @@ -103,7 +103,7 @@ class OrOperatorTest extends BaseTestCase } /** - * @return BusinessProcess + * @return BpConfig */ protected function getBp() { diff --git a/test/php/library/Businessprocess/ServiceNodeTest.php b/test/php/library/Businessprocess/ServiceNodeTest.php index 6389ff3..152c256 100644 --- a/test/php/library/Businessprocess/ServiceNodeTest.php +++ b/test/php/library/Businessprocess/ServiceNodeTest.php @@ -2,7 +2,7 @@ namespace Tests\Icinga\Module\Businessprocess; -use Icinga\Module\Businessprocess\BusinessProcess; +use Icinga\Module\Businessprocess\BpConfig; use Icinga\Module\Businessprocess\ServiceNode; use Icinga\Module\Businessprocess\Test\BaseTestCase; @@ -46,7 +46,7 @@ class ServiceNodeTest extends BaseTestCase */ protected function pingOnLocalhost() { - $bp = new BusinessProcess(); + $bp = new BpConfig(); return new ServiceNode($bp, (object) array( 'hostname' => 'localhost', 'service' => 'ping <> pong', diff --git a/test/php/library/Businessprocess/Storage/LegacyStorageTest.php b/test/php/library/Businessprocess/Storage/LegacyStorageTest.php index 4c5425a..038261d 100644 --- a/test/php/library/Businessprocess/Storage/LegacyStorageTest.php +++ b/test/php/library/Businessprocess/Storage/LegacyStorageTest.php @@ -7,7 +7,7 @@ use Icinga\Module\Businessprocess\Storage\LegacyStorage; class LegacyStorageTest extends BaseTestCase { - private $processClass = 'Icinga\\Module\\Businessprocess\\BusinessProcess'; + private $processClass = 'Icinga\\Module\\Businessprocess\\BpConfig'; public function testCanBeInstantiatedWithAnEmptyConfigSection() {