Merge branch 'master' into feature/setup-wizard-7163

Conflicts:
	library/Icinga/Authentication/Backend/LdapUserBackend.php
	library/Icinga/File/Ini/IniWriter.php
This commit is contained in:
Johannes Meyer 2014-11-04 14:22:53 +01:00
commit 170ded6510
42 changed files with 178 additions and 156 deletions

View File

@ -9,7 +9,7 @@ use Icinga\Web\Controller\ActionController;
use Icinga\Form\Authentication\LoginForm; use Icinga\Form\Authentication\LoginForm;
use Icinga\Authentication\AuthChain; use Icinga\Authentication\AuthChain;
use Icinga\Application\Config; use Icinga\Application\Config;
use Icinga\Logger\Logger; use Icinga\Application\Logger;
use Icinga\Exception\AuthenticationException; use Icinga\Exception\AuthenticationException;
use Icinga\Exception\NotReadableError; use Icinga\Exception\NotReadableError;
use Icinga\Exception\ConfigurationError; use Icinga\Exception\ConfigurationError;

View File

@ -2,16 +2,16 @@
// {{{ICINGA_LICENSE_HEADER}}} // {{{ICINGA_LICENSE_HEADER}}}
// {{{ICINGA_LICENSE_HEADER}}} // {{{ICINGA_LICENSE_HEADER}}}
use Icinga\Web\Url; use Icinga\Application\Config;
use Icinga\Logger\Logger; use Icinga\Application\Logger;
use Icinga\Config\PreservingIniWriter;
use Icinga\Application\Config as IcingaConfig;
use Icinga\Web\Widget\Dashboard;
use Icinga\Form\Dashboard\AddUrlForm;
use Icinga\Exception\NotReadableError;
use Icinga\Exception\ConfigurationError; use Icinga\Exception\ConfigurationError;
use Icinga\Web\Controller\ActionController;
use Icinga\Exception\IcingaException; use Icinga\Exception\IcingaException;
use Icinga\Exception\NotReadableError;
use Icinga\File\Ini\IniWriter;
use Icinga\Form\Dashboard\AddUrlForm;
use Icinga\Web\Controller\ActionController;
use Icinga\Web\Url;
use Icinga\Web\Widget\Dashboard;
/** /**
* Handle creation, removal and displaying of dashboards, panes and components * Handle creation, removal and displaying of dashboards, panes and components
@ -36,7 +36,7 @@ class DashboardController extends ActionController
{ {
$dashboard = new Dashboard(); $dashboard = new Dashboard();
try { try {
$dashboardConfig = IcingaConfig::app($config); $dashboardConfig = Config::app($config);
if (count($dashboardConfig) === 0) { if (count($dashboardConfig) === 0) {
return null; return null;
} }
@ -92,7 +92,7 @@ class DashboardController extends ActionController
ltrim($form->getValue('url'), '/') ltrim($form->getValue('url'), '/')
); );
$configFile = IcingaConfig::app('dashboard/dashboard')->getConfigFile(); $configFile = Config::app('dashboard/dashboard')->getConfigFile();
if ($this->writeConfiguration(new Zend_Config($dashboard->toArray()), $configFile)) { if ($this->writeConfiguration(new Zend_Config($dashboard->toArray()), $configFile)) {
$this->redirectNow(Url::fromPath('dashboard', array('pane' => $form->getValue('pane')))); $this->redirectNow(Url::fromPath('dashboard', array('pane' => $form->getValue('pane'))));
} else { } else {
@ -125,7 +125,7 @@ class DashboardController extends ActionController
$dashboard->activate($pane); $dashboard->activate($pane);
} }
$this->view->configPath = IcingaConfig::resolvePath(self::DEFAULT_CONFIG); $this->view->configPath = Config::resolvePath(self::DEFAULT_CONFIG);
if ($dashboard === null) { if ($dashboard === null) {
$this->view->title = 'Dashboard'; $this->view->title = 'Dashboard';
@ -158,7 +158,7 @@ class DashboardController extends ActionController
*/ */
protected function writeConfiguration(Zend_Config $config, $target) protected function writeConfiguration(Zend_Config $config, $target)
{ {
$writer = new PreservingIniWriter(array('config' => $config, 'filename' => $target)); $writer = new IniWriter(array('config' => $config, 'filename' => $target));
try { try {
$writer->write(); $writer->write();

View File

@ -4,7 +4,7 @@
// namespace Icinga\Application\Controllers; // namespace Icinga\Application\Controllers;
use Icinga\Logger\Logger; use Icinga\Application\Logger;
use Icinga\Web\Controller\ActionController; use Icinga\Web\Controller\ActionController;
use Icinga\Application\Icinga; use Icinga\Application\Icinga;

View File

@ -4,7 +4,7 @@
use Icinga\Web\Controller\ActionController; use Icinga\Web\Controller\ActionController;
use Icinga\Filter\Filter; use Icinga\Filter\Filter;
use Icinga\Logger\Logger; use Icinga\Application\Logger;
/** /**
* Application wide interface for filtering * Application wide interface for filtering

View File

@ -5,9 +5,7 @@
use Icinga\Module\Monitoring\Controller; use Icinga\Module\Monitoring\Controller;
use Icinga\Web\Hook; use Icinga\Web\Hook;
use Icinga\Web\Url; use Icinga\Web\Url;
use Icinga\Data\ResourceFactory; use Icinga\Application\Logger;
use Icinga\Logger\Logger;
use Icinga\Logger\Writer\FileWriter;
use Icinga\Protocol\File\FileReader; use Icinga\Protocol\File\FileReader;
use \Zend_Controller_Action_Exception as ActionError; use \Zend_Controller_Action_Exception as ActionError;

View File

@ -4,7 +4,7 @@
use Icinga\Web\Controller\ActionController; use Icinga\Web\Controller\ActionController;
use Icinga\Application\Icinga; use Icinga\Application\Icinga;
use Icinga\Logger\Logger; use Icinga\Application\Logger;
use Icinga\Web\FileCache; use Icinga\Web\FileCache;
use Zend_Controller_Action_Exception as ActionException; use Zend_Controller_Action_Exception as ActionException;

View File

@ -5,7 +5,7 @@
namespace Icinga\Form\Config\General; namespace Icinga\Form\Config\General;
use Icinga\Application\Icinga; use Icinga\Application\Icinga;
use Icinga\Logger\Logger; use Icinga\Application\Logger;
use Icinga\Web\Form; use Icinga\Web\Form;
use Icinga\Web\Form\Validator\WritablePathValidator; use Icinga\Web\Form\Validator\WritablePathValidator;

View File

@ -7,7 +7,7 @@ namespace Icinga\Form;
use Exception; use Exception;
use Icinga\Web\Form; use Icinga\Web\Form;
use Icinga\Application\Config; use Icinga\Application\Config;
use Icinga\Config\PreservingIniWriter; use Icinga\File\Ini\IniWriter;
/** /**
* Form base-class providing standard functionality for configuration forms * Form base-class providing standard functionality for configuration forms
@ -43,7 +43,7 @@ class ConfigForm extends Form
*/ */
public function save() public function save()
{ {
$writer = new PreservingIniWriter( $writer = new IniWriter(
array( array(
'config' => $this->config, 'config' => $this->config,
'filename' => $this->config->getConfigFile() 'filename' => $this->config->getConfigFile()

View File

@ -6,7 +6,7 @@ namespace Icinga\Form;
use Exception; use Exception;
use DateTimeZone; use DateTimeZone;
use Icinga\Logger\Logger; use Icinga\Application\Logger;
use Icinga\User\Preferences; use Icinga\User\Preferences;
use Icinga\User\Preferences\PreferencesStore; use Icinga\User\Preferences\PreferencesStore;
use Icinga\Util\TimezoneDetect; use Icinga\Util\TimezoneDetect;

View File

@ -11,7 +11,7 @@ use Icinga\Application\Modules\Manager as ModuleManager;
use Icinga\Data\ResourceFactory; use Icinga\Data\ResourceFactory;
use Icinga\Exception\ConfigurationError; use Icinga\Exception\ConfigurationError;
use Icinga\Exception\NotReadableError; use Icinga\Exception\NotReadableError;
use Icinga\Logger\Logger; use Icinga\Application\Logger;
use Icinga\Util\DateTimeFactory; use Icinga\Util\DateTimeFactory;
use Icinga\Util\Translator; use Icinga\Util\Translator;
use Icinga\Exception\IcingaException; use Icinga\Exception\IcingaException;
@ -397,6 +397,7 @@ abstract class ApplicationBootstrap
return false; // Continue with the normal error handler return false; // Continue with the normal error handler
} }
switch($errno) { switch($errno) {
case E_WARNING:
case E_STRICT: case E_STRICT:
throw new ErrorException($errstr, 0, $errno, $errfile, $errline); throw new ErrorException($errstr, 0, $errno, $errfile, $errline);
} }

View File

@ -9,7 +9,7 @@ use Icinga\Application\ApplicationBootstrap;
use Icinga\Cli\Params; use Icinga\Cli\Params;
use Icinga\Cli\Loader; use Icinga\Cli\Loader;
use Icinga\Cli\Screen; use Icinga\Cli\Screen;
use Icinga\Logger\Logger; use Icinga\Application\Logger;
use Icinga\Application\Benchmark; use Icinga\Application\Benchmark;
use Icinga\Exception\ProgrammingError; use Icinga\Exception\ProgrammingError;
use Zend_Config; use Zend_Config;

View File

@ -2,13 +2,13 @@
// {{{ICINGA_LICENSE_HEADER}}} // {{{ICINGA_LICENSE_HEADER}}}
// {{{ICINGA_LICENSE_HEADER}}} // {{{ICINGA_LICENSE_HEADER}}}
namespace Icinga\Logger; namespace Icinga\Application;
use Exception; use Exception;
use Zend_Config; use Zend_Config;
use Icinga\Application\Logger\Writer\FileWriter;
use Icinga\Application\Logger\Writer\SyslogWriter;
use Icinga\Exception\ConfigurationError; use Icinga\Exception\ConfigurationError;
use Icinga\Logger\Writer\FileWriter;
use Icinga\Logger\Writer\SyslogWriter;
/** /**
* Logger * Logger
@ -57,7 +57,7 @@ class Logger
/** /**
* Log writer * Log writer
* *
* @var \Icinga\Logger\LogWriter * @var \Icinga\Application\Logger\LogWriter
*/ */
protected $writer; protected $writer;
@ -133,12 +133,12 @@ class Logger
* *
* @param Zend_Config $config The configuration to initialize the writer with * @param Zend_Config $config The configuration to initialize the writer with
* *
* @return \Icinga\Logger\LogWriter The requested log writer * @return \Icinga\Application\Logger\LogWriter The requested log writer
* @throws ConfigurationError If the requested writer cannot be found * @throws ConfigurationError If the requested writer cannot be found
*/ */
protected function createWriter(Zend_Config $config) protected function createWriter(Zend_Config $config)
{ {
$class = 'Icinga\\Logger\\Writer\\' . ucfirst(strtolower($config->log)) . 'Writer'; $class = 'Icinga\\Application\\Logger\\Writer\\' . ucfirst(strtolower($config->log)) . 'Writer';
if (! class_exists($class)) { if (! class_exists($class)) {
throw new ConfigurationError( throw new ConfigurationError(
'Cannot find log writer of type "%s"', 'Cannot find log writer of type "%s"',
@ -258,7 +258,7 @@ class Logger
/** /**
* Get the log writer to use * Get the log writer to use
* *
* @return \Icinga\Logger\LogWriter * @return \Icinga\Application\Logger\LogWriter
*/ */
public function getWriter() public function getWriter()
{ {

View File

@ -2,7 +2,7 @@
// {{{ICINGA_LICENSE_HEADER}}} // {{{ICINGA_LICENSE_HEADER}}}
// {{{ICINGA_LICENSE_HEADER}}} // {{{ICINGA_LICENSE_HEADER}}}
namespace Icinga\Logger; namespace Icinga\Application\Logger;
use Zend_Config; use Zend_Config;

View File

@ -2,13 +2,13 @@
// {{{ICINGA_LICENSE_HEADER}}} // {{{ICINGA_LICENSE_HEADER}}}
// {{{ICINGA_LICENSE_HEADER}}} // {{{ICINGA_LICENSE_HEADER}}}
namespace Icinga\Logger\Writer; namespace Icinga\Application\Logger\Writer;
use Exception; use Exception;
use Zend_Config; use Zend_Config;
use Icinga\Application\Logger;
use Icinga\Application\Logger\LogWriter;
use Icinga\Exception\ConfigurationError; use Icinga\Exception\ConfigurationError;
use Icinga\Logger\Logger;
use Icinga\Logger\LogWriter;
use Icinga\Util\File; use Icinga\Util\File;
/** /**

View File

@ -2,11 +2,11 @@
// {{{ICINGA_LICENSE_HEADER}}} // {{{ICINGA_LICENSE_HEADER}}}
// {{{ICINGA_LICENSE_HEADER}}} // {{{ICINGA_LICENSE_HEADER}}}
namespace Icinga\Logger\Writer; namespace Icinga\Application\Logger\Writer;
use Zend_Config; use Zend_Config;
use Icinga\Logger\Logger; use Icinga\Application\Logger;
use Icinga\Logger\LogWriter; use Icinga\Application\Logger\LogWriter;
/** /**
* Log to the syslog service * Log to the syslog service

View File

@ -6,7 +6,7 @@ namespace Icinga\Application\Modules;
use Icinga\Application\ApplicationBootstrap; use Icinga\Application\ApplicationBootstrap;
use Icinga\Application\Icinga; use Icinga\Application\Icinga;
use Icinga\Logger\Logger; use Icinga\Application\Logger;
use Icinga\Data\DataArray\ArrayDatasource; use Icinga\Data\DataArray\ArrayDatasource;
use Icinga\Data\SimpleQuery; use Icinga\Data\SimpleQuery;
use Icinga\Exception\ConfigurationError; use Icinga\Exception\ConfigurationError;

View File

@ -12,7 +12,7 @@ use Zend_Controller_Router_Route_Regex as RegexRoute;
use Icinga\Application\ApplicationBootstrap; use Icinga\Application\ApplicationBootstrap;
use Icinga\Application\Config; use Icinga\Application\Config;
use Icinga\Application\Icinga; use Icinga\Application\Icinga;
use Icinga\Logger\Logger; use Icinga\Application\Logger;
use Icinga\Util\Translator; use Icinga\Util\Translator;
use Icinga\Web\Hook; use Icinga\Web\Hook;
use Icinga\Web\Menu; use Icinga\Web\Menu;

View File

@ -9,7 +9,7 @@ require_once __DIR__ . '/ApplicationBootstrap.php';
use Icinga\Authentication\Manager as AuthenticationManager; use Icinga\Authentication\Manager as AuthenticationManager;
use Icinga\Exception\ConfigurationError; use Icinga\Exception\ConfigurationError;
use Icinga\Exception\NotReadableError; use Icinga\Exception\NotReadableError;
use Icinga\Logger\Logger; use Icinga\Application\Logger;
use Icinga\Util\TimezoneDetect; use Icinga\Util\TimezoneDetect;
use Icinga\Web\Request; use Icinga\Web\Request;
use Icinga\Web\Response; use Icinga\Web\Response;

View File

@ -6,7 +6,7 @@ namespace Icinga\Authentication;
use Iterator; use Iterator;
use Zend_Config; use Zend_Config;
use Icinga\Logger\Logger; use Icinga\Application\Logger;
use Icinga\Exception\ConfigurationError; use Icinga\Exception\ConfigurationError;
/** /**

View File

@ -78,8 +78,16 @@ class LdapUserBackend extends UserBackend
*/ */
public function assertAuthenticationPossible() public function assertAuthenticationPossible()
{ {
$q = $this->conn->select()->setBase($this->baseDn)->from($this->userClass); try {
$result = $q->fetchRow(); $q = $this->conn->select()->setBase($this->baseDn)->from($this->userClass);
$result = $q->fetchRow();
} catch (LdapException $e) {
throw new AuthenticationException(
'Connection not possible: %s',
$e->getMessage()
);
}
if (! isset($result)) { if (! isset($result)) {
throw new AuthenticationException( throw new AuthenticationException(
'No objects with objectClass="%s" in DN="%s" found.', 'No objects with objectClass="%s" in DN="%s" found.',
@ -168,7 +176,7 @@ class LdapUserBackend extends UserBackend
} catch (AuthenticationException $e) { } catch (AuthenticationException $e) {
// Authentication not possible // Authentication not possible
throw new AuthenticationException( throw new AuthenticationException(
'Authentication against backend "%s" not possible: ', 'Authentication against backend "%s" not possible: %s',
$this->getName(), $this->getName(),
$e $e
); );

View File

@ -9,7 +9,7 @@ use Zend_Config;
use Icinga\Application\Config; use Icinga\Application\Config;
use Icinga\Exception\IcingaException; use Icinga\Exception\IcingaException;
use Icinga\Exception\NotReadableError; use Icinga\Exception\NotReadableError;
use Icinga\Logger\Logger; use Icinga\Application\Logger;
use Icinga\User; use Icinga\User;
use Icinga\User\Preferences; use Icinga\User\Preferences;
use Icinga\User\Preferences\PreferencesStore; use Icinga\User\Preferences\PreferencesStore;

View File

@ -2,7 +2,7 @@
// {{{ICINGA_LICENSE_HEADER}}} // {{{ICINGA_LICENSE_HEADER}}}
// {{{ICINGA_LICENSE_HEADER}}} // {{{ICINGA_LICENSE_HEADER}}}
namespace Icinga\Config; namespace Icinga\File\Ini;
/** /**
* Edit the sections and keys of an ini in-place * Edit the sections and keys of an ini in-place

View File

@ -2,18 +2,17 @@
// {{{ICINGA_LICENSE_HEADER}}} // {{{ICINGA_LICENSE_HEADER}}}
// {{{ICINGA_LICENSE_HEADER}}} // {{{ICINGA_LICENSE_HEADER}}}
namespace Icinga\Config; namespace Icinga\File\Ini;
use Zend_Config; use Zend_Config;
use Zend_Config_Ini; use Zend_Config_Ini;
use Zend_Config_Exception; use Zend_Config_Exception;
use Zend_Config_Writer_FileAbstract; use Zend_Config_Writer_FileAbstract;
use Icinga\Config\IniEditor;
/** /**
* A ini file adapter that respects the file structure and the comments of already existing ini files * A INI file adapter that respects the file structure and the comments of already existing ini files
*/ */
class PreservingIniWriter extends Zend_Config_Writer_FileAbstract class IniWriter extends Zend_Config_Writer_FileAbstract
{ {
/** /**
* Stores the options * Stores the options
@ -30,7 +29,7 @@ class PreservingIniWriter extends Zend_Config_Writer_FileAbstract
public static $fileMode; public static $fileMode;
/** /**
* Create a new PreservingIniWriter * Create a new INI writer
* *
* @param array $options Supports all options of Zend_Config_Writer and additional options: * @param array $options Supports all options of Zend_Config_Writer and additional options:
* * filemode: The mode to set on new files * * filemode: The mode to set on new files

View File

@ -7,7 +7,7 @@ namespace Icinga\Protocol\Ldap;
use Icinga\Protocol\Ldap\Exception as LdapException; use Icinga\Protocol\Ldap\Exception as LdapException;
use Icinga\Application\Platform; use Icinga\Application\Platform;
use Icinga\Application\Config; use Icinga\Application\Config;
use Icinga\Logger\Logger; use Icinga\Application\Logger;
use Zend_Config; use Zend_Config;
/** /**

View File

@ -5,12 +5,12 @@
namespace Icinga\User\Preferences\Store; namespace Icinga\User\Preferences\Store;
use Zend_Config; use Zend_Config;
use Icinga\Util\File;
use Icinga\Config\PreservingIniWriter;
use Icinga\Exception\NotReadableError; use Icinga\Exception\NotReadableError;
use Icinga\Exception\NotWritableError; use Icinga\Exception\NotWritableError;
use Icinga\File\Ini\IniWriter;
use Icinga\User\Preferences; use Icinga\User\Preferences;
use Icinga\User\Preferences\PreferencesStore; use Icinga\User\Preferences\PreferencesStore;
use Icinga\Util\File;
/** /**
* Load and save user preferences from and to INI files * Load and save user preferences from and to INI files
@ -34,7 +34,7 @@ class IniStore extends PreferencesStore
/** /**
* Writer which stores the preferences * Writer which stores the preferences
* *
* @var PreservingIniWriter * @var IniWriter
*/ */
protected $writer; protected $writer;
@ -114,7 +114,7 @@ class IniStore extends PreferencesStore
); );
} }
$this->writer = new PreservingIniWriter( $this->writer = new IniWriter(
array( array(
'config' => new Zend_Config($this->preferences), 'config' => new Zend_Config($this->preferences),
'filename' => $this->preferencesFile 'filename' => $this->preferencesFile

View File

@ -5,7 +5,7 @@
namespace Icinga\Web; namespace Icinga\Web;
use Exception; use Exception;
use Icinga\Logger\Logger; use Icinga\Application\Logger;
use Icinga\Exception\ProgrammingError; use Icinga\Exception\ProgrammingError;
/** /**

View File

@ -9,7 +9,7 @@ use RecursiveIterator;
use Zend_Config; use Zend_Config;
use Icinga\Application\Config; use Icinga\Application\Config;
use Icinga\Application\Icinga; use Icinga\Application\Icinga;
use Icinga\Logger\Logger; use Icinga\Application\Logger;
use Icinga\Exception\ConfigurationError; use Icinga\Exception\ConfigurationError;
use Icinga\Exception\ProgrammingError; use Icinga\Exception\ProgrammingError;
use Icinga\Web\Url; use Icinga\Web\Url;

View File

@ -6,7 +6,7 @@ namespace Icinga\Web;
use Exception; use Exception;
use RecursiveIteratorIterator; use RecursiveIteratorIterator;
use Icinga\Logger\Logger; use Icinga\Application\Logger;
/** /**
* A renderer to draw a menu with its sub-menus using an unordered html list * A renderer to draw a menu with its sub-menus using an unordered html list

View File

@ -6,7 +6,7 @@ namespace Icinga\Web;
use Icinga\Exception\ProgrammingError; use Icinga\Exception\ProgrammingError;
use Icinga\Application\Platform; use Icinga\Application\Platform;
use Icinga\Logger\Logger; use Icinga\Application\Logger;
use Icinga\Web\Session; use Icinga\Web\Session;
/** /**

View File

@ -4,7 +4,7 @@
namespace Icinga\Web\Session; namespace Icinga\Web\Session;
use Icinga\Logger\Logger; use Icinga\Application\Logger;
use Icinga\Exception\ConfigurationError; use Icinga\Exception\ConfigurationError;
/** /**

View File

@ -7,7 +7,7 @@ namespace Icinga\Web\Widget\Chart;
use Icinga\Web\Widget\AbstractWidget; use Icinga\Web\Widget\AbstractWidget;
use Icinga\Web\Url; use Icinga\Web\Url;
use Icinga\Util\Format; use Icinga\Util\Format;
use Icinga\Logger\Logger; use Icinga\Application\Logger;
/** /**
* A SVG-PieChart intended to be displayed as a small icon next to labels, to offer a better visualization of the * A SVG-PieChart intended to be displayed as a small icon next to labels, to offer a better visualization of the

View File

@ -4,7 +4,7 @@
use Icinga\Application\Icinga; use Icinga\Application\Icinga;
use Icinga\Application\Config; use Icinga\Application\Config;
use Icinga\Logger\Logger; use Icinga\Application\Logger;
use Icinga\Module\Monitoring\Form\Command\DisableNotificationWithExpireForm; use Icinga\Module\Monitoring\Form\Command\DisableNotificationWithExpireForm;
use Icinga\Module\Monitoring\Form\Command\SingleArgumentCommandForm; use Icinga\Module\Monitoring\Form\Command\SingleArgumentCommandForm;
use Icinga\Web\Form; use Icinga\Web\Form;

View File

@ -4,7 +4,7 @@
namespace Icinga\Module\Monitoring\Backend\Ido\Query; namespace Icinga\Module\Monitoring\Backend\Ido\Query;
use Icinga\Logger\Logger; use Icinga\Application\Logger;
use Zend_Db_Select; use Zend_Db_Select;
class GroupSummaryQuery extends IdoQuery class GroupSummaryQuery extends IdoQuery

View File

@ -5,7 +5,7 @@
namespace Icinga\Module\Monitoring\Backend\Ido\Query; namespace Icinga\Module\Monitoring\Backend\Ido\Query;
use Icinga\Exception\IcingaException; use Icinga\Exception\IcingaException;
use Icinga\Logger\Logger; use Icinga\Application\Logger;
use Icinga\Data\Db\DbQuery; use Icinga\Data\Db\DbQuery;
use Icinga\Exception\ProgrammingError; use Icinga\Exception\ProgrammingError;
use Icinga\Application\Icinga; use Icinga\Application\Icinga;

View File

@ -6,7 +6,7 @@ namespace Icinga\Module\Monitoring\Command\Transport;
use Exception; use Exception;
use LogicException; use LogicException;
use Icinga\Logger\Logger; use Icinga\Application\Logger;
use Icinga\Module\Monitoring\Command\Exception\TransportException; use Icinga\Module\Monitoring\Command\Exception\TransportException;
use Icinga\Module\Monitoring\Command\IcingaCommand; use Icinga\Module\Monitoring\Command\IcingaCommand;
use Icinga\Module\Monitoring\Command\Renderer\IcingaCommandFileCommandRenderer; use Icinga\Module\Monitoring\Command\Renderer\IcingaCommandFileCommandRenderer;

View File

@ -5,7 +5,7 @@
namespace Icinga\Module\Monitoring\Command\Transport; namespace Icinga\Module\Monitoring\Command\Transport;
use LogicException; use LogicException;
use Icinga\Logger\Logger; use Icinga\Application\Logger;
use Icinga\Module\Monitoring\Command\Exception\TransportException; use Icinga\Module\Monitoring\Command\Exception\TransportException;
use Icinga\Module\Monitoring\Command\IcingaCommand; use Icinga\Module\Monitoring\Command\IcingaCommand;
use Icinga\Module\Monitoring\Command\Renderer\IcingaCommandFileCommandRenderer; use Icinga\Module\Monitoring\Command\Renderer\IcingaCommandFileCommandRenderer;

View File

@ -130,7 +130,8 @@ class Host extends MonitoredObject
'host_notes_url', 'host_notes_url',
'host_modified_host_attributes', 'host_modified_host_attributes',
'host_problem', 'host_problem',
'host_process_performance_data' 'host_process_performance_data',
'process_perfdata' => 'host_process_performance_data'
)) ))
->where('host_name', $this->host); ->where('host_name', $this->host);
} }

View File

@ -317,10 +317,12 @@ abstract class MonitoredObject
'contact_alias', 'contact_alias',
'contact_email', 'contact_email',
'contact_pager', 'contact_pager',
)) ));
->where('host_name', $this->host_name);
if ($this->type === self::TYPE_SERVICE) { if ($this->type === self::TYPE_SERVICE) {
$contacts->where('service_host_name', $this->host_name);
$contacts->where('service_description', $this->service_description); $contacts->where('service_description', $this->service_description);
} else {
$contacts->where('host_name', $this->host_name);
} }
$this->contacts = $contacts->getQuery()->fetchAll(); $this->contacts = $contacts->getQuery()->fetchAll();
return $this; return $this;

View File

@ -191,6 +191,7 @@ class Service extends MonitoredObject
'service_flap_detection_enabled_changed', 'service_flap_detection_enabled_changed',
'service_modified_service_attributes', 'service_modified_service_attributes',
'service_process_performance_data', 'service_process_performance_data',
'process_perfdata' => 'service_process_performance_data',
'service_percent_state_change', 'service_percent_state_change',
'service_host_name' 'service_host_name'
)) ))

View File

@ -269,15 +269,24 @@
} }
} else { } else {
if (req.$target.attr('id') === 'col2') { // TODO: multicol
if ($('#col1').data('icingaUrl') === redirect) {
icinga.ui.layout1col();
req.$target = $('#col1');
delete(this.requests['col2']);
}
}
this.loadUrl(redirect, req.$target); if (redirect.match(/#!/)) {
var parts = redirect.split(/#!/);
icinga.ui.layout2col();
this.loadUrl(parts.shift(), $('#col1'));
this.loadUrl(parts.shift(), $('#col2'));
} else {
if (req.$target.attr('id') === 'col2') { // TODO: multicol
if ($('#col1').data('icingaUrl') === redirect) {
icinga.ui.layout1col();
req.$target = $('#col1');
delete(this.requests['col2']);
}
}
this.loadUrl(redirect, req.$target);
}
} }
return true; return true;
}, },
@ -672,6 +681,8 @@
} }
} }
$container.trigger('beforerender');
var discard = false; var discard = false;
$.each(self.icinga.behaviors, function(name, behavior) { $.each(self.icinga.behaviors, function(name, behavior) {
if (behavior.renderHook) { if (behavior.renderHook) {
@ -691,11 +702,12 @@
var $content = $('<div>' + content + '</div>'); var $content = $('<div>' + content + '</div>');
// Disable all click events while rendering // Disable all click events while rendering
$('*').click(function (event) { // (Disabling disabled, was ways too slow)
event.stopImmediatePropagation(); // $('*').click(function (event) {
event.stopPropagation(); // event.stopImmediatePropagation();
event.preventDefault(); // event.stopPropagation();
}); // event.preventDefault();
// });
$('.container', $container).each(function() { $('.container', $container).each(function() {
self.stopPendingRequestsFor($(this)); self.stopPendingRequestsFor($(this));
@ -738,8 +750,8 @@
icinga.ui.initializeControls($container); icinga.ui.initializeControls($container);
icinga.ui.fixControls(); icinga.ui.fixControls();
// Re-enable all click events // Re-enable all click events (disabled as of performance reasons)
$('*').off('click'); // $('*').off('click');
}, },
/** /**

View File

@ -6,10 +6,10 @@ namespace Tests\Icinga\Config;
use Zend_Config; use Zend_Config;
use Zend_Config_Ini; use Zend_Config_Ini;
use Icinga\File\Ini\IniWriter;
use Icinga\Test\BaseTestCase; use Icinga\Test\BaseTestCase;
use Icinga\Config\PreservingIniWriter;
class PreservingIniWriterTest extends BaseTestCase class IniWriterTest extends BaseTestCase
{ {
protected $tempFile; protected $tempFile;
protected $tempFile2; protected $tempFile2;
@ -34,22 +34,22 @@ class PreservingIniWriterTest extends BaseTestCase
{ {
$target = $this->writeConfigToTemporaryFile(''); $target = $this->writeConfigToTemporaryFile('');
$config = new Zend_Config(array('key' => 'value')); $config = new Zend_Config(array('key' => 'value'));
$writer = new PreservingIniWriter(array('config' => $config, 'filename' => $target)); $writer = new IniWriter(array('config' => $config, 'filename' => $target));
$writer->write(); $writer->write();
$newConfig = new Zend_Config_Ini($target); $newConfig = new Zend_Config_Ini($target);
$this->assertEquals('value', $newConfig->get('key'), 'PreservingIniWriter does not insert in empty files'); $this->assertEquals('value', $newConfig->get('key'), 'IniWriter does not insert in empty files');
} }
public function testWhetherSimplePropertiesAreInsertedInExistingFiles() public function testWhetherSimplePropertiesAreInsertedInExistingFiles()
{ {
$target = $this->writeConfigToTemporaryFile('key1 = "1"'); $target = $this->writeConfigToTemporaryFile('key1 = "1"');
$config = new Zend_Config(array('key2' => '2')); $config = new Zend_Config(array('key2' => '2'));
$writer = new PreservingIniWriter(array('config' => $config, 'filename' => $target)); $writer = new IniWriter(array('config' => $config, 'filename' => $target));
$writer->write(); $writer->write();
$newConfig = new Zend_Config_Ini($target); $newConfig = new Zend_Config_Ini($target);
$this->assertEquals('2', $newConfig->get('key2'), 'PreservingIniWriter does not insert in existing files'); $this->assertEquals('2', $newConfig->get('key2'), 'IniWriter does not insert in existing files');
} }
/** /**
@ -59,11 +59,11 @@ class PreservingIniWriterTest extends BaseTestCase
{ {
$target = $this->writeConfigToTemporaryFile('key = "value"'); $target = $this->writeConfigToTemporaryFile('key = "value"');
$config = new Zend_Config(array('key' => 'eulav')); $config = new Zend_Config(array('key' => 'eulav'));
$writer = new PreservingIniWriter(array('config' => $config, 'filename' => $target)); $writer = new IniWriter(array('config' => $config, 'filename' => $target));
$writer->write(); $writer->write();
$newConfig = new Zend_Config_Ini($target); $newConfig = new Zend_Config_Ini($target);
$this->assertEquals('eulav', $newConfig->get('key'), 'PreservingIniWriter does not update simple properties'); $this->assertEquals('eulav', $newConfig->get('key'), 'IniWriter does not update simple properties');
} }
/** /**
@ -73,30 +73,30 @@ class PreservingIniWriterTest extends BaseTestCase
{ {
$target = $this->writeConfigToTemporaryFile('key = "value"'); $target = $this->writeConfigToTemporaryFile('key = "value"');
$config = new Zend_Config(array()); $config = new Zend_Config(array());
$writer = new PreservingIniWriter(array('config' => $config, 'filename' => $target)); $writer = new IniWriter(array('config' => $config, 'filename' => $target));
$writer->write(); $writer->write();
$newConfig = new Zend_Config_Ini($target); $newConfig = new Zend_Config_Ini($target);
$this->assertNull($newConfig->get('key'), 'PreservingIniWriter does not delete simple properties'); $this->assertNull($newConfig->get('key'), 'IniWriter does not delete simple properties');
} }
public function testWhetherNestedPropertiesAreInserted() public function testWhetherNestedPropertiesAreInserted()
{ {
$target = $this->writeConfigToTemporaryFile(''); $target = $this->writeConfigToTemporaryFile('');
$config = new Zend_Config(array('a' => array('b' => 'c'))); $config = new Zend_Config(array('a' => array('b' => 'c')));
$writer = new PreservingIniWriter(array('config' => $config, 'filename' => $target)); $writer = new IniWriter(array('config' => $config, 'filename' => $target));
$writer->write(); $writer->write();
$newConfig = new Zend_Config_Ini($target); $newConfig = new Zend_Config_Ini($target);
$this->assertInstanceOf( $this->assertInstanceOf(
'\Zend_Config', '\Zend_Config',
$newConfig->get('a'), $newConfig->get('a'),
'PreservingIniWriter does not insert nested properties' 'IniWriter does not insert nested properties'
); );
$this->assertEquals( $this->assertEquals(
'c', 'c',
$newConfig->get('a')->get('b'), $newConfig->get('a')->get('b'),
'PreservingIniWriter does not insert nested properties' 'IniWriter does not insert nested properties'
); );
} }
@ -107,19 +107,19 @@ class PreservingIniWriterTest extends BaseTestCase
{ {
$target = $this->writeConfigToTemporaryFile('a.b = "c"'); $target = $this->writeConfigToTemporaryFile('a.b = "c"');
$config = new Zend_Config(array('a' => array('b' => 'cc'))); $config = new Zend_Config(array('a' => array('b' => 'cc')));
$writer = new PreservingIniWriter(array('config' => $config, 'filename' => $target)); $writer = new IniWriter(array('config' => $config, 'filename' => $target));
$writer->write(); $writer->write();
$newConfig = new Zend_Config_Ini($target); $newConfig = new Zend_Config_Ini($target);
$this->assertInstanceOf( $this->assertInstanceOf(
'\Zend_Config', '\Zend_Config',
$newConfig->get('a'), $newConfig->get('a'),
'PreservingIniWriter does not update nested properties' 'IniWriter does not update nested properties'
); );
$this->assertEquals( $this->assertEquals(
'cc', 'cc',
$newConfig->get('a')->get('b'), $newConfig->get('a')->get('b'),
'PreservingIniWriter does not update nested properties' 'IniWriter does not update nested properties'
); );
} }
@ -130,13 +130,13 @@ class PreservingIniWriterTest extends BaseTestCase
{ {
$target = $this->writeConfigToTemporaryFile('a.b = "c"'); $target = $this->writeConfigToTemporaryFile('a.b = "c"');
$config = new Zend_Config(array()); $config = new Zend_Config(array());
$writer = new PreservingIniWriter(array('config' => $config, 'filename' => $target)); $writer = new IniWriter(array('config' => $config, 'filename' => $target));
$writer->write(); $writer->write();
$newConfig = new Zend_Config_Ini($target); $newConfig = new Zend_Config_Ini($target);
$this->assertNull( $this->assertNull(
$newConfig->get('a'), $newConfig->get('a'),
'PreservingIniWriter does not delete nested properties' 'IniWriter does not delete nested properties'
); );
} }
@ -144,19 +144,19 @@ class PreservingIniWriterTest extends BaseTestCase
{ {
$target = $this->writeConfigToTemporaryFile(''); $target = $this->writeConfigToTemporaryFile('');
$config = new Zend_Config(array('section' => array('key' => 'value'))); $config = new Zend_Config(array('section' => array('key' => 'value')));
$writer = new PreservingIniWriter(array('config' => $config, 'filename' => $target)); $writer = new IniWriter(array('config' => $config, 'filename' => $target));
$writer->write(); $writer->write();
$newConfig = new Zend_Config_Ini($target); $newConfig = new Zend_Config_Ini($target);
$this->assertInstanceOf( $this->assertInstanceOf(
'\Zend_Config', '\Zend_Config',
$newConfig->get('section'), $newConfig->get('section'),
'PreservingIniWriter does not insert sections' 'IniWriter does not insert sections'
); );
$this->assertEquals( $this->assertEquals(
'value', 'value',
$newConfig->get('section')->get('key'), $newConfig->get('section')->get('key'),
'PreservingIniWriter does not insert simple section properties' 'IniWriter does not insert simple section properties'
); );
} }
@ -171,14 +171,14 @@ key = "value"
EOD EOD
); );
$config = new Zend_Config(array('section' => array('key' => 'eulav'))); $config = new Zend_Config(array('section' => array('key' => 'eulav')));
$writer = new PreservingIniWriter(array('config' => $config, 'filename' => $target)); $writer = new IniWriter(array('config' => $config, 'filename' => $target));
$writer->write(); $writer->write();
$newConfig = new Zend_Config_Ini($target); $newConfig = new Zend_Config_Ini($target);
$this->assertEquals( $this->assertEquals(
'eulav', 'eulav',
$newConfig->get('section')->get('key'), $newConfig->get('section')->get('key'),
'PreservingIniWriter does not update simple section properties' 'IniWriter does not update simple section properties'
); );
} }
@ -193,13 +193,13 @@ key = "value"
EOD EOD
); );
$config = new Zend_Config(array('section' => array())); $config = new Zend_Config(array('section' => array()));
$writer = new PreservingIniWriter(array('config' => $config, 'filename' => $target)); $writer = new IniWriter(array('config' => $config, 'filename' => $target));
$writer->write(); $writer->write();
$newConfig = new Zend_Config_Ini($target); $newConfig = new Zend_Config_Ini($target);
$this->assertNull( $this->assertNull(
$newConfig->get('section')->get('key'), $newConfig->get('section')->get('key'),
'PreservingIniWriter does not delete simple section properties' 'IniWriter does not delete simple section properties'
); );
} }
@ -207,24 +207,24 @@ EOD
{ {
$target = $this->writeConfigToTemporaryFile(''); $target = $this->writeConfigToTemporaryFile('');
$config = new Zend_Config(array('section' => array('a' => array('b' => 'c')))); $config = new Zend_Config(array('section' => array('a' => array('b' => 'c'))));
$writer = new PreservingIniWriter(array('config' => $config, 'filename' => $target)); $writer = new IniWriter(array('config' => $config, 'filename' => $target));
$writer->write(); $writer->write();
$newConfig = new Zend_Config_Ini($target); $newConfig = new Zend_Config_Ini($target);
$this->assertInstanceOf( $this->assertInstanceOf(
'\Zend_Config', '\Zend_Config',
$newConfig->get('section'), $newConfig->get('section'),
'PreservingIniWriter does not insert sections' 'IniWriter does not insert sections'
); );
$this->assertInstanceOf( $this->assertInstanceOf(
'\Zend_Config', '\Zend_Config',
$newConfig->get('section')->get('a'), $newConfig->get('section')->get('a'),
'PreservingIniWriter does not insert nested section properties' 'IniWriter does not insert nested section properties'
); );
$this->assertEquals( $this->assertEquals(
'c', 'c',
$newConfig->get('section')->get('a')->get('b'), $newConfig->get('section')->get('a')->get('b'),
'PreservingIniWriter does not insert nested section properties' 'IniWriter does not insert nested section properties'
); );
} }
@ -239,14 +239,14 @@ a.b = "c"
EOD EOD
); );
$config = new Zend_Config(array('section' => array('a' => array('b' => 'cc')))); $config = new Zend_Config(array('section' => array('a' => array('b' => 'cc'))));
$writer = new PreservingIniWriter(array('config' => $config, 'filename' => $target)); $writer = new IniWriter(array('config' => $config, 'filename' => $target));
$writer->write(); $writer->write();
$newConfig = new Zend_Config_Ini($target); $newConfig = new Zend_Config_Ini($target);
$this->assertEquals( $this->assertEquals(
'cc', 'cc',
$newConfig->get('section')->get('a')->get('b'), $newConfig->get('section')->get('a')->get('b'),
'PreservingIniWriter does not update nested section properties' 'IniWriter does not update nested section properties'
); );
} }
@ -261,13 +261,13 @@ a.b = "c"
EOD EOD
); );
$config = new Zend_Config(array('section' => array())); $config = new Zend_Config(array('section' => array()));
$writer = new PreservingIniWriter(array('config' => $config, 'filename' => $target)); $writer = new IniWriter(array('config' => $config, 'filename' => $target));
$writer->write(); $writer->write();
$newConfig = new Zend_Config_Ini($target); $newConfig = new Zend_Config_Ini($target);
$this->assertNull( $this->assertNull(
$newConfig->get('section')->get('a'), $newConfig->get('section')->get('a'),
'PreservingIniWriter does not delete nested section properties' 'IniWriter does not delete nested section properties'
); );
} }
@ -281,29 +281,29 @@ EOD
) )
); );
$config->setExtend('bar', 'foo'); $config->setExtend('bar', 'foo');
$writer = new PreservingIniWriter(array('config' => $config, 'filename' => $target)); $writer = new IniWriter(array('config' => $config, 'filename' => $target));
$writer->write(); $writer->write();
$newConfig = new Zend_Config_Ini($target); $newConfig = new Zend_Config_Ini($target);
$this->assertInstanceOf( $this->assertInstanceOf(
'\Zend_Config', '\Zend_Config',
$newConfig->get('foo'), $newConfig->get('foo'),
'PreservingIniWriter does not insert extended sections' 'IniWriter does not insert extended sections'
); );
$this->assertInstanceOf( $this->assertInstanceOf(
'\Zend_Config', '\Zend_Config',
$newConfig->get('bar'), $newConfig->get('bar'),
'PreservingIniWriter does not insert extending sections' 'IniWriter does not insert extending sections'
); );
$this->assertEquals( $this->assertEquals(
'2', '2',
$newConfig->get('bar')->get('key2'), $newConfig->get('bar')->get('key2'),
'PreservingIniWriter does not insert simple properties into extending sections' 'IniWriter does not insert simple properties into extending sections'
); );
$this->assertEquals( $this->assertEquals(
'1', '1',
$newConfig->get('foo')->get('key1'), $newConfig->get('foo')->get('key1'),
'PreservingIniWriter does not properly define extending sections' 'IniWriter does not properly define extending sections'
); );
} }
@ -327,14 +327,14 @@ EOD
) )
); );
$config->setExtend('bar', 'foo'); $config->setExtend('bar', 'foo');
$writer = new PreservingIniWriter(array('config' => $config, 'filename' => $target)); $writer = new IniWriter(array('config' => $config, 'filename' => $target));
$writer->write(); $writer->write();
$newConfig = new Zend_Config_Ini($target); $newConfig = new Zend_Config_Ini($target);
$this->assertEquals( $this->assertEquals(
'22', '22',
$newConfig->get('bar')->get('key2'), $newConfig->get('bar')->get('key2'),
'PreservingIniWriter does not update simple properties of extending sections' 'IniWriter does not update simple properties of extending sections'
); );
} }
@ -358,13 +358,13 @@ EOD
) )
); );
$config->setExtend('bar', 'foo'); $config->setExtend('bar', 'foo');
$writer = new PreservingIniWriter(array('config' => $config, 'filename' => $target)); $writer = new IniWriter(array('config' => $config, 'filename' => $target));
$writer->write(); $writer->write();
$newConfig = new Zend_Config_Ini($target); $newConfig = new Zend_Config_Ini($target);
$this->assertNull( $this->assertNull(
$newConfig->get('bar')->get('key2'), $newConfig->get('bar')->get('key2'),
'PreservingIniWriter does not delete simple properties of extending sections' 'IniWriter does not delete simple properties of extending sections'
); );
} }
@ -378,34 +378,34 @@ EOD
) )
); );
$config->setExtend('bar', 'foo'); $config->setExtend('bar', 'foo');
$writer = new PreservingIniWriter(array('config' => $config, 'filename' => $target)); $writer = new IniWriter(array('config' => $config, 'filename' => $target));
$writer->write(); $writer->write();
$newConfig = new Zend_Config_Ini($target); $newConfig = new Zend_Config_Ini($target);
$this->assertInstanceOf( $this->assertInstanceOf(
'\Zend_Config', '\Zend_Config',
$newConfig->get('foo'), $newConfig->get('foo'),
'PreservingIniWriter does not insert extended sections' 'IniWriter does not insert extended sections'
); );
$this->assertInstanceOf( $this->assertInstanceOf(
'\Zend_Config', '\Zend_Config',
$newConfig->get('bar'), $newConfig->get('bar'),
'PreservingIniWriter does not insert extending sections' 'IniWriter does not insert extending sections'
); );
$this->assertInstanceOf( $this->assertInstanceOf(
'\Zend_Config', '\Zend_Config',
$newConfig->get('bar')->get('d'), $newConfig->get('bar')->get('d'),
'PreservingIniWriter does not insert nested properties into extending sections' 'IniWriter does not insert nested properties into extending sections'
); );
$this->assertEquals( $this->assertEquals(
'f', 'f',
$newConfig->get('bar')->get('d')->get('e'), $newConfig->get('bar')->get('d')->get('e'),
'PreservingIniWriter does not insert nested properties into extending sections' 'IniWriter does not insert nested properties into extending sections'
); );
$this->assertEquals( $this->assertEquals(
'c', 'c',
$newConfig->get('bar')->get('a')->get('b'), $newConfig->get('bar')->get('a')->get('b'),
'PreservingIniWriter does not properly define extending sections with nested properties' 'IniWriter does not properly define extending sections with nested properties'
); );
} }
@ -429,14 +429,14 @@ EOD
) )
); );
$config->setExtend('bar', 'foo'); $config->setExtend('bar', 'foo');
$writer = new PreservingIniWriter(array('config' => $config, 'filename' => $target)); $writer = new IniWriter(array('config' => $config, 'filename' => $target));
$writer->write(); $writer->write();
$newConfig = new Zend_Config_Ini($target); $newConfig = new Zend_Config_Ini($target);
$this->assertEquals( $this->assertEquals(
'ff', 'ff',
$newConfig->get('bar')->get('d')->get('e'), $newConfig->get('bar')->get('d')->get('e'),
'PreservingIniWriter does not update nested properties of extending sections' 'IniWriter does not update nested properties of extending sections'
); );
} }
@ -460,13 +460,13 @@ EOD
) )
); );
$config->setExtend('bar', 'foo'); $config->setExtend('bar', 'foo');
$writer = new PreservingIniWriter(array('config' => $config, 'filename' => $target)); $writer = new IniWriter(array('config' => $config, 'filename' => $target));
$writer->write(); $writer->write();
$newConfig = new Zend_Config_Ini($target); $newConfig = new Zend_Config_Ini($target);
$this->assertNull( $this->assertNull(
$newConfig->get('bar')->get('d'), $newConfig->get('bar')->get('d'),
'PreservingIniWriter does not delete nested properties of extending sections' 'IniWriter does not delete nested properties of extending sections'
); );
} }
@ -504,7 +504,7 @@ key1 = "1"
key2 = "2" key2 = "2"
EOD; EOD;
$target = $this->writeConfigToTemporaryFile($config); $target = $this->writeConfigToTemporaryFile($config);
$writer = new PreservingIniWriter( $writer = new IniWriter(
array( array(
'config' => new Zend_Config( 'config' => new Zend_Config(
array( array(
@ -535,7 +535,7 @@ EOD;
$this->assertEquals( $this->assertEquals(
trim($reverted), trim($reverted),
trim($writer->render()), trim($writer->render()),
'PreservingIniWriter does not preserve section and/or property order' 'IniWriter does not preserve section and/or property order'
); );
} }
@ -559,7 +559,7 @@ EOD;
[one] [one]
EOD; EOD;
$target = $this->writeConfigToTemporaryFile($config); $target = $this->writeConfigToTemporaryFile($config);
$writer = new PreservingIniWriter( $writer = new IniWriter(
array( array(
'config' => new Zend_Config( 'config' => new Zend_Config(
array( array(
@ -574,7 +574,7 @@ EOD;
$this->assertEquals( $this->assertEquals(
trim($reverted), trim($reverted),
trim($writer->render()), trim($writer->render()),
'PreservingIniWriter does not preserve section and/or property order' 'IniWriter does not preserve section and/or property order'
); );
} }
@ -588,14 +588,14 @@ key = "value"
; boring comment ; boring comment
EOD; EOD;
$target = $this->writeConfigToTemporaryFile($config); $target = $this->writeConfigToTemporaryFile($config);
$writer = new PreservingIniWriter( $writer = new IniWriter(
array('config' => new Zend_Config(array('key' => 'value')), 'filename' => $target) array('config' => new Zend_Config(array('key' => 'value')), 'filename' => $target)
); );
$this->assertEquals( $this->assertEquals(
$config, $config,
$writer->render(), $writer->render(),
'PreservingIniWriter does not preserve comments on empty lines' 'IniWriter does not preserve comments on empty lines'
); );
} }
@ -608,7 +608,7 @@ key = "value" ; some comment for a small sized pro
xxl = "very loooooooooooooooooooooong" ; my value is very lo... xxl = "very loooooooooooooooooooooong" ; my value is very lo...
EOD; EOD;
$target = $this->writeConfigToTemporaryFile($config); $target = $this->writeConfigToTemporaryFile($config);
$writer = new PreservingIniWriter( $writer = new IniWriter(
array( array(
'config' => new Zend_Config( 'config' => new Zend_Config(
array( array(
@ -625,7 +625,7 @@ EOD;
$this->assertEquals( $this->assertEquals(
$config, $config,
$writer->render(), $writer->render(),
'PreservingIniWriter does not preserve comments on property lines' 'IniWriter does not preserve comments on property lines'
); );
} }
@ -637,14 +637,14 @@ EOD;
key = "value" key = "value"
EOD; EOD;
$target = $this->writeConfigToTemporaryFile($config); $target = $this->writeConfigToTemporaryFile($config);
$writer = new PreservingIniWriter( $writer = new IniWriter(
array('config' => new Zend_Config(array('section' => array('key' => 'value'))), 'filename' => $target) array('config' => new Zend_Config(array('section' => array('key' => 'value'))), 'filename' => $target)
); );
$this->assertEquals( $this->assertEquals(
$config, $config,
$writer->render(), $writer->render(),
'PreservingIniWriter does not preserve comments on empty section lines' 'IniWriter does not preserve comments on empty section lines'
); );
} }
@ -658,7 +658,7 @@ key = "value" ; some comment for a small sized pro
xxl = "very loooooooooooooooooooooong" ; my value is very lo... xxl = "very loooooooooooooooooooooong" ; my value is very lo...
EOD; EOD;
$target = $this->writeConfigToTemporaryFile($config); $target = $this->writeConfigToTemporaryFile($config);
$writer = new PreservingIniWriter( $writer = new IniWriter(
array( array(
'config' => new Zend_Config( 'config' => new Zend_Config(
array( array(
@ -677,13 +677,13 @@ EOD;
$this->assertEquals( $this->assertEquals(
$config, $config,
$writer->render(), $writer->render(),
'PreservingIniWriter does not preserve comments on property lines' 'IniWriter does not preserve comments on property lines'
); );
} }
public function testKeyNormalization() public function testKeyNormalization()
{ {
$normalKeys = new PreservingIniWriter( $normalKeys = new IniWriter(
array ( array (
'config' => new Zend_Config(array ( 'config' => new Zend_Config(array (
'foo' => 'bar', 'foo' => 'bar',
@ -704,7 +704,7 @@ EOD;
); );
$nestedKeys = new PreservingIniWriter( $nestedKeys = new IniWriter(
array ( array (
'config' => new Zend_Config(array ( 'config' => new Zend_Config(array (
'foo' => 'bar', 'foo' => 'bar',

View File

@ -5,9 +5,9 @@
namespace Tests\Icinga\Logger\Writer; namespace Tests\Icinga\Logger\Writer;
use Zend_Config; use Zend_Config;
use Icinga\Logger\Logger; use Icinga\Application\Logger;
use Icinga\Application\Logger\Writer\FileWriter;
use Icinga\Test\BaseTestCase; use Icinga\Test\BaseTestCase;
use Icinga\Logger\Writer\FileWriter;
class StreamWriterTest extends BaseTestCase class StreamWriterTest extends BaseTestCase
{ {