Commit 39194524 authored by Thomas Markwalder's avatar Thomas Markwalder
Browse files

[3075] Additional review changes.

Replaced use of EXPECT_EQ(false,) with EXPECT_FALSE()
in d2_process_unittests.cc.  These were failing to
compile under Fedora 18/gtest 1.6. This appears to be
a gtest bug.  Other minor changes.
parent 968bc964
......@@ -226,7 +226,7 @@ TSIGKeyInfoParser::commit() {
isc_throw(D2CfgError, "TSIG Key Info must specify name");
}
// Algorithme cannot be blank.
// Algorithm cannot be blank.
if (algorithm.empty()) {
isc_throw(D2CfgError, "TSIG Key Info must specify algorithm");
}
......
......@@ -606,7 +606,7 @@ public:
/// @brief Iterates over the internal list of TSIGKeyInfoParsers,
/// invoking commit on each. This causes each parser to instantiate a
/// TSIGKeyInfo from its internal data values and add that that key
/// TSIGKeyInfo from its internal data values and add that key
/// instance to the local key storage area, local_keys_. If all of the
/// key parsers commit cleanly, then update the context key map (keys_)
/// with the contents of local_keys_. This is done to allow for duplicate
......
......@@ -22,12 +22,6 @@
namespace isc {
namespace d2 {
// String translations for ShutdownType enums.
const char* D2Process::SD_NORMAL_STR = "normal";
const char* D2Process::SD_DRAIN_FIRST_STR = "drain_first";
const char* D2Process::SD_NOW_STR = "now";
const char* D2Process::SD_INVALID_STR = "invalid";
// Setting to 80% for now. This is an arbitrary choice and should probably
// be configurable.
const unsigned int D2Process::QUEUE_RESTART_PERCENT = 80;
......@@ -173,7 +167,7 @@ D2Process::shutdown(isc::data::ConstElementPtr args) {
: "(no args)");
// Default shutdown type is normal.
std::string type_str(SD_NORMAL_STR);
std::string type_str(getShutdownTypeStr(SD_NORMAL));
shutdown_type_ = SD_NORMAL;
if (args) {
......@@ -181,11 +175,11 @@ D2Process::shutdown(isc::data::ConstElementPtr args) {
args->contains("type")) {
type_str = args->get("type")->stringValue();
if (type_str == SD_NORMAL_STR) {
if (type_str == getShutdownTypeStr(SD_NORMAL)) {
shutdown_type_ = SD_NORMAL;
} else if (type_str == SD_DRAIN_FIRST_STR) {
} else if (type_str == getShutdownTypeStr(SD_DRAIN_FIRST)) {
shutdown_type_ = SD_DRAIN_FIRST;
} else if (type_str == SD_NOW_STR) {
} else if (type_str == getShutdownTypeStr(SD_NOW)) {
shutdown_type_ = SD_NOW;
} else {
setShutdownFlag(false);
......@@ -378,16 +372,16 @@ D2Process::getD2CfgMgr() {
}
const char* D2Process::getShutdownTypeStr(const ShutdownType& type) {
const char* str = SD_INVALID_STR;
const char* str = "invalid";
switch (type) {
case SD_NORMAL:
str = SD_NORMAL_STR;
str = "normal";
break;
case SD_DRAIN_FIRST:
str = SD_DRAIN_FIRST_STR;
str = "drain_first";
break;
case SD_NOW:
str = SD_NOW_STR;
str = "now";
break;
default:
break;
......@@ -396,6 +390,5 @@ const char* D2Process::getShutdownTypeStr(const ShutdownType& type) {
return (str);
}
}; // namespace isc::d2
}; // namespace isc
......@@ -47,14 +47,6 @@ public:
SD_NOW
};
//@{
/// @brief Define text labels for the shutdown types.
static const char* SD_NORMAL_STR;
static const char* SD_DRAIN_FIRST_STR;
static const char* SD_NOW_STR;
static const char* SD_INVALID_STR;
//@}
/// @brief Defines the point at which to resume receiving requests.
/// If the receive queue has become full, D2Process will "pause" the
/// reception of requests by putting the queue manager in the stopped
......
......@@ -477,18 +477,18 @@ TEST_F(D2ProcessTest, canShutdown) {
const D2QueueMgrPtr& queue_mgr = getD2QueueMgr();
// Shutdown flag is false. Method should return false for all types.
EXPECT_EQ(false, checkCanShutdown(SD_NORMAL));
EXPECT_EQ(false, checkCanShutdown(SD_DRAIN_FIRST));
EXPECT_EQ(false, checkCanShutdown(SD_NOW));
EXPECT_FALSE(checkCanShutdown(SD_NORMAL));
EXPECT_FALSE(checkCanShutdown(SD_DRAIN_FIRST));
EXPECT_FALSE(checkCanShutdown(SD_NOW));
// Set shutdown flag to true.
setShutdownFlag(true);
// Queue Manager is running, queue is empty, no transactions.
// Only SD_NOW should return true.
EXPECT_EQ(false, checkCanShutdown(SD_NORMAL));
EXPECT_EQ(false, checkCanShutdown(SD_DRAIN_FIRST));
EXPECT_EQ(true, checkCanShutdown(SD_NOW));
EXPECT_FALSE(checkCanShutdown(SD_NORMAL));
EXPECT_FALSE(checkCanShutdown(SD_DRAIN_FIRST));
EXPECT_TRUE(checkCanShutdown(SD_NOW));
// Tell queue manager to stop.
queue_mgr->stopListening();
......@@ -497,9 +497,9 @@ TEST_F(D2ProcessTest, canShutdown) {
// Queue Manager is stopping, queue is empty, no transactions.
// Only SD_NOW should return true.
EXPECT_EQ(false, checkCanShutdown(SD_NORMAL));
EXPECT_EQ(false, checkCanShutdown(SD_DRAIN_FIRST));
EXPECT_EQ(true, checkCanShutdown(SD_NOW));
EXPECT_FALSE(checkCanShutdown(SD_NORMAL));
EXPECT_FALSE(checkCanShutdown(SD_DRAIN_FIRST));
EXPECT_TRUE(checkCanShutdown(SD_NOW));
// Allow cancel event to process.
ASSERT_NO_THROW(runIO());
......@@ -508,9 +508,9 @@ TEST_F(D2ProcessTest, canShutdown) {
// Queue Manager is stopped, queue is empty, no transactions.
// All types should return true.
EXPECT_EQ(true, checkCanShutdown(SD_NORMAL));
EXPECT_EQ(true, checkCanShutdown(SD_DRAIN_FIRST));
EXPECT_EQ(true, checkCanShutdown(SD_NOW));
EXPECT_TRUE(checkCanShutdown(SD_NORMAL));
EXPECT_TRUE(checkCanShutdown(SD_DRAIN_FIRST));
EXPECT_TRUE(checkCanShutdown(SD_NOW));
const char* test_msg =
"{"
......@@ -533,9 +533,9 @@ TEST_F(D2ProcessTest, canShutdown) {
// Queue Manager is stopped. Queue is not empty, no transactions.
// SD_DRAIN_FIRST should be false, SD_NORMAL and SD_NOW should be true.
EXPECT_EQ(true, checkCanShutdown(SD_NORMAL));
EXPECT_EQ(false, checkCanShutdown(SD_DRAIN_FIRST));
EXPECT_EQ(true, checkCanShutdown(SD_NOW));
EXPECT_TRUE(checkCanShutdown(SD_NORMAL));
EXPECT_FALSE(checkCanShutdown(SD_DRAIN_FIRST));
EXPECT_TRUE(checkCanShutdown(SD_NOW));
// Now use update manager to dequeue the request and make a transaction.
// This lets us verify transaction list not empty logic.
......@@ -547,9 +547,9 @@ TEST_F(D2ProcessTest, canShutdown) {
// Queue Manager is stopped. Queue is empty, one transaction.
// Only SD_NOW should be true.
EXPECT_EQ(false, checkCanShutdown(SD_NORMAL));
EXPECT_EQ(false, checkCanShutdown(SD_DRAIN_FIRST));
EXPECT_EQ(true, checkCanShutdown(SD_NOW));
EXPECT_FALSE(checkCanShutdown(SD_NORMAL));
EXPECT_FALSE(checkCanShutdown(SD_DRAIN_FIRST));
EXPECT_TRUE(checkCanShutdown(SD_NOW));
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment