@Test
public void testPutEntryAttribute() throws Exception
{
Entry entry = new DefaultEntry( schemaManager, EXAMPLE_DN );
Attribute oc = new DefaultAttribute( atObjectClass, "top", "person" );
Attribute cn = new DefaultAttribute( atCN, "test1", "test2" );
Attribute sn = new DefaultAttribute( atSN, "Test1", "Test2" );
Attribute up = new DefaultAttribute( atPwd, BYTES1, BYTES2 );
Attribute c = new DefaultAttribute( atEMail, "FR", "US" );
List<Attribute> removed = entry.put( oc, cn, sn, c );
assertEquals( 4, entry.size() );
assertEquals( 0, removed.size() );
assertTrue( entry.containsAttribute( "ObjectClass" ) );
assertTrue( entry.containsAttribute( "CN" ) );
assertTrue( entry.containsAttribute( " sn " ) );
assertTrue( entry.containsAttribute( " email " ) );
Attribute attr = entry.get( "objectclass" );
assertEquals( 2, attr.size() );
Attribute c2 = new DefaultAttribute( atEMail, "UK", "DE" );
removed = entry.put( c2, up );
assertEquals( 1, removed.size() );
assertEquals( c, removed.get( 0 ) );
assertTrue( removed.get( 0 ).contains( "FR" ) );
assertTrue( removed.get( 0 ).contains( "US" ) );
assertEquals( 5, entry.size() );
assertTrue( entry.containsAttribute( "userPassword" ) );
assertTrue( entry.containsAttribute( " email " ) );
Attribute attrC = entry.get( "email" );
assertEquals( 2, attrC.size() );
assertTrue( attrC.contains( "UK", "DE" ) );
c2.clear();
entry.put( c2 );
assertEquals( 5, entry.size() );
attrC = entry.get( "email" );
assertEquals( 0, attrC.size() );
}