Commit 8b853a9e authored by Francis Dupont's avatar Francis Dupont

[5085] Enforced lower case JSON keywords

parent a082bb9f
...@@ -207,25 +207,25 @@ public: ...@@ -207,25 +207,25 @@ public:
params["space"] = DHCP4_OPTION_SPACE; params["space"] = DHCP4_OPTION_SPACE;
params["code"] = "56"; params["code"] = "56";
params["data"] = "ABCDEF0105"; params["data"] = "ABCDEF0105";
params["csv-format"] = "False"; params["csv-format"] = "false";
} else if (parameter == "space") { } else if (parameter == "space") {
params["name"] = "dhcp-message"; params["name"] = "dhcp-message";
params["space"] = param_value; params["space"] = param_value;
params["code"] = "56"; params["code"] = "56";
params["data"] = "ABCDEF0105"; params["data"] = "ABCDEF0105";
params["csv-format"] = "False"; params["csv-format"] = "false";
} else if (parameter == "code") { } else if (parameter == "code") {
params["name"] = "dhcp-message"; params["name"] = "dhcp-message";
params["space"] = DHCP4_OPTION_SPACE; params["space"] = DHCP4_OPTION_SPACE;
params["code"] = param_value; params["code"] = param_value;
params["data"] = "ABCDEF0105"; params["data"] = "ABCDEF0105";
params["csv-format"] = "False"; params["csv-format"] = "false";
} else if (parameter == "data") { } else if (parameter == "data") {
params["name"] = "dhcp-message"; params["name"] = "dhcp-message";
params["space"] = DHCP4_OPTION_SPACE; params["space"] = DHCP4_OPTION_SPACE;
params["code"] = "56"; params["code"] = "56";
params["data"] = param_value; params["data"] = param_value;
params["csv-format"] = "False"; params["csv-format"] = "false";
} else if (parameter == "csv-format") { } else if (parameter == "csv-format") {
params["name"] = "dhcp-message"; params["name"] = "dhcp-message";
params["space"] = DHCP4_OPTION_SPACE; params["space"] = DHCP4_OPTION_SPACE;
...@@ -1670,7 +1670,7 @@ TEST_F(Dhcp4ParserTest, optionDefArray) { ...@@ -1670,7 +1670,7 @@ TEST_F(Dhcp4ParserTest, optionDefArray) {
" \"name\": \"foo\"," " \"name\": \"foo\","
" \"code\": 100," " \"code\": 100,"
" \"type\": \"uint32\"," " \"type\": \"uint32\","
" \"array\": True," " \"array\": true,"
" \"space\": \"isc\"" " \"space\": \"isc\""
" } ]" " } ]"
"}"; "}";
...@@ -1851,7 +1851,7 @@ TEST_F(Dhcp4ParserTest, optionDefEncapsulatedSpaceAndArray) { ...@@ -1851,7 +1851,7 @@ TEST_F(Dhcp4ParserTest, optionDefEncapsulatedSpaceAndArray) {
" \"name\": \"foo\"," " \"name\": \"foo\","
" \"code\": 100," " \"code\": 100,"
" \"type\": \"uint32\"," " \"type\": \"uint32\","
" \"array\": True," " \"array\": true,"
" \"space\": \"isc\"," " \"space\": \"isc\","
" \"encapsulate\": \"valid-space-name\"" " \"encapsulate\": \"valid-space-name\""
" } ]" " } ]"
...@@ -1994,12 +1994,12 @@ TEST_F(Dhcp4ParserTest, optionDataDefaultsGlobal) { ...@@ -1994,12 +1994,12 @@ TEST_F(Dhcp4ParserTest, optionDataDefaultsGlobal) {
"\"option-data\": [ {" "\"option-data\": [ {"
" \"name\": \"dhcp-message\"," " \"name\": \"dhcp-message\","
" \"data\": \"ABCDEF0105\"," " \"data\": \"ABCDEF0105\","
" \"csv-format\": False" " \"csv-format\": false"
" }," " },"
" {" " {"
" \"name\": \"default-ip-ttl\"," " \"name\": \"default-ip-ttl\","
" \"data\": \"01\"," " \"data\": \"01\","
" \"csv-format\": False" " \"csv-format\": false"
" } ]," " } ],"
"\"subnet4\": [ { " "\"subnet4\": [ { "
" \"pools\": [ { \"pool\": \"192.0.2.1 - 192.0.2.100\" } ]," " \"pools\": [ { \"pool\": \"192.0.2.1 - 192.0.2.100\" } ],"
...@@ -2066,12 +2066,12 @@ TEST_F(Dhcp4ParserTest, optionDataDefaultsSubnet) { ...@@ -2066,12 +2066,12 @@ TEST_F(Dhcp4ParserTest, optionDataDefaultsSubnet) {
" \"option-data\": [ {" " \"option-data\": [ {"
" \"name\": \"dhcp-message\"," " \"name\": \"dhcp-message\","
" \"data\": \"ABCDEF0105\"," " \"data\": \"ABCDEF0105\","
" \"csv-format\": False" " \"csv-format\": false"
" }," " },"
" {" " {"
" \"name\": \"default-ip-ttl\"," " \"name\": \"default-ip-ttl\","
" \"data\": \"01\"," " \"data\": \"01\","
" \"csv-format\": False" " \"csv-format\": false"
" } ]" " } ]"
" } ]," " } ],"
"\"valid-lifetime\": 4000 }"; "\"valid-lifetime\": 4000 }";
...@@ -2137,7 +2137,7 @@ TEST_F(Dhcp4ParserTest, optionDataTwoSpaces) { ...@@ -2137,7 +2137,7 @@ TEST_F(Dhcp4ParserTest, optionDataTwoSpaces) {
"\"option-data\": [ {" "\"option-data\": [ {"
" \"name\": \"dhcp-message\"," " \"name\": \"dhcp-message\","
" \"data\": \"ABCDEF0105\"," " \"data\": \"ABCDEF0105\","
" \"csv-format\": False" " \"csv-format\": false"
" }," " },"
" {" " {"
" \"name\": \"foo\"," " \"name\": \"foo\","
...@@ -2330,7 +2330,7 @@ TEST_F(Dhcp4ParserTest, optionDataInSingleSubnet) { ...@@ -2330,7 +2330,7 @@ TEST_F(Dhcp4ParserTest, optionDataInSingleSubnet) {
"\"option-data\": [ {" "\"option-data\": [ {"
" \"name\": \"dhcp-message\"," " \"name\": \"dhcp-message\","
" \"data\": \"AB\"," " \"data\": \"AB\","
" \"csv-format\": False" " \"csv-format\": false"
" } ]," " } ],"
"\"subnet4\": [ { " "\"subnet4\": [ { "
" \"pools\": [ { \"pool\": \"192.0.2.1 - 192.0.2.100\" } ]," " \"pools\": [ { \"pool\": \"192.0.2.1 - 192.0.2.100\" } ],"
...@@ -2338,12 +2338,12 @@ TEST_F(Dhcp4ParserTest, optionDataInSingleSubnet) { ...@@ -2338,12 +2338,12 @@ TEST_F(Dhcp4ParserTest, optionDataInSingleSubnet) {
" \"option-data\": [ {" " \"option-data\": [ {"
" \"name\": \"dhcp-message\"," " \"name\": \"dhcp-message\","
" \"data\": \"ABCDEF0105\"," " \"data\": \"ABCDEF0105\","
" \"csv-format\": False" " \"csv-format\": false"
" }," " },"
" {" " {"
" \"name\": \"default-ip-ttl\"," " \"name\": \"default-ip-ttl\","
" \"data\": \"01\"," " \"data\": \"01\","
" \"csv-format\": False" " \"csv-format\": false"
" } ]" " } ]"
" } ]," " } ],"
"\"valid-lifetime\": 4000 }"; "\"valid-lifetime\": 4000 }";
...@@ -2481,7 +2481,7 @@ TEST_F(Dhcp4ParserTest, optionDataInMultipleSubnets) { ...@@ -2481,7 +2481,7 @@ TEST_F(Dhcp4ParserTest, optionDataInMultipleSubnets) {
" \"option-data\": [ {" " \"option-data\": [ {"
" \"name\": \"dhcp-message\"," " \"name\": \"dhcp-message\","
" \"data\": \"0102030405060708090A\"," " \"data\": \"0102030405060708090A\","
" \"csv-format\": False" " \"csv-format\": false"
" } ]" " } ]"
" }," " },"
" {" " {"
...@@ -2490,7 +2490,7 @@ TEST_F(Dhcp4ParserTest, optionDataInMultipleSubnets) { ...@@ -2490,7 +2490,7 @@ TEST_F(Dhcp4ParserTest, optionDataInMultipleSubnets) {
" \"option-data\": [ {" " \"option-data\": [ {"
" \"name\": \"default-ip-ttl\"," " \"name\": \"default-ip-ttl\","
" \"data\": \"FF\"," " \"data\": \"FF\","
" \"csv-format\": False" " \"csv-format\": false"
" } ]" " } ]"
" } ]," " } ],"
"\"valid-lifetime\": 4000 }"; "\"valid-lifetime\": 4000 }";
...@@ -2638,7 +2638,7 @@ TEST_F(Dhcp4ParserTest, stdOptionData) { ...@@ -2638,7 +2638,7 @@ TEST_F(Dhcp4ParserTest, stdOptionData) {
params["code"] = "41"; params["code"] = "41";
// Specify option values in a CSV (user friendly) format. // Specify option values in a CSV (user friendly) format.
params["data"] = "192.0.2.10, 192.0.2.1, 192.0.2.3"; params["data"] = "192.0.2.10, 192.0.2.1, 192.0.2.3";
params["csv-format"] = "True"; params["csv-format"] = "true";
std::string config = createConfigWithOption(params); std::string config = createConfigWithOption(params);
ElementPtr json = Element::fromJSON(config); ElementPtr json = Element::fromJSON(config);
...@@ -2794,7 +2794,7 @@ TEST_F(Dhcp4ParserTest, stdOptionDataEncapsulate) { ...@@ -2794,7 +2794,7 @@ TEST_F(Dhcp4ParserTest, stdOptionDataEncapsulate) {
"\"renew-timer\": 1000," "\"renew-timer\": 1000,"
"\"option-data\": [ {" "\"option-data\": [ {"
" \"name\": \"vendor-encapsulated-options\"," " \"name\": \"vendor-encapsulated-options\","
" \"csv-format\": False" " \"csv-format\": false"
" }," " },"
" {" " {"
" \"name\": \"foo\"," " \"name\": \"foo\","
...@@ -2806,7 +2806,7 @@ TEST_F(Dhcp4ParserTest, stdOptionDataEncapsulate) { ...@@ -2806,7 +2806,7 @@ TEST_F(Dhcp4ParserTest, stdOptionDataEncapsulate) {
" \"space\": \"vendor-encapsulated-options-space\"," " \"space\": \"vendor-encapsulated-options-space\","
" \"code\": 2," " \"code\": 2,"
" \"data\": \"192.168.2.1\"," " \"data\": \"192.168.2.1\","
" \"csv-format\": True" " \"csv-format\": true"
" } ]," " } ],"
"\"option-def\": [ {" "\"option-def\": [ {"
" \"name\": \"foo\"," " \"name\": \"foo\","
...@@ -2890,14 +2890,14 @@ TEST_F(Dhcp4ParserTest, vendorOptionsHex) { ...@@ -2890,14 +2890,14 @@ TEST_F(Dhcp4ParserTest, vendorOptionsHex) {
" \"space\": \"vendor-4491\"," // VENDOR_ID_CABLE_LABS = 4491 " \"space\": \"vendor-4491\"," // VENDOR_ID_CABLE_LABS = 4491
" \"code\": 100," // just a random code " \"code\": 100," // just a random code
" \"data\": \"ABCDEF0105\"," " \"data\": \"ABCDEF0105\","
" \"csv-format\": False" " \"csv-format\": false"
" }," " },"
" {" " {"
" \"name\": \"option-two\"," " \"name\": \"option-two\","
" \"space\": \"vendor-1234\"," " \"space\": \"vendor-1234\","
" \"code\": 100," " \"code\": 100,"
" \"data\": \"1234\"," " \"data\": \"1234\","
" \"csv-format\": False" " \"csv-format\": false"
" } ]," " } ],"
"\"subnet4\": [ { " "\"subnet4\": [ { "
" \"pools\": [ { \"pool\": \"192.0.2.1-192.0.2.10\" } ]," " \"pools\": [ { \"pool\": \"192.0.2.1-192.0.2.10\" } ],"
...@@ -3016,7 +3016,7 @@ buildHooksLibrariesConfig(const std::vector<std::string>& libraries) { ...@@ -3016,7 +3016,7 @@ buildHooksLibrariesConfig(const std::vector<std::string>& libraries) {
"\"option-data\": [ {" "\"option-data\": [ {"
" \"name\": \"dhcp-message\"," " \"name\": \"dhcp-message\","
" \"data\": \"ABCDEF0105\"," " \"data\": \"ABCDEF0105\","
" \"csv-format\": False" " \"csv-format\": false"
" }," " },"
" {" " {"
" \"name\": \"foo\"," " \"name\": \"foo\","
......
...@@ -1067,7 +1067,7 @@ TEST_F(Dhcpv4SrvTest, vendorOptionsDocsis) { ...@@ -1067,7 +1067,7 @@ TEST_F(Dhcpv4SrvTest, vendorOptionsDocsis) {
" \"space\": \"vendor-4491\"," " \"space\": \"vendor-4491\","
" \"code\": 2," " \"code\": 2,"
" \"data\": \"10.253.175.16\"," " \"data\": \"10.253.175.16\","
" \"csv-format\": True" " \"csv-format\": true"
" }]," " }],"
"\"subnet4\": [ { " "\"subnet4\": [ { "
" \"pools\": [ { \"pool\": \"10.254.226.0/25\" } ]," " \"pools\": [ { \"pool\": \"10.254.226.0/25\" } ],"
...@@ -1358,7 +1358,7 @@ TEST_F(Dhcpv4SrvTest, vendorOptionsORO) { ...@@ -1358,7 +1358,7 @@ TEST_F(Dhcpv4SrvTest, vendorOptionsORO) {
" \"space\": \"vendor-4491\"," " \"space\": \"vendor-4491\","
" \"code\": 2," " \"code\": 2,"
" \"data\": \"192.0.2.1, 192.0.2.2\"," " \"data\": \"192.0.2.1, 192.0.2.2\","
" \"csv-format\": True" " \"csv-format\": true"
" }]," " }],"
"\"subnet4\": [ { " "\"subnet4\": [ { "
" \"pools\": [ { \"pool\": \"192.0.2.0/25\" } ]," " \"pools\": [ { \"pool\": \"192.0.2.0/25\" } ],"
...@@ -1448,7 +1448,7 @@ TEST_F(Dhcpv4SrvTest, vendorOptionsDocsisDefinitions) { ...@@ -1448,7 +1448,7 @@ TEST_F(Dhcpv4SrvTest, vendorOptionsDocsisDefinitions) {
" \"code\": "; " \"code\": ";
string config_postfix = "," string config_postfix = ","
" \"data\": \"192.0.2.1\"," " \"data\": \"192.0.2.1\","
" \"csv-format\": True" " \"csv-format\": true"
" }]," " }],"
"\"subnet4\": [ { " "\"subnet4\": [ { "
" \"pools\": [ { \"pool\": \"192.0.2.1 - 192.0.2.50\" } ]," " \"pools\": [ { \"pool\": \"192.0.2.1 - 192.0.2.50\" } ],"
......
...@@ -1076,6 +1076,12 @@ null { ...@@ -1076,6 +1076,12 @@ null {
return isc::dhcp::Dhcp6Parser::make_NULL_TYPE(driver.loc_); return isc::dhcp::Dhcp6Parser::make_NULL_TYPE(driver.loc_);
} }
(?i:true) driver.error (driver.loc_, "JSON true reserved keyword is lower case only");
(?i:false) driver.error (driver.loc_, "JSON false reserved keyword is lower case only");
(?i:null) driver.error (driver.loc_, "JSON null reserved keyword is lower case only");
<*>. driver.error (driver.loc_, "Invalid character: " + std::string(yytext)); <*>. driver.error (driver.loc_, "Invalid character: " + std::string(yytext));
<<EOF>> { <<EOF>> {
......
...@@ -330,13 +330,22 @@ TEST(ParserTest, errors) { ...@@ -330,13 +330,22 @@ TEST(ParserTest, errors) {
Parser6Context::PARSER_JSON, Parser6Context::PARSER_JSON,
"Can't open include file /foo/bar"); "Can't open include file /foo/bar");
// case sensitivity // JSON keywords
testError("{ \"foo\": True }", testError("{ \"foo\": True }",
Parser6Context::PARSER_JSON,
"<string>:1.10-13: JSON true reserved keyword is lower case only");
testError("{ \"foo\": False }",
Parser6Context::PARSER_JSON,
"<string>:1.10-14: JSON false reserved keyword is lower case only");
testError("{ \"foo\": NULL }",
Parser6Context::PARSER_JSON,
"<string>:1.10-13: JSON null reserved keyword is lower case only");
testError("{ \"foo\": Tru }",
Parser6Context::PARSER_JSON, Parser6Context::PARSER_JSON,
"<string>:1.10: Invalid character: T"); "<string>:1.10: Invalid character: T");
testError("{ \"foo\": NULL }", testError("{ \"foo\": nul }",
Parser6Context::PARSER_JSON, Parser6Context::PARSER_JSON,
"<string>:1.10: Invalid character: N"); "<string>:1.10: Invalid character: n");
// numbers // numbers
testError("123", testError("123",
......
...@@ -20,7 +20,6 @@ ...@@ -20,7 +20,6 @@
#include <fstream> #include <fstream>
#include <cerrno> #include <cerrno>
#include <boost/algorithm/string.hpp> // for iequals
#include <boost/lexical_cast.hpp> #include <boost/lexical_cast.hpp>
#include <cmath> #include <cmath>
...@@ -458,10 +457,10 @@ fromStringstreamBool(std::istream& in, const std::string& file, ...@@ -458,10 +457,10 @@ fromStringstreamBool(std::istream& in, const std::string& file,
// This will move the pos to the end of the value. // This will move the pos to the end of the value.
const std::string word = wordFromStringstream(in, pos); const std::string word = wordFromStringstream(in, pos);
if (boost::iequals(word, "True")) { if (word == "true") {
return (Element::create(true, Element::Position(file, line, return (Element::create(true, Element::Position(file, line,
start_pos))); start_pos)));
} else if (boost::iequals(word, "False")) { } else if (word == "false") {
return (Element::create(false, Element::Position(file, line, return (Element::create(false, Element::Position(file, line,
start_pos))); start_pos)));
} else { } else {
...@@ -480,7 +479,7 @@ fromStringstreamNull(std::istream& in, const std::string& file, ...@@ -480,7 +479,7 @@ fromStringstreamNull(std::istream& in, const std::string& file,
const uint32_t start_pos = pos; const uint32_t start_pos = pos;
// This will move the pos to the end of the value. // This will move the pos to the end of the value.
const std::string word = wordFromStringstream(in, pos); const std::string word = wordFromStringstream(in, pos);
if (boost::iequals(word, "null")) { if (word == "null") {
return (Element::create(Element::Position(file, line, start_pos))); return (Element::create(Element::Position(file, line, start_pos)));
} else { } else {
throwJSONError(std::string("Bad null value: ") + word, file, throwJSONError(std::string("Bad null value: ") + word, file,
...@@ -659,16 +658,13 @@ Element::fromJSON(std::istream& in, const std::string& file, int& line, ...@@ -659,16 +658,13 @@ Element::fromJSON(std::istream& in, const std::string& file, int& line,
el_read = true; el_read = true;
break; break;
case 't': case 't':
case 'T':
case 'f': case 'f':
case 'F':
in.putback(c); in.putback(c);
--pos; --pos;
element = fromStringstreamBool(in, file, line, pos); element = fromStringstreamBool(in, file, line, pos);
el_read = true; el_read = true;
break; break;
case 'n': case 'n':
case 'N':
in.putback(c); in.putback(c);
--pos; --pos;
element = fromStringstreamNull(in, file, line, pos); element = fromStringstreamNull(in, file, line, pos);
......
...@@ -131,11 +131,13 @@ TEST(Element, from_and_to_json) { ...@@ -131,11 +131,13 @@ TEST(Element, from_and_to_json) {
sv.push_back("{1}"); sv.push_back("{1}");
//ElementPtr ep = Element::fromJSON("\"aaa\nbbb\"err"); //ElementPtr ep = Element::fromJSON("\"aaa\nbbb\"err");
//std::cout << ep << std::endl; //std::cout << ep << std::endl;
sv.push_back("\n\nTru"); sv.push_back("\n\nTrue");
sv.push_back("\n\ntru");
sv.push_back("{ \n \"aaa\nbbb\"err:"); sv.push_back("{ \n \"aaa\nbbb\"err:");
sv.push_back("{ \t\n \"aaa\nbbb\"\t\n\n:\n True, \"\\\""); sv.push_back("{ \t\n \"aaa\nbbb\"\t\n\n:\n true, \"\\\"");
sv.push_back("{ \"a\": None}"); sv.push_back("{ \"a\": None}");
sv.push_back(""); sv.push_back("");
sv.push_back("NULL");
sv.push_back("nul"); sv.push_back("nul");
sv.push_back("hello\"foobar\""); sv.push_back("hello\"foobar\"");
sv.push_back("\"foobar\"hello"); sv.push_back("\"foobar\"hello");
...@@ -178,12 +180,6 @@ TEST(Element, from_and_to_json) { ...@@ -178,12 +180,6 @@ TEST(Element, from_and_to_json) {
EXPECT_EQ("0.01", Element::fromJSON("1.0e-2")->str()); EXPECT_EQ("0.01", Element::fromJSON("1.0e-2")->str());
EXPECT_EQ("0.012", Element::fromJSON("1.2e-2")->str()); EXPECT_EQ("0.012", Element::fromJSON("1.2e-2")->str());
EXPECT_EQ("0.012", Element::fromJSON("1.2E-2")->str()); EXPECT_EQ("0.012", Element::fromJSON("1.2E-2")->str());
EXPECT_EQ("null", Element::fromJSON("Null")->str());
EXPECT_EQ("null", Element::fromJSON("NULL")->str());
EXPECT_EQ("false", Element::fromJSON("False")->str());
EXPECT_EQ("false", Element::fromJSON("FALSE")->str());
EXPECT_EQ("true", Element::fromJSON("True")->str());
EXPECT_EQ("true", Element::fromJSON("TRUE")->str());
EXPECT_EQ("\"\"", Element::fromJSON(" \n \t \r \f \b \"\" \n \f \t \r \b")->str()); EXPECT_EQ("\"\"", Element::fromJSON(" \n \t \r \f \b \"\" \n \f \t \r \b")->str());
EXPECT_EQ("{ }", Element::fromJSON("{ \n \r \t \b \f }")->str()); EXPECT_EQ("{ }", Element::fromJSON("{ \n \r \t \b \f }")->str());
EXPECT_EQ("[ ]", Element::fromJSON("[ \n \r \f \t \b ]")->str()); EXPECT_EQ("[ ]", Element::fromJSON("[ \n \r \f \t \b ]")->str());
...@@ -709,35 +705,35 @@ TEST(Element, equals) { ...@@ -709,35 +705,35 @@ TEST(Element, equals) {
EXPECT_NE(*efs("1"), *efs("2")); EXPECT_NE(*efs("1"), *efs("2"));
EXPECT_NE(*efs("1"), *efs("\"1\"")); EXPECT_NE(*efs("1"), *efs("\"1\""));
EXPECT_NE(*efs("1"), *efs("[]")); EXPECT_NE(*efs("1"), *efs("[]"));
EXPECT_NE(*efs("1"), *efs("True")); EXPECT_NE(*efs("1"), *efs("true"));
EXPECT_NE(*efs("1"), *efs("{}")); EXPECT_NE(*efs("1"), *efs("{}"));
EXPECT_EQ(*efs("1.1"), *efs("1.1")); EXPECT_EQ(*efs("1.1"), *efs("1.1"));
EXPECT_NE(*efs("1.0"), *efs("1")); EXPECT_NE(*efs("1.0"), *efs("1"));
EXPECT_NE(*efs("1.1"), *efs("\"1\"")); EXPECT_NE(*efs("1.1"), *efs("\"1\""));
EXPECT_NE(*efs("1.1"), *efs("[]")); EXPECT_NE(*efs("1.1"), *efs("[]"));
EXPECT_NE(*efs("1.1"), *efs("True")); EXPECT_NE(*efs("1.1"), *efs("true"));
EXPECT_NE(*efs("1.1"), *efs("{}")); EXPECT_NE(*efs("1.1"), *efs("{}"));
EXPECT_EQ(*efs("True"), *efs("True")); EXPECT_EQ(*efs("true"), *efs("true"));
EXPECT_NE(*efs("True"), *efs("False")); EXPECT_NE(*efs("true"), *efs("false"));
EXPECT_NE(*efs("True"), *efs("1")); EXPECT_NE(*efs("true"), *efs("1"));
EXPECT_NE(*efs("True"), *efs("\"1\"")); EXPECT_NE(*efs("true"), *efs("\"1\""));
EXPECT_NE(*efs("True"), *efs("[]")); EXPECT_NE(*efs("true"), *efs("[]"));
EXPECT_NE(*efs("True"), *efs("{}")); EXPECT_NE(*efs("true"), *efs("{}"));
EXPECT_EQ(*efs("\"foo\""), *efs("\"foo\"")); EXPECT_EQ(*efs("\"foo\""), *efs("\"foo\""));
EXPECT_NE(*efs("\"foo\""), *efs("\"bar\"")); EXPECT_NE(*efs("\"foo\""), *efs("\"bar\""));
EXPECT_NE(*efs("\"foo\""), *efs("1")); EXPECT_NE(*efs("\"foo\""), *efs("1"));
EXPECT_NE(*efs("\"foo\""), *efs("\"1\"")); EXPECT_NE(*efs("\"foo\""), *efs("\"1\""));
EXPECT_NE(*efs("\"foo\""), *efs("True")); EXPECT_NE(*efs("\"foo\""), *efs("true"));
EXPECT_NE(*efs("\"foo\""), *efs("[]")); EXPECT_NE(*efs("\"foo\""), *efs("[]"));
EXPECT_NE(*efs("\"foo\""), *efs("{}")); EXPECT_NE(*efs("\"foo\""), *efs("{}"));
EXPECT_EQ(*efs("[]"), *efs("[]")); EXPECT_EQ(*efs("[]"), *efs("[]"));
EXPECT_EQ(*efs("[ 1, 2, 3 ]"), *efs("[ 1, 2, 3 ]")); EXPECT_EQ(*efs("[ 1, 2, 3 ]"), *efs("[ 1, 2, 3 ]"));
EXPECT_EQ(*efs("[ \"a\", [ True, 1], 2.2 ]"), *efs("[ \"a\", [ True, 1], 2.2 ]")); EXPECT_EQ(*efs("[ \"a\", [ true, 1], 2.2 ]"), *efs("[ \"a\", [ true, 1], 2.2 ]"));
EXPECT_NE(*efs("[ \"a\", [ True, 1], 2.2 ]"), *efs("[ \"a\", [ True, 2], 2.2 ]")); EXPECT_NE(*efs("[ \"a\", [ true, 1], 2.2 ]"), *efs("[ \"a\", [ true, 2], 2.2 ]"));
EXPECT_NE(*efs("[]"), *efs("[1]")); EXPECT_NE(*efs("[]"), *efs("[1]"));
EXPECT_NE(*efs("[]"), *efs("1")); EXPECT_NE(*efs("[]"), *efs("1"));
EXPECT_NE(*efs("[]"), *efs("\"1\"")); EXPECT_NE(*efs("[]"), *efs("\"1\""));
......
...@@ -33,7 +33,7 @@ To add a simple configuration option, let's say an int, we make it the following ...@@ -33,7 +33,7 @@ To add a simple configuration option, let's say an int, we make it the following
"config_data" contains a list of elements of the form "config_data" contains a list of elements of the form
{ "item_name": "name" { "item_name": "name"
"item_type": "integer|real|boolean|string|list|map" "item_type": "integer|real|boolean|string|list|map"
"item_optional": True|False "item_optional": true|false
"item_default": <depends on type> "item_default": <depends on type>
} }
......
...@@ -117,7 +117,7 @@ template<> void ValueParser<bool>::build(isc::data::ConstElementPtr value) { ...@@ -117,7 +117,7 @@ template<> void ValueParser<bool>::build(isc::data::ConstElementPtr value) {
// Invoke common code for all specializations of build(). // Invoke common code for all specializations of build().
buildCommon(value); buildCommon(value);
// The Config Manager checks if user specified a // The Config Manager checks if user specified a
// valid value for a boolean parameter: True or False. // valid value for a boolean parameter: true or false.
// We should have a boolean Element, use value directly // We should have a boolean Element, use value directly
try { try {
value_ = value->boolValue(); value_ = value->boolValue();
...@@ -1475,11 +1475,11 @@ D2ClientConfigParser::build(isc::data::ConstElementPtr client_config) { ...@@ -1475,11 +1475,11 @@ D2ClientConfigParser::build(isc::data::ConstElementPtr client_config) {
mode_str = string_values_->getOptionalParam("replace-client-name", mode_str = string_values_->getOptionalParam("replace-client-name",
D2ClientConfig:: D2ClientConfig::
DFT_REPLACE_CLIENT_NAME_MODE); DFT_REPLACE_CLIENT_NAME_MODE);
if (boost::iequals(mode_str, "FALSE")) { if (boost::iequals(mode_str, "false")) {
// @todo add a debug log // @todo add a debug log
replace_client_name_mode = D2ClientConfig::RCM_NEVER; replace_client_name_mode = D2ClientConfig::RCM_NEVER;
} }
else if (boost::iequals(mode_str, "TRUE")) { else if (boost::iequals(mode_str, "true")) {
// @todo add a debug log // @todo add a debug log
replace_client_name_mode = D2ClientConfig::RCM_WHEN_PRESENT; replace_client_name_mode = D2ClientConfig::RCM_WHEN_PRESENT;
} else { } else {
......
...@@ -483,7 +483,7 @@ TEST_F(ParseConfigTest, basicOptionDefTest) { ...@@ -483,7 +483,7 @@ TEST_F(ParseConfigTest, basicOptionDefTest) {
" \"name\": \"foo\"," " \"name\": \"foo\","
" \"code\": 100," " \"code\": 100,"
" \"type\": \"ipv4-address\"," " \"type\": \"ipv4-address\","