LOG_ERROR(auth_logger, AUTH_DATASRC_CLIENTS_SHUTDOWN_ERROR).
arg(ex.what());
} catch (...) {}
+
+ cleanup(); // see below
}
private:
+ // This is expected to be called at the end of the destructor. It
+ // actually does nothing, but provides a customization point for
+ // specialized class for tests so that the tests can inspect the last
+ // state of the class.
+ void cleanup() {}
+
void sendCommand(datasrc_clientmgr_internal::CommandID command,
data::ConstElementPtr arg) {
{
// Define static DataSrcClientsBuilder member variables.
bool FakeDataSrcClientsBuilder::started = false;
std::list<Command>* FakeDataSrcClientsBuilder::command_queue = NULL;
+std::list<Command> FakeDataSrcClientsBuilder::command_queue_copy;
TestCondVar* FakeDataSrcClientsBuilder::cond = NULL;
+TestCondVar FakeDataSrcClientsBuilder::cond_copy;
TestMutex* FakeDataSrcClientsBuilder::queue_mutex = NULL;
+TestMutex FakeDataSrcClientsBuilder::queue_mutex_copy;
bool FakeDataSrcClientsBuilder::thread_waited = false;
FakeDataSrcClientsBuilder::ExceptionFromWait
FakeDataSrcClientsBuilder::thread_throw_on_wait =
throw 42;
}
}
+} // namespace datasrc_clientmgr_internal
+
+template<>
+void
+TestDataSrcClientsMgr::cleanup() {
+ using namespace datasrc_clientmgr_internal;
+ // Make copy of some of the manager's member variables and reset the
+ // corresponding pointers. The currently pointed objects are in the
+ // manager object, which are going to be invalidated.
+
+ FakeDataSrcClientsBuilder::command_queue_copy = command_queue_;
+ FakeDataSrcClientsBuilder::command_queue =
+ &FakeDataSrcClientsBuilder::command_queue_copy;
+ FakeDataSrcClientsBuilder::queue_mutex_copy = queue_mutex_;
+ FakeDataSrcClientsBuilder::queue_mutex =
+ &FakeDataSrcClientsBuilder::queue_mutex_copy;
+ FakeDataSrcClientsBuilder::cond_copy = cond_;
+ FakeDataSrcClientsBuilder::cond =
+ &FakeDataSrcClientsBuilder::cond_copy;
}
-}
-}
+
+} // namespace auth
+} // namespace isc
// Local Variables:
// mode: c++
static bool started;
// These three correspond to the resource shared with the manager.
+ // xxx_copy will be set in the manager's destructor to record the
+ // final state of the manager.
static std::list<Command>* command_queue;
static TestCondVar* cond;
static TestMutex* queue_mutex;
+ static std::list<Command> command_queue_copy;
+ static TestCondVar cond_copy;
+ static TestMutex queue_mutex_copy;
// true iff the manager waited on the thread running the builder.
static bool thread_waited;
datasrc_clientmgr_internal::TestMutex,
datasrc_clientmgr_internal::TestCondVar> TestDataSrcClientsMgr;
+// A specialization of manager's "cleanup" called at the end of the
+// destructor. We use this to record the final values of some of the class
+// member variables.
+template<>
+void
+TestDataSrcClientsMgr::cleanup();
+
} // namespace auth
} // namespace isc