Package javax.naming.ldap

Examples of javax.naming.ldap.LdapName


            bas.put("test1", "test1");
            bas.put("test3", "test3");
            Rdn rdn1 = new Rdn(bas);
            LinkedList<Rdn> rdns = new LinkedList<Rdn>();
            rdns.add(rdn1);
            LdapName ln = new LdapName(rdns);
            assertEquals("test1=test1+test2=test2+test3=test3", ln.getAll().nextElement());
        } catch (Exception e) {
            e.printStackTrace();
        }
    }
View Full Code Here


     * <p>
     * The expected result is zero.
     * </p>
     */
    public void testHashCode001() throws Exception {
        assertEquals(0, new LdapName("").hashCode());
    }
View Full Code Here

     */
    public void testHashCode002() throws Exception {
        Rdn t = new Rdn("");
        LinkedList<Rdn> test = new LinkedList<Rdn>();
        test.add(t);
        LdapName ln = new LdapName(test);
        assertEquals(0, t.hashCode() & ln.hashCode());
        assertEquals(t.hashCode(), ln.hashCode());
    }
View Full Code Here

        Rdn rdn1 = new Rdn("CN=commonName");
        Rdn rdn2 = new Rdn("t=test");
        LinkedList<Rdn> test = new LinkedList<Rdn>();
        test.add(rdn1);
        test.add(rdn2);
        LdapName ln = new LdapName(test);
        assertEquals(rdn1.hashCode() + rdn2.hashCode(), ln.hashCode());
    }
View Full Code Here

     * The expected result is the equals hash of two objects.
     * </p>
     */
    public void testHashCode004() throws Exception {
        String test = "t=test,h=asd";
        LdapName x = new LdapName(test);
        LdapName y = new LdapName(test);
        assertNotSame(0, x.hashCode() & y.hashCode());
        assertEquals(x.hashCode(), y.hashCode());
    }
View Full Code Here

     * <p>
     * The expected result is false.
     * </p>
     */
    public void testEquals003() throws Exception {
        LdapName ln = new LdapName("o=other");
        assertFalse(new LdapName("t=test").equals(ln));
    }
View Full Code Here

     * <p>
     * The expected result is true.
     * </p>
     */
    public void testEquals004() throws Exception {
        assertTrue(new LdapName("t=test").equals(new LdapName("t=test")));
        assertTrue(new LdapName("t=test").equals(new LdapName("T=TEST")));
        assertTrue(new LdapName("t=test").equals(new LdapName("T=  TEST")));
    }
View Full Code Here

     * The expected result in this case is if a change in primary object no
     * affect the clone.
     * </p>
     */
    public void testClone002() throws Exception {
        LdapName ln = new LdapName("t=test");
        LdapName copy = (LdapName) ln.clone();
        ln.add("ch=change");
        assertNotSame(ln.toString(), copy.toString());
    }
View Full Code Here

     * The expected result in this case is if a change in the clone object no
     * affect the primary.
     * </p>
     */
    public void testClone003() throws Exception {
        LdapName ln = new LdapName("t=test");
        LdapName copy = (LdapName) ln.clone();
        copy.add("ch=change");
        assertNotSame(ln.toString(), copy.toString());
    }
View Full Code Here

     * The expected result in this case is if clone of an empty object is equal
     * to its primary.
     * </p>
     */
    public void testClone004() throws Exception {
        LdapName ln = new LdapName("");
        LdapName copy = (LdapName) ln.clone();
        assertEquals(ln, copy);
    }
View Full Code Here

TOP

Related Classes of javax.naming.ldap.LdapName

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.