Add prefix to config db 24/33924/1
authorPiotr Bartosiewicz <p.bartosiewi@partner.samsung.com>
Fri, 16 Jan 2015 14:00:40 +0000 (15:00 +0100)
committerPiotr Bartosiewicz <p.bartosiewi@partner.samsung.com>
Fri, 16 Jan 2015 14:00:40 +0000 (15:00 +0100)
[Bug/Feature]   Added prefix to config db. Adjusted to libConfig
                changes.
[Cause]         N/A
[Solution]      N/A
[Verification]  Build, run tests

Change-Id: Ie2cbf4cd4c8b4ef6225b5a2bfa740e5f61129fcc

server/server.cpp
server/zone-provision.cpp
server/zone.cpp
server/zones-manager.cpp
tests/unit_tests/config/ut-configuration.cpp
tests/unit_tests/config/ut-dynvisit.cpp
tests/unit_tests/server/ut-zone-admin.cpp
tests/unit_tests/server/ut-zone-provision.cpp

index 2f30a55..874b02f 100644 (file)
@@ -144,7 +144,7 @@ bool Server::prepareEnvironment(const std::string& configPath, bool runAsRoot)
 
     // TODO: currently this config is loaded twice: here and in ZonesManager
     ZonesManagerConfig config;
-    config::loadFromFile(configPath, config);
+    config::loadFromJsonFile(configPath, config);
 
     struct passwd* pwd = ::getpwnam(VASUM_USER);
     if (pwd == NULL) {
index b9192a4..c04a32a 100644 (file)
@@ -51,10 +51,10 @@ void declareUnit(const std::string& file, ZoneProvisioning::Unit&& unit)
      // TODO: Add to the dynamic configuration
     ZoneProvisioning config;
     if (fs::exists(file)) {
-        config::loadFromFile(file, config);
+        config::loadFromJsonFile(file, config);
     }
     config.units.push_back(std::move(unit));
-    config::saveToFile(file, config);
+    config::saveToJsonFile(file, config);
 }
 
 } // namespace
@@ -113,7 +113,7 @@ void ZoneProvision::declareLink(const std::string& source,
 void ZoneProvision::start() noexcept
 {
     if (fs::exists(mProvisionFile)) {
-        config::loadFromFile(mProvisionFile, mProvisioningConfig);
+        config::loadFromJsonFile(mProvisionFile, mProvisioningConfig);
         for (const auto& unit : mProvisioningConfig.units) {
             try {
                 if (unit.is<ZoneProvisioning::File>()) {
index 1c4d2b2..d38a0c2 100644 (file)
@@ -58,7 +58,7 @@ Zone::Zone(const utils::Worker::Pointer& worker,
            const std::string& baseRunMountPointPath)
     : mWorker(worker)
 {
-    config::loadFromFile(zoneConfigPath, mConfig);
+    config::loadFromJsonFile(zoneConfigPath, mConfig);
 
     for (std::string r: mConfig.permittedToSend) {
         mPermittedToSend.push_back(boost::regex(r));
index 42a3a48..af1da8d 100644 (file)
@@ -64,8 +64,8 @@ bool regexMatchVector(const std::string& str, const std::vector<boost::regex>& v
     return false;
 }
 
+const std::string DB_PREFIX = "daemon";
 const std::string HOST_ID = "host";
-const std::string ZONE_TEMPLATE_CONFIG_PATH = "template.conf";
 const std::string ENABLED_FILE_NAME = "enabled";
 
 const boost::regex ZONE_NAME_REGEX("~NAME~");
@@ -95,8 +95,8 @@ ZonesManager::ZonesManager(const std::string& configPath)
 {
     LOGD("Instantiating ZonesManager object...");
 
-    config::loadFromFile(configPath, mConfig);
-    config::loadFromKVStoreWithJsonFile(mConfig.dbPath, configPath, mDynamicConfig);
+    config::loadFromJsonFile(configPath, mConfig);
+    config::loadFromKVStoreWithJsonFile(mConfig.dbPath, configPath, mDynamicConfig, DB_PREFIX);
 
     mProxyCallPolicy.reset(new ProxyCallPolicy(mConfig.proxyCallRules));
 
@@ -195,7 +195,7 @@ ZonesManager::~ZonesManager()
 
 void ZonesManager::saveDynamicConfig()
 {
-    config::saveToKVStore(mConfig.dbPath, mDynamicConfig);
+    config::saveToKVStore(mConfig.dbPath, mDynamicConfig, DB_PREFIX);
 }
 
 void ZonesManager::createZone(const std::string& zoneConfigPath)
index 95fc52a..bbf9ed9 100644 (file)
@@ -45,7 +45,7 @@ BOOST_AUTO_TEST_CASE(FromStringTest)
 {
     TestConfig testConfig;
 
-    BOOST_REQUIRE_NO_THROW(loadFromString(jsonTestString, testConfig));
+    BOOST_REQUIRE_NO_THROW(loadFromJsonString(jsonTestString, testConfig));
 
     BOOST_CHECK_EQUAL(12345, testConfig.intVal);
     BOOST_CHECK_EQUAL(-1234567890123456789ll, testConfig.int64Val);
@@ -91,13 +91,13 @@ BOOST_AUTO_TEST_CASE(FromStringTest)
 BOOST_AUTO_TEST_CASE(ToStringTest)
 {
     TestConfig testConfig;
-    BOOST_REQUIRE_NO_THROW(loadFromString(jsonTestString, testConfig));
+    BOOST_REQUIRE_NO_THROW(loadFromJsonString(jsonTestString, testConfig));
 
-    std::string out = saveToString(testConfig);
+    std::string out = saveToJsonString(testConfig);
     BOOST_CHECK_EQUAL(out, jsonTestString);
 
     TestConfig::SubConfigOption unionConfig;
-    BOOST_CHECK_THROW(saveToString(unionConfig), ConfigException);
+    BOOST_CHECK_THROW(saveToJsonString(unionConfig), ConfigException);
 }
 
 namespace loadErrorsTest {
@@ -129,70 +129,70 @@ BOOST_AUTO_TEST_CASE(LoadErrorsTest)
     using namespace loadErrorsTest;
 
     IntConfig config;
-    BOOST_REQUIRE_NO_THROW(loadFromString("{\"field\":1}", config));
+    BOOST_REQUIRE_NO_THROW(loadFromJsonString("{\"field\":1}", config));
 
-    BOOST_CHECK_THROW(loadFromString("", config), ConfigException);
-    BOOST_CHECK_THROW(loadFromString("{", config), ConfigException); // invalid json
-    BOOST_CHECK_THROW(loadFromString("{}", config), ConfigException); // missing field
+    BOOST_CHECK_THROW(loadFromJsonString("", config), ConfigException);
+    BOOST_CHECK_THROW(loadFromJsonString("{", config), ConfigException); // invalid json
+    BOOST_CHECK_THROW(loadFromJsonString("{}", config), ConfigException); // missing field
 
     // invalid type
 
     IntConfig intConfig;
-    BOOST_CHECK_NO_THROW(loadFromString("{\"field\": 1}", intConfig));
-    BOOST_CHECK_THROW(loadFromString("{\"field\": \"1\"}", intConfig), ConfigException);
-    BOOST_CHECK_THROW(loadFromString("{\"field\": 1.0}", intConfig), ConfigException);
-    BOOST_CHECK_THROW(loadFromString("{\"field\": true}", intConfig), ConfigException);
-    BOOST_CHECK_THROW(loadFromString("{\"field\": []}", intConfig), ConfigException);
-    BOOST_CHECK_THROW(loadFromString("{\"field\": {}}", intConfig), ConfigException);
-    BOOST_CHECK_THROW(loadFromString("{\"field\": 1234567890123456789}", intConfig), ConfigException);
-    BOOST_CHECK_THROW(loadFromString("{\"field\": -1234567890123456789}", intConfig), ConfigException);
+    BOOST_CHECK_NO_THROW(loadFromJsonString("{\"field\": 1}", intConfig));
+    BOOST_CHECK_THROW(loadFromJsonString("{\"field\": \"1\"}", intConfig), ConfigException);
+    BOOST_CHECK_THROW(loadFromJsonString("{\"field\": 1.0}", intConfig), ConfigException);
+    BOOST_CHECK_THROW(loadFromJsonString("{\"field\": true}", intConfig), ConfigException);
+    BOOST_CHECK_THROW(loadFromJsonString("{\"field\": []}", intConfig), ConfigException);
+    BOOST_CHECK_THROW(loadFromJsonString("{\"field\": {}}", intConfig), ConfigException);
+    BOOST_CHECK_THROW(loadFromJsonString("{\"field\": 1234567890123456789}", intConfig), ConfigException);
+    BOOST_CHECK_THROW(loadFromJsonString("{\"field\": -1234567890123456789}", intConfig), ConfigException);
 
     StringConfig stringConfig;
-    BOOST_CHECK_THROW(loadFromString("{\"field\": 1}", stringConfig), ConfigException);
-    BOOST_CHECK_NO_THROW(loadFromString("{\"field\": \"1\"}", stringConfig));
-    BOOST_CHECK_THROW(loadFromString("{\"field\": 1.0}", stringConfig), ConfigException);
-    BOOST_CHECK_THROW(loadFromString("{\"field\": true}", stringConfig), ConfigException);
-    BOOST_CHECK_THROW(loadFromString("{\"field\": []}", stringConfig), ConfigException);
-    BOOST_CHECK_THROW(loadFromString("{\"field\": {}}", stringConfig), ConfigException);
+    BOOST_CHECK_THROW(loadFromJsonString("{\"field\": 1}", stringConfig), ConfigException);
+    BOOST_CHECK_NO_THROW(loadFromJsonString("{\"field\": \"1\"}", stringConfig));
+    BOOST_CHECK_THROW(loadFromJsonString("{\"field\": 1.0}", stringConfig), ConfigException);
+    BOOST_CHECK_THROW(loadFromJsonString("{\"field\": true}", stringConfig), ConfigException);
+    BOOST_CHECK_THROW(loadFromJsonString("{\"field\": []}", stringConfig), ConfigException);
+    BOOST_CHECK_THROW(loadFromJsonString("{\"field\": {}}", stringConfig), ConfigException);
 
     DoubleConfig doubleConfig;
-    BOOST_CHECK_THROW(loadFromString("{\"field\": 1}", doubleConfig), ConfigException);
-    BOOST_CHECK_THROW(loadFromString("{\"field\": \"1\"}", doubleConfig), ConfigException);
-    BOOST_CHECK_NO_THROW(loadFromString("{\"field\": 1.0}", doubleConfig));
-    BOOST_CHECK_THROW(loadFromString("{\"field\": true}", doubleConfig), ConfigException);
-    BOOST_CHECK_THROW(loadFromString("{\"field\": []}", doubleConfig), ConfigException);
-    BOOST_CHECK_THROW(loadFromString("{\"field\": {}}", doubleConfig), ConfigException);
+    BOOST_CHECK_THROW(loadFromJsonString("{\"field\": 1}", doubleConfig), ConfigException);
+    BOOST_CHECK_THROW(loadFromJsonString("{\"field\": \"1\"}", doubleConfig), ConfigException);
+    BOOST_CHECK_NO_THROW(loadFromJsonString("{\"field\": 1.0}", doubleConfig));
+    BOOST_CHECK_THROW(loadFromJsonString("{\"field\": true}", doubleConfig), ConfigException);
+    BOOST_CHECK_THROW(loadFromJsonString("{\"field\": []}", doubleConfig), ConfigException);
+    BOOST_CHECK_THROW(loadFromJsonString("{\"field\": {}}", doubleConfig), ConfigException);
 
     BoolConfig boolConfig;
-    BOOST_CHECK_THROW(loadFromString("{\"field\": 1}", boolConfig), ConfigException);
-    BOOST_CHECK_THROW(loadFromString("{\"field\": \"1\"}", boolConfig), ConfigException);
-    BOOST_CHECK_THROW(loadFromString("{\"field\": 1.0}", boolConfig), ConfigException);
-    BOOST_CHECK_NO_THROW(loadFromString("{\"field\": true}", boolConfig));
-    BOOST_CHECK_THROW(loadFromString("{\"field\": []}", boolConfig), ConfigException);
-    BOOST_CHECK_THROW(loadFromString("{\"field\": {}}", boolConfig), ConfigException);
+    BOOST_CHECK_THROW(loadFromJsonString("{\"field\": 1}", boolConfig), ConfigException);
+    BOOST_CHECK_THROW(loadFromJsonString("{\"field\": \"1\"}", boolConfig), ConfigException);
+    BOOST_CHECK_THROW(loadFromJsonString("{\"field\": 1.0}", boolConfig), ConfigException);
+    BOOST_CHECK_NO_THROW(loadFromJsonString("{\"field\": true}", boolConfig));
+    BOOST_CHECK_THROW(loadFromJsonString("{\"field\": []}", boolConfig), ConfigException);
+    BOOST_CHECK_THROW(loadFromJsonString("{\"field\": {}}", boolConfig), ConfigException);
 
     ArrayConfig arrayConfig;
-    BOOST_CHECK_THROW(loadFromString("{\"field\": 1}", arrayConfig), ConfigException);
-    BOOST_CHECK_THROW(loadFromString("{\"field\": \"1\"}", arrayConfig), ConfigException);
-    BOOST_CHECK_THROW(loadFromString("{\"field\": 1.0}", arrayConfig), ConfigException);
-    BOOST_CHECK_THROW(loadFromString("{\"field\": true}", arrayConfig), ConfigException);
-    BOOST_CHECK_NO_THROW(loadFromString("{\"field\": []}", arrayConfig));
-    BOOST_CHECK_THROW(loadFromString("{\"field\": {}}", arrayConfig), ConfigException);
+    BOOST_CHECK_THROW(loadFromJsonString("{\"field\": 1}", arrayConfig), ConfigException);
+    BOOST_CHECK_THROW(loadFromJsonString("{\"field\": \"1\"}", arrayConfig), ConfigException);
+    BOOST_CHECK_THROW(loadFromJsonString("{\"field\": 1.0}", arrayConfig), ConfigException);
+    BOOST_CHECK_THROW(loadFromJsonString("{\"field\": true}", arrayConfig), ConfigException);
+    BOOST_CHECK_NO_THROW(loadFromJsonString("{\"field\": []}", arrayConfig));
+    BOOST_CHECK_THROW(loadFromJsonString("{\"field\": {}}", arrayConfig), ConfigException);
 
     ObjectConfig objectConfig;
-    BOOST_CHECK_THROW(loadFromString("{\"field\": 1}", objectConfig), ConfigException);
-    BOOST_CHECK_THROW(loadFromString("{\"field\": \"1\"}", objectConfig), ConfigException);
-    BOOST_CHECK_THROW(loadFromString("{\"field\": 1.0}", objectConfig), ConfigException);
-    BOOST_CHECK_THROW(loadFromString("{\"field\": true}", objectConfig), ConfigException);
-    BOOST_CHECK_THROW(loadFromString("{\"field\": []}", objectConfig), ConfigException);
-    BOOST_CHECK_THROW(loadFromString("{\"field\": {}}", objectConfig), ConfigException);
-    BOOST_CHECK_NO_THROW(loadFromString("{\"field\": {\"field\": 1}}", objectConfig));
+    BOOST_CHECK_THROW(loadFromJsonString("{\"field\": 1}", objectConfig), ConfigException);
+    BOOST_CHECK_THROW(loadFromJsonString("{\"field\": \"1\"}", objectConfig), ConfigException);
+    BOOST_CHECK_THROW(loadFromJsonString("{\"field\": 1.0}", objectConfig), ConfigException);
+    BOOST_CHECK_THROW(loadFromJsonString("{\"field\": true}", objectConfig), ConfigException);
+    BOOST_CHECK_THROW(loadFromJsonString("{\"field\": []}", objectConfig), ConfigException);
+    BOOST_CHECK_THROW(loadFromJsonString("{\"field\": {}}", objectConfig), ConfigException);
+    BOOST_CHECK_NO_THROW(loadFromJsonString("{\"field\": {\"field\": 1}}", objectConfig));
 
     UnionConfig unionConfig;
-    BOOST_CHECK_THROW(loadFromString("{\"type\": \"long\", \"value\": 1}", unionConfig), ConfigException);
-    BOOST_CHECK_THROW(loadFromString("{\"type\": \"int\"}", unionConfig), ConfigException);
-    BOOST_CHECK_NO_THROW(loadFromString("{\"type\": \"int\", \"value\": 1}", unionConfig));
-    BOOST_CHECK_NO_THROW(loadFromString("{\"type\": \"bool\", \"value\": true}", unionConfig));
+    BOOST_CHECK_THROW(loadFromJsonString("{\"type\": \"long\", \"value\": 1}", unionConfig), ConfigException);
+    BOOST_CHECK_THROW(loadFromJsonString("{\"type\": \"int\"}", unionConfig), ConfigException);
+    BOOST_CHECK_NO_THROW(loadFromJsonString("{\"type\": \"int\", \"value\": 1}", unionConfig));
+    BOOST_CHECK_NO_THROW(loadFromJsonString("{\"type\": \"bool\", \"value\": true}", unionConfig));
 }
 
 namespace hasVisitableTest {
@@ -247,15 +247,15 @@ BOOST_AUTO_TEST_CASE(HasVisibleInternalHelperTest)
 BOOST_AUTO_TEST_CASE(FromToKVStoreTest)
 {
     TestConfig config;
-    loadFromString(jsonTestString, config);
+    loadFromJsonString(jsonTestString, config);
 
     std::string dbPath = fs::unique_path("/tmp/kvstore-%%%%.db3").string();
 
-    saveToKVStore(dbPath, config);
+    saveToKVStore(dbPath, config, "prefix");
     TestConfig outConfig;
-    loadFromKVStore(dbPath, outConfig);
+    loadFromKVStore(dbPath, outConfig, "prefix");
 
-    std::string out = saveToString(outConfig);
+    std::string out = saveToJsonString(outConfig);
     BOOST_CHECK_EQUAL(out, jsonTestString);
 
     fs::remove(dbPath);
@@ -265,7 +265,7 @@ BOOST_AUTO_TEST_CASE(FromToKVStoreTest)
 BOOST_AUTO_TEST_CASE(FromToFDTest)
 {
     TestConfig config;
-    loadFromString(jsonTestString, config);
+    loadFromJsonString(jsonTestString, config);
     // Setup fd
     std::string fifoPath = fs::unique_path("/tmp/fdstore-%%%%").string();
     BOOST_CHECK(::mkfifo(fifoPath.c_str(), S_IWUSR | S_IRUSR) >= 0);
@@ -276,7 +276,7 @@ BOOST_AUTO_TEST_CASE(FromToFDTest)
     saveToFD(fd, config);
     TestConfig outConfig;
     loadFromFD(fd, outConfig);
-    std::string out = saveToString(outConfig);
+    std::string out = saveToJsonString(outConfig);
     BOOST_CHECK_EQUAL(out, jsonTestString);
 
     // Cleanup
@@ -287,7 +287,7 @@ BOOST_AUTO_TEST_CASE(FromToFDTest)
 BOOST_AUTO_TEST_CASE(ConfigUnionTest)
 {
     TestConfig testConfig;
-    BOOST_REQUIRE_NO_THROW(loadFromString(jsonTestString, testConfig));
+    BOOST_REQUIRE_NO_THROW(loadFromJsonString(jsonTestString, testConfig));
 
     BOOST_CHECK(testConfig.union1.is<int>());
     BOOST_CHECK(!testConfig.union1.is<TestConfig::SubConfig>());
@@ -298,7 +298,7 @@ BOOST_AUTO_TEST_CASE(ConfigUnionTest)
     BOOST_CHECK_EQUAL(subConfig.intVal, 54321);
     BOOST_CHECK(testConfig.unions[0].is<int>());
     BOOST_CHECK(testConfig.unions[1].is<TestConfig::SubConfig>());
-    std::string out = saveToString(testConfig);
+    std::string out = saveToJsonString(testConfig);
     BOOST_CHECK_EQUAL(out, jsonTestString);
 
     //Check copy
@@ -326,7 +326,7 @@ BOOST_AUTO_TEST_CASE(ConfigUnionTest)
 
     testConfig.unions.clear();
     testConfig.unions = unions;
-    out = saveToString(testConfig);
+    out = saveToJsonString(testConfig);
     BOOST_CHECK_EQUAL(out, jsonTestString);
 }
 
index 0a24d5c..dd782f3 100644 (file)
@@ -37,9 +37,11 @@ namespace fs = boost::filesystem;
 
 struct Fixture {
     std::string dbPath;
+    std::string dbPrefix;
 
     Fixture()
         : dbPath(fs::unique_path("/tmp/kvstore-%%%%.db3").string())
+        , dbPrefix("conf")
     {
         fs::remove(dbPath);
     }
@@ -54,7 +56,7 @@ BOOST_FIXTURE_TEST_SUITE(DynVisitSuite, Fixture)
 void checkJsonConfig(const TestConfig& cfg, const std::string& json)
 {
     TestConfig cfg2;
-    loadFromString(json, cfg2);
+    loadFromJsonString(json, cfg2);
     BOOST_CHECK_EQUAL(cfg2.intVal, cfg.intVal);
     BOOST_CHECK_EQUAL(cfg.int64Val, cfg.int64Val);
     BOOST_CHECK_EQUAL(cfg2.boolVal, cfg.boolVal);
@@ -66,34 +68,34 @@ void checkJsonConfig(const TestConfig& cfg, const std::string& json)
 void checkKVConfig(const TestConfig& cfg, const std::string& db)
 {
     KVStore store(db);
-    BOOST_CHECK_EQUAL(store.get<int>(".intVal"), cfg.intVal);
-    BOOST_CHECK_EQUAL(store.get<int64_t>(".int64Val"), cfg.int64Val);
-    BOOST_CHECK_EQUAL(store.get<bool>(".boolVal"), cfg.boolVal);
-    BOOST_CHECK_EQUAL(store.get<std::string>(".stringVal"), cfg.stringVal);
-    BOOST_CHECK_EQUAL(store.get<int>(".intVector"), cfg.intVector.size());
-    BOOST_CHECK_EQUAL(store.get<int>(".subObj.intVal"), cfg.subObj.intVal);
+    BOOST_CHECK_EQUAL(store.get<int>("conf.intVal"), cfg.intVal);
+    BOOST_CHECK_EQUAL(store.get<int64_t>("conf.int64Val"), cfg.int64Val);
+    BOOST_CHECK_EQUAL(store.get<bool>("conf.boolVal"), cfg.boolVal);
+    BOOST_CHECK_EQUAL(store.get<std::string>("conf.stringVal"), cfg.stringVal);
+    BOOST_CHECK_EQUAL(store.get<int>("conf.intVector"), cfg.intVector.size());
+    BOOST_CHECK_EQUAL(store.get<int>("conf.subObj.intVal"), cfg.subObj.intVal);
 }
 
 BOOST_AUTO_TEST_CASE(ReadConfigDefaults)
 {
     TestConfig cfg;
-    loadFromKVStoreWithJson(dbPath, jsonTestString, cfg);
+    loadFromKVStoreWithJson(dbPath, jsonTestString, cfg, dbPrefix);
     checkJsonConfig(cfg, jsonTestString);
 }
 
 BOOST_AUTO_TEST_CASE(ReadConfigNoDefaults)
 {
     TestConfig cfg;
-    loadFromKVStoreWithJson(dbPath, jsonTestString, cfg);
+    loadFromKVStoreWithJson(dbPath, jsonTestString, cfg, dbPrefix);
     // modify and save config
     cfg.intVal += 5;
     cfg.int64Val += 7777;
     cfg.boolVal = !cfg.boolVal;
     cfg.stringVal += "-changed";
-    config::saveToKVStore(dbPath, cfg);
+    config::saveToKVStore(dbPath, cfg, dbPrefix);
 
     TestConfig cfg2;
-    loadFromKVStoreWithJson(dbPath, jsonTestString, cfg2);
+    loadFromKVStoreWithJson(dbPath, jsonTestString, cfg2, dbPrefix);
     checkKVConfig(cfg2, dbPath);
 }
 
index 0cd2ddf..8dc3eb8 100644 (file)
@@ -56,7 +56,7 @@ struct Fixture {
 
     std::unique_ptr<ZoneAdmin> create(const std::string& configPath)
     {
-        config::loadFromFile(configPath, mConfig);
+        config::loadFromJsonFile(configPath, mConfig);
         return std::unique_ptr<ZoneAdmin>(new ZoneAdmin(ZONES_PATH,
                                                                   LXC_TEMPLATES_PATH,
                                                                   mConfig));
index 239d53e..8d1738f 100644 (file)
@@ -92,7 +92,7 @@ BOOST_AUTO_TEST_CASE(DestructorTest)
                                           ""}));
         config.units.push_back(unit);
 
-        config::saveToFile(PROVISION_FILE_PATH.string(), config);
+        config::saveToJsonFile(PROVISION_FILE_PATH.string(), config);
         ZoneProvision zoneProvision(ZONE_PATH.string(), {});
         zoneProvision.start();
     }
@@ -129,7 +129,7 @@ BOOST_AUTO_TEST_CASE(FileTest)
                                     0,
                                     0777}));
     config.units.push_back(unit);
-    config::saveToFile(PROVISION_FILE_PATH.string(), config);
+    config::saveToJsonFile(PROVISION_FILE_PATH.string(), config);
 
     ZoneProvision zoneProvision(ZONE_PATH.string(), {});
     zoneProvision.start();
@@ -170,7 +170,7 @@ BOOST_AUTO_TEST_CASE(MountTest)
                                     O_CREAT,
                                     0777}));
     config.units.push_back(unit);
-    config::saveToFile(PROVISION_FILE_PATH.string(), config);
+    config::saveToJsonFile(PROVISION_FILE_PATH.string(), config);
 
     ZoneProvision zoneProvision(ZONE_PATH.string(), {});
     zoneProvision.start();
@@ -192,7 +192,7 @@ BOOST_AUTO_TEST_CASE(LinkTest)
     unit.set(ZoneProvisioning::Link({PROVISION_FILE_PATH.string(),
                                      linkFile.string()}));
     config.units.push_back(unit);
-    config::saveToFile(PROVISION_FILE_PATH.string(), config);
+    config::saveToJsonFile(PROVISION_FILE_PATH.string(), config);
     {
         ZoneProvision zoneProvision(ZONE_PATH.string(), {});
         zoneProvision.start();
@@ -218,7 +218,7 @@ BOOST_AUTO_TEST_CASE(DeclareFileTest)
     zoneProvision.declareFile(2, "path", 0747, 0777);
 
     ZoneProvisioning config;
-    BOOST_REQUIRE_NO_THROW(loadFromFile(PROVISION_FILE_PATH.string(), config));
+    BOOST_REQUIRE_NO_THROW(loadFromJsonFile(PROVISION_FILE_PATH.string(), config));
     BOOST_REQUIRE_EQUAL(config.units.size(), 2);
     BOOST_REQUIRE(config.units[0].is<ZoneProvisioning::File>());
     BOOST_REQUIRE(config.units[1].is<ZoneProvisioning::File>());
@@ -236,7 +236,7 @@ BOOST_AUTO_TEST_CASE(DeclareMountTest)
     zoneProvision.declareMount("/fake/path2", "/fake/path2", "tmpfs", 077, "fake");
 
     ZoneProvisioning config;
-    BOOST_REQUIRE_NO_THROW(loadFromFile(PROVISION_FILE_PATH.string(), config));
+    BOOST_REQUIRE_NO_THROW(loadFromJsonFile(PROVISION_FILE_PATH.string(), config));
     BOOST_REQUIRE_EQUAL(config.units.size(), 2);
     BOOST_REQUIRE(config.units[0].is<ZoneProvisioning::Mount>());
     BOOST_REQUIRE(config.units[1].is<ZoneProvisioning::Mount>());
@@ -255,7 +255,7 @@ BOOST_AUTO_TEST_CASE(DeclareLinkTest)
     zoneProvision.declareLink("/fake/path2", "/fake/path2");
 
     ZoneProvisioning config;
-    BOOST_REQUIRE_NO_THROW(loadFromFile(PROVISION_FILE_PATH.string(), config));
+    BOOST_REQUIRE_NO_THROW(loadFromJsonFile(PROVISION_FILE_PATH.string(), config));
     BOOST_REQUIRE_EQUAL(config.units.size(), 2);
     BOOST_REQUIRE(config.units[0].is<ZoneProvisioning::Link>());
     BOOST_REQUIRE(config.units[1].is<ZoneProvisioning::Link>());
@@ -286,7 +286,7 @@ BOOST_AUTO_TEST_CASE(ProvisionedAlreadyTest)
                                     0777}));
     config.units.push_back(unit);
 
-    config::saveToFile(PROVISION_FILE_PATH.string(), config);
+    config::saveToJsonFile(PROVISION_FILE_PATH.string(), config);
 
     ZoneProvision zoneProvision(ZONE_PATH.string(), {"/tmp/"});
     zoneProvision.start();