本文整理匯總了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();
}