Java 类javax.naming.ldap.ControlFactory 实例源码

项目:cn1    文件:TestControlFactoryWhiteBoxDevelopment.java   
/**
 * <p>Test method for 'javax.naming.ldap.ControlFactory.getControlInstance(Control)'</p>
 * <p>Here we are going to test if we can get an instance with the controls sended.</p>
 */
public void testGetControlInstanceControl() {

    try {

        Hashtable env = new Hashtable();
        env.put(Context.INITIAL_CONTEXT_FACTORY,"org.apache.harmony.jndi.tests.javax.naming.spi.mock.ldap.MockContextFactory");
        MockControl[] cs = { new MockControl("c1", false, new byte[] { 1, 2, 3, 4 }), 
                new MockControl("c1", true, new byte[] { 'a', 'b', 'c', 'd' }), };
        MockControl cs2 =  new MockControl("c1", false, new byte[] { 1, 2, 3, 4 }); 
        InitialLdapContext ilc=new InitialLdapContext(env, cs);
        assertEquals(cs2,ControlFactory.getControlInstance(cs2,ilc,env));

    } catch (NamingException e) {

    }
}
项目:freeVM    文件:TestControlFactoryWhiteBoxDevelopment.java   
/**
 * <p>Test method for 'javax.naming.ldap.ControlFactory.getControlInstance(Control)'</p>
 * <p>Here we are gonna test if we can get an instance with the controls sended.</p>
 */
public void testGetControlInstanceControl() {

    try {

        Hashtable env = new Hashtable();
        env.put(Context.INITIAL_CONTEXT_FACTORY,"org.apache.harmony.jndi.tests.javax.naming.spi.mock.ldap.MockContextFactory");
        MockControl[] cs = { new MockControl("c1", false, new byte[] { 1, 2, 3, 4 }), 
                new MockControl("c1", true, new byte[] { 'a', 'b', 'c', 'd' }), };
        MockControl cs2 =  new MockControl("c1", false, new byte[] { 1, 2, 3, 4 }); 
        InitialLdapContext ilc=new InitialLdapContext(env, cs);
        assertEquals(cs2,ControlFactory.getControlInstance(cs2,ilc,env));

    } catch (NamingException e) {

    }
}
项目:freeVM    文件:TestControlFactoryWhiteBoxDevelopment.java   
/**
 * <p>Test method for 'javax.naming.ldap.ControlFactory.getControlInstance(Control)'</p>
 * <p>Here we are going to test if we can get an instance with the controls sended.</p>
 */
public void testGetControlInstanceControl() {

    try {

        Hashtable env = new Hashtable();
        env.put(Context.INITIAL_CONTEXT_FACTORY,"org.apache.harmony.jndi.tests.javax.naming.spi.mock.ldap.MockContextFactory");
        MockControl[] cs = { new MockControl("c1", false, new byte[] { 1, 2, 3, 4 }), 
                new MockControl("c1", true, new byte[] { 'a', 'b', 'c', 'd' }), };
        MockControl cs2 =  new MockControl("c1", false, new byte[] { 1, 2, 3, 4 }); 
        InitialLdapContext ilc=new InitialLdapContext(env, cs);
        assertEquals(cs2,ControlFactory.getControlInstance(cs2,ilc,env));

    } catch (NamingException e) {

    }
}
项目:cn1    文件:LdapContextImpl.java   
/**
 * convert raw controls to particular type of controls using
 * <code>getControlInstance(Control, Context,
 Hashtable<?, ?>)</code>
 * 
 * @param rawControls
 *            raw controls
 * @return particular type of controls
 * 
 * @throws NamingException
 */
private Control[] narrowingControls(Control[] rawControls)
        throws NamingException {
    if (rawControls == null) {
        return null;
    }

    Control[] controls = new Control[rawControls.length];
    for (int i = 0; i < rawControls.length; ++i) {
        controls[i] = ControlFactory.getControlInstance(rawControls[i],
                this, env);
    }

    return controls;
}
项目:cn1    文件:ControlFactoryTest.java   
/**
 * <p>Test method for 'javax.naming.ldap.ControlFactory.getControlInstance(Control, Context, Hashtable<?, ?>)'</p>
 * <p>Here we are testing the static method of the class ControlFactory</p>
 * <p>The expected result is the control sended.</p> 
 */
public void testGetControlInstanceControlContextHashtableOfQQ003() throws Exception {
    Hashtable env = new Hashtable();
    env.put(Context.INITIAL_CONTEXT_FACTORY,"org.apache.harmony.jndi.tests.javax.naming.spi.mock.ldap.MockContextFactory");
    MockControl[] cs = { new MockControl("c1", false, new byte[] { 1, 2, 3, 4 }), 
            new MockControl("c1", true, new byte[] { 'a', 'b', 'c', 'd' }), };
    MockControl cs2 =  new MockControl("c1", false, new byte[] { 1, 2, 3, 4 }); 
    InitialLdapContext ilc=new InitialLdapContext(env, cs);
    assertEquals(cs2,ControlFactory.getControlInstance(cs2,ilc,env));
}
项目:cn1    文件:ControlFactoryTest.java   
/**
 * <p>Test method for 'javax.naming.ldap.ControlFactory.getControlInstance(Control, Context, Hashtable<?, ?>)'</p>
 * <p>Here we are testing the static method of the class ControlFactory</p>
 * <p>The expected result is the control sended.</p> 
 */
public void testGetControlInstanceControlContextHashtableOfQQ004() throws Exception {
    Hashtable env = new Hashtable();
    env.put(Context.INITIAL_CONTEXT_FACTORY,"org.apache.harmony.jndi.tests.javax.naming.spi.mock.ldap.MockContextFactory");
    env.put(LdapContext.CONTROL_FACTORIES,"org.apache.harmony.jndi.tests.javax.naming.spi.mock.ldap.MockControlFactory");
    MockControl[] cs = { new MockControl("c1", false, new byte[] { 1, 2, 3, 4 }),new MockControl("c1", true, new byte[] { 'a', 'b', 'c', 'd' }), };
    MockControl cs2 =  new MockControl("c1", false, new byte[] { 1, 2, 3, 4 });
    InitialLdapContext ilc=new InitialLdapContext(env, cs);

    assertEquals(cs2,ControlFactory.getControlInstance(cs2,ilc,env));
}
项目:nextop-client    文件:LdapContextImpl.java   
/**
 * convert raw controls to particular type of controls using
 * <code>getControlInstance(Control, Context,
 Hashtable<?, ?>)</code>
 * 
 * @param rawControls
 *            raw controls
 * @return particular type of controls
 * 
 * @throws NamingException
 */
private Control[] narrowingControls(Control[] rawControls)
        throws NamingException {
    if (rawControls == null) {
        return null;
    }

    Control[] controls = new Control[rawControls.length];
    for (int i = 0; i < rawControls.length; ++i) {
        controls[i] = ControlFactory.getControlInstance(rawControls[i],
                this, env);
    }

    return controls;
}
项目:freeVM    文件:ControlFactoryTest.java   
/**
 * <p>Test method for 'javax.naming.ldap.ControlFactory.getControlInstance(Control, Context, Hashtable<?, ?>)'</p>
 * <p>Here we are testing the static method of the class ControlFactory</p>
 * <p>The expected result is the control sended.</p> 
 */
public void testGetControlInstanceControlContextHashtableOfQQ003() throws Exception {
    Hashtable env = new Hashtable();
    env.put(Context.INITIAL_CONTEXT_FACTORY,"org.apache.harmony.jndi.tests.javax.naming.spi.mock.ldap.MockContextFactory");
    MockControl[] cs = { new MockControl("c1", false, new byte[] { 1, 2, 3, 4 }), 
            new MockControl("c1", true, new byte[] { 'a', 'b', 'c', 'd' }), };
    MockControl cs2 =  new MockControl("c1", false, new byte[] { 1, 2, 3, 4 }); 
    InitialLdapContext ilc=new InitialLdapContext(env, cs);
    assertEquals(cs2,ControlFactory.getControlInstance(cs2,ilc,env));
}
项目:freeVM    文件:ControlFactoryTest.java   
/**
 * <p>Test method for 'javax.naming.ldap.ControlFactory.getControlInstance(Control, Context, Hashtable<?, ?>)'</p>
 * <p>Here we are testing the static method of the class ControlFactory</p>
 * <p>The expected result is the control sended.</p> 
 */
public void testGetControlInstanceControlContextHashtableOfQQ004() throws Exception {
    Hashtable env = new Hashtable();
    env.put(Context.INITIAL_CONTEXT_FACTORY,"org.apache.harmony.jndi.tests.javax.naming.spi.mock.ldap.MockContextFactory");
    env.put(LdapContext.CONTROL_FACTORIES,"org.apache.harmony.jndi.tests.javax.naming.spi.mock.ldap.MockControlFactory");
    MockControl[] cs = { new MockControl("c1", false, new byte[] { 1, 2, 3, 4 }),new MockControl("c1", true, new byte[] { 'a', 'b', 'c', 'd' }), };
    MockControl cs2 =  new MockControl("c1", false, new byte[] { 1, 2, 3, 4 });
    InitialLdapContext ilc=new InitialLdapContext(env, cs);

    assertEquals(cs2,ControlFactory.getControlInstance(cs2,ilc,env));
}
项目:freeVM    文件:LdapContextImpl.java   
/**
 * convert raw controls to particular type of controls using
 * <code>getControlInstance(Control, Context,
 Hashtable<?, ?>)</code>
 * 
 * @param rawControls
 *            raw controls
 * @return particular type of controls
 * 
 * @throws NamingException
 */
private Control[] narrowingControls(Control[] rawControls)
        throws NamingException {
    if (rawControls == null) {
        return null;
    }

    Control[] controls = new Control[rawControls.length];
    for (int i = 0; i < rawControls.length; ++i) {
        controls[i] = ControlFactory.getControlInstance(rawControls[i],
                this, env);
    }

    return controls;
}
项目:freeVM    文件:ControlFactoryTest.java   
/**
 * <p>Test method for 'javax.naming.ldap.ControlFactory.getControlInstance(Control, Context, Hashtable<?, ?>)'</p>
 * <p>Here we are testing the static method of the class ControlFactory</p>
 * <p>The expected result is the control sended.</p> 
 */
public void testGetControlInstanceControlContextHashtableOfQQ003() throws Exception {
    Hashtable env = new Hashtable();
    env.put(Context.INITIAL_CONTEXT_FACTORY,"org.apache.harmony.jndi.tests.javax.naming.spi.mock.ldap.MockContextFactory");
    MockControl[] cs = { new MockControl("c1", false, new byte[] { 1, 2, 3, 4 }), 
            new MockControl("c1", true, new byte[] { 'a', 'b', 'c', 'd' }), };
    MockControl cs2 =  new MockControl("c1", false, new byte[] { 1, 2, 3, 4 }); 
    InitialLdapContext ilc=new InitialLdapContext(env, cs);
    assertEquals(cs2,ControlFactory.getControlInstance(cs2,ilc,env));
}
项目:freeVM    文件:ControlFactoryTest.java   
/**
 * <p>Test method for 'javax.naming.ldap.ControlFactory.getControlInstance(Control, Context, Hashtable<?, ?>)'</p>
 * <p>Here we are testing the static method of the class ControlFactory</p>
 * <p>The expected result is the control sended.</p> 
 */
public void testGetControlInstanceControlContextHashtableOfQQ004() throws Exception {
    Hashtable env = new Hashtable();
    env.put(Context.INITIAL_CONTEXT_FACTORY,"org.apache.harmony.jndi.tests.javax.naming.spi.mock.ldap.MockContextFactory");
    env.put(LdapContext.CONTROL_FACTORIES,"org.apache.harmony.jndi.tests.javax.naming.spi.mock.ldap.MockControlFactory");
    MockControl[] cs = { new MockControl("c1", false, new byte[] { 1, 2, 3, 4 }),new MockControl("c1", true, new byte[] { 'a', 'b', 'c', 'd' }), };
    MockControl cs2 =  new MockControl("c1", false, new byte[] { 1, 2, 3, 4 });
    InitialLdapContext ilc=new InitialLdapContext(env, cs);

    assertEquals(cs2,ControlFactory.getControlInstance(cs2,ilc,env));
}
项目:cn1    文件:ControlFactoryTest.java   
/**
 * <p>Test method for 'javax.naming.ldap.ControlFactory.getControlInstance(Control, Context, Hashtable<?, ?>)'</p>
 * <p>Here we are testing the static method of the class ControlFactory</p>
 * <p>The expected result is null.</p> 
 */
public void testGetControlInstanceControlContextHashtableOfQQ001() throws Exception {
    ControlFactory.getControlInstance(null,null,null);
}
项目:cn1    文件:ControlFactoryTest.java   
/**
 * <p>Test method for 'javax.naming.ldap.ControlFactory.getControlInstance(Control, Context, Hashtable<?, ?>)'</p>
 * <p>Here we are testing the static method of the class ControlFactory</p>
 * <p>The expected result is the control sended.</p> 
 */
public void testGetControlInstanceControlContextHashtableOfQQ002() throws Exception {
    MockControl cs =  new MockControl("c1", false, new byte[] { 1, 2, 3, 4 }); 
    assertEquals(cs,ControlFactory.getControlInstance(cs,null,null));
}
项目:freeVM    文件:ControlFactoryTest.java   
/**
 * <p>Test method for 'javax.naming.ldap.ControlFactory.getControlInstance(Control, Context, Hashtable<?, ?>)'</p>
 * <p>Here we are testing the static method of the class ControlFactory</p>
 * <p>The expected result is null.</p> 
 */
public void testGetControlInstanceControlContextHashtableOfQQ001() throws Exception {
    ControlFactory.getControlInstance(null,null,null);
}
项目:freeVM    文件:ControlFactoryTest.java   
/**
 * <p>Test method for 'javax.naming.ldap.ControlFactory.getControlInstance(Control, Context, Hashtable<?, ?>)'</p>
 * <p>Here we are testing the static method of the class ControlFactory</p>
 * <p>The expected result is the control sended.</p> 
 */
public void testGetControlInstanceControlContextHashtableOfQQ002() throws Exception {
    MockControl cs =  new MockControl("c1", false, new byte[] { 1, 2, 3, 4 }); 
    assertEquals(cs,ControlFactory.getControlInstance(cs,null,null));
}
项目:freeVM    文件:ControlFactoryTest.java   
/**
 * <p>Test method for 'javax.naming.ldap.ControlFactory.getControlInstance(Control, Context, Hashtable<?, ?>)'</p>
 * <p>Here we are testing the static method of the class ControlFactory</p>
 * <p>The expected result is null.</p> 
 */
public void testGetControlInstanceControlContextHashtableOfQQ001() throws Exception {
    ControlFactory.getControlInstance(null,null,null);
}
项目:freeVM    文件:ControlFactoryTest.java   
/**
 * <p>Test method for 'javax.naming.ldap.ControlFactory.getControlInstance(Control, Context, Hashtable<?, ?>)'</p>
 * <p>Here we are testing the static method of the class ControlFactory</p>
 * <p>The expected result is the control sended.</p> 
 */
public void testGetControlInstanceControlContextHashtableOfQQ002() throws Exception {
    MockControl cs =  new MockControl("c1", false, new byte[] { 1, 2, 3, 4 }); 
    assertEquals(cs,ControlFactory.getControlInstance(cs,null,null));
}