namespace server_common {
namespace portconfig {
-// This flags disables pushing the sockets to the DNSService. It prevents
-// the clearServers() method to close the file descriptors we made up.
-// It is not presented in any header, but we use it from the tests anyway.
-bool test_mode(false);
-
AddressList
parseAddresses(isc::data::ConstElementPtr addresses,
const std::string& elemName)
#include <server_common/portconfig.h>
#include <testutils/socket_request.h>
+#include <testutils/mockups.h>
#include <cc/data.h>
#include <exceptions/exceptions.h>
using namespace std;
using namespace isc::asiolink;
using namespace isc::asiodns;
+using namespace isc::testutils;
using boost::lexical_cast;
namespace {
// Test fixture for installListenAddresses
struct InstallListenAddresses : public ::testing::Test {
InstallListenAddresses() :
- dnss_(ios_, NULL, NULL, NULL),
// The empty string is expected parameter of requestSocket,
// not app_name - the request does not fall back to this, it
// is checked to be the same.
invalid_.push_back(AddressPair("127.0.0.1", 5288));
invalid_.push_back(AddressPair("192.0.2.2", 1));
}
- IOService ios_;
- DNSService dnss_;
+ MockDNSService dnss_;
AddressList store_;
isc::testutils::TestSocketRequestor sock_requestor_;
// We should be able to bind to these addresses
#include <string>
namespace isc {
-namespace server_common {
-namespace portconfig {
-// Access the private hidden flag
-extern bool test_mode;
-}
-}
-
namespace testutils {
/// \brief A testcase part for faking the SocketRequestor in tests
{
// Prepare the requestor (us) for the test
server_common::initTestSocketRequestor(this);
- // Don't manipulate the real sockets
- server_common::portconfig::test_mode = true;
}
/// \brief Destructor
server_common::portconfig::installListenAddresses(list, store_, dnss_);
// Don't leave invalid pointers here
server_common::initTestSocketRequestor(NULL);
- // And return the mode
- server_common::portconfig::test_mode = false;
}
/// \brief Tokens released by releaseSocket