Package javax.naming.ldap

Examples of javax.naming.ldap.BasicControl


import org.apache.harmony.jndi.provider.ldap.asn1.ASN1TestUtils;
import org.apache.harmony.jndi.provider.ldap.asn1.LdapASN1Constant;

public class LdapControlTest extends TestCase {
    public void test_encodeValues_$LObject() {
        LdapControl control = new LdapControl(new BasicControl("id", true,
                new byte[10]));
        ASN1TestUtils.checkEncode(control, LdapASN1Constant.Control);
       
        //controlValue is optional, so it could be null
        control = new LdapControl(new BasicControl("id2", false, null));
        ASN1TestUtils.checkEncode(control, LdapASN1Constant.Control);
    }
View Full Code Here


        new Rdn("y=asd+t=test", "a=asd");
        new Rdn("y=asd", "a=asd+t=test");
        new Rdn("t", new ArrayList());
        new Rdn("t=t=t", new Object());
        new Rdn("t=t=t", "test");
        new Rdn("t", new BasicControl("test"));
    }
View Full Code Here

     * </p>
     */
    public void testRdnStringObject018() throws Exception {
        new Rdn(new String("t===T"), new ArrayList());
        new Rdn(new String("t=+=T"), new Object());
        new Rdn(new String("t=,33,=T"), new BasicControl("test"));
    }
View Full Code Here

     * </p>
     */
    public void testRdnStringObject019() throws Exception {
        new Rdn(new String("t===T"), new char[] { 'a', 'v' });
        new Rdn(new String("t=+=T"), new int[] { 1, 2, 3 });
        new Rdn(new String("t=,33,=T"), new BasicControl("test"));
    }
View Full Code Here

                    .equals(new Rdn("t", new int[] { 00 }));
            fail("Should throw an exception.");
        } catch (ClassCastException e) {}

        try {
            new Rdn("t", new BasicControl("t")).equals(new Rdn("t",
                    new BasicControl("t")));
            fail("Should throw an exception.");
        } catch (ClassCastException e) {}
    }
View Full Code Here

        context = new LdapContextImpl(client, env, "cn=test");

        context.setRequestControls(null);
        assertNull(context.getRequestControls());

        Control[] controls = new Control[] { new BasicControl("0"),
                new BasicControl("1"), new BasicControl("2"),
                new BasicControl("3") };

        context.setRequestControls(controls);

        Control[] actual = context.getRequestControls();
View Full Code Here

     * Test method for 'javax.naming.ldap.BasicControl.BasicControl'
     * </p>
     */
    public void testBasicControl() {
        // no exceptions expected
        new BasicControl(null);
        new BasicControl("");
        new BasicControl("1.2.3.333");
        new BasicControl("", true, null);
        new BasicControl("", false, new byte[0]);
        new BasicControl(null, false, null);
    }
View Full Code Here

    /**
     * Test method for {@link javax.naming.ldap.BasicControl#isCritical()}.
     */
    public void testIsCritical() {
        BasicControl bc = new BasicControl("fixture");
        assertFalse(bc.isCritical());

        bc = new BasicControl(null, false, null);
        assertFalse(bc.isCritical());

        bc = new BasicControl(null, true, null);
        assertTrue(bc.isCritical());
    }
View Full Code Here

    /**
     * @tests javax.naming.ldap.BasicControl#getID()
     */
    public void testGetID() {
        String ID = "somestring";
        assertSame(ID, new BasicControl(ID).getID());

        assertNull(new BasicControl(null).getID());

        assertNull(new BasicControl(null, false, new byte[1]).getID());
    }
View Full Code Here

     * <p>
     * The expected result is a null encoded value.
     * </p>
     */
    public void testGetEncodedValue() {
        assertNull(new BasicControl("control", true, null).getEncodedValue());

        // spec says the byte[] is NOT copied
        byte[] test = new byte[15];
        BasicControl bc = new BasicControl("control", true, test);
        assertSame(test, bc.getEncodedValue());
    }
View Full Code Here

TOP

Related Classes of javax.naming.ldap.BasicControl

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.