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


Java LdapName.getAll方法代码示例

本文整理汇总了Java中javax.naming.ldap.LdapName.getAll方法的典型用法代码示例。如果您正苦于以下问题:Java LdapName.getAll方法的具体用法?Java LdapName.getAll怎么用?Java LdapName.getAll使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在javax.naming.ldap.LdapName的用法示例。


在下文中一共展示了LdapName.getAll方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: testGetAll003

import javax.naming.ldap.LdapName; //导入方法依赖的package包/类
/**
 * <p>
 * Test method for 'javax.naming.ldap.LdapName.getAll()'
 * </p>
 * <p>
 * Here we are testing if this method correctly returns all the RDNs that
 * make up this LdapName as Strings.
 * </p>
 * <p>
 * The expected result is if a non empty name returns a non-null
 * enumeration, and ordered like it should be.
 * </p>
 */
public void testGetAll003() throws Exception {
    LinkedList<Rdn> test = new LinkedList<Rdn>();
    Rdn a = new Rdn("cn", "test");
    Rdn b = new Rdn("uid", "test");
    Rdn c = new Rdn("l", "test");
    Rdn d = new Rdn("st", "test");
    test.add(0, a);
    test.add(1, b);
    test.add(2, c);
    test.add(3, d);
    LdapName ln = new LdapName(test);
    Enumeration<String> e = ln.getAll();
    for (Rdn rdn : test) {
        assertEquals(rdn.toString(), e.nextElement());
    }
}
 
开发者ID:shannah,项目名称:cn1,代码行数:30,代码来源:LdapNameTest.java

示例2: testGetAll001

import javax.naming.ldap.LdapName; //导入方法依赖的package包/类
/**
 * <p>Test method for 'javax.naming.ldap.LdapName.getAll()'</p>
 * <p>Here we are testing if this method retrieves the components of this name as an enumeration of strings.</p>
 * <p>The expected result is if an empty name returns a non-null enumeration.</p>
 */
public void testGetAll001() {

	try {
		LdapName ln=new LdapName("");
		Enumeration<String> x=ln.getAll();
		assertNotNull(x);
		assertEquals(x.hasMoreElements(),ln.getRdns().iterator().hasNext());
	} catch (InvalidNameException e) {
		
	}
}
 
开发者ID:shannah,项目名称:cn1,代码行数:17,代码来源:TestLdapNameWhiteBoxDevelopment.java

示例3: testIntegrationConstructorAndMethods001

import javax.naming.ldap.LdapName; //导入方法依赖的package包/类
/**
 * <p>Method to test all the add methods in addition to the test of get methods.</p>
 *
 */
public void testIntegrationConstructorAndMethods001(){
	
	try {
		
		//Testing Constructor
		LdapName temp=new LdapName("t=test");
		LdapName temp2=new LdapName(list);
		list.add(aux);
		LdapName temp3=new LdapName(list);
		assertNotNull(temp);
		assertNotNull(temp2);
		assertNotNull(temp3);
		
		//Testing Add Methods
		temp.add(0,aux);
		temp.add(0,"f=flag");
		temp.add(aux);
		temp.add("f=flag");
		temp.addAll(0,list);
		temp.addAll(0,temp2);
		temp.addAll(list);
		temp.addAll(temp2);

		
		//Testing get methods 
		LdapName en=(LdapName) temp.clone();
		assertEquals("t=test",temp.get(0));
		assertNotNull(temp.getAll());
		Enumeration<String> enume=temp.getAll();
		Enumeration<String> enume2=en.getAll();
		while(enume.hasMoreElements()&&enume2.hasMoreElements()){
			if(enume.nextElement().compareTo(enume2.nextElement())!=0)fail("Fail.");
			
		}
		if(!temp.getClass().equals(temp2.getClass()))fail("Fail.");
		assertTrue(temp.startsWith(temp.getPrefix(0)));
		assertTrue(temp.endsWith(temp.getSuffix(0)));
		assertTrue(temp.endsWith(temp.getRdns()));
		assertTrue(temp.getRdn(0).equals(aux));
		
	} catch (InvalidNameException e) {
		fail("Failed with:"+e);
	}
		
}
 
开发者ID:shannah,项目名称:cn1,代码行数:50,代码来源:TestLdapNameIntegration.java

示例4: testCompleteIntegration

import javax.naming.ldap.LdapName; //导入方法依赖的package包/类
/**
 * <p>Test method to test the complete integration of the class.</p>
 *
 */
public void testCompleteIntegration(){
	try {
		
		//Testing Constructor
		LdapName temp=new LdapName("t=test");
		LdapName temp2=new LdapName(list);
		list.add(aux);
		LdapName temp3=new LdapName(list);
		assertNotNull(temp);
		assertNotNull(temp2);
		assertNotNull(temp3);
		
		//Testing Add Methods
		temp.add(0,aux);
		temp.add(0,"f=flag");
		temp.add(aux);
		temp.add("f=flag");
		temp.addAll(0,list);
		temp.addAll(0,temp2);
		temp.addAll(list);
		temp.addAll(temp2);

		//Testing String
		String x="t=test,T=TEST";
		LdapName temp4=new LdapName(x);
		assertEquals(x.getBytes().length,temp4.toString().getBytes().length);
		
		//Testing get methods 
		LdapName en=(LdapName) temp.clone();
		assertEquals("t=test",temp.get(0));
		assertNotNull(temp.getAll());
		Enumeration<String> enume=temp.getAll();
		Enumeration<String> enume2=en.getAll();
		while(enume.hasMoreElements()&&enume2.hasMoreElements()){
			if(enume.nextElement().compareTo(enume2.nextElement())!=0)fail("Fail.");
			
		}
		if(!temp.getClass().equals(temp2.getClass()))fail("Fail.");
		assertTrue(temp.startsWith(temp.getPrefix(0)));
		assertTrue(temp.endsWith(temp.getSuffix(0)));
		assertTrue(temp.endsWith(temp.getRdns()));
		assertTrue(temp.getRdn(0).equals(aux));
		
		//Testing Clone, Equlas and CompareTo 
		if(!temp.clone().getClass().equals(temp.getClass()))fail("Fail.");
		assertEquals(0,temp.compareTo(temp));
		assertTrue(temp.compareTo(temp2)>0);
		assertTrue(temp.compareTo(temp3)>0);
		assertFalse(temp.equals(null));
		assertTrue(temp.equals(temp));
		assertFalse(temp.equals(temp2));
		
		//Testing SartWith and EndWith methods
		assertTrue(temp.endsWith(list));
		assertTrue(temp.endsWith(temp2));
		assertTrue(temp.startsWith(list));
		assertTrue(temp.startsWith(temp2));
		
		//Testing methods 
		assertTrue(temp.hashCode()!=0);
		assertFalse(temp.isEmpty());
		assertNotNull(temp.remove(0));
		assertTrue(temp.size()!=0);
		while(temp.size()>0){
			assertNotNull(temp.remove(temp.size()-1));
		}
		assertTrue(temp.isEmpty());
	} catch (InvalidNameException e) {
		fail("Failed with:"+e);
	}
}
 
开发者ID:shannah,项目名称:cn1,代码行数:76,代码来源:TestLdapNameIntegration.java

示例5: testGetAll001

import javax.naming.ldap.LdapName; //导入方法依赖的package包/类
/**
 * <p>
 * Test method for 'javax.naming.ldap.LdapName.getAll()'
 * </p>
 * <p>
 * Here we are testing if this method correctly returns all the RDNs that
 * make up this LdapName as Strings.
 * </p>
 * <p>
 * The expected result is if an empty name returns a non-null enumeration.
 * </p>
 */
public void testGetAll001() throws Exception {
    LdapName ln = new LdapName("");
    Enumeration<String> x = ln.getAll();
    assertNotNull(x);
}
 
开发者ID:shannah,项目名称:cn1,代码行数:18,代码来源:LdapNameTest.java

示例6: testGetAll002

import javax.naming.ldap.LdapName; //导入方法依赖的package包/类
/**
 * <p>
 * Test method for 'javax.naming.ldap.LdapName.getAll()'
 * </p>
 * <p>
 * Here we are testing if this method correctly returns all the RDNs that
 * make up this LdapName as Strings.
 * </p>
 * <p>
 * The expected result is if a non empty name returns a non-null
 * enumeration, and ordered like it should be.
 * </p>
 */
public void testGetAll002() throws Exception {
    LdapName ln = new LdapName("t=test");
    Enumeration<String> e = ln.getAll();
    assertEquals("t=test", e.nextElement());
}
 
开发者ID:shannah,项目名称:cn1,代码行数:19,代码来源:LdapNameTest.java


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