@Test
public void testPutEntryAttribute() throws Exception
{
Entry entry = new DefaultServerEntry( schemaManager, EXAMPLE_DN );
EntryAttribute oc = new DefaultServerAttribute( atObjectClass, "top", "person" );
EntryAttribute cn = new DefaultServerAttribute( atCN, "test1", "test2" );
EntryAttribute sn = new DefaultServerAttribute( atSN, "Test1", "Test2" );
EntryAttribute up = new DefaultServerAttribute( atPwd, BYTES1, BYTES2 );
EntryAttribute c = new DefaultServerAttribute( atC, "FR", "US" );
List<EntryAttribute> 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( " countryName " ) );
EntryAttribute attr = entry.get( "objectclass" );
assertEquals( 2, attr.size() );
EntryAttribute c2 = new DefaultServerAttribute( atC, "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( " countryName " ) );
EntryAttribute attrC = entry.get( "countryName" );
assertEquals( 2, attrC.size() );
assertTrue( attrC.contains( "UK", "DE" ) );
c2.clear();
entry.put( c2 );
assertEquals( 5, entry.size() );
attrC = entry.get( "countryName" );
assertEquals( 0, attrC.size() );
}