本文整理汇总了Java中javax.naming.ldap.LdapName.addAll方法的典型用法代码示例。如果您正苦于以下问题:Java LdapName.addAll方法的具体用法?Java LdapName.addAll怎么用?Java LdapName.addAll使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类javax.naming.ldap.LdapName
的用法示例。
在下文中一共展示了LdapName.addAll方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: testIntegrationConstructorAndAddMethods
import javax.naming.ldap.LdapName; //导入方法依赖的package包/类
/**
* <p>Method to test all the add methods.</p>
*
*/
public void testIntegrationConstructorAndAddMethods(){
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 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);
} catch (InvalidNameException e) {
fail("Failed with:"+e);
}
}
示例2: testAddAll001
import javax.naming.ldap.LdapName; //导入方法依赖的package包/类
/**
* <p>Test method for 'javax.naming.ldap.LdapName.add(int, String)'</p>
* <p>Here we are testing if this method adds a single component at a specified position within this LDAP name.</p>
* <p>Here we are testing if a naming exception is thrown if a name is trying of be added.</p>
*/
public void testAddAll001(){
try {
LdapName x=new LdapName("t=test");
x.addAll(1,new CompositeName());
assertNotNull(x);
} catch (InvalidNameException e) {
fail("Failed with:"+e);
}
}
示例3: testAddAll002
import javax.naming.ldap.LdapName; //导入方法依赖的package包/类
/**
* <p>Test method for 'javax.naming.ldap.LdapName.add(int, String)'</p>
* <p>Here we are testing if this method adds a single component at a specified position within this LDAP name.</p>
* <p>Here we are testing if a naming exception is thrown if a name is trying of be added.</p>
*/
public void testAddAll002(){
try {
LdapName x=new LdapName("t=test");
x.addAll(1,new CompoundName("",new Properties()));
assertNotNull(x);
} catch (InvalidNameException e) {
fail("Failed with:"+e);
}
}
示例4: testAddAll003
import javax.naming.ldap.LdapName; //导入方法依赖的package包/类
/**
* <p>Test method for 'javax.naming.ldap.LdapName.add(int, String)'</p>
* <p>Here we are testing if this method adds a single component at a specified position within this LDAP name.</p>
* <p>Here we are testing if a naming exception is thrown if a name is trying of be added.</p>
*/
public void testAddAll003(){
try {
LdapName x=new LdapName("t=test");
x.addAll(1,new CompositeName("/"));
assertNotNull(x);
} catch (InvalidNameException e) {
fail("Failed with:"+e);
}
}
示例5: 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);
}
}
示例6: testIntegrationConstructorAndMethods002
import javax.naming.ldap.LdapName; //导入方法依赖的package包/类
/**
* <p>Method to test all the add methods in addition to the test of the remaining methods.</p>
*
*/
public void testIntegrationConstructorAndMethods002(){
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 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());
//Testing String
String x="t=test,T=TEST";
LdapName temp4=new LdapName(x);
assertEquals(x.getBytes().length,temp4.toString().getBytes().length);
} catch (InvalidNameException e) {
fail("Failed with:"+e);
}
}
示例7: 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);
}
}
示例8: testAddAllIntListOfRdn005
import javax.naming.ldap.LdapName; //导入方法依赖的package包/类
/**
* <p>
* Test method for 'javax.naming.ldap.LdapName.addAll(int, List<Rdn>)'
* </p>
* <p>
* Here we are testing if this method correctly adds the Rdns to an LdapName
* at the given index.
* </p>
* <p>
* The expected result is the Rdns added in the correct order.
* </p>
*/
public void testAddAllIntListOfRdn005() throws Exception {
LinkedList<Rdn> test = new LinkedList<Rdn>();
test.add(new Rdn("t=test"));
LdapName ln = new LdapName("");
ln.addAll(0, test);
assertEquals("t=test", ln.toString());
}
示例9: testAddAllIntName002
import javax.naming.ldap.LdapName; //导入方法依赖的package包/类
/**
* <p>
* Test method for 'javax.naming.ldap.LdapName.addAll(int, Name)'
* </p>
* <p>
* Here we are testing if this method correctly adds the components of the
* given Name to an LdapName at the given index.
* <p>
* The expected result is an IndexOutOfBounds Exception.
* </p>
*/
public void testAddAllIntName002() throws Exception {
try {
LdapName ln = new LdapName("t=test");
ln.addAll(-1, new LdapName("uid=userid"));
fail("IndexOutOfBoundsException expected");
} catch (IndexOutOfBoundsException e) {}
}
示例10: testAddAllName001
import javax.naming.ldap.LdapName; //导入方法依赖的package包/类
/**
* <p>
* Test method for 'javax.naming.ldap.LdapName.addAll(Name)'
* </p>
* <p>
* Here we are testing if this method correctly appends the components of a
* name to the end of this LdapName.
* </p>
* <p>
* The expected result is if a null name is sended to add an
* NullPointerException is thrown.
* </p>
*/
public void testAddAllName001() throws Exception {
try {
LdapName ln = new LdapName("t=test");
LdapName toadd = null;
ln.addAll(toadd);
fail("NPE expected");
} catch (NullPointerException e) {}
}
示例11: testAddAllListOfRdn001
import javax.naming.ldap.LdapName; //导入方法依赖的package包/类
/**
* <p>
* Test method for 'javax.naming.ldap.LdapName.addAll(List<Rdn>)'
* </p>
* <p>
* Here we are testing if this method correctly appends the Rdns in the
* given List to the end of this LdapName.
* </p>
* <p>
* The expected result is NullPointerException.
* </p>
*/
public void testAddAllListOfRdn001() throws Exception {
LinkedList<Rdn> test = null;
try {
LdapName ln = new LdapName("t=test");
ln.addAll(test);
fail("NPE expected");
} catch (NullPointerException e) {}
}
示例12: testAddAllIntListOfRdn002
import javax.naming.ldap.LdapName; //导入方法依赖的package包/类
/**
* <p>
* Test method for 'javax.naming.ldap.LdapName.addAll(int, List<Rdn>)'
* </p>
* <p>
* Here we are testing if this method correctly adds the Rdns to an LdapName
* at the given index.
* </p>
* <p>
* The expected result is an IndexOutOfBoundsException.
* </p>
*/
public void testAddAllIntListOfRdn002() throws Exception {
LinkedList<Rdn> test = new LinkedList<Rdn>();
try {
test.add(new Rdn("t=test"));
test.add(new Rdn("cn=common"));
LdapName ln = new LdapName("t=test");
ln.addAll(-1, test);
fail("IndexOutOfBoundsException expected");
} catch (IndexOutOfBoundsException e) {}
}
示例13: testAddAllListOfRdn004
import javax.naming.ldap.LdapName; //导入方法依赖的package包/类
/**
* <p>
* Test method for 'javax.naming.ldap.LdapName.addAll(List<Rdn>)'
* </p>
* <p>
* Here we are testing if this method correctly appends the Rdns in the
* given List to the end of this LdapName.
* </p>
* <p>
* The expected result is the adding in the especified order.
* </p>
*/
public void testAddAllListOfRdn004() throws Exception {
LinkedList<Rdn> test = new LinkedList<Rdn>();
test.add(new Rdn("t=test"));
LdapName ln = new LdapName("");
ln.addAll(test);
assertEquals("t=test", ln.toString());
}
示例14: testAddAllListOfRdn005
import javax.naming.ldap.LdapName; //导入方法依赖的package包/类
/**
* <p>
* Test method for 'javax.naming.ldap.LdapName.addAll(List<Rdn>)'
* </p>
* <p>
* Here we are testing if this method correctly appends the Rdns in the
* given List to the end of this LdapName.
* </p>
* <p>
* The expected result is the adding in the especified order.
* </p>
*/
public void testAddAllListOfRdn005() throws Exception {
LinkedList<Rdn> test = new LinkedList<Rdn>();
test.add(new Rdn("t=test"));
test.add(new Rdn("t2=test"));
LdapName ln = new LdapName("t3=test");
ln.addAll(test);
assertEquals("t2=test,t=test,t3=test", ln.toString());
}
示例15: testAddAllName003
import javax.naming.ldap.LdapName; //导入方法依赖的package包/类
/**
* <p>
* Test method for 'javax.naming.ldap.LdapName.addAll(Name)'
* </p>
* <p>
* Here we are testing if this method correctly appends the components of a
* name to the end of this LdapName.
* </p>
* <p>
* The expected result is if a non null name is sended to add, it must be in
* order.
* </p>
*/
public void testAddAllName003() throws Exception {
LdapName ln = new LdapName("t=test");
ln.addAll(new LdapName("uid=userid"));
assertEquals("uid=userid,t=test", ln.toString());
}