From e1ea3e0d8999105f144d2be98e0286928b8319ed Mon Sep 17 00:00:00 2001
From: neil_a_wilson <neil_a_wilson@localhost>
Date: Tue, 03 Apr 2007 18:52:11 +0000
Subject: [PATCH] Add initial support for a virtual attribute subsystem, and implement a few different kinds of virtual attributes.  This commit addresses the following issues:

---
 opends/tests/unit-tests-testng/src/server/org/opends/server/interop/LazyDNTestCase.java |   39 +++++++++++++++++++++++++++++++++++++++
 1 files changed, 39 insertions(+), 0 deletions(-)

diff --git a/opends/tests/unit-tests-testng/src/server/org/opends/server/interop/LazyDNTestCase.java b/opends/tests/unit-tests-testng/src/server/org/opends/server/interop/LazyDNTestCase.java
index b739017..7145bae 100644
--- a/opends/tests/unit-tests-testng/src/server/org/opends/server/interop/LazyDNTestCase.java
+++ b/opends/tests/unit-tests-testng/src/server/org/opends/server/interop/LazyDNTestCase.java
@@ -40,6 +40,7 @@
 import org.opends.server.TestCaseUtils;
 import org.opends.server.types.DN;
 import org.opends.server.types.RDN;
+import org.opends.server.types.SearchScope;
 
 import static org.testng.Assert.*;
 
@@ -110,6 +111,10 @@
     sigs.add(new String[] { "isAncestorOf",
                             "boolean",
                             "org.opends.server.types.DN" });
+    sigs.add(new String[] { "matchesBaseAndScope",
+                            "boolean",
+                            "org.opends.server.types.DN",
+                            "org.opends.server.types.SearchScope" });
     sigs.add(new String[] { "equals",
                             "boolean",
                             "java.lang.Object" });
@@ -578,6 +583,40 @@
 
 
   /**
+   * Tests the {@code matchesBaseAndScope} method with valid DN strings.
+   *
+   * @throws  Exception  If an unexpected problem occurs.
+   */
+  @Test()
+  public void testMatchesBaseAndScope()
+         throws Exception
+  {
+    assertTrue(new LazyDN("").matchesBaseAndScope(DN.nullDN(),
+                                                  SearchScope.BASE_OBJECT));
+    assertTrue(new LazyDN("dc=example,dc=com").matchesBaseAndScope(
+                    DN.decode("dc=example,dc=com"), SearchScope.BASE_OBJECT));
+    assertTrue(new LazyDN("ou=People,dc=example,dc=com").matchesBaseAndScope(
+                    DN.decode("dc=example,dc=com"), SearchScope.WHOLE_SUBTREE));
+  }
+
+
+
+  /**
+   * Tests the {@code matchesBaseAndScope} method with an invalid DN string.
+   *
+   * @throws  Exception  If an unexpected problem occurs.
+   */
+  @Test(expectedExceptions = { RuntimeException.class })
+  public void testMatchesBaseandScopeInvalid()
+         throws Exception
+  {
+    new LazyDN("invalid").matchesBaseAndScope(DN.decode("dc=example,dc=com"),
+                                              SearchScope.WHOLE_SUBTREE);
+  }
+
+
+
+  /**
    * Tests the {@code equals} method with valid DN strings.
    *
    * @throws  Exception  If an unexpected problem occurs.

--
Gitblit v1.10.0