* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. *
******************************************************************************/
+#define BOOST_TEST_MAIN
+
#include "icinga/icingaapplication.hpp"
#include "base/application.hpp"
#include <BoostTestTargetConfig.h>
using namespace icinga;
-static bool init_unit_test()
-{
- return true;
-}
-
-int main(int argc, char *argv[])
+struct TestIcingaApplication
{
- Application::InitializeBase();
-
- IcingaApplication::Ptr appInst;
+ TestIcingaApplication()
+ {
+ Application::InitializeBase();
- appInst = new IcingaApplication();
- static_pointer_cast<ConfigObject>(appInst)->OnConfigLoaded();
+ IcingaApplication::Ptr appInst;
- int rc = boost::unit_test::unit_test_main(&init_unit_test, argc, argv);
+ appInst = new IcingaApplication();
+ static_pointer_cast<ConfigObject>(appInst)->OnConfigLoaded();
+ }
- appInst.reset();
+ ~TestIcingaApplication()
+ {
+ IcingaApplication::GetInstance().reset();
+ }
+};
- Application::Exit(rc);
-}
+BOOST_GLOBAL_FIXTURE(TestIcingaApplication);