1 /* 2 * This file is part of PowerDNS or dnsdist. 3 * Copyright -- PowerDNS.COM B.V. and its contributors 4 * 5 * This program is free software; you can redistribute it and/or modify 6 * it under the terms of version 2 of the GNU General Public License as 7 * published by the Free Software Foundation. 8 * 9 * In addition, for the avoidance of any doubt, permission is granted to 10 * link this program with OpenSSL and to (re)distribute the binaries 11 * produced as the result of such linking. 12 * 13 * This program is distributed in the hope that it will be useful, 14 * but WITHOUT ANY WARRANTY; without even the implied warranty of 15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 * GNU General Public License for more details. 17 * 18 * You should have received a copy of the GNU General Public License 19 * along with this program; if not, write to the Free Software 20 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. 21 */ 22 23 #ifdef HAVE_CONFIG_H 24 #include "config.h" 25 #endif 26 #include "pdns/namespaces.hh" 27 #include "pdns/dns.hh" 28 #include "pdns/dnsbackend.hh" 29 #include "pdns/dnspacket.hh" 30 #include "pdns/pdnsexception.hh" 31 #include "pdns/logger.hh" 32 #include "pdns/arguments.hh" 33 #include "pdns/json.hh" 34 #include "pdns/statbag.hh" 35 #include "pdns/auth-packetcache.hh" 36 #include "pdns/auth-querycache.hh" 37 #include "pdns/auth-zonecache.hh" 38 39 StatBag S; 40 AuthPacketCache PC; 41 AuthQueryCache QC; 42 AuthZoneCache g_zoneCache; arg()43ArgvMap& arg() 44 { 45 static ArgvMap arg; 46 return arg; 47 }; 48 49 class RemoteLoader 50 { 51 public: 52 RemoteLoader(); 53 }; 54 55 DNSBackend* be; 56 57 #define BOOST_TEST_DYN_LINK 58 #define BOOST_TEST_MAIN 59 #define BOOST_TEST_MODULE unit 60 61 #include <boost/test/unit_test.hpp> 62 #include <boost/assign/list_of.hpp> 63 64 #include <boost/tuple/tuple.hpp> 65 66 struct RemotebackendSetup 67 { RemotebackendSetupRemotebackendSetup68 RemotebackendSetup() 69 { 70 be = 0; 71 try { 72 // setup minimum arguments 73 ::arg().set("module-dir") = "./.libs"; 74 new RemoteLoader(); 75 BackendMakers().launch("remote"); 76 // then get us a instance of it 77 ::arg().set("remote-connection-string") = "http:url=http://localhost:62434/dns"; 78 ::arg().set("remote-dnssec") = "yes"; 79 be = BackendMakers().all()[0]; 80 } 81 catch (PDNSException& ex) { 82 BOOST_TEST_MESSAGE("Cannot start remotebackend: " << ex.reason); 83 }; 84 } ~RemotebackendSetupRemotebackendSetup85 ~RemotebackendSetup() {} 86 }; 87 88 BOOST_GLOBAL_FIXTURE(RemotebackendSetup); 89