directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From akaras...@apache.org
Subject svn commit: r377135 [35/36] - in /directory/sandbox/akarasulu/rc1: apacheds/core-plugin/src/main/java/org/apache/directory/server/core/tools/schema/ apacheds/core-plugin/src/test/java/org/apache/directory/server/core/tools/schema/ apacheds/core-shared/...
Date Sun, 12 Feb 2006 05:51:22 GMT
Modified: directory/sandbox/akarasulu/rc1/testsuites/src/main/java/org/apache/ldap/testsuite/ldaptests/jndi/ops/modify/MixedModifyFailureTests.java
URL: http://svn.apache.org/viewcvs/directory/sandbox/akarasulu/rc1/testsuites/src/main/java/org/apache/ldap/testsuite/ldaptests/jndi/ops/modify/MixedModifyFailureTests.java?rev=377135&r1=377134&r2=377135&view=diff
==============================================================================
--- directory/sandbox/akarasulu/rc1/testsuites/src/main/java/org/apache/ldap/testsuite/ldaptests/jndi/ops/modify/MixedModifyFailureTests.java (original)
+++ directory/sandbox/akarasulu/rc1/testsuites/src/main/java/org/apache/ldap/testsuite/ldaptests/jndi/ops/modify/MixedModifyFailureTests.java Sat Feb 11 21:50:03 2006
@@ -1,181 +1,181 @@
-/*
- *   Copyright 2004 The Apache Software Foundation
- *
- *   Licensed under the Apache License, Version 2.0 (the "License");
- *   you may not use this file except in compliance with the License.
- *   You may obtain a copy of the License at
- *
- *       http://www.apache.org/licenses/LICENSE-2.0
- *
- *   Unless required by applicable law or agreed to in writing, software
- *   distributed under the License is distributed on an "AS IS" BASIS,
- *   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- *   See the License for the specific language governing permissions and
- *   limitations under the License.
- *
- */
-package org.apache.ldap.testsuite.ldaptests.jndi.ops.modify;
-
-import javax.naming.InvalidNameException;
-import javax.naming.NamingException;
-import javax.naming.directory.Attribute;
-import javax.naming.directory.AttributeInUseException;
-import javax.naming.directory.Attributes;
-import javax.naming.directory.BasicAttribute;
-import javax.naming.directory.BasicAttributes;
-import javax.naming.directory.DirContext;
-import javax.naming.directory.ModificationItem;
-import javax.naming.directory.SchemaViolationException;
-
-import org.apache.ldap.testsuite.ldaptests.jndi.BaseProtocolTest;
-
-/**
- * Tests with several modification items within one modify operation, which
- * cause an error. Goal is to chcek whether the modify operation is atomic.
- * 
- * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
- * @version $Rev: $
- */
-public class MixedModifyFailureTests extends BaseProtocolTest
-{
-
-    DirContext start;
-
-    DirContext ctx;
-
-    public static final String RDN = "cn=Tori Amos";
-
-    public static final String PERSON_DESCRIPTION = "an American singer-songwriter";
-
-    protected Attributes getPersonAttributes(String sn, String cn)
-    {
-        Attributes attributes = new BasicAttributes();
-        Attribute attribute = new BasicAttribute("objectClass");
-        attribute.add("top");
-        attribute.add("person");
-        attributes.put(attribute);
-        attributes.put("cn", cn);
-        attributes.put("sn", sn);
-
-        return attributes;
-    }
-
-    public void setUp() throws NamingException
-    {
-        super.setUp();
-
-        start = this.createContext();
-        ctx = (DirContext) start.lookup(this.getTestContainerRdn());
-
-        // Create a person with description
-        Attributes attributes = this.getPersonAttributes("Amos", "Tori Amos");
-        attributes.put("description", PERSON_DESCRIPTION);
-
-        ctx.createSubcontext(RDN, attributes);
-    }
-
-    public void tearDown() throws NamingException
-    {
-        ctx.unbind(RDN);
-        ctx.close();
-
-        start.close();
-        start = null;
-
-        super.tearDown();
-    }
-
-    /**
-     * Try to add a new attribute (allowed) and to replace the RDN attribute
-     * (forbidden).
-     * 
-     * @throws NamingException
-     */
-    public void testAddAndIllegalReplace() throws NamingException
-    {
-
-        // Add telephoneNumber attribute
-        String newValue = "1234567890";
-        Attribute telephoneNumber = new BasicAttribute("telephoneNumber", newValue);
-        ModificationItem modAdd = new ModificationItem(DirContext.ADD_ATTRIBUTE, telephoneNumber);
-
-        // Try to replace a desciption value, which does not exist
-        Attribute cn = new BasicAttribute("cn", "XXX");
-        ModificationItem modReplace = new ModificationItem(DirContext.REPLACE_ATTRIBUTE, cn);
-
-        // execute modify: 1. add, 2. replace
-        ModificationItem[] mods = new ModificationItem[] { modAdd, modReplace };
-        try {
-            ctx.modifyAttributes(RDN, mods);
-            fail("mofify operation should fail.");
-        } catch (SchemaViolationException e) {
-            // Expected behaviour
-        } catch (InvalidNameException e) {
-            // Expected behaviour
-        }
-
-        // Verify, that no telephone attribute was created, and cn has bot been
-        // changed
-        Attributes attrs = ctx.getAttributes(RDN);
-        assertNull(attrs.get("telephoneNumber"));
-        cn = attrs.get("cn");
-        assertNotNull(cn);
-        assertTrue(cn.contains("Tori Amos"));
-
-        // Mix the sequence of modification items: 1. replace, 2. add
-        mods = new ModificationItem[] { modReplace, modAdd };
-        try {
-            ctx.modifyAttributes(RDN, mods);
-            fail("modify operation should fail.");
-        } catch (SchemaViolationException e) {
-            // Expected behaviour
-        } catch (InvalidNameException e) {
-            // Expected behaviour
-        }
-
-        // Verify again, that no telephone attribute was created, and cn has bot
-        // been changed
-        attrs = ctx.getAttributes(RDN);
-        assertNull(attrs.get("telephoneNumber"));
-        cn = attrs.get("cn");
-        assertNotNull(cn);
-        assertTrue(cn.contains("Tori Amos"));
-    }
-
-    /**
-     * Try to remove an attribute (allowed) and add an attribute value twice
-     * (forbidden) within one modify op. Expected behaviour is that the modify
-     * op fails and the entry is not changed.
-     * 
-     * @throws NamingException
-     */
-    public void testRemoveAndDuplicateAdd() throws NamingException
-    {
-
-        // Remove description attribute
-        Attribute description = new BasicAttribute("description");
-        ModificationItem modRemove = new ModificationItem(DirContext.REMOVE_ATTRIBUTE, description);
-
-        // Try to add a new desciption value
-        Attribute telephoneNumber = new BasicAttribute("telephoneNumber", "01234567890");
-        ModificationItem modAdd = new ModificationItem(DirContext.ADD_ATTRIBUTE, telephoneNumber);
-
-        // execute modify: 1. remove, 2. add, 3. same add
-        ModificationItem[] mods = new ModificationItem[] { modRemove, modAdd, modAdd };
-        try {
-            ctx.modifyAttributes(RDN, mods);
-            fail("modify operation should fail.");
-        } catch (AttributeInUseException e) {
-            // Expected behaviour
-        }
-
-        // Verify, that description has not been removed, and telephoneNumber
-        // has not been added
-        Attributes attrs = ctx.getAttributes(RDN);
-        System.err.println(attrs);
-        description = attrs.get("description");
-        assertNotNull(description);
-        assertTrue(description.contains(PERSON_DESCRIPTION));
-        assertNull(attrs.get("telephoneNumber"));
-    }
+/*
+ *   Copyright 2004 The Apache Software Foundation
+ *
+ *   Licensed under the Apache License, Version 2.0 (the "License");
+ *   you may not use this file except in compliance with the License.
+ *   You may obtain a copy of the License at
+ *
+ *       http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *   Unless required by applicable law or agreed to in writing, software
+ *   distributed under the License is distributed on an "AS IS" BASIS,
+ *   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *   See the License for the specific language governing permissions and
+ *   limitations under the License.
+ *
+ */
+package org.apache.ldap.testsuite.ldaptests.jndi.ops.modify;
+
+import javax.naming.InvalidNameException;
+import javax.naming.NamingException;
+import javax.naming.directory.Attribute;
+import javax.naming.directory.AttributeInUseException;
+import javax.naming.directory.Attributes;
+import javax.naming.directory.BasicAttribute;
+import javax.naming.directory.BasicAttributes;
+import javax.naming.directory.DirContext;
+import javax.naming.directory.ModificationItem;
+import javax.naming.directory.SchemaViolationException;
+
+import org.apache.ldap.testsuite.ldaptests.jndi.BaseProtocolTest;
+
+/**
+ * Tests with several modification items within one modify operation, which
+ * cause an error. Goal is to chcek whether the modify operation is atomic.
+ * 
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ * @version $Rev$
+ */
+public class MixedModifyFailureTests extends BaseProtocolTest
+{
+
+    DirContext start;
+
+    DirContext ctx;
+
+    public static final String RDN = "cn=Tori Amos";
+
+    public static final String PERSON_DESCRIPTION = "an American singer-songwriter";
+
+    protected Attributes getPersonAttributes(String sn, String cn)
+    {
+        Attributes attributes = new BasicAttributes();
+        Attribute attribute = new BasicAttribute("objectClass");
+        attribute.add("top");
+        attribute.add("person");
+        attributes.put(attribute);
+        attributes.put("cn", cn);
+        attributes.put("sn", sn);
+
+        return attributes;
+    }
+
+    public void setUp() throws NamingException
+    {
+        super.setUp();
+
+        start = this.createContext();
+        ctx = (DirContext) start.lookup(this.getTestContainerRdn());
+
+        // Create a person with description
+        Attributes attributes = this.getPersonAttributes("Amos", "Tori Amos");
+        attributes.put("description", PERSON_DESCRIPTION);
+
+        ctx.createSubcontext(RDN, attributes);
+    }
+
+    public void tearDown() throws NamingException
+    {
+        ctx.unbind(RDN);
+        ctx.close();
+
+        start.close();
+        start = null;
+
+        super.tearDown();
+    }
+
+    /**
+     * Try to add a new attribute (allowed) and to replace the RDN attribute
+     * (forbidden).
+     * 
+     * @throws NamingException
+     */
+    public void testAddAndIllegalReplace() throws NamingException
+    {
+
+        // Add telephoneNumber attribute
+        String newValue = "1234567890";
+        Attribute telephoneNumber = new BasicAttribute("telephoneNumber", newValue);
+        ModificationItem modAdd = new ModificationItem(DirContext.ADD_ATTRIBUTE, telephoneNumber);
+
+        // Try to replace a desciption value, which does not exist
+        Attribute cn = new BasicAttribute("cn", "XXX");
+        ModificationItem modReplace = new ModificationItem(DirContext.REPLACE_ATTRIBUTE, cn);
+
+        // execute modify: 1. add, 2. replace
+        ModificationItem[] mods = new ModificationItem[] { modAdd, modReplace };
+        try {
+            ctx.modifyAttributes(RDN, mods);
+            fail("mofify operation should fail.");
+        } catch (SchemaViolationException e) {
+            // Expected behaviour
+        } catch (InvalidNameException e) {
+            // Expected behaviour
+        }
+
+        // Verify, that no telephone attribute was created, and cn has bot been
+        // changed
+        Attributes attrs = ctx.getAttributes(RDN);
+        assertNull(attrs.get("telephoneNumber"));
+        cn = attrs.get("cn");
+        assertNotNull(cn);
+        assertTrue(cn.contains("Tori Amos"));
+
+        // Mix the sequence of modification items: 1. replace, 2. add
+        mods = new ModificationItem[] { modReplace, modAdd };
+        try {
+            ctx.modifyAttributes(RDN, mods);
+            fail("modify operation should fail.");
+        } catch (SchemaViolationException e) {
+            // Expected behaviour
+        } catch (InvalidNameException e) {
+            // Expected behaviour
+        }
+
+        // Verify again, that no telephone attribute was created, and cn has bot
+        // been changed
+        attrs = ctx.getAttributes(RDN);
+        assertNull(attrs.get("telephoneNumber"));
+        cn = attrs.get("cn");
+        assertNotNull(cn);
+        assertTrue(cn.contains("Tori Amos"));
+    }
+
+    /**
+     * Try to remove an attribute (allowed) and add an attribute value twice
+     * (forbidden) within one modify op. Expected behaviour is that the modify
+     * op fails and the entry is not changed.
+     * 
+     * @throws NamingException
+     */
+    public void testRemoveAndDuplicateAdd() throws NamingException
+    {
+
+        // Remove description attribute
+        Attribute description = new BasicAttribute("description");
+        ModificationItem modRemove = new ModificationItem(DirContext.REMOVE_ATTRIBUTE, description);
+
+        // Try to add a new desciption value
+        Attribute telephoneNumber = new BasicAttribute("telephoneNumber", "01234567890");
+        ModificationItem modAdd = new ModificationItem(DirContext.ADD_ATTRIBUTE, telephoneNumber);
+
+        // execute modify: 1. remove, 2. add, 3. same add
+        ModificationItem[] mods = new ModificationItem[] { modRemove, modAdd, modAdd };
+        try {
+            ctx.modifyAttributes(RDN, mods);
+            fail("modify operation should fail.");
+        } catch (AttributeInUseException e) {
+            // Expected behaviour
+        }
+
+        // Verify, that description has not been removed, and telephoneNumber
+        // has not been added
+        Attributes attrs = ctx.getAttributes(RDN);
+        System.err.println(attrs);
+        description = attrs.get("description");
+        assertNotNull(description);
+        assertTrue(description.contains(PERSON_DESCRIPTION));
+        assertNull(attrs.get("telephoneNumber"));
+    }
 }

Propchange: directory/sandbox/akarasulu/rc1/testsuites/src/main/java/org/apache/ldap/testsuite/ldaptests/jndi/ops/modify/MixedModifyFailureTests.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: directory/sandbox/akarasulu/rc1/testsuites/src/main/java/org/apache/ldap/testsuite/ldaptests/jndi/ops/modify/MixedModifyFailureTests.java
------------------------------------------------------------------------------
--- svn:keywords (added)
+++ svn:keywords Sat Feb 11 21:50:03 2006
@@ -0,0 +1,4 @@
+Rev
+Revision
+Date
+Id

Modified: directory/sandbox/akarasulu/rc1/testsuites/src/main/java/org/apache/ldap/testsuite/ldaptests/jndi/ops/modifydn/AllTests.java
URL: http://svn.apache.org/viewcvs/directory/sandbox/akarasulu/rc1/testsuites/src/main/java/org/apache/ldap/testsuite/ldaptests/jndi/ops/modifydn/AllTests.java?rev=377135&r1=377134&r2=377135&view=diff
==============================================================================
--- directory/sandbox/akarasulu/rc1/testsuites/src/main/java/org/apache/ldap/testsuite/ldaptests/jndi/ops/modifydn/AllTests.java (original)
+++ directory/sandbox/akarasulu/rc1/testsuites/src/main/java/org/apache/ldap/testsuite/ldaptests/jndi/ops/modifydn/AllTests.java Sat Feb 11 21:50:03 2006
@@ -1,40 +1,40 @@
-/*
- *   Copyright 2004 The Apache Software Foundation
- *
- *   Licensed under the Apache License, Version 2.0 (the "License");
- *   you may not use this file except in compliance with the License.
- *   You may obtain a copy of the License at
- *
- *       http://www.apache.org/licenses/LICENSE-2.0
- *
- *   Unless required by applicable law or agreed to in writing, software
- *   distributed under the License is distributed on an "AS IS" BASIS,
- *   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- *   See the License for the specific language governing permissions and
- *   limitations under the License.
- *
- */
-package org.apache.ldap.testsuite.ldaptests.jndi.ops.modifydn;
-
-import junit.framework.TestSuite;
-
-/**
- * Contains the test classes for the LDAP modify DN operation executed via JNDI.
- * It is used to form the complete suite into a structure.
- * 
- * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
- * @version $Rev$
- */
-public class AllTests extends TestSuite
-{
-
-    public static TestSuite suite()
-    {
-        TestSuite suite = new TestSuite("Modify DN");
-
-        suite.addTestSuite(BasicModifyDnTests.class);
-        suite.addTestSuite(ModifyDnSameAttributeTests.class);
-
-        return suite;
-    }
-}
+/*
+ *   Copyright 2004 The Apache Software Foundation
+ *
+ *   Licensed under the Apache License, Version 2.0 (the "License");
+ *   you may not use this file except in compliance with the License.
+ *   You may obtain a copy of the License at
+ *
+ *       http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *   Unless required by applicable law or agreed to in writing, software
+ *   distributed under the License is distributed on an "AS IS" BASIS,
+ *   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *   See the License for the specific language governing permissions and
+ *   limitations under the License.
+ *
+ */
+package org.apache.ldap.testsuite.ldaptests.jndi.ops.modifydn;
+
+import junit.framework.TestSuite;
+
+/**
+ * Contains the test classes for the LDAP modify DN operation executed via JNDI.
+ * It is used to form the complete suite into a structure.
+ * 
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ * @version $Rev$
+ */
+public class AllTests extends TestSuite
+{
+
+    public static TestSuite suite()
+    {
+        TestSuite suite = new TestSuite("Modify DN");
+
+        suite.addTestSuite(BasicModifyDnTests.class);
+        suite.addTestSuite(ModifyDnSameAttributeTests.class);
+
+        return suite;
+    }
+}

Propchange: directory/sandbox/akarasulu/rc1/testsuites/src/main/java/org/apache/ldap/testsuite/ldaptests/jndi/ops/modifydn/AllTests.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: directory/sandbox/akarasulu/rc1/testsuites/src/main/java/org/apache/ldap/testsuite/ldaptests/jndi/ops/modifydn/AllTests.java
------------------------------------------------------------------------------
--- svn:keywords (original)
+++ svn:keywords Sat Feb 11 21:50:03 2006
@@ -1 +1,4 @@
-HeadURL Id LastChangedBy LastChangedDate LastChangedRevision
+Rev
+Revision
+Date
+Id

Modified: directory/sandbox/akarasulu/rc1/testsuites/src/main/java/org/apache/ldap/testsuite/ldaptests/jndi/ops/modifydn/BasicModifyDnTests.java
URL: http://svn.apache.org/viewcvs/directory/sandbox/akarasulu/rc1/testsuites/src/main/java/org/apache/ldap/testsuite/ldaptests/jndi/ops/modifydn/BasicModifyDnTests.java?rev=377135&r1=377134&r2=377135&view=diff
==============================================================================
--- directory/sandbox/akarasulu/rc1/testsuites/src/main/java/org/apache/ldap/testsuite/ldaptests/jndi/ops/modifydn/BasicModifyDnTests.java (original)
+++ directory/sandbox/akarasulu/rc1/testsuites/src/main/java/org/apache/ldap/testsuite/ldaptests/jndi/ops/modifydn/BasicModifyDnTests.java Sat Feb 11 21:50:03 2006
@@ -1,188 +1,188 @@
-/*
- *   Copyright 2004 The Apache Software Foundation
- *
- *   Licensed under the Apache License, Version 2.0 (the "License");
- *   you may not use this file except in compliance with the License.
- *   You may obtain a copy of the License at
- *
- *       http://www.apache.org/licenses/LICENSE-2.0
- *
- *   Unless required by applicable law or agreed to in writing, software
- *   distributed under the License is distributed on an "AS IS" BASIS,
- *   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- *   See the License for the specific language governing permissions and
- *   limitations under the License.
- *
- */
-package org.apache.ldap.testsuite.ldaptests.jndi.ops.modifydn;
-
-import javax.naming.NameAlreadyBoundException;
-import javax.naming.NameNotFoundException;
-import javax.naming.NamingException;
-import javax.naming.directory.Attribute;
-import javax.naming.directory.Attributes;
-import javax.naming.directory.BasicAttribute;
-import javax.naming.directory.BasicAttributes;
-import javax.naming.directory.DirContext;
-import javax.naming.directory.SchemaViolationException;
-
-import org.apache.ldap.testsuite.ldaptests.jndi.BaseProtocolTest;
-
-/**
- * Basic Tests for the Modify DN operation.
- * 
- * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
- * @version $Rev: $
- */
-public class BasicModifyDnTests extends BaseProtocolTest
-{
-
-    /**
-     * Creates attributes for a inetOrgPerson with minimum required attributes.
-     * 
-     * @param sn
-     *            sn value of the person (surname)
-     * @param cn
-     *            cn value of the person (common name)
-     * @return attributes object for this person
-     */
-    protected Attributes getInetOrgPersonAttributes(String sn, String cn)
-    {
-        Attributes attributes = new BasicAttributes();
-        Attribute attribute = new BasicAttribute("objectClass");
-        attribute.add("top");
-        attribute.add("person");
-        attribute.add("organizationalPerson");
-        attribute.add("inetOrgPerson");
-        attributes.put(attribute);
-        attributes.put("cn", cn);
-        attributes.put("sn", sn);
-
-        return attributes;
-    }
-
-    /**
-     * Modify DN of an entry, changing RDN from cn to uid.
-     * 
-     * @throws NamingException
-     */
-    public void testModifyRdnAndKeepOld() throws NamingException
-    {
-        DirContext ctx = this.createContext();
-        DirContext target = (DirContext) ctx.lookup(this.getTestContainerRdn());
-
-        // Create a person, cn value is rdn
-        String cnVal = "Tori Amos";
-        String snVal = "Amos";
-        String uidVal = "tamos";
-        String oldRdn = "cn=" + cnVal;
-        Attributes attributes = this.getInetOrgPersonAttributes(snVal, cnVal);
-        attributes.put("uid", uidVal);
-        target.createSubcontext(oldRdn, attributes);
-
-        // modify Rdn
-        String newRdn = "uid=" + uidVal;
-        target.addToEnvironment("java.naming.ldap.deleteRDN", "false");
-        target.rename(oldRdn, newRdn);
-
-        // Check, whether old Entry does not exists
-        try {
-            target.lookup(oldRdn);
-            fail("Entry must not exist");
-        } catch (NameNotFoundException ignored) {
-            // expected behaviour
-        }
-
-        // Check, whether new Entry exists
-        DirContext tori = (DirContext) target.lookup(newRdn);
-        assertNotNull(tori);
-
-        // Check values of cn and uid
-        Attribute cn = tori.getAttributes("").get("cn");
-        assertTrue(cn.contains(cnVal));
-        assertEquals(1, cn.size());
-        Attribute uid = tori.getAttributes("").get("uid");
-        assertTrue(uid.contains(uidVal));
-        assertEquals(1, uid.size());
-
-        ctx.close();
-    }
-
-    /**
-     * Modify Rdn of an entry, changing it from cn to uid, but try delete old
-     * rdn. This should cause a schema violation.
-     * 
-     * @throws NamingException
-     */
-    public void testModifyRdnAndTryToDeleteOld() throws NamingException
-    {
-
-        DirContext ctx = this.createContext();
-        DirContext target = (DirContext) ctx.lookup(this.getTestContainerRdn());
-
-        // Create a person, cn value is rdn
-        String cnVal = "Tori Amos";
-        String snVal = "Amos";
-        String uidVal = "tamos";
-        String oldRdn = "cn=" + cnVal;
-        Attributes attributes = this.getInetOrgPersonAttributes(snVal, cnVal);
-        target.createSubcontext(oldRdn, attributes);
-
-        // modify Rdn, but try delete old val
-        try {
-            String newRdn = "uid=" + uidVal;
-            target.addToEnvironment("java.naming.ldap.deleteRDN", "true");
-            target.rename(oldRdn, newRdn);
-            fail("modify DN should cause a schema violation");
-        } catch (SchemaViolationException sve) {
-            // expected behaviour
-        }
-
-        // Check that old entry still exists
-        DirContext tori = (DirContext) target.lookup(oldRdn);
-        assertNotNull(tori);
-
-        ctx.close();
-    }
-
-    /**
-     * Modify Rdn of an entry, changing it from cn to uid. But an entry with
-     * corresponding RDN already exists. This should cause an exception.
-     * 
-     * @throws NamingException
-     */
-    public void testModifyRdnToExistingValue() throws NamingException
-    {
-
-        DirContext ctx = this.createContext();
-        DirContext target = (DirContext) ctx.lookup(this.getTestContainerRdn());
-
-        // Create a person, cn value is rdn
-        String cnVal = "Tori Amos";
-        String snVal = "Amos";
-        String oldRdn = "cn=" + cnVal;
-        String uidVal = "tamos";
-        Attributes attributes = this.getInetOrgPersonAttributes(snVal, cnVal);
-        target.createSubcontext(oldRdn, attributes);
-
-        // create same person with sn as RDN
-        String newRdn = "uid=" + uidVal;
-        attributes.put("uid", uidVal);
-        target.createSubcontext(newRdn, attributes);
-
-        // modify DN, use existing value
-        target.addToEnvironment("java.naming.ldap.deleteRDN", "false");
-        try {
-            target.rename(oldRdn, newRdn);
-            fail("modify DN should cause an exception");
-        } catch (NameAlreadyBoundException nbe) {
-            // expected behaviour
-        }
-
-        // Check that old entry still exists
-        DirContext tori = (DirContext) target.lookup(oldRdn);
-        assertNotNull(tori);
-
-        ctx.close();
-    }
+/*
+ *   Copyright 2004 The Apache Software Foundation
+ *
+ *   Licensed under the Apache License, Version 2.0 (the "License");
+ *   you may not use this file except in compliance with the License.
+ *   You may obtain a copy of the License at
+ *
+ *       http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *   Unless required by applicable law or agreed to in writing, software
+ *   distributed under the License is distributed on an "AS IS" BASIS,
+ *   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *   See the License for the specific language governing permissions and
+ *   limitations under the License.
+ *
+ */
+package org.apache.ldap.testsuite.ldaptests.jndi.ops.modifydn;
+
+import javax.naming.NameAlreadyBoundException;
+import javax.naming.NameNotFoundException;
+import javax.naming.NamingException;
+import javax.naming.directory.Attribute;
+import javax.naming.directory.Attributes;
+import javax.naming.directory.BasicAttribute;
+import javax.naming.directory.BasicAttributes;
+import javax.naming.directory.DirContext;
+import javax.naming.directory.SchemaViolationException;
+
+import org.apache.ldap.testsuite.ldaptests.jndi.BaseProtocolTest;
+
+/**
+ * Basic Tests for the Modify DN operation.
+ * 
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ * @version $Rev$
+ */
+public class BasicModifyDnTests extends BaseProtocolTest
+{
+
+    /**
+     * Creates attributes for a inetOrgPerson with minimum required attributes.
+     * 
+     * @param sn
+     *            sn value of the person (surname)
+     * @param cn
+     *            cn value of the person (common name)
+     * @return attributes object for this person
+     */
+    protected Attributes getInetOrgPersonAttributes(String sn, String cn)
+    {
+        Attributes attributes = new BasicAttributes();
+        Attribute attribute = new BasicAttribute("objectClass");
+        attribute.add("top");
+        attribute.add("person");
+        attribute.add("organizationalPerson");
+        attribute.add("inetOrgPerson");
+        attributes.put(attribute);
+        attributes.put("cn", cn);
+        attributes.put("sn", sn);
+
+        return attributes;
+    }
+
+    /**
+     * Modify DN of an entry, changing RDN from cn to uid.
+     * 
+     * @throws NamingException
+     */
+    public void testModifyRdnAndKeepOld() throws NamingException
+    {
+        DirContext ctx = this.createContext();
+        DirContext target = (DirContext) ctx.lookup(this.getTestContainerRdn());
+
+        // Create a person, cn value is rdn
+        String cnVal = "Tori Amos";
+        String snVal = "Amos";
+        String uidVal = "tamos";
+        String oldRdn = "cn=" + cnVal;
+        Attributes attributes = this.getInetOrgPersonAttributes(snVal, cnVal);
+        attributes.put("uid", uidVal);
+        target.createSubcontext(oldRdn, attributes);
+
+        // modify Rdn
+        String newRdn = "uid=" + uidVal;
+        target.addToEnvironment("java.naming.ldap.deleteRDN", "false");
+        target.rename(oldRdn, newRdn);
+
+        // Check, whether old Entry does not exists
+        try {
+            target.lookup(oldRdn);
+            fail("Entry must not exist");
+        } catch (NameNotFoundException ignored) {
+            // expected behaviour
+        }
+
+        // Check, whether new Entry exists
+        DirContext tori = (DirContext) target.lookup(newRdn);
+        assertNotNull(tori);
+
+        // Check values of cn and uid
+        Attribute cn = tori.getAttributes("").get("cn");
+        assertTrue(cn.contains(cnVal));
+        assertEquals(1, cn.size());
+        Attribute uid = tori.getAttributes("").get("uid");
+        assertTrue(uid.contains(uidVal));
+        assertEquals(1, uid.size());
+
+        ctx.close();
+    }
+
+    /**
+     * Modify Rdn of an entry, changing it from cn to uid, but try delete old
+     * rdn. This should cause a schema violation.
+     * 
+     * @throws NamingException
+     */
+    public void testModifyRdnAndTryToDeleteOld() throws NamingException
+    {
+
+        DirContext ctx = this.createContext();
+        DirContext target = (DirContext) ctx.lookup(this.getTestContainerRdn());
+
+        // Create a person, cn value is rdn
+        String cnVal = "Tori Amos";
+        String snVal = "Amos";
+        String uidVal = "tamos";
+        String oldRdn = "cn=" + cnVal;
+        Attributes attributes = this.getInetOrgPersonAttributes(snVal, cnVal);
+        target.createSubcontext(oldRdn, attributes);
+
+        // modify Rdn, but try delete old val
+        try {
+            String newRdn = "uid=" + uidVal;
+            target.addToEnvironment("java.naming.ldap.deleteRDN", "true");
+            target.rename(oldRdn, newRdn);
+            fail("modify DN should cause a schema violation");
+        } catch (SchemaViolationException sve) {
+            // expected behaviour
+        }
+
+        // Check that old entry still exists
+        DirContext tori = (DirContext) target.lookup(oldRdn);
+        assertNotNull(tori);
+
+        ctx.close();
+    }
+
+    /**
+     * Modify Rdn of an entry, changing it from cn to uid. But an entry with
+     * corresponding RDN already exists. This should cause an exception.
+     * 
+     * @throws NamingException
+     */
+    public void testModifyRdnToExistingValue() throws NamingException
+    {
+
+        DirContext ctx = this.createContext();
+        DirContext target = (DirContext) ctx.lookup(this.getTestContainerRdn());
+
+        // Create a person, cn value is rdn
+        String cnVal = "Tori Amos";
+        String snVal = "Amos";
+        String oldRdn = "cn=" + cnVal;
+        String uidVal = "tamos";
+        Attributes attributes = this.getInetOrgPersonAttributes(snVal, cnVal);
+        target.createSubcontext(oldRdn, attributes);
+
+        // create same person with sn as RDN
+        String newRdn = "uid=" + uidVal;
+        attributes.put("uid", uidVal);
+        target.createSubcontext(newRdn, attributes);
+
+        // modify DN, use existing value
+        target.addToEnvironment("java.naming.ldap.deleteRDN", "false");
+        try {
+            target.rename(oldRdn, newRdn);
+            fail("modify DN should cause an exception");
+        } catch (NameAlreadyBoundException nbe) {
+            // expected behaviour
+        }
+
+        // Check that old entry still exists
+        DirContext tori = (DirContext) target.lookup(oldRdn);
+        assertNotNull(tori);
+
+        ctx.close();
+    }
 }

Propchange: directory/sandbox/akarasulu/rc1/testsuites/src/main/java/org/apache/ldap/testsuite/ldaptests/jndi/ops/modifydn/BasicModifyDnTests.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: directory/sandbox/akarasulu/rc1/testsuites/src/main/java/org/apache/ldap/testsuite/ldaptests/jndi/ops/modifydn/BasicModifyDnTests.java
------------------------------------------------------------------------------
--- svn:keywords (added)
+++ svn:keywords Sat Feb 11 21:50:03 2006
@@ -0,0 +1,4 @@
+Rev
+Revision
+Date
+Id

Modified: directory/sandbox/akarasulu/rc1/testsuites/src/main/java/org/apache/ldap/testsuite/ldaptests/jndi/ops/modifydn/ModifyDnSameAttributeTests.java
URL: http://svn.apache.org/viewcvs/directory/sandbox/akarasulu/rc1/testsuites/src/main/java/org/apache/ldap/testsuite/ldaptests/jndi/ops/modifydn/ModifyDnSameAttributeTests.java?rev=377135&r1=377134&r2=377135&view=diff
==============================================================================
--- directory/sandbox/akarasulu/rc1/testsuites/src/main/java/org/apache/ldap/testsuite/ldaptests/jndi/ops/modifydn/ModifyDnSameAttributeTests.java (original)
+++ directory/sandbox/akarasulu/rc1/testsuites/src/main/java/org/apache/ldap/testsuite/ldaptests/jndi/ops/modifydn/ModifyDnSameAttributeTests.java Sat Feb 11 21:50:03 2006
@@ -1,175 +1,175 @@
-/*
- *   Copyright 2004 The Apache Software Foundation
- *
- *   Licensed under the Apache License, Version 2.0 (the "License");
- *   you may not use this file except in compliance with the License.
- *   You may obtain a copy of the License at
- *
- *       http://www.apache.org/licenses/LICENSE-2.0
- *
- *   Unless required by applicable law or agreed to in writing, software
- *   distributed under the License is distributed on an "AS IS" BASIS,
- *   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- *   See the License for the specific language governing permissions and
- *   limitations under the License.
- *
- */
-package org.apache.ldap.testsuite.ldaptests.jndi.ops.modifydn;
-
-import javax.naming.NameNotFoundException;
-import javax.naming.NamingException;
-import javax.naming.directory.Attribute;
-import javax.naming.directory.Attributes;
-import javax.naming.directory.DirContext;
-
-import org.apache.ldap.testsuite.ldaptests.jndi.BaseProtocolTest;
-import org.apache.ldap.testsuite.ldaptests.jndi.util.AttributesFactory;
-
-/**
- * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
- * @version $Rev$
- */
-public class ModifyDnSameAttributeTests extends BaseProtocolTest
-{
-    /**
-     * Modify Rdn of an entry, delete its old rdn value.
-     * 
-     * @throws NamingException
-     */
-    public void testModifyRdnAndDeleteOld() throws NamingException
-    {
-        DirContext ctx = this.createContext();
-        DirContext target = (DirContext) ctx.lookup(this.getTestContainerRdn());
-
-        // Create an organizational unit, ou value is rdn
-        String oldOu = "Judean People's Front";
-        String oldRdn = "ou=" + oldOu;
-        Attributes attributes = AttributesFactory.createOrganizationalUnitAttributes(oldOu);
-        target.createSubcontext(oldRdn, attributes);
-
-        // modify Rdn
-        String newOu = "People's Front of Judea";
-        String newRdn = "ou=" + newOu;
-        target.addToEnvironment("java.naming.ldap.deleteRDN", "true");
-        target.rename(oldRdn, newRdn);
-
-        // Check, whether old Entry does not exists
-        try {
-            target.lookup(oldRdn);
-            fail("Entry must not exist");
-        } catch (NameNotFoundException ignored) {
-            // expected behaviour
-            assertTrue(true);
-        }
-
-        // Check, whether new Entry exists
-        DirContext ouEntry = (DirContext) target.lookup(newRdn);
-        assertNotNull(ouEntry);
-
-        // Check values of ou
-        Attribute ou = ouEntry.getAttributes("").get("ou");
-        assertTrue(ou.contains(newOu));
-        assertTrue(!ou.contains(oldOu)); // old vaue is gone
-        assertEquals(1, ou.size());
-
-        ctx.close();
-    }
-
-    /**
-     * Modify Rdn of an entry, keep its old rdn value.
-     * 
-     * @throws NamingException
-     */
-    public void testModifyRdnAndKeepOld() throws NamingException
-    {
-
-        DirContext ctx = this.createContext();
-        DirContext target = (DirContext) ctx.lookup(this.getTestContainerRdn());
-
-        // Create an organizational unit, ou value is rdn
-        String oldOu = "Judean People's Front";
-        String oldRdn = "ou=" + oldOu;
-        Attributes attributes = AttributesFactory.createOrganizationalUnitAttributes(oldOu);
-        target.createSubcontext(oldRdn, attributes);
-
-        // modify Rdn
-        String newOu = "People's Front of Judea";
-        String newRdn = "ou=" + newOu;
-        target.addToEnvironment("java.naming.ldap.deleteRDN", "false");
-        target.rename(oldRdn, newRdn);
-
-        // Check, whether old entry does not exist
-        try {
-            target.lookup(oldRdn);
-            fail("Entry must not exist");
-        } catch (NameNotFoundException ignored) {
-            // expected behaviour
-            assertTrue(true);
-        }
-
-        // Check, whether new entry exists
-        DirContext ouEntry = (DirContext) target.lookup(newRdn);
-        assertNotNull(ouEntry);
-
-        // Check values of cn
-        Attribute ou = ouEntry.getAttributes("").get("ou");
-        assertTrue(ou.contains(newOu));
-        assertTrue(ou.contains(oldOu)); // old value is still present
-        assertEquals(2, ou.size());
-
-        ouEntry.close();
-        target.close();
-        ctx.close();
-    }
-
-    /**
-     * Modify Rdn of an entry, delete its old rdn value. Here, the rdn attribute
-     * cn has another value as well.
-     * 
-     * @throws NamingException
-     */
-    public void testModifyRdnAndDeleteOldVariant() throws NamingException
-    {
-        DirContext ctx = this.createContext();
-        DirContext target = (DirContext) ctx.lookup(this.getTestContainerRdn());
-
-        // Create an organizational unit, ou value is rdn
-        String oldOu = "Judean People's Front";
-        String oldRdn = "ou=" + oldOu;
-        Attributes attributes = AttributesFactory.createOrganizationalUnitAttributes(oldOu);
-
-        // add a second ou value
-        String alternateOu = "J.P.F.";
-        Attribute ou = attributes.get("ou");
-        ou.add(alternateOu);
-        assertEquals(2, ou.size());
-
-        target.createSubcontext(oldRdn, attributes);
-
-        // modify Rdn
-        String newOu = "People's Front of Judea";
-        String newRdn = "ou=" + newOu;
-        target.addToEnvironment("java.naming.ldap.deleteRDN", "true");
-        target.rename(oldRdn, newRdn);
-
-        // Check, whether old Entry does not exist anymore
-        try {
-            target.lookup(oldRdn);
-            fail("Entry must not exist");
-        } catch (NameNotFoundException ignored) {
-            // expected behaviour
-            assertTrue(true);
-        }
-
-        // Check, whether new Entry exists
-        DirContext ouEntry = (DirContext) target.lookup(newRdn);
-        assertNotNull(ouEntry);
-
-        // Check values of cn
-        ou = ouEntry.getAttributes("").get("ou");
-        assertTrue(ou.contains(newOu));
-        assertTrue(!ou.contains(oldOu)); // old value is gone
-        assertTrue(ou.contains(alternateOu)); // alternate value is still
-        assertEquals(2, ou.size());
-    }
-}
+/*
+ *   Copyright 2004 The Apache Software Foundation
+ *
+ *   Licensed under the Apache License, Version 2.0 (the "License");
+ *   you may not use this file except in compliance with the License.
+ *   You may obtain a copy of the License at
+ *
+ *       http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *   Unless required by applicable law or agreed to in writing, software
+ *   distributed under the License is distributed on an "AS IS" BASIS,
+ *   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *   See the License for the specific language governing permissions and
+ *   limitations under the License.
+ *
+ */
+package org.apache.ldap.testsuite.ldaptests.jndi.ops.modifydn;
+
+import javax.naming.NameNotFoundException;
+import javax.naming.NamingException;
+import javax.naming.directory.Attribute;
+import javax.naming.directory.Attributes;
+import javax.naming.directory.DirContext;
+
+import org.apache.ldap.testsuite.ldaptests.jndi.BaseProtocolTest;
+import org.apache.ldap.testsuite.ldaptests.jndi.util.AttributesFactory;
+
+/**
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ * @version $Rev$
+ */
+public class ModifyDnSameAttributeTests extends BaseProtocolTest
+{
+    /**
+     * Modify Rdn of an entry, delete its old rdn value.
+     * 
+     * @throws NamingException
+     */
+    public void testModifyRdnAndDeleteOld() throws NamingException
+    {
+        DirContext ctx = this.createContext();
+        DirContext target = (DirContext) ctx.lookup(this.getTestContainerRdn());
+
+        // Create an organizational unit, ou value is rdn
+        String oldOu = "Judean People's Front";
+        String oldRdn = "ou=" + oldOu;
+        Attributes attributes = AttributesFactory.createOrganizationalUnitAttributes(oldOu);
+        target.createSubcontext(oldRdn, attributes);
+
+        // modify Rdn
+        String newOu = "People's Front of Judea";
+        String newRdn = "ou=" + newOu;
+        target.addToEnvironment("java.naming.ldap.deleteRDN", "true");
+        target.rename(oldRdn, newRdn);
+
+        // Check, whether old Entry does not exists
+        try {
+            target.lookup(oldRdn);
+            fail("Entry must not exist");
+        } catch (NameNotFoundException ignored) {
+            // expected behaviour
+            assertTrue(true);
+        }
+
+        // Check, whether new Entry exists
+        DirContext ouEntry = (DirContext) target.lookup(newRdn);
+        assertNotNull(ouEntry);
+
+        // Check values of ou
+        Attribute ou = ouEntry.getAttributes("").get("ou");
+        assertTrue(ou.contains(newOu));
+        assertTrue(!ou.contains(oldOu)); // old vaue is gone
+        assertEquals(1, ou.size());
+
+        ctx.close();
+    }
+
+    /**
+     * Modify Rdn of an entry, keep its old rdn value.
+     * 
+     * @throws NamingException
+     */
+    public void testModifyRdnAndKeepOld() throws NamingException
+    {
+
+        DirContext ctx = this.createContext();
+        DirContext target = (DirContext) ctx.lookup(this.getTestContainerRdn());
+
+        // Create an organizational unit, ou value is rdn
+        String oldOu = "Judean People's Front";
+        String oldRdn = "ou=" + oldOu;
+        Attributes attributes = AttributesFactory.createOrganizationalUnitAttributes(oldOu);
+        target.createSubcontext(oldRdn, attributes);
+
+        // modify Rdn
+        String newOu = "People's Front of Judea";
+        String newRdn = "ou=" + newOu;
+        target.addToEnvironment("java.naming.ldap.deleteRDN", "false");
+        target.rename(oldRdn, newRdn);
+
+        // Check, whether old entry does not exist
+        try {
+            target.lookup(oldRdn);
+            fail("Entry must not exist");
+        } catch (NameNotFoundException ignored) {
+            // expected behaviour
+            assertTrue(true);
+        }
+
+        // Check, whether new entry exists
+        DirContext ouEntry = (DirContext) target.lookup(newRdn);
+        assertNotNull(ouEntry);
+
+        // Check values of cn
+        Attribute ou = ouEntry.getAttributes("").get("ou");
+        assertTrue(ou.contains(newOu));
+        assertTrue(ou.contains(oldOu)); // old value is still present
+        assertEquals(2, ou.size());
+
+        ouEntry.close();
+        target.close();
+        ctx.close();
+    }
+
+    /**
+     * Modify Rdn of an entry, delete its old rdn value. Here, the rdn attribute
+     * cn has another value as well.
+     * 
+     * @throws NamingException
+     */
+    public void testModifyRdnAndDeleteOldVariant() throws NamingException
+    {
+        DirContext ctx = this.createContext();
+        DirContext target = (DirContext) ctx.lookup(this.getTestContainerRdn());
+
+        // Create an organizational unit, ou value is rdn
+        String oldOu = "Judean People's Front";
+        String oldRdn = "ou=" + oldOu;
+        Attributes attributes = AttributesFactory.createOrganizationalUnitAttributes(oldOu);
+
+        // add a second ou value
+        String alternateOu = "J.P.F.";
+        Attribute ou = attributes.get("ou");
+        ou.add(alternateOu);
+        assertEquals(2, ou.size());
+
+        target.createSubcontext(oldRdn, attributes);
+
+        // modify Rdn
+        String newOu = "People's Front of Judea";
+        String newRdn = "ou=" + newOu;
+        target.addToEnvironment("java.naming.ldap.deleteRDN", "true");
+        target.rename(oldRdn, newRdn);
+
+        // Check, whether old Entry does not exist anymore
+        try {
+            target.lookup(oldRdn);
+            fail("Entry must not exist");
+        } catch (NameNotFoundException ignored) {
+            // expected behaviour
+            assertTrue(true);
+        }
+
+        // Check, whether new Entry exists
+        DirContext ouEntry = (DirContext) target.lookup(newRdn);
+        assertNotNull(ouEntry);
+
+        // Check values of cn
+        ou = ouEntry.getAttributes("").get("ou");
+        assertTrue(ou.contains(newOu));
+        assertTrue(!ou.contains(oldOu)); // old value is gone
+        assertTrue(ou.contains(alternateOu)); // alternate value is still
+        assertEquals(2, ou.size());
+    }
+}

Propchange: directory/sandbox/akarasulu/rc1/testsuites/src/main/java/org/apache/ldap/testsuite/ldaptests/jndi/ops/modifydn/ModifyDnSameAttributeTests.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: directory/sandbox/akarasulu/rc1/testsuites/src/main/java/org/apache/ldap/testsuite/ldaptests/jndi/ops/modifydn/ModifyDnSameAttributeTests.java
------------------------------------------------------------------------------
--- svn:keywords (original)
+++ svn:keywords Sat Feb 11 21:50:03 2006
@@ -1 +1,4 @@
-HeadURL Id LastChangedBy LastChangedDate LastChangedRevision
+Rev
+Revision
+Date
+Id

Modified: directory/sandbox/akarasulu/rc1/testsuites/src/main/java/org/apache/ldap/testsuite/ldaptests/jndi/ops/search/AllTests.java
URL: http://svn.apache.org/viewcvs/directory/sandbox/akarasulu/rc1/testsuites/src/main/java/org/apache/ldap/testsuite/ldaptests/jndi/ops/search/AllTests.java?rev=377135&r1=377134&r2=377135&view=diff
==============================================================================
--- directory/sandbox/akarasulu/rc1/testsuites/src/main/java/org/apache/ldap/testsuite/ldaptests/jndi/ops/search/AllTests.java (original)
+++ directory/sandbox/akarasulu/rc1/testsuites/src/main/java/org/apache/ldap/testsuite/ldaptests/jndi/ops/search/AllTests.java Sat Feb 11 21:50:03 2006
@@ -1,42 +1,42 @@
-/*
- *   Copyright 2004 The Apache Software Foundation
- *
- *   Licensed under the Apache License, Version 2.0 (the "License");
- *   you may not use this file except in compliance with the License.
- *   You may obtain a copy of the License at
- *
- *       http://www.apache.org/licenses/LICENSE-2.0
- *
- *   Unless required by applicable law or agreed to in writing, software
- *   distributed under the License is distributed on an "AS IS" BASIS,
- *   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- *   See the License for the specific language governing permissions and
- *   limitations under the License.
- *
- */
-package org.apache.ldap.testsuite.ldaptests.jndi.ops.search;
-
-import junit.framework.TestSuite;
-
-/**
- * Contains the test classes for the LDAP search operation executed via JNDI. It
- * is used to form the complete suite into a structure.
- * 
- * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
- * @version $Rev$
- */
-public class AllTests extends TestSuite
-{
-
-    public static TestSuite suite()
-    {
-        TestSuite suite = new TestSuite("Search");
-
-        suite.addTestSuite(SearchFilterSimpleTest.class);
-        suite.addTestSuite(SearchScopeTest.class);
-        suite.addTestSuite(IllegalSearchFilterTest.class);
-        suite.addTestSuite(SearchFilterAttributeNamesTest.class);
-
-        return suite;
-    }
-}
+/*
+ *   Copyright 2004 The Apache Software Foundation
+ *
+ *   Licensed under the Apache License, Version 2.0 (the "License");
+ *   you may not use this file except in compliance with the License.
+ *   You may obtain a copy of the License at
+ *
+ *       http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *   Unless required by applicable law or agreed to in writing, software
+ *   distributed under the License is distributed on an "AS IS" BASIS,
+ *   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *   See the License for the specific language governing permissions and
+ *   limitations under the License.
+ *
+ */
+package org.apache.ldap.testsuite.ldaptests.jndi.ops.search;
+
+import junit.framework.TestSuite;
+
+/**
+ * Contains the test classes for the LDAP search operation executed via JNDI. It
+ * is used to form the complete suite into a structure.
+ * 
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ * @version $Rev$
+ */
+public class AllTests extends TestSuite
+{
+
+    public static TestSuite suite()
+    {
+        TestSuite suite = new TestSuite("Search");
+
+        suite.addTestSuite(SearchFilterSimpleTest.class);
+        suite.addTestSuite(SearchScopeTest.class);
+        suite.addTestSuite(IllegalSearchFilterTest.class);
+        suite.addTestSuite(SearchFilterAttributeNamesTest.class);
+
+        return suite;
+    }
+}

Propchange: directory/sandbox/akarasulu/rc1/testsuites/src/main/java/org/apache/ldap/testsuite/ldaptests/jndi/ops/search/AllTests.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: directory/sandbox/akarasulu/rc1/testsuites/src/main/java/org/apache/ldap/testsuite/ldaptests/jndi/ops/search/AllTests.java
------------------------------------------------------------------------------
--- svn:keywords (original)
+++ svn:keywords Sat Feb 11 21:50:03 2006
@@ -1 +1,4 @@
-HeadURL Id LastChangedBy LastChangedDate LastChangedRevision
+Rev
+Revision
+Date
+Id

Modified: directory/sandbox/akarasulu/rc1/testsuites/src/main/java/org/apache/ldap/testsuite/ldaptests/jndi/ops/search/IllegalSearchFilterTest.java
URL: http://svn.apache.org/viewcvs/directory/sandbox/akarasulu/rc1/testsuites/src/main/java/org/apache/ldap/testsuite/ldaptests/jndi/ops/search/IllegalSearchFilterTest.java?rev=377135&r1=377134&r2=377135&view=diff
==============================================================================
--- directory/sandbox/akarasulu/rc1/testsuites/src/main/java/org/apache/ldap/testsuite/ldaptests/jndi/ops/search/IllegalSearchFilterTest.java (original)
+++ directory/sandbox/akarasulu/rc1/testsuites/src/main/java/org/apache/ldap/testsuite/ldaptests/jndi/ops/search/IllegalSearchFilterTest.java Sat Feb 11 21:50:03 2006
@@ -1,94 +1,94 @@
-/*
- *   Copyright 2004 The Apache Software Foundation
- *
- *   Licensed under the Apache License, Version 2.0 (the "License");
- *   you may not use this file except in compliance with the License.
- *   You may obtain a copy of the License at
- *
- *       http://www.apache.org/licenses/LICENSE-2.0
- *
- *   Unless required by applicable law or agreed to in writing, software
- *   distributed under the License is distributed on an "AS IS" BASIS,
- *   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- *   See the License for the specific language governing permissions and
- *   limitations under the License.
- *
- */
-package org.apache.ldap.testsuite.ldaptests.jndi.ops.search;
-
-import javax.naming.NamingException;
-import javax.naming.directory.DirContext;
-import javax.naming.directory.InvalidSearchFilterException;
-import javax.naming.directory.SearchControls;
-
-import org.apache.ldap.testsuite.ldaptests.jndi.BaseProtocolTest;
-
-/**
- * Tests for the search operations with JNDI which use illegal search filters.
- * 
- * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
- * @version $Rev: $
- */
-public class IllegalSearchFilterTest extends BaseProtocolTest
-{
-
-    private DirContext ctx;
-
-    public void setUp() throws NamingException
-    {
-        super.setUp();
-
-        ctx = this.createContext();
-        ctx = (DirContext) ctx.lookup(this.getTestContainerRdn());
-    }
-
-    public void tearDown() throws NamingException
-    {
-        ctx.close();
-        ctx = null;
-
-        super.tearDown();
-    }
-
-    public void testFiltersWithSyntaxErrors() throws NamingException
-    {
-
-        SearchControls ctls = new SearchControls();
-        ctls.setSearchScope(SearchControls.ONELEVEL_SCOPE);
-
-        String[] filters = { null, "", ",", "&", "1", "This is no filter" };
-
-        for (int i = 0; i < filters.length; i++) {
-            String filter = filters[i];
-
-            // Search
-            try {
-                ctx.search("", filter, ctls);
-                fail("Filter [" + filter + "] has syntax errors and should cause an error.");
-            } catch (InvalidSearchFilterException e) {
-                // Expected behaviour
-            }
-        }
-    }
-
-    public void testFilterWithUnbalancedParenthesis() throws NamingException
-    {
-
-        SearchControls ctls = new SearchControls();
-        ctls.setSearchScope(SearchControls.ONELEVEL_SCOPE);
-
-        String[] filters = { "((sn=Amos)", "(&(sn=Amos)(cn=Tori Amos)", "(!(sn=Amos)" };
-
-        for (int i = 0; i < filters.length; i++) {
-            String filter = filters[i];
-
-            // Search
-            try {
-                ctx.search("", filter, ctls);
-                fail("Filter [" + filter + "] has unbalanced parenthesis and should cause an error.");
-            } catch (InvalidSearchFilterException e) {
-                // Expected behaviour
-            }
-        }
-    }
+/*
+ *   Copyright 2004 The Apache Software Foundation
+ *
+ *   Licensed under the Apache License, Version 2.0 (the "License");
+ *   you may not use this file except in compliance with the License.
+ *   You may obtain a copy of the License at
+ *
+ *       http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *   Unless required by applicable law or agreed to in writing, software
+ *   distributed under the License is distributed on an "AS IS" BASIS,
+ *   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *   See the License for the specific language governing permissions and
+ *   limitations under the License.
+ *
+ */
+package org.apache.ldap.testsuite.ldaptests.jndi.ops.search;
+
+import javax.naming.NamingException;
+import javax.naming.directory.DirContext;
+import javax.naming.directory.InvalidSearchFilterException;
+import javax.naming.directory.SearchControls;
+
+import org.apache.ldap.testsuite.ldaptests.jndi.BaseProtocolTest;
+
+/**
+ * Tests for the search operations with JNDI which use illegal search filters.
+ * 
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ * @version $Rev$
+ */
+public class IllegalSearchFilterTest extends BaseProtocolTest
+{
+
+    private DirContext ctx;
+
+    public void setUp() throws NamingException
+    {
+        super.setUp();
+
+        ctx = this.createContext();
+        ctx = (DirContext) ctx.lookup(this.getTestContainerRdn());
+    }
+
+    public void tearDown() throws NamingException
+    {
+        ctx.close();
+        ctx = null;
+
+        super.tearDown();
+    }
+
+    public void testFiltersWithSyntaxErrors() throws NamingException
+    {
+
+        SearchControls ctls = new SearchControls();
+        ctls.setSearchScope(SearchControls.ONELEVEL_SCOPE);
+
+        String[] filters = { null, "", ",", "&", "1", "This is no filter" };
+
+        for (int i = 0; i < filters.length; i++) {
+            String filter = filters[i];
+
+            // Search
+            try {
+                ctx.search("", filter, ctls);
+                fail("Filter [" + filter + "] has syntax errors and should cause an error.");
+            } catch (InvalidSearchFilterException e) {
+                // Expected behaviour
+            }
+        }
+    }
+
+    public void testFilterWithUnbalancedParenthesis() throws NamingException
+    {
+
+        SearchControls ctls = new SearchControls();
+        ctls.setSearchScope(SearchControls.ONELEVEL_SCOPE);
+
+        String[] filters = { "((sn=Amos)", "(&(sn=Amos)(cn=Tori Amos)", "(!(sn=Amos)" };
+
+        for (int i = 0; i < filters.length; i++) {
+            String filter = filters[i];
+
+            // Search
+            try {
+                ctx.search("", filter, ctls);
+                fail("Filter [" + filter + "] has unbalanced parenthesis and should cause an error.");
+            } catch (InvalidSearchFilterException e) {
+                // Expected behaviour
+            }
+        }
+    }
 }

Propchange: directory/sandbox/akarasulu/rc1/testsuites/src/main/java/org/apache/ldap/testsuite/ldaptests/jndi/ops/search/IllegalSearchFilterTest.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: directory/sandbox/akarasulu/rc1/testsuites/src/main/java/org/apache/ldap/testsuite/ldaptests/jndi/ops/search/IllegalSearchFilterTest.java
------------------------------------------------------------------------------
--- svn:keywords (added)
+++ svn:keywords Sat Feb 11 21:50:03 2006
@@ -0,0 +1,4 @@
+Rev
+Revision
+Date
+Id

Modified: directory/sandbox/akarasulu/rc1/testsuites/src/main/java/org/apache/ldap/testsuite/ldaptests/jndi/ops/search/SearchFilterAttributeNamesTest.java
URL: http://svn.apache.org/viewcvs/directory/sandbox/akarasulu/rc1/testsuites/src/main/java/org/apache/ldap/testsuite/ldaptests/jndi/ops/search/SearchFilterAttributeNamesTest.java?rev=377135&r1=377134&r2=377135&view=diff
==============================================================================
--- directory/sandbox/akarasulu/rc1/testsuites/src/main/java/org/apache/ldap/testsuite/ldaptests/jndi/ops/search/SearchFilterAttributeNamesTest.java (original)
+++ directory/sandbox/akarasulu/rc1/testsuites/src/main/java/org/apache/ldap/testsuite/ldaptests/jndi/ops/search/SearchFilterAttributeNamesTest.java Sat Feb 11 21:50:03 2006
@@ -1,149 +1,149 @@
-/*
- *   Copyright 2004 The Apache Software Foundation
- *
- *   Licensed under the Apache License, Version 2.0 (the "License");
- *   you may not use this file except in compliance with the License.
- *   You may obtain a copy of the License at
- *
- *       http://www.apache.org/licenses/LICENSE-2.0
- *
- *   Unless required by applicable law or agreed to in writing, software
- *   distributed under the License is distributed on an "AS IS" BASIS,
- *   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- *   See the License for the specific language governing permissions and
- *   limitations under the License.
- *
- */
-package org.apache.ldap.testsuite.ldaptests.jndi.ops.search;
-
-import javax.naming.NamingEnumeration;
-import javax.naming.NamingException;
-import javax.naming.directory.Attribute;
-import javax.naming.directory.Attributes;
-import javax.naming.directory.BasicAttribute;
-import javax.naming.directory.BasicAttributes;
-import javax.naming.directory.DirContext;
-import javax.naming.directory.SearchControls;
-import javax.naming.directory.SearchResult;
-
-import org.apache.ldap.testsuite.ldaptests.jndi.BaseProtocolTest;
-
-/**
- * Tests for the search operations with concentrating on attribute names.
- * 
- * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
- * @version $Rev$
- */
-public class SearchFilterAttributeNamesTest extends BaseProtocolTest
-{
-
-    private DirContext ctx;
-
-    static final String[] firstNames = { "Tori", "Heather", "Alanis", "Kate", "Fiona" };
-
-    static final String[] lastNames = { "Amos", "Nova", "Morisette", "Bush", "Apple" };
-
-    protected Attributes getPersonAttributes(Person p)
-    {
-        Attributes attributes = new BasicAttributes();
-        Attribute attribute = new BasicAttribute("objectClass");
-        attribute.add("top");
-        attribute.add("person");
-        attributes.put(attribute);
-        attributes.put("sn", p.sn);
-        attributes.put("cn", p.cn);
-
-        return attributes;
-    }
-
-    public void setUp() throws NamingException
-    {
-        super.setUp();
-
-        ctx = this.createContext();
-        ctx = (DirContext) ctx.lookup(this.getTestContainerRdn());
-
-        for (int i = 0; i < lastNames.length; ++i) {
-            Person p = new Person(firstNames[i], lastNames[i]);
-            ctx.createSubcontext("cn=" + p.cn, getPersonAttributes(p));
-        }
-    }
-
-    public void tearDown() throws NamingException
-    {
-        ctx.close();
-        ctx = null;
-
-        super.tearDown();
-    }
-
-    /**
-     * Tests presence filter for the objectClass attribute.
-     */
-    public void testObjectclassPresence() throws NamingException
-    {
-        SearchControls ctls = new SearchControls();
-        ctls.setSearchScope(SearchControls.ONELEVEL_SCOPE);
-
-        String[] filters = { "(objectClass=*)", "(objectclass=*)", "(OBJECTCLASS=*)", "(Objectclass=*)" };
-
-        for (int i = 0; i < filters.length; i++) {
-            String filter = filters[i];
-
-            NamingEnumeration enm = ctx.search("", filter, ctls);
-            assertTrue("Entries found with filter " + filter, enm.hasMore());
-            int numberOfEntries = 0;
-            while (enm.hasMore()) {
-                SearchResult entry = (SearchResult) enm.next();
-                Attributes attrs = entry.getAttributes();
-                Attribute sn = attrs.get("sn");
-                assertEquals(1, sn.size());
-
-                numberOfEntries++;
-            }
-
-            assertEquals("number of entries in result with filter " + filter, lastNames.length, numberOfEntries);
-        }
-    }
-
-    /**
-     * Tests equals filter for the objectClass attribute.
-     */
-    public void testObjectclassEquals() throws NamingException
-    {
-        SearchControls ctls = new SearchControls();
-        ctls.setSearchScope(SearchControls.SUBTREE_SCOPE);
-
-        String[] filters = { "(objectClass=person)", "(objectclass=person)", "(OBJECTCLASS=person)",
-                "(Objectclass=person)" };
-
-        for (int i = 0; i < filters.length; i++) {
-            String filter = filters[i];
-
-            NamingEnumeration enm = ctx.search("", filter, ctls);
-            assertTrue("Entries found with filter " + filter, enm.hasMore());
-            int numberOfEntries = 0;
-            while (enm.hasMore()) {
-                SearchResult entry = (SearchResult) enm.next();
-                Attributes attrs = entry.getAttributes();
-                Attribute sn = attrs.get("sn");
-                assertEquals(1, sn.size());
-
-                numberOfEntries++;
-            }
-
-            assertEquals("number of entries in result with filter " + filter, lastNames.length, numberOfEntries);
-        }
-    }
-
-    private class Person
-    {
-        Person(String firstName, String lastName) {
-            this.sn = lastName;
-            this.cn = firstName + " " + lastName;
-        }
-
-        String sn;
-        String cn;
-    }
+/*
+ *   Copyright 2004 The Apache Software Foundation
+ *
+ *   Licensed under the Apache License, Version 2.0 (the "License");
+ *   you may not use this file except in compliance with the License.
+ *   You may obtain a copy of the License at
+ *
+ *       http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *   Unless required by applicable law or agreed to in writing, software
+ *   distributed under the License is distributed on an "AS IS" BASIS,
+ *   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *   See the License for the specific language governing permissions and
+ *   limitations under the License.
+ *
+ */
+package org.apache.ldap.testsuite.ldaptests.jndi.ops.search;
+
+import javax.naming.NamingEnumeration;
+import javax.naming.NamingException;
+import javax.naming.directory.Attribute;
+import javax.naming.directory.Attributes;
+import javax.naming.directory.BasicAttribute;
+import javax.naming.directory.BasicAttributes;
+import javax.naming.directory.DirContext;
+import javax.naming.directory.SearchControls;
+import javax.naming.directory.SearchResult;
+
+import org.apache.ldap.testsuite.ldaptests.jndi.BaseProtocolTest;
+
+/**
+ * Tests for the search operations with concentrating on attribute names.
+ * 
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ * @version $Rev$
+ */
+public class SearchFilterAttributeNamesTest extends BaseProtocolTest
+{
+
+    private DirContext ctx;
+
+    static final String[] firstNames = { "Tori", "Heather", "Alanis", "Kate", "Fiona" };
+
+    static final String[] lastNames = { "Amos", "Nova", "Morisette", "Bush", "Apple" };
+
+    protected Attributes getPersonAttributes(Person p)
+    {
+        Attributes attributes = new BasicAttributes();
+        Attribute attribute = new BasicAttribute("objectClass");
+        attribute.add("top");
+        attribute.add("person");
+        attributes.put(attribute);
+        attributes.put("sn", p.sn);
+        attributes.put("cn", p.cn);
+
+        return attributes;
+    }
+
+    public void setUp() throws NamingException
+    {
+        super.setUp();
+
+        ctx = this.createContext();
+        ctx = (DirContext) ctx.lookup(this.getTestContainerRdn());
+
+        for (int i = 0; i < lastNames.length; ++i) {
+            Person p = new Person(firstNames[i], lastNames[i]);
+            ctx.createSubcontext("cn=" + p.cn, getPersonAttributes(p));
+        }
+    }
+
+    public void tearDown() throws NamingException
+    {
+        ctx.close();
+        ctx = null;
+
+        super.tearDown();
+    }
+
+    /**
+     * Tests presence filter for the objectClass attribute.
+     */
+    public void testObjectclassPresence() throws NamingException
+    {
+        SearchControls ctls = new SearchControls();
+        ctls.setSearchScope(SearchControls.ONELEVEL_SCOPE);
+
+        String[] filters = { "(objectClass=*)", "(objectclass=*)", "(OBJECTCLASS=*)", "(Objectclass=*)" };
+
+        for (int i = 0; i < filters.length; i++) {
+            String filter = filters[i];
+
+            NamingEnumeration enm = ctx.search("", filter, ctls);
+            assertTrue("Entries found with filter " + filter, enm.hasMore());
+            int numberOfEntries = 0;
+            while (enm.hasMore()) {
+                SearchResult entry = (SearchResult) enm.next();
+                Attributes attrs = entry.getAttributes();
+                Attribute sn = attrs.get("sn");
+                assertEquals(1, sn.size());
+
+                numberOfEntries++;
+            }
+
+            assertEquals("number of entries in result with filter " + filter, lastNames.length, numberOfEntries);
+        }
+    }
+
+    /**
+     * Tests equals filter for the objectClass attribute.
+     */
+    public void testObjectclassEquals() throws NamingException
+    {
+        SearchControls ctls = new SearchControls();
+        ctls.setSearchScope(SearchControls.SUBTREE_SCOPE);
+
+        String[] filters = { "(objectClass=person)", "(objectclass=person)", "(OBJECTCLASS=person)",
+                "(Objectclass=person)" };
+
+        for (int i = 0; i < filters.length; i++) {
+            String filter = filters[i];
+
+            NamingEnumeration enm = ctx.search("", filter, ctls);
+            assertTrue("Entries found with filter " + filter, enm.hasMore());
+            int numberOfEntries = 0;
+            while (enm.hasMore()) {
+                SearchResult entry = (SearchResult) enm.next();
+                Attributes attrs = entry.getAttributes();
+                Attribute sn = attrs.get("sn");
+                assertEquals(1, sn.size());
+
+                numberOfEntries++;
+            }
+
+            assertEquals("number of entries in result with filter " + filter, lastNames.length, numberOfEntries);
+        }
+    }
+
+    private class Person
+    {
+        Person(String firstName, String lastName) {
+            this.sn = lastName;
+            this.cn = firstName + " " + lastName;
+        }
+
+        String sn;
+        String cn;
+    }
 }

Propchange: directory/sandbox/akarasulu/rc1/testsuites/src/main/java/org/apache/ldap/testsuite/ldaptests/jndi/ops/search/SearchFilterAttributeNamesTest.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: directory/sandbox/akarasulu/rc1/testsuites/src/main/java/org/apache/ldap/testsuite/ldaptests/jndi/ops/search/SearchFilterAttributeNamesTest.java
------------------------------------------------------------------------------
--- svn:keywords (original)
+++ svn:keywords Sat Feb 11 21:50:03 2006
@@ -1 +1,4 @@
-HeadURL Id LastChangedBy LastChangedDate LastChangedRevision
+Rev
+Revision
+Date
+Id

Modified: directory/sandbox/akarasulu/rc1/testsuites/src/main/java/org/apache/ldap/testsuite/ldaptests/jndi/ops/search/SearchFilterSimpleTest.java
URL: http://svn.apache.org/viewcvs/directory/sandbox/akarasulu/rc1/testsuites/src/main/java/org/apache/ldap/testsuite/ldaptests/jndi/ops/search/SearchFilterSimpleTest.java?rev=377135&r1=377134&r2=377135&view=diff
==============================================================================
--- directory/sandbox/akarasulu/rc1/testsuites/src/main/java/org/apache/ldap/testsuite/ldaptests/jndi/ops/search/SearchFilterSimpleTest.java (original)
+++ directory/sandbox/akarasulu/rc1/testsuites/src/main/java/org/apache/ldap/testsuite/ldaptests/jndi/ops/search/SearchFilterSimpleTest.java Sat Feb 11 21:50:03 2006
@@ -1,184 +1,184 @@
-/*
- *   Copyright 2004 The Apache Software Foundation
- *
- *   Licensed under the Apache License, Version 2.0 (the "License");
- *   you may not use this file except in compliance with the License.
- *   You may obtain a copy of the License at
- *
- *       http://www.apache.org/licenses/LICENSE-2.0
- *
- *   Unless required by applicable law or agreed to in writing, software
- *   distributed under the License is distributed on an "AS IS" BASIS,
- *   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- *   See the License for the specific language governing permissions and
- *   limitations under the License.
- *
- */
-package org.apache.ldap.testsuite.ldaptests.jndi.ops.search;
-
-import javax.naming.NamingEnumeration;
-import javax.naming.NamingException;
-import javax.naming.directory.Attribute;
-import javax.naming.directory.Attributes;
-import javax.naming.directory.DirContext;
-import javax.naming.directory.SearchControls;
-import javax.naming.directory.SearchResult;
-
-import org.apache.ldap.testsuite.ldaptests.jndi.BaseProtocolTest;
-import org.apache.ldap.testsuite.ldaptests.jndi.util.AttributesFactory;
-
-/**
- * Tests for the search operations with JNDI containing simple filter
- * expressions. All boolean operators are covered.
- * 
- * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
- * @version $Rev$
- */
-public class SearchFilterSimpleTest extends BaseProtocolTest
-{
-
-    private DirContext ctx;
-
-    static final String[] firstNames = { "Tori", "Heather", "Alanis", "Kate", "Fiona" };
-
-    static final String[] lastNames = { "Amos", "Nova", "Morisette", "Bush", "Apple" };
-
-    public void setUp() throws NamingException
-    {
-        super.setUp();
-
-        ctx = this.createContext();
-        ctx = (DirContext) ctx.lookup(this.getTestContainerRdn());
-
-        // Create person entries
-        for (int i = 0; i < lastNames.length; ++i) {
-            String cn = firstNames[i] + " " + lastNames[i];
-            Attributes person = AttributesFactory.createPersonAttributes(cn, lastNames[i]);
-            ctx.createSubcontext("cn=" + cn, person);
-        }
-
-        // Create an organization Unit
-        String ou = "anOrgUnit";
-        Attributes orgUnit = AttributesFactory.createOrganizationalUnitAttributes(ou);
-        ctx.createSubcontext("ou=" + ou, orgUnit);
-    }
-
-    public void tearDown() throws NamingException
-    {
-        ctx.close();
-        ctx = null;
-
-        super.tearDown();
-    }
-
-    public void testSimpleFilter() throws NamingException
-    {
-
-        SearchControls ctls = new SearchControls();
-        ctls.setSearchScope(SearchControls.ONELEVEL_SCOPE);
-
-        NamingEnumeration enm = ctx.search("", "(sn=Amos)", ctls);
-        assertTrue(enm.hasMore());
-        int numberOfEntries = 0;
-        while (enm.hasMore()) {
-            SearchResult entry = (SearchResult) enm.next();
-            Attributes attrs = entry.getAttributes();
-            Attribute sn = attrs.get("sn");
-
-            assertEquals(1, sn.size());
-            assertTrue(sn.contains("Amos"));
-
-            numberOfEntries++;
-        }
-
-        assertEquals("number of entries in result", 1, numberOfEntries);
-        enm.close();
-    }
-
-    /**
-     * Test with a search filter which contains an NOT operator.
-     */
-    public void testFilterWithNot() throws NamingException
-    {
-        SearchControls ctls = new SearchControls();
-        ctls.setSearchScope(SearchControls.ONELEVEL_SCOPE);
-
-        // Filter "(!(objectClass=person))"
-        //
-        NamingEnumeration enm = ctx.search("", "(!(objectClass=person))", ctls);
-        assertTrue(enm.hasMore());
-        int numberOfEntries = 0;
-        while (enm.hasMore()) {
-            SearchResult entry = (SearchResult) enm.next();
-            Attributes attrs = entry.getAttributes();
-            Attribute ocls = attrs.get("objectClass");
-
-            assertFalse(ocls.contains("person"));
-
-            numberOfEntries++;
-        }
-        // Check whether number of entries foud is 1 (the org unit)
-        assertEquals("number of entries in result", 1, numberOfEntries);
-        enm.close();
-        
-        // Filter "(!(objectClass=*))"
-        //
-        enm = ctx.search("", "(!(objectClass=*))", ctls);
-        assertFalse("entries found", enm.hasMore());
-        enm.close();
-    }
-
-    /**
-     * Test with search filters which contain an AND operator.
-     */
-    public void testFilterWithAnd() throws NamingException
-    {
-
-        SearchControls ctls = new SearchControls();
-        ctls.setSearchScope(SearchControls.SUBTREE_SCOPE);
-
-        // Filter "(&(objectClass=person)(sn=Amos))"
-        //
-        NamingEnumeration enm = ctx.search("", "(&(objectClass=person)(sn=Amos))", ctls);
-        assertTrue(enm.hasMore());
-        int numberOfEntries = 0;
-        while (enm.hasMore()) {
-            SearchResult entry = (SearchResult) enm.next();
-            Attributes attrs = entry.getAttributes();
-            Attribute sn = attrs.get("sn");
-            assertTrue(sn.contains("Amos"));
-            numberOfEntries++;
-        }
-        assertEquals("number of entries in result", 1, numberOfEntries);
-        enm.close();
-        
-        // Filter "(&(sn=Amos)(sn=Bush))"
-        //
-        enm = ctx.search("", "(&(sn=Amos)(sn=Bush))", ctls);
-        assertFalse("entries found", enm.hasMore());
-        enm.close();
-    }
-
-    /**
-     * Test with a search filter which contains an OR operator.
-     */
-    public void testFilterWithOr() throws NamingException
-    {
-
-        SearchControls ctls = new SearchControls();
-        ctls.setSearchScope(SearchControls.SUBTREE_SCOPE);
-
-        NamingEnumeration enm = ctx.search("", "(|(cn=Kate Bush)(sn=Amos))", ctls);
-        assertTrue(enm.hasMore());
-        int numberOfEntries = 0;
-        while (enm.hasMore()) {
-            SearchResult entry = (SearchResult) enm.next();
-            Attributes attrs = entry.getAttributes();
-            Attribute sn = attrs.get("sn");
-            assertTrue(sn.contains("Amos") || sn.contains("Bush"));
-            numberOfEntries++;
-        }
-        assertEquals("number of entries in result", 2, numberOfEntries);
-        enm.close();
-    }
+/*
+ *   Copyright 2004 The Apache Software Foundation
+ *
+ *   Licensed under the Apache License, Version 2.0 (the "License");
+ *   you may not use this file except in compliance with the License.
+ *   You may obtain a copy of the License at
+ *
+ *       http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *   Unless required by applicable law or agreed to in writing, software
+ *   distributed under the License is distributed on an "AS IS" BASIS,
+ *   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *   See the License for the specific language governing permissions and
+ *   limitations under the License.
+ *
+ */
+package org.apache.ldap.testsuite.ldaptests.jndi.ops.search;
+
+import javax.naming.NamingEnumeration;
+import javax.naming.NamingException;
+import javax.naming.directory.Attribute;
+import javax.naming.directory.Attributes;
+import javax.naming.directory.DirContext;
+import javax.naming.directory.SearchControls;
+import javax.naming.directory.SearchResult;
+
+import org.apache.ldap.testsuite.ldaptests.jndi.BaseProtocolTest;
+import org.apache.ldap.testsuite.ldaptests.jndi.util.AttributesFactory;
+
+/**
+ * Tests for the search operations with JNDI containing simple filter
+ * expressions. All boolean operators are covered.
+ * 
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ * @version $Rev$
+ */
+public class SearchFilterSimpleTest extends BaseProtocolTest
+{
+
+    private DirContext ctx;
+
+    static final String[] firstNames = { "Tori", "Heather", "Alanis", "Kate", "Fiona" };
+
+    static final String[] lastNames = { "Amos", "Nova", "Morisette", "Bush", "Apple" };
+
+    public void setUp() throws NamingException
+    {
+        super.setUp();
+
+        ctx = this.createContext();
+        ctx = (DirContext) ctx.lookup(this.getTestContainerRdn());
+
+        // Create person entries
+        for (int i = 0; i < lastNames.length; ++i) {
+            String cn = firstNames[i] + " " + lastNames[i];
+            Attributes person = AttributesFactory.createPersonAttributes(cn, lastNames[i]);
+            ctx.createSubcontext("cn=" + cn, person);
+        }
+
+        // Create an organization Unit
+        String ou = "anOrgUnit";
+        Attributes orgUnit = AttributesFactory.createOrganizationalUnitAttributes(ou);
+        ctx.createSubcontext("ou=" + ou, orgUnit);
+    }
+
+    public void tearDown() throws NamingException
+    {
+        ctx.close();
+        ctx = null;
+
+        super.tearDown();
+    }
+
+    public void testSimpleFilter() throws NamingException
+    {
+
+        SearchControls ctls = new SearchControls();
+        ctls.setSearchScope(SearchControls.ONELEVEL_SCOPE);
+
+        NamingEnumeration enm = ctx.search("", "(sn=Amos)", ctls);
+        assertTrue(enm.hasMore());
+        int numberOfEntries = 0;
+        while (enm.hasMore()) {
+            SearchResult entry = (SearchResult) enm.next();
+            Attributes attrs = entry.getAttributes();
+            Attribute sn = attrs.get("sn");
+
+            assertEquals(1, sn.size());
+            assertTrue(sn.contains("Amos"));
+
+            numberOfEntries++;
+        }
+
+        assertEquals("number of entries in result", 1, numberOfEntries);
+        enm.close();
+    }
+
+    /**
+     * Test with a search filter which contains an NOT operator.
+     */
+    public void testFilterWithNot() throws NamingException
+    {
+        SearchControls ctls = new SearchControls();
+        ctls.setSearchScope(SearchControls.ONELEVEL_SCOPE);
+
+        // Filter "(!(objectClass=person))"
+        //
+        NamingEnumeration enm = ctx.search("", "(!(objectClass=person))", ctls);
+        assertTrue(enm.hasMore());
+        int numberOfEntries = 0;
+        while (enm.hasMore()) {
+            SearchResult entry = (SearchResult) enm.next();
+            Attributes attrs = entry.getAttributes();
+            Attribute ocls = attrs.get("objectClass");
+
+            assertFalse(ocls.contains("person"));
+
+            numberOfEntries++;
+        }
+        // Check whether number of entries foud is 1 (the org unit)
+        assertEquals("number of entries in result", 1, numberOfEntries);
+        enm.close();
+        
+        // Filter "(!(objectClass=*))"
+        //
+        enm = ctx.search("", "(!(objectClass=*))", ctls);
+        assertFalse("entries found", enm.hasMore());
+        enm.close();
+    }
+
+    /**
+     * Test with search filters which contain an AND operator.
+     */
+    public void testFilterWithAnd() throws NamingException
+    {
+
+        SearchControls ctls = new SearchControls();
+        ctls.setSearchScope(SearchControls.SUBTREE_SCOPE);
+
+        // Filter "(&(objectClass=person)(sn=Amos))"
+        //
+        NamingEnumeration enm = ctx.search("", "(&(objectClass=person)(sn=Amos))", ctls);
+        assertTrue(enm.hasMore());
+        int numberOfEntries = 0;
+        while (enm.hasMore()) {
+            SearchResult entry = (SearchResult) enm.next();
+            Attributes attrs = entry.getAttributes();
+            Attribute sn = attrs.get("sn");
+            assertTrue(sn.contains("Amos"));
+            numberOfEntries++;
+        }
+        assertEquals("number of entries in result", 1, numberOfEntries);
+        enm.close();
+        
+        // Filter "(&(sn=Amos)(sn=Bush))"
+        //
+        enm = ctx.search("", "(&(sn=Amos)(sn=Bush))", ctls);
+        assertFalse("entries found", enm.hasMore());
+        enm.close();
+    }
+
+    /**
+     * Test with a search filter which contains an OR operator.
+     */
+    public void testFilterWithOr() throws NamingException
+    {
+
+        SearchControls ctls = new SearchControls();
+        ctls.setSearchScope(SearchControls.SUBTREE_SCOPE);
+
+        NamingEnumeration enm = ctx.search("", "(|(cn=Kate Bush)(sn=Amos))", ctls);
+        assertTrue(enm.hasMore());
+        int numberOfEntries = 0;
+        while (enm.hasMore()) {
+            SearchResult entry = (SearchResult) enm.next();
+            Attributes attrs = entry.getAttributes();
+            Attribute sn = attrs.get("sn");
+            assertTrue(sn.contains("Amos") || sn.contains("Bush"));
+            numberOfEntries++;
+        }
+        assertEquals("number of entries in result", 2, numberOfEntries);
+        enm.close();
+    }
 }

Propchange: directory/sandbox/akarasulu/rc1/testsuites/src/main/java/org/apache/ldap/testsuite/ldaptests/jndi/ops/search/SearchFilterSimpleTest.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: directory/sandbox/akarasulu/rc1/testsuites/src/main/java/org/apache/ldap/testsuite/ldaptests/jndi/ops/search/SearchFilterSimpleTest.java
------------------------------------------------------------------------------
--- svn:keywords (original)
+++ svn:keywords Sat Feb 11 21:50:03 2006
@@ -1 +1,4 @@
-HeadURL Id LastChangedBy LastChangedDate LastChangedRevision
+Rev
+Revision
+Date
+Id



Mime
View raw message