本文整理汇总了Java中javax.naming.ldap.ControlFactory类的典型用法代码示例。如果您正苦于以下问题:Java ControlFactory类的具体用法?Java ControlFactory怎么用?Java ControlFactory使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
ControlFactory类属于javax.naming.ldap包,在下文中一共展示了ControlFactory类的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: testGetControlInstanceControl
import javax.naming.ldap.ControlFactory; //导入依赖的package包/类
/**
* <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) {
}
}
示例2: testGetControlInstanceControl
import javax.naming.ldap.ControlFactory; //导入依赖的package包/类
/**
* <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) {
}
}
示例3: narrowingControls
import javax.naming.ldap.ControlFactory; //导入依赖的package包/类
/**
* 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;
}
示例4: testGetControlInstanceControlContextHashtableOfQQ003
import javax.naming.ldap.ControlFactory; //导入依赖的package包/类
/**
* <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));
}
示例5: testGetControlInstanceControlContextHashtableOfQQ004
import javax.naming.ldap.ControlFactory; //导入依赖的package包/类
/**
* <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));
}
示例6: testGetControlInstanceControlContextHashtableOfQQ001
import javax.naming.ldap.ControlFactory; //导入依赖的package包/类
/**
* <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);
}
示例7: testGetControlInstanceControlContextHashtableOfQQ002
import javax.naming.ldap.ControlFactory; //导入依赖的package包/类
/**
* <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));
}