-// Copyright (C) 2013-2015 Internet Systems Consortium, Inc. ("ISC")
+// Copyright (C) 2013-2015,2017 Internet Systems Consortium, Inc. ("ISC")
//
// This Source Code Form is subject to the terms of the Mozilla Public
// License, v. 2.0. If a copy of the MPL was not distributed with this
/// @brief Thrown if the queue manager's receive handler is passed
/// a failure result.
+/// @todo use or remove it.
class D2QueueMgrReceiveError : public isc::Exception {
public:
D2QueueMgrReceiveError(const char* file, size_t line, const char* what) :
/// @brief Thrown if the request queue is full when an enqueue is attempted.
+/// @todo use or remove it.
class D2QueueMgrQueueFull : public isc::Exception {
public:
D2QueueMgrQueueFull(const char* file, size_t line, const char* what) :
// Verify that the forward manager can be retrieved.
DdnsDomainListMgrPtr mgr = context->getForwardMgr();
ASSERT_TRUE(mgr);
+ EXPECT_EQ("forward-ddns", mgr->getName());
// Verify that the forward manager has the correct number of domains.
DdnsDomainMapPtr domains = mgr->getDomains();
// Verify that the reverse manager can be retrieved.
mgr = context->getReverseMgr();
ASSERT_TRUE(mgr);
+ EXPECT_EQ("reverse-ddns", mgr->getName());
// Verify that the reverse manager has the correct number of domains.
domains = mgr->getDomains();
-// Copyright (C) 2013-2015 Internet Systems Consortium, Inc. ("ISC")
+// Copyright (C) 2013-2015,2017 Internet Systems Consortium, Inc. ("ISC")
//
// This Source Code Form is subject to the terms of the Mozilla Public
// License, v. 2.0. If a copy of the MPL was not distributed with this
#include <config.h>
#include <d2/d2_zone.h>
#include <gtest/gtest.h>
+#include <sstream>
using namespace std;
using namespace isc;
EXPECT_EQ("foo.example.com. IN SOA\n", zone2.toText());
}
+ // Same than for toText() but using the << operator.
+TEST(D2ZoneTest, output) {
+ // Create first object.
+ D2Zone zone1(Name("example.com"), RRClass::ANY());
+ ostringstream ss;
+ ss << zone1;
+ EXPECT_EQ("example.com. ANY SOA\n", ss.str());
+ // Create another object with different parameters to make sure that the
+ // function's output changes accordingly.
+ D2Zone zone2(Name("foo.example.com"), RRClass::IN());
+ ostringstream ss2;
+ ss2 << zone2;
+ EXPECT_EQ("foo.example.com. IN SOA\n", ss2.str());
+}
+
// This test verifies that the equality and inequality operators behave as
// expected.
TEST(D2ZoneTest, compare) {
opterr = 0;
optind = 1;
- while ((ch = getopt(argc, argv, ":46dvVWp:x:i:o:c:f:")) != -1) {
+ while ((ch = getopt(argc, argv, ":46dhvVWp:x:i:o:c:f:")) != -1) {
switch (ch) {
case '4':
// Process DHCPv4 lease files.
case '?':
// Unknown argument
+ // note this will catch all the prevous ... name missing
isc_throw(InvalidUsage, "Unknown argument");
case ':':
-// Copyright (C) 2015 Internet Systems Consortium, Inc. ("ISC")
+// Copyright (C) 2015,2017 Internet Systems Consortium, Inc. ("ISC")
//
// This Source Code Form is subject to the terms of the Mozilla Public
// License, v. 2.0. If a copy of the MPL was not distributed with this
EXPECT_TRUE(lfc_controller.getPidFile().empty());
}
+/// @brief Verify that parsing -v/V/W/h works well.
+TEST_F(LFCControllerTest, version) {
+ LFCController lfc_controller;
+
+ int argc = 2;
+ char *argv_v[] = { const_cast<char*>("progName"),
+ const_cast<char*>("-v") };
+ char *argv_V[] = { const_cast<char*>("progName"),
+ const_cast<char*>("-V") };
+ char *argv_W[] = { const_cast<char*>("progName"),
+ const_cast<char*>("-W") };
+ char *argv_h[] = { const_cast<char*>("progName"),
+ const_cast<char*>("-h") };
+
+ ASSERT_EXIT(lfc_controller.parseArgs(argc, argv_v),
+ ::testing::ExitedWithCode(0), "");
+ ASSERT_EXIT(lfc_controller.parseArgs(argc, argv_V),
+ ::testing::ExitedWithCode(0), "");
+ ASSERT_EXIT(lfc_controller.parseArgs(argc, argv_W),
+ ::testing::ExitedWithCode(0), "");
+ ASSERT_EXIT(lfc_controller.parseArgs(argc, argv_h),
+ ::testing::ExitedWithCode(0), "Usage");
+}
+
/// @brief Verify that parsing a full command line works.
/// Parse a complete command line then verify the parsed
/// and saved data matches our expectations.
EXPECT_TRUE(noExistIOFP());
}
+// @todo double launch (how to do that)
+
} // end of anonymous namespace
-// Copyright (C) 2009-2015 Internet Systems Consortium, Inc. ("ISC")
+// Copyright (C) 2009-2015,2017 Internet Systems Consortium, Inc. ("ISC")
//
// This Source Code Form is subject to the terms of the Mozilla Public
// License, v. 2.0. If a copy of the MPL was not distributed with this
}
}
+// Same than basicMethods but using a string (vs char *)
+TEST_F(ExceptionTest, string) {
+ try {
+ isc_throw(Exception, std::string(teststring));
+ } catch (Exception& ex) {
+ EXPECT_EQ(ex.getMessage(), std::string(teststring));
+ EXPECT_EQ(ex.getFile(), std::string(__FILE__));
+ EXPECT_EQ(ex.getLine(), __LINE__ - 4);
+ }
+}
+
// Test to see if it works as a proper derived class of std::exception.
TEST_F(ExceptionTest, stdInheritance) {
try {
-// Copyright (C) 2012-2015 Internet Systems Consortium, Inc. ("ISC")
+// Copyright (C) 2012-2015,2017 Internet Systems Consortium, Inc. ("ISC")
//
// This Source Code Form is subject to the terms of the Mozilla Public
// License, v. 2.0. If a copy of the MPL was not distributed with this
using isc::util::unittests::parentReadState;
namespace {
+TEST(InterprocessSyncFileTest, BadFile) {
+ InterprocessSyncFile sync("/no-such--dir/or--file");
+ InterprocessSyncLocker locker(sync);
+
+ EXPECT_FALSE(locker.isLocked());
+ ASSERT_THROW(locker.lock(), InterprocessSyncFileError);
+}
+
TEST(InterprocessSyncFileTest, TestLock) {
InterprocessSyncFile sync("test");
InterprocessSyncLocker locker(sync);