// PERFORMANCE OF THIS SOFTWARE.
#include "dns.h"
+#include "logic_check.h"
+
+using boost::shared_ptr;
namespace isc {
namespace acl {
getLoader() {
static Loader* loader(NULL);
if (loader == NULL) {
+ // TODO:
+ // There's some trick with auto_ptr in the branch when IP check
+ // is added here. That one is better, bring it in on merge.
loader = new Loader(REJECT);
- // TODO: This is the place where we register default check creators
- // like IP check, etc, once we have them.
+ loader->registerCreator(
+ shared_ptr<NotCreator<RequestContext> >(
+ new NotCreator<RequestContext>("NOT")));
+ loader->registerCreator(
+ shared_ptr<LogicCreator<AnyOfSpec, RequestContext> >(
+ new LogicCreator<AnyOfSpec, RequestContext>("ANY")));
+ loader->registerCreator(
+ shared_ptr<LogicCreator<AllOfSpec, RequestContext> >(
+ new LogicCreator<AllOfSpec, RequestContext>("ALL")));
}
return (*loader);
}
// check, are loaded.
}
+// The following tests test only the creators are registered, they are tested
+// elsewhere
+
+// TODO: Enable the tests when we merge the IP check branch here (is it called
+// "from" in the branch?)
+TEST(DNSACL, DISABLED_notLoad) {
+ EXPECT_NO_THROW(getLoader().loadCheck(isc::data::Element::fromJSON(
+ "{\"NOT\": {\"from\": \"192.0.2.1\"}}")));
+}
+
+TEST(DNSACL, DISABLED_allLoad) {
+ EXPECT_NO_THROW(getLoader().loadCheck(isc::data::Element::fromJSON(
+ "{\"ALL\": [{\"from\": \"192.0.2.1\"}]}")));
+}
+
+TEST(DNSACL, DISABLED_anyLoad) {
+ EXPECT_NO_THROW(getLoader().loadCheck(isc::data::Element::fromJSON(
+ "{\"ANY\": [{\"from\": \"192.0.2.1\"}]}")));
+}
+
}