]> granicus.if.org Git - icinga2/blobdiff - test/base-dictionary.cpp
Merge branch 'support/2.4'
[icinga2] / test / base-dictionary.cpp
index eed1229c6c993ab38b59b7b63e652e4c8ada1bfc..f847741dc8d69fb6f9d83aad809c9cbf60ee19e1 100644 (file)
@@ -1,6 +1,6 @@
 /******************************************************************************
  * Icinga 2                                                                   *
- * Copyright (C) 2012-2014 Icinga Development Team (http://www.icinga.org)    *
+ * Copyright (C) 2012-2016 Icinga Development Team (https://www.icinga.org/)  *
  *                                                                            *
  * This program is free software; you can redistribute it and/or              *
  * modify it under the terms of the GNU General Public License                *
@@ -19,7 +19,7 @@
 
 #include "base/dictionary.hpp"
 #include "base/objectlock.hpp"
-#include "base/serializer.hpp"
+#include "base/json.hpp"
 #include <boost/test/unit_test.hpp>
 #include <boost/foreach.hpp>
 #include <boost/tuple/tuple.hpp>
@@ -30,13 +30,13 @@ BOOST_AUTO_TEST_SUITE(base_dictionary)
 
 BOOST_AUTO_TEST_CASE(construct)
 {
-       Dictionary::Ptr dictionary = make_shared<Dictionary>();
+       Dictionary::Ptr dictionary = new Dictionary();
        BOOST_CHECK(dictionary);
 }
 
 BOOST_AUTO_TEST_CASE(get1)
 {
-       Dictionary::Ptr dictionary = make_shared<Dictionary>();
+       Dictionary::Ptr dictionary = new Dictionary();
        dictionary->Set("test1", 7);
        dictionary->Set("test2", "hello world");
 
@@ -58,8 +58,8 @@ BOOST_AUTO_TEST_CASE(get1)
 
 BOOST_AUTO_TEST_CASE(get2)
 {
-       Dictionary::Ptr dictionary = make_shared<Dictionary>();
-       Dictionary::Ptr other = make_shared<Dictionary>();
+       Dictionary::Ptr dictionary = new Dictionary();
+       Dictionary::Ptr other = new Dictionary();
 
        dictionary->Set("test1", other);
 
@@ -74,7 +74,7 @@ BOOST_AUTO_TEST_CASE(get2)
 
 BOOST_AUTO_TEST_CASE(foreach)
 {
-       Dictionary::Ptr dictionary = make_shared<Dictionary>();
+       Dictionary::Ptr dictionary = new Dictionary();
        dictionary->Set("test1", 7);
        dictionary->Set("test2", "hello world");
 
@@ -106,7 +106,7 @@ BOOST_AUTO_TEST_CASE(foreach)
 
 BOOST_AUTO_TEST_CASE(remove)
 {
-       Dictionary::Ptr dictionary = make_shared<Dictionary>();
+       Dictionary::Ptr dictionary = new Dictionary();
 
        dictionary->Set("test1", 7);
        dictionary->Set("test2", "hello world");
@@ -144,7 +144,7 @@ BOOST_AUTO_TEST_CASE(remove)
 
 BOOST_AUTO_TEST_CASE(clone)
 {
-       Dictionary::Ptr dictionary = make_shared<Dictionary>();
+       Dictionary::Ptr dictionary = new Dictionary();
 
        dictionary->Set("test1", 7);
        dictionary->Set("test2", "hello world");
@@ -167,14 +167,14 @@ BOOST_AUTO_TEST_CASE(clone)
 
 BOOST_AUTO_TEST_CASE(json)
 {
-       Dictionary::Ptr dictionary = make_shared<Dictionary>();
+       Dictionary::Ptr dictionary = new Dictionary();
 
        dictionary->Set("test1", 7);
        dictionary->Set("test2", "hello world");
 
-       String json = JsonSerialize(dictionary);
+       String json = JsonEncode(dictionary);
        BOOST_CHECK(json.GetLength() > 0);
-       Dictionary::Ptr deserialized = JsonDeserialize(json);
+       Dictionary::Ptr deserialized = JsonDecode(json);
        BOOST_CHECK(deserialized->GetLength() == 2);
        BOOST_CHECK(deserialized->Get("test1") == 7);
        BOOST_CHECK(deserialized->Get("test2") == "hello world");