本文整理汇总了Java中org.apache.directory.api.ldap.model.entry.Entry.clear方法的典型用法代码示例。如果您正苦于以下问题:Java Entry.clear方法的具体用法?Java Entry.clear怎么用?Java Entry.clear使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.apache.directory.api.ldap.model.entry.Entry
的用法示例。
在下文中一共展示了Entry.clear方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: testClear
import org.apache.directory.api.ldap.model.entry.Entry; //导入方法依赖的package包/类
/**
* Test method for clear()
*/
@Test
public void testClear() throws LdapException
{
Entry entry = new DefaultEntry( exampleDn );
assertEquals( 0, entry.size() );
assertNull( entry.get( "ObjectClass" ) );
entry.clear();
assertEquals( 0, entry.size() );
assertNull( entry.get( "ObjectClass" ) );
entry.add( "ObjectClass", "top", "person" );
assertEquals( 1, entry.size() );
assertNotNull( entry.get( "ObjectClass" ) );
entry.clear();
assertEquals( 0, entry.size() );
assertNull( entry.get( "ObjectClass" ) );
}
示例2: testSize
import org.apache.directory.api.ldap.model.entry.Entry; //导入方法依赖的package包/类
/**
* Test method for size()
*/
@Test
public void testSize() throws LdapException
{
Entry entry = new DefaultEntry( exampleDn );
assertEquals( 0, entry.size() );
entry.add( "ObjectClass", "top", "person" );
entry.add( "cn", "test" );
entry.add( "sn", "Test" );
assertEquals( 3, entry.size() );
entry.clear();
assertEquals( 0, entry.size() );
}
示例3: testContainsAttribute
import org.apache.directory.api.ldap.model.entry.Entry; //导入方法依赖的package包/类
/**
* Test method for containsAttribute( String )
*/
@Test
public void testContainsAttribute() throws LdapException
{
Entry entry = new DefaultEntry( exampleDn );
assertFalse( entry.containsAttribute( "objectClass" ) );
Attribute attrOC = new DefaultAttribute( "objectClass", "top", "person" );
Attribute attrCN = new DefaultAttribute( "cn", "test1", "test2" );
Attribute attrSN = new DefaultAttribute( "sn", "Test1", "Test2" );
Attribute attrPWD = new DefaultAttribute( "userPassword", BYTES1, BYTES2 );
entry.add( attrOC, attrCN, attrSN, attrPWD );
assertTrue( entry.containsAttribute( "OBJECTCLASS" ) );
assertTrue( entry.containsAttribute( " cn " ) );
assertTrue( entry.containsAttribute( "Sn" ) );
assertTrue( entry.containsAttribute( " userPASSWORD " ) );
entry.clear();
assertFalse( entry.containsAttribute( "OBJECTCLASS" ) );
assertFalse( entry.containsAttribute( " cn " ) );
assertFalse( entry.containsAttribute( "Sn" ) );
assertFalse( entry.containsAttribute( " userPASSWORD " ) );
}
示例4: testEqualsObject
import org.apache.directory.api.ldap.model.entry.Entry; //导入方法依赖的package包/类
/**
* Test method for equals()
*/
@Test
public void testEqualsObject() throws LdapException
{
Entry entry1 = new DefaultEntry();
Entry entry2 = new DefaultEntry();
assertEquals( entry1, entry2 );
entry1.setDn( exampleDn );
assertNotSame( entry1, entry2 );
entry2.setDn( exampleDn );
assertEquals( entry1, entry2 );
Attribute attrOC = new DefaultAttribute( "objectClass", "top", "person" );
Attribute attrCN = new DefaultAttribute( "cn", "test1", "test2" );
Attribute attrSN = new DefaultAttribute( "sn", "Test1", "Test2" );
Attribute attrPWD = new DefaultAttribute( "userPassword", BYTES1, BYTES2 );
entry1.put( attrOC, attrCN, attrSN, attrPWD );
entry2.put( attrOC, attrCN, attrSN );
assertNotSame( entry1, entry2 );
entry2.put( attrPWD );
assertEquals( entry1, entry2 );
Attribute attrL1 = new DefaultAttribute( "l", "Paris", "New-York" );
Attribute attrL2 = new DefaultAttribute( "l", "Paris", "Tokyo" );
entry1.put( attrL1 );
entry2.put( attrL1 );
assertEquals( entry1, entry2 );
entry1.add( "l", "London" );
assertNotSame( entry1, entry2 );
entry2.add( attrL2 );
assertNotSame( entry1, entry2 );
entry1.clear();
entry2.clear();
assertEquals( entry1, entry2 );
}