mgmt: add sample configuration file and install default configuration
refs: #1332
Change-Id: Ic50aac57382b9760aa3b1c22b7dd2a9fec589cf9
diff --git a/tests/mgmt/command-validator.cpp b/tests/mgmt/command-validator.cpp
index 7a6d39d..4e53322 100644
--- a/tests/mgmt/command-validator.cpp
+++ b/tests/mgmt/command-validator.cpp
@@ -207,7 +207,7 @@
config.addSectionHandler("authorizations",
bind(&CommandValidator::onConfig, boost::ref(validator), _1, _2));
- config.parse(CONFIG, false);
+ config.parse(CONFIG, false, "dummy-config");
validator.validate(*fibCommand,
bind(&CommandValidatorTester::onValidated, boost::ref(m_tester1), _1),
@@ -267,7 +267,7 @@
config.addSectionHandler("authorizations",
bind(&CommandValidator::onConfig, boost::ref(validator), _1, _2));
- config.parse(CONFIG, true);
+ config.parse(CONFIG, true, "dummy-config");
validator.validate(*fibCommand,
bind(&CommandValidatorTester::onValidated, boost::ref(m_tester1), _1),
@@ -312,7 +312,7 @@
config.addSectionHandler("authorizations",
bind(&CommandValidator::onConfig, boost::ref(validator), _1, _2));
- BOOST_CHECK_THROW(config.parse(NO_AUTHORIZE_CONFIG, false), ConfigFile::Error);
+ BOOST_CHECK_THROW(config.parse(NO_AUTHORIZE_CONFIG, false, "dummy-config"), ConfigFile::Error);
}
BOOST_AUTO_TEST_CASE(NoPrivilegesSections)
@@ -331,7 +331,7 @@
config.addSectionHandler("authorizations",
bind(&CommandValidator::onConfig, boost::ref(validator), _1, _2));
- BOOST_CHECK_THROW(config.parse(NO_PRIVILEGES_CONFIG, false), ConfigFile::Error);
+ BOOST_CHECK_THROW(config.parse(NO_PRIVILEGES_CONFIG, false, "dummy-config"), ConfigFile::Error);
}
BOOST_AUTO_TEST_CASE(InvalidKeyFile)
@@ -355,7 +355,7 @@
config.addSectionHandler("authorizations",
bind(&CommandValidator::onConfig, boost::ref(validator), _1, _2));
- BOOST_CHECK_THROW(config.parse(INVALID_KEY_CONFIG, false), ConfigFile::Error);
+ BOOST_CHECK_THROW(config.parse(INVALID_KEY_CONFIG, false, "dummy-config"), ConfigFile::Error);
}
BOOST_AUTO_TEST_CASE(NoKeyFile)
@@ -379,7 +379,7 @@
config.addSectionHandler("authorizations",
bind(&CommandValidator::onConfig, boost::ref(validator), _1, _2));
- BOOST_CHECK_THROW(config.parse(NO_KEY_CONFIG, false), ConfigFile::Error);
+ BOOST_CHECK_THROW(config.parse(NO_KEY_CONFIG, false, "dummy-config"), ConfigFile::Error);
}
BOOST_AUTO_TEST_CASE(MalformedKey)
@@ -404,7 +404,7 @@
config.addSectionHandler("authorizations",
bind(&CommandValidator::onConfig, boost::ref(validator), _1, _2));
- BOOST_CHECK_THROW(config.parse(MALFORMED_KEY_CONFIG, false), ConfigFile::Error);
+ BOOST_CHECK_THROW(config.parse(MALFORMED_KEY_CONFIG, false, "dummy-config"), ConfigFile::Error);
}
bool
@@ -431,7 +431,7 @@
config.addSectionHandler("authorizations",
bind(&CommandValidator::onConfig, boost::ref(validator), _1, _2));
- BOOST_CHECK_EXCEPTION(config.parse(NO_AUTHORIZE_CONFIG, true),
+ BOOST_CHECK_EXCEPTION(config.parse(NO_AUTHORIZE_CONFIG, true, "dummy-config"),
ConfigFile::Error,
bind(&validateErrorMessage,
"No authorize sections found", _1));
@@ -472,7 +472,7 @@
<< "No privileges section found for key file tests/mgmt/key2.pub "
<< "(" << m_tester2.getPublicKeyName().toUri() << ")";
- BOOST_CHECK_EXCEPTION(config.parse(NO_PRIVILEGES_CONFIG, true),
+ BOOST_CHECK_EXCEPTION(config.parse(NO_PRIVILEGES_CONFIG, true, "dummy-config"),
ConfigFile::Error,
bind(&validateErrorMessage, expectedError.str(), _1));
}
@@ -506,7 +506,7 @@
config.addSectionHandler("authorizations",
bind(&CommandValidator::onConfig, boost::ref(validator), _1, _2));
- BOOST_CHECK_EXCEPTION(config.parse(INVALID_KEY_CONFIG, true),
+ BOOST_CHECK_EXCEPTION(config.parse(INVALID_KEY_CONFIG, true, "dummy-config"),
ConfigFile::Error,
bind(&validateErrorMessage,
"Unable to open key file tests/mgmt/notakeyfile.pub\n"
@@ -537,7 +537,7 @@
config.addSectionHandler("authorizations",
bind(&CommandValidator::onConfig, boost::ref(validator), _1, _2));
- BOOST_CHECK_EXCEPTION(config.parse(NO_KEY_CONFIG, true),
+ BOOST_CHECK_EXCEPTION(config.parse(NO_KEY_CONFIG, true, "dummy-config"),
ConfigFile::Error,
bind(&validateErrorMessage,
"No keyfile specified\n"
@@ -570,7 +570,7 @@
config.addSectionHandler("authorizations",
bind(&CommandValidator::onConfig, boost::ref(validator), _1, _2));
- BOOST_CHECK_EXCEPTION(config.parse(MALFORMED_KEY_CONFIG, true),
+ BOOST_CHECK_EXCEPTION(config.parse(MALFORMED_KEY_CONFIG, true, "dummy-config"),
ConfigFile::Error,
bind(&validateErrorMessage,
"Malformed key file tests/mgmt/malformedkey.pub\n"
diff --git a/tests/mgmt/config-file.cpp b/tests/mgmt/config-file.cpp
index ca89aec..830ebbb 100644
--- a/tests/mgmt/config-file.cpp
+++ b/tests/mgmt/config-file.cpp
@@ -202,8 +202,7 @@
input.open("tests/mgmt/config_example.info");
BOOST_REQUIRE(input.is_open());
- file.parse(input);
-
+ file.parse(input, false, "config_example.info");
BOOST_CHECK(sub.allCallbacksFired());
}
@@ -214,7 +213,7 @@
std::ifstream input;
- BOOST_CHECK_THROW(file.parse(input), ConfigFile::Error);
+ BOOST_CHECK_THROW(file.parse(input, false, "unknown"), ConfigFile::Error);
BOOST_CHECK(sub.noCallbacksFired());
}
@@ -224,7 +223,7 @@
ConfigFile file;
DummyAllSubscriber sub(file);
- file.parse(CONFIG);
+ file.parse(CONFIG, false, "dummy-config");
BOOST_CHECK(sub.allCallbacksFired());
}
@@ -234,7 +233,7 @@
ConfigFile file;
DummyAllSubscriber sub(file);
- BOOST_CHECK_THROW(file.parse(std::string()), ConfigFile::Error);
+ BOOST_CHECK_THROW(file.parse(std::string(), false, "dummy-config"), ConfigFile::Error);
BOOST_CHECK(sub.noCallbacksFired());
}
@@ -243,7 +242,7 @@
ConfigFile file;
DummyAllSubscriber sub(file);
- BOOST_CHECK_THROW(file.parse(MALFORMED_CONFIG), ConfigFile::Error);
+ BOOST_CHECK_THROW(file.parse(MALFORMED_CONFIG, false, "dummy-config"), ConfigFile::Error);
BOOST_CHECK(sub.noCallbacksFired());
}
@@ -252,7 +251,7 @@
ConfigFile file;
DummyAllSubscriber sub(file, true);
- file.parse(CONFIG, true);
+ file.parse(CONFIG, true, "dummy-config");
BOOST_CHECK(sub.allCallbacksFired());
}
@@ -262,7 +261,7 @@
ConfigFile file;
DummyAllSubscriber sub(file);
- file.parse("tests/mgmt/config_example.info");
+ file.parse("tests/mgmt/config_example.info", false);
BOOST_CHECK(sub.allCallbacksFired());
}
@@ -272,7 +271,7 @@
ConfigFile file;
DummyAllSubscriber sub(file);
- BOOST_CHECK_THROW(file.parse("i_made_this_up.info"), ConfigFile::Error);
+ BOOST_CHECK_THROW(file.parse("i_made_this_up.info", false), ConfigFile::Error);
BOOST_CHECK(sub.noCallbacksFired());
}
@@ -282,7 +281,7 @@
ConfigFile file;
DummyAllSubscriber sub(file);
- BOOST_CHECK_THROW(file.parse("tests/mgmt/config_malformed.info"), ConfigFile::Error);
+ BOOST_CHECK_THROW(file.parse("tests/mgmt/config_malformed.info", false), ConfigFile::Error);
BOOST_CHECK(sub.noCallbacksFired());
}
@@ -296,7 +295,7 @@
input.open("tests/mgmt/config_example.info");
BOOST_REQUIRE(input.is_open());
- file.parse(input, true);
+ file.parse(input, true, "tests/mgmt/config_example.info");
BOOST_CHECK(sub.allCallbacksFired());
@@ -318,7 +317,7 @@
DummyAllSubscriber sub1(file);
DummyAllSubscriber sub2(file);
- file.parse(CONFIG);
+ file.parse(CONFIG, false, "dummy-config");
BOOST_CHECK(sub1.noCallbacksFired());
BOOST_CHECK(sub2.allCallbacksFired());
@@ -328,7 +327,7 @@
{
ConfigFile file;
- BOOST_CHECK_THROW(file.parse(CONFIG), ConfigFile::Error);
+ BOOST_CHECK_THROW(file.parse(CONFIG, false, "dummy-config"), ConfigFile::Error);
}
BOOST_AUTO_TEST_CASE(OnConfigCoveredByPartialSubscribers)
@@ -337,7 +336,7 @@
DummyOneSubscriber subA(file, "a");
DummyOneSubscriber subB(file, "b");
- file.parse(CONFIG);
+ file.parse(CONFIG, false, "dummy-config");
BOOST_CHECK(subA.allCallbacksFired());
BOOST_CHECK(subB.allCallbacksFired());
diff --git a/tests/mgmt/face-manager.cpp b/tests/mgmt/face-manager.cpp
index e4e7954..191de04 100644
--- a/tests/mgmt/face-manager.cpp
+++ b/tests/mgmt/face-manager.cpp
@@ -260,7 +260,7 @@
void
parseConfig(const std::string configuration, bool isDryRun)
{
- m_config.parse(configuration, isDryRun);
+ m_config.parse(configuration, isDryRun, "dummy-config");
}
virtual