test_datasrc_clients_mgr.cc 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. // Copyright (C) 2012 Internet Systems Consortium, Inc. ("ISC")
  2. //
  3. // Permission to use, copy, modify, and/or distribute this software for any
  4. // purpose with or without fee is hereby granted, provided that the above
  5. // copyright notice and this permission notice appear in all copies.
  6. //
  7. // THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH
  8. // REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
  9. // AND FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT,
  10. // INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
  11. // LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
  12. // OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
  13. // PERFORMANCE OF THIS SOFTWARE.
  14. #include <exceptions/exceptions.h>
  15. #include "test_datasrc_clients_mgr.h"
  16. namespace isc {
  17. namespace auth {
  18. namespace datasrc_clientmgr_internal {
  19. // Define static DataSrcClientsBuilder member variables.
  20. bool FakeDataSrcClientsBuilder::started = false;
  21. std::list<Command>* FakeDataSrcClientsBuilder::command_queue = NULL;
  22. TestCondVar* FakeDataSrcClientsBuilder::cond = NULL;
  23. TestMutex* FakeDataSrcClientsBuilder::queue_mutex = NULL;
  24. bool FakeDataSrcClientsBuilder::thread_waited = false;
  25. FakeDataSrcClientsBuilder::ExceptionFromWait
  26. FakeDataSrcClientsBuilder::thread_throw_on_wait =
  27. FakeDataSrcClientsBuilder::NOTHROW;
  28. template<>
  29. void
  30. TestDataSrcClientsBuilder::doNoop() {
  31. ++queue_mutex_->noop_count;
  32. switch (queue_mutex_->throw_from_noop) {
  33. case TestMutex::NONE:
  34. break; // no throw
  35. case TestMutex::EXCLASS:
  36. isc_throw(Exception, "test exception");
  37. case TestMutex::INTEGER:
  38. throw 42;
  39. }
  40. }
  41. }
  42. }
  43. }
  44. // Local Variables:
  45. // mode: c++
  46. // End: