]> granicus.if.org Git - icinga2/blob - test/icingaapplication-fixture.cpp
Merge pull request #6999 from Icinga/bugfix/compiler-warnings
[icinga2] / test / icingaapplication-fixture.cpp
1 /* Icinga 2 | (c) 2012 Icinga GmbH | GPLv2+ */
2
3 #include "icingaapplication-fixture.hpp"
4
5 using namespace icinga;
6
7 static bool IcingaInitialized = false;
8
9 IcingaApplicationFixture::IcingaApplicationFixture()
10 {
11         if (!IcingaInitialized)
12                 InitIcingaApplication();
13 }
14
15 void IcingaApplicationFixture::InitIcingaApplication()
16 {
17         BOOST_TEST_MESSAGE("Initializing Application...");
18         Application::InitializeBase();
19
20         BOOST_TEST_MESSAGE("Initializing IcingaApplication...");
21         IcingaApplication::Ptr appInst = new IcingaApplication();
22         static_pointer_cast<ConfigObject>(appInst)->OnConfigLoaded();
23
24         IcingaInitialized = true;
25 }
26
27 IcingaApplicationFixture::~IcingaApplicationFixture()
28 {
29         IcingaApplication::GetInstance().reset();
30 }
31
32 BOOST_GLOBAL_FIXTURE(IcingaApplicationFixture);