client_unittest.cc 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. // Copyright (C) 2011 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 <datasrc/client.h>
  15. #include <dns/name.h>
  16. #include <gtest/gtest.h>
  17. using namespace isc::datasrc;
  18. using isc::dns::Name;
  19. namespace {
  20. /*
  21. * The DataSourceClient can't be created as it has pure virtual methods.
  22. * So we implement them as NOPs and test the other methods.
  23. */
  24. class NopClient : public DataSourceClient {
  25. public:
  26. virtual FindResult findZone(const isc::dns::Name&) const {
  27. return (FindResult(result::NOTFOUND, ZoneFinderPtr()));
  28. }
  29. };
  30. class ClientTest : public ::testing::Test {
  31. public:
  32. NopClient client_;
  33. };
  34. // The default implementation is NotImplemented
  35. TEST_F(ClientTest, defaultIterator) {
  36. EXPECT_THROW(client_.getIterator(Name(".")), isc::NotImplemented);
  37. }
  38. }