本文整理汇总了Java中javax.naming.ldap.LdapName.clone方法的典型用法代码示例。如果您正苦于以下问题:Java LdapName.clone方法的具体用法?Java LdapName.clone怎么用?Java LdapName.clone使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类javax.naming.ldap.LdapName
的用法示例。
在下文中一共展示了LdapName.clone方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: 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);
}
}
示例2: 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);
}
}
示例3: testClone002
import javax.naming.ldap.LdapName; //导入方法依赖的package包/类
/**
* <p>
* Test method for 'javax.naming.ldap.LdapName.clone()'
* </p>
* <p>
* Here we are testing if this method correctly clones this LdapName.
* </p>
* <p>
* The expected result in this case is if a change in primary object no
* affect the clone.
* </p>
*/
public void testClone002() throws Exception {
LdapName ln = new LdapName("t=test");
LdapName copy = (LdapName) ln.clone();
ln.add("ch=change");
assertNotSame(ln.toString(), copy.toString());
}
示例4: testClone003
import javax.naming.ldap.LdapName; //导入方法依赖的package包/类
/**
* <p>
* Test method for 'javax.naming.ldap.LdapName.clone()'
* </p>
* <p>
* Here we are testing if this method correctly clones this LdapName.
* </p>
* <p>
* The expected result in this case is if a change in the clone object no
* affect the primary.
* </p>
*/
public void testClone003() throws Exception {
LdapName ln = new LdapName("t=test");
LdapName copy = (LdapName) ln.clone();
copy.add("ch=change");
assertNotSame(ln.toString(), copy.toString());
}
示例5: testClone001
import javax.naming.ldap.LdapName; //导入方法依赖的package包/类
/**
* <p>
* Test method for 'javax.naming.ldap.LdapName.clone()'
* </p>
* <p>
* Here we are testing if a clone of an object of LdapName is equal to the
* original.
* </p>
* <p>
* The expected result in this case is true.
* </p>
*/
public void testClone001() throws Exception {
LdapName ln = new LdapName("t=test");
LdapName copy = (LdapName) ln.clone();
assertEquals(ln, copy);
}
示例6: testClone004
import javax.naming.ldap.LdapName; //导入方法依赖的package包/类
/**
* <p>
* Test method for 'javax.naming.ldap.LdapName.clone()'
* </p>
* <p>
* Here we are testing if this method correctly clones this LdapName.
* </p>
* <p>
* The expected result in this case is if clone of an empty object is equal
* to its primary.
* </p>
*/
public void testClone004() throws Exception {
LdapName ln = new LdapName("");
LdapName copy = (LdapName) ln.clone();
assertEquals(ln, copy);
}