當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。