当前位置: 首页>>代码示例>>Java>>正文


Java ControlFactory类代码示例

本文整理汇总了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) {
		
	}
}
 
开发者ID:shannah,项目名称:cn1,代码行数:21,代码来源:TestControlFactoryWhiteBoxDevelopment.java

示例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) {
		
	}
}
 
开发者ID:freeVM,项目名称:freeVM,代码行数:21,代码来源:TestControlFactoryWhiteBoxDevelopment.java

示例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;
}
 
开发者ID:shannah,项目名称:cn1,代码行数:26,代码来源:LdapContextImpl.java

示例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));
}
 
开发者ID:shannah,项目名称:cn1,代码行数:15,代码来源:ControlFactoryTest.java

示例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));
}
 
开发者ID:shannah,项目名称:cn1,代码行数:16,代码来源:ControlFactoryTest.java

示例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);
}
 
开发者ID:shannah,项目名称:cn1,代码行数:9,代码来源:ControlFactoryTest.java

示例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));
}
 
开发者ID:shannah,项目名称:cn1,代码行数:10,代码来源:ControlFactoryTest.java


注:本文中的javax.naming.ldap.ControlFactory类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。