]> git.ipfire.org Git - thirdparty/kea.git/commitdiff
[1781] Merge branch 'master' into trac1781 with fixing conflicts.
authorJINMEI Tatuya <jinmei@isc.org>
Tue, 17 Apr 2012 00:14:03 +0000 (17:14 -0700)
committerJINMEI Tatuya <jinmei@isc.org>
Tue, 17 Apr 2012 00:14:03 +0000 (17:14 -0700)
As part of conflict resolution, I've extended the unified textToRRset
so it takes an optional 'origin' parameter.  It's necessary to convert
SOA RRs.

1  2 
src/lib/datasrc/database.cc
src/lib/datasrc/database.h
src/lib/datasrc/tests/database_unittest.cc
src/lib/datasrc/tests/memory_datasrc_unittest.cc
src/lib/testutils/dnsmessage_test.cc
src/lib/testutils/dnsmessage_test.h

Simple merge
Simple merge
index eead1e78d4283938ea2c977e54f4a8dd63731e0d,c18cfadc765a2490e060f8ffd7e562116f1888a1..5b3a5dca6f9ec6af5c918f73c00969c820104ac7
  // OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
  // PERFORMANCE OF THIS SOFTWARE.
  
 -#include <stdlib.h>
 -
 -#include <boost/shared_ptr.hpp>
 -#include <boost/lexical_cast.hpp>
 -
 -#include <gtest/gtest.h>
 -
+ #include "faked_nsec3.h"
  #include <exceptions/exceptions.h>
  
 +#include <dns/masterload.h>
  #include <dns/name.h>
  #include <dns/rrttl.h>
  #include <dns/rrset.h>
@@@ -45,7 -47,7 +48,8 @@@ using namespace std
  using boost::dynamic_pointer_cast;
  using boost::lexical_cast;
  using namespace isc::dns;
 +using namespace isc::testutils;
+ using namespace isc::datasrc::test;
  
  namespace {
  
@@@ -1402,10 -1376,10 +1432,10 @@@ checkRRset(isc::dns::ConstRRsetPtr rrse
              isc::dns::rdata::createRdata(rrtype, rrclass,
                                           rdatas[i]));
      }
 -    isc::testutils::rrsetCheck(expected_rrset, rrset);
 +    rrsetCheck(expected_rrset, rrset);
  }
  
- // Iterate through a zone
+ // Iterate through a zone, common case
  TYPED_TEST(DatabaseClientTest, iterator) {
      ZoneIteratorPtr it(this->client_->getIterator(Name("example.org")));
      ConstRRsetPtr rrset(it->getNextRRset());
index 244f43381d9acafb7233622c8fe39a7e933fded2,3d653c0f79606a61c93eae5d4455e090c7e06523..ec6914d510ac05f7e028c42ebb77b05857361442
@@@ -86,25 -80,6 +86,26 @@@ matchRdata(const char*, const char*
      }
      return (::testing::AssertionSuccess());
  }
- textToRRset(const string& text_rrset, const RRClass& rrclass) {
 +
 +// A helper callback of masterLoad() used by textToRRset() below.
 +void
 +setRRset(RRsetPtr rrset, RRsetPtr* rrsetp) {
 +    if (*rrsetp) {
 +        isc_throw(isc::Unexpected,
 +                  "multiple RRsets are given to textToRRset");
 +    }
 +    *rrsetp = rrset;
 +}
 +}
 +
 +RRsetPtr
-     masterLoad(ss, Name::ROOT_NAME(), rrclass,
-                boost::bind(setRRset, _1, &rrset));
++textToRRset(const string& text_rrset, const RRClass& rrclass,
++            const Name& origin)
++{
 +    stringstream ss(text_rrset);
 +    RRsetPtr rrset;
++    masterLoad(ss, origin, rrclass, boost::bind(setRRset, _1, &rrset));
 +    return (rrset);
  }
  
  void
index 83c9405bf895a5e0635a5b5b008ff5593cf6c1ee,5c7401101e2d45e89c12e2b040a8517736a09b42..57cb72c1c33860050ab81221dbea53294b33b741
@@@ -174,23 -174,6 +174,29 @@@ private
  };
  }
  
-                                isc::dns::RRClass::IN());
 +/// \brief A converter from a string to RRset.
 +///
 +/// This is a convenient shortcut for tests that need to create an RRset
 +/// from textual representation with a single call to a function.
 +///
 +/// An RRset consisting of multiple RRs can be constructed, but only one
 +/// RRset is allowed.  If the given string contains mixed types of RRs
 +/// it throws an \c isc::Unexpected exception.
 +///
 +/// \param text_rrset A complete textual representation of an RRset.
 +///  It must meets the assumption of the \c dns::masterLoad() function.
 +/// \param rrclass The RR class of the RRset.  Note that \c text_rrset should
 +/// contain the RR class, but it's needed for \c dns::masterLoad().
++/// \param origin The zone origin where the RR is expected to belong.  This
++/// parameter normally doesn't have to be specified, but for an SOA RR it
++/// must be set to its owner name, due to the internal check of
++/// \c dns::masterLoad().
 +isc::dns::RRsetPtr textToRRset(const std::string& text_rrset,
 +                               const isc::dns::RRClass& rrclass =
++                               isc::dns::RRClass::IN(),
++                               const isc::dns::Name& origin =
++                               isc::dns::Name::ROOT_NAME());
 +
  /// Set of unit tests to check if two sets of RRsets are identical.
  ///
  /// This templated function takes two sets of sequences, each defined by