本文整理汇总了Java中javax.naming.ldap.InitialLdapContext.reconnect方法的典型用法代码示例。如果您正苦于以下问题:Java InitialLdapContext.reconnect方法的具体用法?Java InitialLdapContext.reconnect怎么用?Java InitialLdapContext.reconnect使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类javax.naming.ldap.InitialLdapContext
的用法示例。
在下文中一共展示了InitialLdapContext.reconnect方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: testReconnect003
import javax.naming.ldap.InitialLdapContext; //导入方法依赖的package包/类
/**
* <p>
* Test method for
* 'javax.naming.ldap.InitialLdapContext.reconnect(Control[])'
* </p>
* <p>
* Here we are testing if this method correctly reconnects to the LDAP
* server. In this case we are using a different set of controls for the
* reconnection.
* </p>
* <p>
* The expected result is a reconection with the new set of controls.
* </p>
*/
public void testReconnect003() throws Exception {
System
.setProperty(Context.INITIAL_CONTEXT_FACTORY,
"org.apache.harmony.jndi.tests.javax.naming.spi.mock.ldap.MockContextFactory");
Control[] cs = {
new MockControl("c1", false, new byte[] { 1, 2, 3, 4 }),
new MockControl("c1", true, new byte[] { 'a', 'b', 'c', 'd' }), };
Control[] cs2 = {
new MockControl("c2", false, new byte[] { 1, 2, 3, 4 }),
new MockControl("c2", true, new byte[] { 'a', 'b', 'c', 'd' }), };
InitialLdapContext ilc = new InitialLdapContext(null, cs);
ilc.reconnect(cs2);
assertEquals(cs2, ilc.getConnectControls());
ilc.close();
}
示例2: testReconnect003
import javax.naming.ldap.InitialLdapContext; //导入方法依赖的package包/类
/**
* <p>
* Test method for
* 'javax.naming.ldap.InitialLdapContext.reconnect(Control[])'
* </p>
* <p>
* Here we are testing if this method reconnects to the LDAP server using
* the supplied controls and this context's environment. In this case we are
* sending a new set of controls to reconection.
* </p>
* <p>
* The expected result is a reconection with the new set of controls.
* </p>
*/
public void testReconnect003() throws Exception {
System
.setProperty(Context.INITIAL_CONTEXT_FACTORY,
"org.apache.harmony.jndi.tests.javax.naming.spi.mock.ldap.MockContextFactory");
Control[] cs = {
new MockControl("c1", false, new byte[] { 1, 2, 3, 4 }),
new MockControl("c1", true, new byte[] { 'a', 'b', 'c', 'd' }), };
Control[] cs2 = {
new MockControl("c2", false, new byte[] { 1, 2, 3, 4 }),
new MockControl("c2", true, new byte[] { 'a', 'b', 'c', 'd' }), };
InitialLdapContext ilc = new InitialLdapContext(null, cs);
ilc.reconnect(cs2);
assertEquals(cs2, ilc.getConnectControls());
ilc.close();
}
示例3: testReconnect001
import javax.naming.ldap.InitialLdapContext; //导入方法依赖的package包/类
/**
* <p>
* Test method for
* 'javax.naming.ldap.InitialLdapContext.reconnect(Control[])'
* </p>
* <p>
* Here we are testing if this method correctly reconnects to the LDAP
* server. In this case we are using a null argument.
* </p>
* <p>
* The expected result is a reconection with no controls.
* </p>
*/
public void testReconnect001() throws Exception {
System.setProperty(Context.INITIAL_CONTEXT_FACTORY,
"org.apache.harmony.jndi.tests.javax.naming.spi.mock.ldap.MockContextFactory");
InitialLdapContext ilc = new InitialLdapContext();
ilc.reconnect(null);
assertNull(ilc.getConnectControls());
ilc.close();
}
示例4: testReconnect002
import javax.naming.ldap.InitialLdapContext; //导入方法依赖的package包/类
/**
* <p>
* Test method for
* 'javax.naming.ldap.InitialLdapContext.reconnect(Control[])'
* </p>
* <p>
* Here we are testing if this method correctly reconnects to the LDAP
* server In this case we are using a non-null argument.
* </p>
* <p>
* The expected result is a reconection with the controls sended.
* </p>
*/
public void testReconnect002() throws Exception {
System.setProperty(Context.INITIAL_CONTEXT_FACTORY,
"org.apache.harmony.jndi.tests.javax.naming.spi.mock.ldap.MockContextFactory");
Control[] cs = {
new MockControl("c1", false, new byte[] { 1, 2, 3, 4 }),
new MockControl("c1", true, new byte[] { 'a', 'b', 'c', 'd' }), };
InitialLdapContext ilc = new InitialLdapContext();
ilc.reconnect(cs);
assertEquals(cs, ilc.getConnectControls());
ilc.close();
}
示例5: testReconnect001
import javax.naming.ldap.InitialLdapContext; //导入方法依赖的package包/类
/**
* <p>
* Test method for
* 'javax.naming.ldap.InitialLdapContext.reconnect(Control[])'
* </p>
* <p>
* Here we are testing if this method reconnects to the LDAP server using
* the supplied controls and this context's environment. In this case we are
* sending a set of null controls.
* </p>
* <p>
* The expected result is a reconection with no controls.
* </p>
*/
public void testReconnect001() throws Exception {
System.setProperty(Context.INITIAL_CONTEXT_FACTORY,
"org.apache.harmony.jndi.tests.javax.naming.spi.mock.ldap.MockContextFactory");
InitialLdapContext ilc = new InitialLdapContext();
ilc.reconnect(null);
assertNull(ilc.getConnectControls());
ilc.close();
}
示例6: testReconnect002
import javax.naming.ldap.InitialLdapContext; //导入方法依赖的package包/类
/**
* <p>
* Test method for
* 'javax.naming.ldap.InitialLdapContext.reconnect(Control[])'
* </p>
* <p>
* Here we are testing if this method reconnects to the LDAP server using
* the supplied controls and this context's environment. In this case we are
* sending a set not null of controls.
* </p>
* <p>
* The expected result is a reconection with the controls sended.
* </p>
*/
public void testReconnect002() throws Exception {
System.setProperty(Context.INITIAL_CONTEXT_FACTORY,
"org.apache.harmony.jndi.tests.javax.naming.spi.mock.ldap.MockContextFactory");
Control[] cs = {
new MockControl("c1", false, new byte[] { 1, 2, 3, 4 }),
new MockControl("c1", true, new byte[] { 'a', 'b', 'c', 'd' }), };
InitialLdapContext ilc = new InitialLdapContext();
ilc.reconnect(cs);
assertEquals(cs, ilc.getConnectControls());
ilc.close();
}