BIND 10 trac3075, updated. 39194524eb9a6ce9fa53814516c1ceaffda3b9c3 [3075] Additional review changes.

BIND 10 source code commits bind10-changes at lists.isc.org
Tue Aug 27 12:18:02 UTC 2013


The branch, trac3075 has been updated
       via  39194524eb9a6ce9fa53814516c1ceaffda3b9c3 (commit)
      from  968bc96429fc12aea18e5e4186fcafcb5f29dc58 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
commit 39194524eb9a6ce9fa53814516c1ceaffda3b9c3
Author: Thomas Markwalder <tmark at isc.org>
Date:   Tue Aug 27 08:15:23 2013 -0400

    [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.

-----------------------------------------------------------------------

Summary of changes:
 src/bin/d2/d2_config.cc                  |    2 +-
 src/bin/d2/d2_config.h                   |    2 +-
 src/bin/d2/d2_process.cc                 |   23 +++++++------------
 src/bin/d2/d2_process.h                  |    8 -------
 src/bin/d2/tests/d2_process_unittests.cc |   36 +++++++++++++++---------------
 5 files changed, 28 insertions(+), 43 deletions(-)

-----------------------------------------------------------------------
diff --git a/src/bin/d2/d2_config.cc b/src/bin/d2/d2_config.cc
index f2ee4a8..b2e28d3 100644
--- a/src/bin/d2/d2_config.cc
+++ b/src/bin/d2/d2_config.cc
@@ -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");
     }
diff --git a/src/bin/d2/d2_config.h b/src/bin/d2/d2_config.h
index bfb253f..8e3bd34 100644
--- a/src/bin/d2/d2_config.h
+++ b/src/bin/d2/d2_config.h
@@ -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
diff --git a/src/bin/d2/d2_process.cc b/src/bin/d2/d2_process.cc
index 09760d7..63bd6bd 100644
--- a/src/bin/d2/d2_process.cc
+++ b/src/bin/d2/d2_process.cc
@@ -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
diff --git a/src/bin/d2/d2_process.h b/src/bin/d2/d2_process.h
index 08bbe14..5c76af5 100644
--- a/src/bin/d2/d2_process.h
+++ b/src/bin/d2/d2_process.h
@@ -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
diff --git a/src/bin/d2/tests/d2_process_unittests.cc b/src/bin/d2/tests/d2_process_unittests.cc
index 4953ab6..cbbdd3f 100644
--- a/src/bin/d2/tests/d2_process_unittests.cc
+++ b/src/bin/d2/tests/d2_process_unittests.cc
@@ -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));
 }
 
 



More information about the bind10-changes mailing list