You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@directory.apache.org by el...@apache.org on 2010/03/26 14:25:12 UTC
svn commit: r927839 [1/3] - in /directory:
apacheds/trunk/avl-partition/src/main/java/org/apache/directory/server/core/partition/avl/
apacheds/trunk/avl-partition/src/test/java/org/apache/directory/server/core/partition/avl/
apacheds/trunk/core-api/src...
Author: elecharny
Date: Fri Mar 26 13:25:10 2010
New Revision: 927839
URL: http://svn.apache.org/viewvc?rev=927839&view=rev
Log:
o Started to merge DefaultServerAttribute and DefaultClientAttribute
o Removed the ClientAttribute interface
o Removed the ServerAttribute interface
o Fixed some AttributeType which had some wrong entryUUID in schema
Removed:
directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/entry/ServerAttribute.java
directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/entry/client/ClientAttribute.java
Modified:
directory/apacheds/trunk/avl-partition/src/main/java/org/apache/directory/server/core/partition/avl/AvlStore.java
directory/apacheds/trunk/avl-partition/src/test/java/org/apache/directory/server/core/partition/avl/AvlStoreTest.java
directory/apacheds/trunk/core-api/src/main/java/org/apache/directory/server/core/schema/registries/synchronizers/SchemaSynchronizer.java
directory/apacheds/trunk/core-entry/src/main/java/org/apache/directory/server/core/entry/ClonedServerEntry.java
directory/apacheds/trunk/core-entry/src/main/java/org/apache/directory/server/core/entry/ServerEntryUtils.java
directory/apacheds/trunk/core-entry/src/test/java/org/apache/directory/server/core/entry/DefaultServerAttributeTest.java
directory/apacheds/trunk/core-entry/src/test/java/org/apache/directory/server/core/entry/DefaultServerEntryTest.java
directory/apacheds/trunk/core-entry/src/test/java/org/apache/directory/server/core/entry/ServerModificationTest.java
directory/apacheds/trunk/core-integ/src/test/java/org/apache/directory/server/core/jndi/referral/ModifyReferralIT.java
directory/apacheds/trunk/core-jndi/src/main/java/org/apache/directory/server/core/jndi/JavaLdapSupport.java
directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/authz/AciAuthorizationInterceptor.java
directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/authz/GroupCache.java
directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/authz/TupleCache.java
directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/changelog/ChangeLogInterceptor.java
directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/collective/CollectiveAttributesSchemaChecker.java
directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/exception/ExceptionInterceptor.java
directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/journal/JournalInterceptor.java
directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/operational/OperationalAttributeInterceptor.java
directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/prefs/ServerSystemPreferences.java
directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/schema/DefaultSchemaService.java
directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/schema/SchemaChecker.java
directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/schema/SchemaInterceptor.java
directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/schema/SchemaSubentryManager.java
directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/subtree/RefinementEvaluator.java
directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/subtree/RefinementLeafEvaluator.java
directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/subtree/SubentryInterceptor.java
directory/apacheds/trunk/core/src/test/java/org/apache/directory/server/core/authz/support/RelatedProtectedItemFilterTest.java
directory/apacheds/trunk/core/src/test/java/org/apache/directory/server/core/schema/SchemaCheckerTest.java
directory/apacheds/trunk/core/src/test/java/org/apache/directory/server/core/subtree/RefinementEvaluatorTest.java
directory/apacheds/trunk/core/src/test/java/org/apache/directory/server/core/subtree/RefinementLeafEvaluatorTest.java
directory/apacheds/trunk/interceptor-kerberos/src/main/java/org/apache/directory/server/core/kerberos/KeyDerivationInterceptor.java
directory/apacheds/trunk/interceptor-kerberos/src/main/java/org/apache/directory/server/core/kerberos/PasswordPolicyInterceptor.java
directory/apacheds/trunk/jdbm-store/src/main/java/org/apache/directory/server/core/partition/impl/btree/jdbm/JdbmStore.java
directory/apacheds/trunk/jdbm-store/src/test/java/org/apache/directory/server/core/partition/impl/btree/jdbm/JdbmStoreTest.java
directory/apacheds/trunk/kerberos-shared/src/main/java/org/apache/directory/server/kerberos/shared/store/operations/ChangePassword.java
directory/apacheds/trunk/protocol-ldap/src/main/java/org/apache/directory/server/ldap/handlers/ReferralAwareRequestHandler.java
directory/apacheds/trunk/xdbm-search/src/main/java/org/apache/directory/server/xdbm/search/impl/ApproximateEvaluator.java
directory/apacheds/trunk/xdbm-search/src/main/java/org/apache/directory/server/xdbm/search/impl/EqualityEvaluator.java
directory/apacheds/trunk/xdbm-search/src/main/java/org/apache/directory/server/xdbm/search/impl/GreaterEqEvaluator.java
directory/apacheds/trunk/xdbm-search/src/main/java/org/apache/directory/server/xdbm/search/impl/LessEqEvaluator.java
directory/apacheds/trunk/xdbm-search/src/main/java/org/apache/directory/server/xdbm/search/impl/PresenceEvaluator.java
directory/apacheds/trunk/xdbm-search/src/main/java/org/apache/directory/server/xdbm/search/impl/SubstringEvaluator.java
directory/shared/trunk/ldap-ldif/src/main/java/org/apache/directory/shared/ldap/ldif/LdifEntry.java
directory/shared/trunk/ldap-ldif/src/main/java/org/apache/directory/shared/ldap/ldif/LdifUtils.java
directory/shared/trunk/ldap-schema/src/main/resources/schema/ou=schema/cn=java/ou=objectclasses/m-oid=1.3.6.1.4.1.42.2.27.4.2.7.ldif
directory/shared/trunk/ldap-schema/src/main/resources/schema/ou=schema/cn=java/ou=objectclasses/m-oid=1.3.6.1.4.1.42.2.27.4.2.8.ldif
directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/entry/DefaultServerAttribute.java
directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/entry/DefaultServerEntry.java
directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/entry/EntryAttribute.java
directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/entry/ServerModification.java
directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/entry/client/ClientModification.java
directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/entry/client/DefaultClientAttribute.java
directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/entry/client/DefaultClientEntry.java
directory/shared/trunk/ldap/src/test/java/org/apache/directory/shared/ldap/entry/client/ClientModificationTest.java
directory/shared/trunk/ldap/src/test/java/org/apache/directory/shared/ldap/entry/client/DefaultClientAttributeTest.java
Modified: directory/apacheds/trunk/avl-partition/src/main/java/org/apache/directory/server/core/partition/avl/AvlStore.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/avl-partition/src/main/java/org/apache/directory/server/core/partition/avl/AvlStore.java?rev=927839&r1=927838&r2=927839&view=diff
==============================================================================
--- directory/apacheds/trunk/avl-partition/src/main/java/org/apache/directory/server/core/partition/avl/AvlStore.java (original)
+++ directory/apacheds/trunk/avl-partition/src/main/java/org/apache/directory/server/core/partition/avl/AvlStore.java Fri Mar 26 13:25:10 2010
@@ -43,7 +43,6 @@ import org.apache.directory.shared.ldap.
import org.apache.directory.shared.ldap.entry.EntryAttribute;
import org.apache.directory.shared.ldap.entry.Modification;
import org.apache.directory.shared.ldap.entry.ModificationOperation;
-import org.apache.directory.shared.ldap.entry.ServerAttribute;
import org.apache.directory.shared.ldap.entry.ServerEntry;
import org.apache.directory.shared.ldap.entry.ServerStringValue;
import org.apache.directory.shared.ldap.entry.Value;
@@ -250,7 +249,7 @@ public class AvlStore<E> implements Stor
// Now work on the user defined userIndices
for ( EntryAttribute attribute : entry )
{
- String attributeOid = ( ( ServerAttribute ) attribute ).getAttributeType().getOid();
+ String attributeOid = attribute.getAttributeType().getOid();
if ( hasUserIndexOn( attributeOid ) )
{
@@ -338,7 +337,7 @@ public class AvlStore<E> implements Stor
for ( EntryAttribute attribute : entry )
{
- String attributeOid = ( ( ServerAttribute ) attribute ).getAttributeType().getOid();
+ String attributeOid = attribute.getAttributeType().getOid();
if ( hasUserIndexOn( attributeOid ) )
{
@@ -1272,7 +1271,7 @@ public class AvlStore<E> implements Stor
for ( Modification mod : mods )
{
- ServerAttribute attrMods = ( ServerAttribute ) mod.getAttribute();
+ EntryAttribute attrMods = mod.getAttribute();
switch ( mod.getOperation() )
{
Modified: directory/apacheds/trunk/avl-partition/src/test/java/org/apache/directory/server/core/partition/avl/AvlStoreTest.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/avl-partition/src/test/java/org/apache/directory/server/core/partition/avl/AvlStoreTest.java?rev=927839&r1=927838&r2=927839&view=diff
==============================================================================
--- directory/apacheds/trunk/avl-partition/src/test/java/org/apache/directory/server/core/partition/avl/AvlStoreTest.java (original)
+++ directory/apacheds/trunk/avl-partition/src/test/java/org/apache/directory/server/core/partition/avl/AvlStoreTest.java Fri Mar 26 13:25:10 2010
@@ -49,9 +49,9 @@ import org.apache.directory.shared.ldap.
import org.apache.directory.shared.ldap.cursor.Cursor;
import org.apache.directory.shared.ldap.entry.DefaultServerAttribute;
import org.apache.directory.shared.ldap.entry.DefaultServerEntry;
+import org.apache.directory.shared.ldap.entry.EntryAttribute;
import org.apache.directory.shared.ldap.entry.Modification;
import org.apache.directory.shared.ldap.entry.ModificationOperation;
-import org.apache.directory.shared.ldap.entry.ServerAttribute;
import org.apache.directory.shared.ldap.entry.ServerEntry;
import org.apache.directory.shared.ldap.entry.ServerModification;
import org.apache.directory.shared.ldap.exception.LdapNoSuchObjectException;
@@ -604,7 +604,7 @@ public class AvlStoreTest
dn.normalize( schemaManager.getNormalizerMapping() );
List<Modification> mods = new ArrayList<Modification>();
- ServerAttribute attrib = new DefaultServerAttribute( SchemaConstants.OU_AT, schemaManager
+ EntryAttribute attrib = new DefaultServerAttribute( SchemaConstants.OU_AT, schemaManager
.lookupAttributeTypeRegistry( SchemaConstants.OU_AT_OID ) );
attrib.add( "Engineering" );
@@ -706,7 +706,7 @@ public class AvlStoreTest
dn.normalize( schemaManager.getNormalizerMapping() );
List<Modification> mods = new ArrayList<Modification>();
- ServerAttribute attrib = new DefaultServerAttribute( SchemaConstants.SURNAME_AT, schemaManager
+ EntryAttribute attrib = new DefaultServerAttribute( SchemaConstants.SURNAME_AT, schemaManager
.lookupAttributeTypeRegistry( SchemaConstants.SURNAME_AT ) );
String attribVal = "Walker";
@@ -738,7 +738,7 @@ public class AvlStoreTest
dn.normalize( schemaManager.getNormalizerMapping() );
List<Modification> mods = new ArrayList<Modification>();
- ServerAttribute attrib = new DefaultServerAttribute( SchemaConstants.SN_AT, schemaManager
+ EntryAttribute attrib = new DefaultServerAttribute( SchemaConstants.SN_AT, schemaManager
.lookupAttributeTypeRegistry( SchemaConstants.SN_AT_OID ) );
String attribVal = "Johnny";
@@ -771,7 +771,7 @@ public class AvlStoreTest
dn.normalize( schemaManager.getNormalizerMapping() );
List<Modification> mods = new ArrayList<Modification>();
- ServerAttribute attrib = new DefaultServerAttribute( SchemaConstants.SN_AT, schemaManager
+ EntryAttribute attrib = new DefaultServerAttribute( SchemaConstants.SN_AT, schemaManager
.lookupAttributeTypeRegistry( SchemaConstants.SN_AT_OID ) );
Modification add = new ServerModification( ModificationOperation.REMOVE_ATTRIBUTE, attrib );
@@ -811,7 +811,7 @@ public class AvlStoreTest
store.add( entry );
List<Modification> mods = new ArrayList<Modification>();
- ServerAttribute attrib = new DefaultServerAttribute( SchemaConstants.OU_AT, schemaManager
+ EntryAttribute attrib = new DefaultServerAttribute( SchemaConstants.OU_AT, schemaManager
.lookupAttributeTypeRegistry( SchemaConstants.OU_AT_OID ) );
String attribVal = "Marketing";
Modified: directory/apacheds/trunk/core-api/src/main/java/org/apache/directory/server/core/schema/registries/synchronizers/SchemaSynchronizer.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/core-api/src/main/java/org/apache/directory/server/core/schema/registries/synchronizers/SchemaSynchronizer.java?rev=927839&r1=927838&r2=927839&view=diff
==============================================================================
--- directory/apacheds/trunk/core-api/src/main/java/org/apache/directory/server/core/schema/registries/synchronizers/SchemaSynchronizer.java (original)
+++ directory/apacheds/trunk/core-api/src/main/java/org/apache/directory/server/core/schema/registries/synchronizers/SchemaSynchronizer.java Fri Mar 26 13:25:10 2010
@@ -38,7 +38,6 @@ import org.apache.directory.shared.ldap.
import org.apache.directory.shared.ldap.entry.EntryAttribute;
import org.apache.directory.shared.ldap.entry.Modification;
import org.apache.directory.shared.ldap.entry.ModificationOperation;
-import org.apache.directory.shared.ldap.entry.ServerAttribute;
import org.apache.directory.shared.ldap.entry.ServerEntry;
import org.apache.directory.shared.ldap.entry.ServerModification;
import org.apache.directory.shared.ldap.entry.Value;
@@ -153,7 +152,7 @@ public class SchemaSynchronizer implemen
{
// We are trying to modify the m-disabled attribute.
ModificationOperation modification = disabledModification.getOperation();
- ServerAttribute attribute = (ServerAttribute)disabledModification.getAttribute();
+ EntryAttribute attribute = disabledModification.getAttribute();
hasModification = modifyDisable( opContext, modification, attribute, disabledInEntry );
}
Modified: directory/apacheds/trunk/core-entry/src/main/java/org/apache/directory/server/core/entry/ClonedServerEntry.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/core-entry/src/main/java/org/apache/directory/server/core/entry/ClonedServerEntry.java?rev=927839&r1=927838&r2=927839&view=diff
==============================================================================
--- directory/apacheds/trunk/core-entry/src/main/java/org/apache/directory/server/core/entry/ClonedServerEntry.java (original)
+++ directory/apacheds/trunk/core-entry/src/main/java/org/apache/directory/server/core/entry/ClonedServerEntry.java Fri Mar 26 13:25:10 2010
@@ -31,7 +31,6 @@ import java.util.Set;
import org.apache.directory.server.i18n.I18n;
import org.apache.directory.shared.ldap.entry.Entry;
import org.apache.directory.shared.ldap.entry.EntryAttribute;
-import org.apache.directory.shared.ldap.entry.ServerAttribute;
import org.apache.directory.shared.ldap.entry.ServerEntry;
import org.apache.directory.shared.ldap.entry.Value;
import org.apache.directory.shared.ldap.entry.client.DefaultClientEntry;
@@ -414,7 +413,7 @@ public class ClonedServerEntry implement
// Convert each attribute
for ( EntryAttribute clonedEntry:this )
{
- EntryAttribute clientAttribute = ((ServerAttribute)clonedEntry).toClientAttribute();
+ EntryAttribute clientAttribute = clonedEntry.toClientAttribute();
clientEntry.add( clientAttribute );
}
@@ -776,7 +775,7 @@ public class ClonedServerEntry implement
// Convert each attribute
for ( EntryAttribute serverAttribute:this )
{
- EntryAttribute clientAttribute = ((ServerAttribute)serverAttribute).toClientAttribute();
+ EntryAttribute clientAttribute = serverAttribute.toClientAttribute();
clientEntry.add( clientAttribute );
}
Modified: directory/apacheds/trunk/core-entry/src/main/java/org/apache/directory/server/core/entry/ServerEntryUtils.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/core-entry/src/main/java/org/apache/directory/server/core/entry/ServerEntryUtils.java?rev=927839&r1=927838&r2=927839&view=diff
==============================================================================
--- directory/apacheds/trunk/core-entry/src/main/java/org/apache/directory/server/core/entry/ServerEntryUtils.java (original)
+++ directory/apacheds/trunk/core-entry/src/main/java/org/apache/directory/server/core/entry/ServerEntryUtils.java Fri Mar 26 13:25:10 2010
@@ -42,7 +42,6 @@ import org.apache.directory.shared.ldap.
import org.apache.directory.shared.ldap.entry.EntryAttribute;
import org.apache.directory.shared.ldap.entry.Modification;
import org.apache.directory.shared.ldap.entry.ModificationOperation;
-import org.apache.directory.shared.ldap.entry.ServerAttribute;
import org.apache.directory.shared.ldap.entry.ServerEntry;
import org.apache.directory.shared.ldap.entry.ServerModification;
import org.apache.directory.shared.ldap.entry.Value;
@@ -70,7 +69,7 @@ public class ServerEntryUtils
*
* @return An instance of a AttributesImpl() object
*/
- public static Attribute toBasicAttribute( ServerAttribute entryAttribute )
+ public static Attribute toBasicAttribute( EntryAttribute entryAttribute )
{
AttributeType attributeType = entryAttribute.getAttributeType();
@@ -115,7 +114,7 @@ public class ServerEntryUtils
}
}
- attributes.put( toBasicAttribute( (ServerAttribute)attr ) );
+ attributes.put( toBasicAttribute( attr ) );
}
return attributes;
@@ -131,7 +130,7 @@ public class ServerEntryUtils
*
* @throws InvalidAttributeIdentifierException If we had an incorrect attribute
*/
- public static ServerAttribute toServerAttribute( Attribute attribute, AttributeType attributeType )
+ public static EntryAttribute toServerAttribute( Attribute attribute, AttributeType attributeType )
{
if ( attribute == null )
{
@@ -140,7 +139,7 @@ public class ServerEntryUtils
try
{
- ServerAttribute serverAttribute = new DefaultServerAttribute( attributeType );
+ EntryAttribute serverAttribute = new DefaultServerAttribute( attributeType );
for ( NamingEnumeration<?> values = attribute.getAll(); values.hasMoreElements(); )
{
@@ -220,7 +219,7 @@ public class ServerEntryUtils
Set<String> options = SchemaUtils.getOptions( attributeId );
// TODO : handle options.
AttributeType attributeType = schemaManager.lookupAttributeTypeRegistry( id );
- ServerAttribute serverAttribute = ServerEntryUtils.toServerAttribute( attr, attributeType );
+ EntryAttribute serverAttribute = ServerEntryUtils.toServerAttribute( attr, attributeType );
if ( serverAttribute != null )
{
@@ -261,11 +260,11 @@ public class ServerEntryUtils
switch ( modOp )
{
case REPLACE_ATTRIBUTE :
- targetEntry.put( (ServerAttribute)mod.getAttribute() );
+ targetEntry.put( mod.getAttribute() );
break;
case REMOVE_ATTRIBUTE :
- ServerAttribute toBeRemoved = (ServerAttribute)mod.getAttribute();
+ EntryAttribute toBeRemoved = mod.getAttribute();
if ( toBeRemoved.size() == 0 )
{
@@ -286,8 +285,8 @@ public class ServerEntryUtils
break;
case ADD_ATTRIBUTE :
- ServerAttribute combined = new DefaultServerAttribute( id, attributeType );
- ServerAttribute toBeAdded = (ServerAttribute)mod.getAttribute();
+ EntryAttribute combined = new DefaultServerAttribute( id, attributeType );
+ EntryAttribute toBeAdded = mod.getAttribute();
EntryAttribute existing = entry.get( id );
if ( existing != null )
@@ -327,7 +326,7 @@ public class ServerEntryUtils
* arguments
* @throws LdapException if there are problems accessing attribute values
*/
- public static ServerAttribute getUnion( ServerAttribute attr0, ServerAttribute attr1 )
+ public static EntryAttribute getUnion( EntryAttribute attr0, EntryAttribute attr1 )
{
if ( attr0 == null && attr1 == null )
{
@@ -335,18 +334,18 @@ public class ServerEntryUtils
}
else if ( attr0 == null )
{
- return (ServerAttribute)attr1.clone();
+ return attr1.clone();
}
else if ( attr1 == null )
{
- return (ServerAttribute)attr0.clone();
+ return attr0.clone();
}
else if ( !attr0.getAttributeType().equals( attr1.getAttributeType() ) )
{
throw new IllegalArgumentException( I18n.err( I18n.ERR_466 ) );
}
- ServerAttribute attr = (ServerAttribute)attr0.clone();
+ EntryAttribute attr = attr0.clone();
for ( Value<?> value:attr1 )
{
@@ -550,7 +549,7 @@ public class ServerEntryUtils
{
for ( Modification modification:mods )
{
- ServerAttribute attribute = (ServerAttribute)modification.getAttribute();
+ EntryAttribute attribute = modification.getAttribute();
if ( attribute.getAttributeType() == type )
{
@@ -569,13 +568,13 @@ public class ServerEntryUtils
* @param type the attributeType spec of the Attribute to extract
* @return the extract Attribute or null if no such attribute exists
*/
- public static ServerAttribute getAttribute( List<Modification> mods, AttributeType type )
+ public static EntryAttribute getAttribute( List<Modification> mods, AttributeType type )
{
Modification mod = getModificationItem( mods, type );
if ( mod != null )
{
- return (ServerAttribute)mod.getAttribute();
+ return mod.getAttribute();
}
return null;
Modified: directory/apacheds/trunk/core-entry/src/test/java/org/apache/directory/server/core/entry/DefaultServerAttributeTest.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/core-entry/src/test/java/org/apache/directory/server/core/entry/DefaultServerAttributeTest.java?rev=927839&r1=927838&r2=927839&view=diff
==============================================================================
--- directory/apacheds/trunk/core-entry/src/test/java/org/apache/directory/server/core/entry/DefaultServerAttributeTest.java (original)
+++ directory/apacheds/trunk/core-entry/src/test/java/org/apache/directory/server/core/entry/DefaultServerAttributeTest.java Fri Mar 26 13:25:10 2010
@@ -45,11 +45,9 @@ import javax.naming.directory.InvalidAtt
import org.apache.commons.io.FileUtils;
import org.apache.directory.shared.ldap.entry.DefaultServerAttribute;
import org.apache.directory.shared.ldap.entry.EntryAttribute;
-import org.apache.directory.shared.ldap.entry.ServerAttribute;
import org.apache.directory.shared.ldap.entry.ServerBinaryValue;
import org.apache.directory.shared.ldap.entry.ServerStringValue;
import org.apache.directory.shared.ldap.entry.Value;
-import org.apache.directory.shared.ldap.entry.client.ClientAttribute;
import org.apache.directory.shared.ldap.entry.client.ClientBinaryValue;
import org.apache.directory.shared.ldap.entry.client.ClientStringValue;
import org.apache.directory.shared.ldap.entry.client.DefaultClientAttribute;
@@ -365,17 +363,17 @@ public class DefaultServerAttributeTest
@Test
public void testGetBytes() throws LdapInvalidAttributeValueException
{
- ServerAttribute attr1 = new DefaultServerAttribute( atPwd );
+ EntryAttribute attr1 = new DefaultServerAttribute( atPwd );
attr1.add( (byte[])null );
assertNull( attr1.getBytes() );
- ServerAttribute attr2 = new DefaultServerAttribute( atPwd );
+ EntryAttribute attr2 = new DefaultServerAttribute( atPwd );
attr2.add( BYTES1, BYTES2 );
assertTrue( Arrays.equals( BYTES1, attr2.getBytes() ) );
- ServerAttribute attr3 = new DefaultServerAttribute( atCN );
+ EntryAttribute attr3 = new DefaultServerAttribute( atCN );
attr3.add( "a", "b" );
@@ -397,7 +395,7 @@ public class DefaultServerAttributeTest
@Test
public void testGetId()
{
- ServerAttribute attr = new DefaultServerAttribute( atCN );
+ EntryAttribute attr = new DefaultServerAttribute( atCN );
assertEquals( "cn", attr.getId() );
@@ -418,17 +416,17 @@ public class DefaultServerAttributeTest
@Test
public void testGetString() throws LdapInvalidAttributeValueException
{
- ServerAttribute attr1 = new DefaultServerAttribute( atCN );
+ EntryAttribute attr1 = new DefaultServerAttribute( atCN );
attr1.add( (String)null );
assertEquals( "", attr1.getString() );
- ServerAttribute attr2 = new DefaultServerAttribute( atCN );
+ EntryAttribute attr2 = new DefaultServerAttribute( atCN );
attr2.add( "a", "b" );
assertEquals( "a", attr2.getString() );
- ServerAttribute attr3 = new DefaultServerAttribute( atPwd );
+ EntryAttribute attr3 = new DefaultServerAttribute( atPwd );
attr3.add( BYTES1, BYTES2 );
@@ -450,7 +448,7 @@ public class DefaultServerAttributeTest
@Test
public void testGetUpId()
{
- ServerAttribute attr = new DefaultServerAttribute( atCN );
+ EntryAttribute attr = new DefaultServerAttribute( atCN );
assertNotNull( attr.getUpId() );
assertEquals( "cn", attr.getUpId() );
@@ -458,11 +456,11 @@ public class DefaultServerAttributeTest
attr.setUpId( "CN" );
assertEquals( "CN", attr.getUpId() );
- attr.setUpId( " Cn " );
- assertEquals( "Cn", attr.getUpId() );
+ attr.setUpId( " Cn " );
+ assertEquals( " Cn ", attr.getUpId() );
- attr.setUpId( " 2.5.4.3 " );
- assertEquals( "2.5.4.3", attr.getUpId() );
+ attr.setUpId( " 2.5.4.3 " );
+ assertEquals( " 2.5.4.3 ", attr.getUpId() );
}
@@ -472,8 +470,8 @@ public class DefaultServerAttributeTest
@Test
public void testHashCode()
{
- ServerAttribute attr1 = new DefaultServerAttribute( atCN );
- ServerAttribute attr2 = new DefaultServerAttribute( atSN );
+ EntryAttribute attr1 = new DefaultServerAttribute( atCN );
+ EntryAttribute attr2 = new DefaultServerAttribute( atSN );
assertNotSame( attr1.hashCode(), attr2.hashCode() );
attr2.setAttributeType( atCN );
@@ -495,8 +493,8 @@ public class DefaultServerAttributeTest
attr2.put( "b", "a" );
assertNotSame( attr1.hashCode(), attr2.hashCode() );
- ServerAttribute attr3 = new DefaultServerAttribute( atPwd );
- ServerAttribute attr4 = new DefaultServerAttribute( atPwd );
+ EntryAttribute attr3 = new DefaultServerAttribute( atPwd );
+ EntryAttribute attr4 = new DefaultServerAttribute( atPwd );
assertNotSame( attr3.hashCode(), attr4.hashCode() );
attr3.put( (byte[])null );
@@ -523,7 +521,7 @@ public class DefaultServerAttributeTest
@Test
public void testSetId()
{
- ServerAttribute attr = new DefaultServerAttribute( atCN );
+ EntryAttribute attr = new DefaultServerAttribute( atCN );
attr.setId( "Cn" );
assertEquals( "cn", attr.getId() );
@@ -585,7 +583,7 @@ public class DefaultServerAttributeTest
@Test
public void testIsValid() throws Exception
{
- ServerAttribute attr = new DefaultServerAttribute( atCN );
+ EntryAttribute attr = new DefaultServerAttribute( atCN );
// No value, this should not be valid
assertFalse( attr.isValid() );
@@ -613,21 +611,21 @@ public class DefaultServerAttributeTest
@Test
public void testAddValueArray()
{
- ServerAttribute attr1 = new DefaultServerAttribute( atCN );
+ EntryAttribute attr1 = new DefaultServerAttribute( atCN );
int nbAdded = attr1.add( new ServerStringValue( atCN, null ) );
assertEquals( 1, nbAdded );
assertTrue( attr1.isHR() );
assertEquals( NULL_STRING_VALUE, attr1.get() );
- ServerAttribute attr2 = new DefaultServerAttribute( atPwd );
+ EntryAttribute attr2 = new DefaultServerAttribute( atPwd );
nbAdded = attr2.add( new ServerBinaryValue( atPwd, null ) );
assertEquals( 1, nbAdded );
assertFalse( attr2.isHR() );
assertEquals( NULL_BINARY_VALUE, attr2.get() );
- ServerAttribute attr3 = new DefaultServerAttribute( atCN );
+ EntryAttribute attr3 = new DefaultServerAttribute( atCN );
nbAdded = attr3.add( new ServerStringValue( atCN, "a" ), new ServerStringValue( atCN, "b" ) );
assertEquals( 2, nbAdded );
@@ -635,7 +633,7 @@ public class DefaultServerAttributeTest
assertTrue( attr3.contains( "a" ) );
assertTrue( attr3.contains( "b" ) );
- ServerAttribute attr4 = new DefaultServerAttribute( atCN );
+ EntryAttribute attr4 = new DefaultServerAttribute( atCN );
nbAdded = attr4.add( new ServerBinaryValue( atPwd, BYTES1 ), new ServerBinaryValue( atPwd, BYTES2 ) );
assertEquals( 0, nbAdded );
@@ -643,7 +641,7 @@ public class DefaultServerAttributeTest
assertFalse( attr4.contains( BYTES1 ) );
assertFalse( attr4.contains( BYTES2 ) );
- ServerAttribute attr5 = new DefaultServerAttribute( atCN );
+ EntryAttribute attr5 = new DefaultServerAttribute( atCN );
nbAdded = attr5.add( new ServerStringValue( atCN, "c" ), new ServerBinaryValue( atPwd, BYTES1 ) );
assertEquals( 1, nbAdded );
@@ -651,7 +649,7 @@ public class DefaultServerAttributeTest
assertFalse( attr5.contains( "ab" ) );
assertTrue( attr5.contains( "c" ) );
- ServerAttribute attr6 = new DefaultServerAttribute( atPwd );
+ EntryAttribute attr6 = new DefaultServerAttribute( atPwd );
nbAdded = attr6.add( new ServerBinaryValue( atPwd, BYTES1 ), new ServerStringValue( atCN, "c" ) );
assertEquals( 1, nbAdded );
@@ -659,7 +657,7 @@ public class DefaultServerAttributeTest
assertTrue( attr6.contains( BYTES1 ) );
assertFalse( attr6.contains( BYTES3 ) );
- ServerAttribute attr7 = new DefaultServerAttribute( atPwd );
+ EntryAttribute attr7 = new DefaultServerAttribute( atPwd );
nbAdded = attr7.add( new ServerBinaryValue( atPwd, null ), new ServerStringValue( atCN, "c" ) );
assertEquals( 1, nbAdded );
@@ -667,7 +665,7 @@ public class DefaultServerAttributeTest
assertTrue( attr7.contains( NULL_BINARY_VALUE ) );
assertFalse( attr7.contains( BYTES3 ) );
- ServerAttribute attr8 = new DefaultServerAttribute( atCN );
+ EntryAttribute attr8 = new DefaultServerAttribute( atCN );
nbAdded = attr8.add( new ServerStringValue( atCN, null ), new ServerBinaryValue( atPwd, BYTES1 ) );
assertEquals( 1, nbAdded );
@@ -676,7 +674,7 @@ public class DefaultServerAttributeTest
assertFalse( attr8.contains( "ab" ) );
- ServerAttribute attr9 = new DefaultServerAttribute( atCN );
+ EntryAttribute attr9 = new DefaultServerAttribute( atCN );
nbAdded = attr9.add( new ClientStringValue( null ), new ClientStringValue( "ab" ) );
assertEquals( 2, nbAdded );
@@ -684,7 +682,7 @@ public class DefaultServerAttributeTest
assertTrue( attr9.contains( NULL_STRING_VALUE ) );
assertTrue( attr9.contains( "ab" ) );
- ServerAttribute attr10 = new DefaultServerAttribute( atPwd );
+ EntryAttribute attr10 = new DefaultServerAttribute( atPwd );
nbAdded = attr10.add( new ClientBinaryValue( null ), new ClientBinaryValue( BYTES1 ) );
assertEquals( 2, nbAdded );
@@ -700,28 +698,28 @@ public class DefaultServerAttributeTest
@Test
public void testAddStringArray() throws LdapInvalidAttributeValueException
{
- ServerAttribute attr1 = new DefaultServerAttribute( atCN );
+ EntryAttribute attr1 = new DefaultServerAttribute( atCN );
int nbAdded = attr1.add( (String)null );
assertEquals( 1, nbAdded );
assertTrue( attr1.isHR() );
assertEquals( NULL_STRING_VALUE, attr1.get() );
- ServerAttribute attr2 = new DefaultServerAttribute( atCN );
+ EntryAttribute attr2 = new DefaultServerAttribute( atCN );
nbAdded = attr2.add( "" );
assertEquals( 1, nbAdded );
assertTrue( attr2.isHR() );
assertEquals( "", attr2.getString() );
- ServerAttribute attr3 = new DefaultServerAttribute( atCN );
+ EntryAttribute attr3 = new DefaultServerAttribute( atCN );
nbAdded = attr3.add( "t" );
assertEquals( 1, nbAdded );
assertTrue( attr3.isHR() );
assertEquals( "t", attr3.getString() );
- ServerAttribute attr4 = new DefaultServerAttribute( atCN );
+ EntryAttribute attr4 = new DefaultServerAttribute( atCN );
nbAdded = attr4.add( "a", "b", "c", "d" );
assertEquals( 4, nbAdded );
@@ -753,7 +751,7 @@ public class DefaultServerAttributeTest
assertTrue( attr4.contains( "e" ) );
assertFalse( attr4.contains( "ab" ) );
- ServerAttribute attr5 = new DefaultServerAttribute( atCN );
+ EntryAttribute attr5 = new DefaultServerAttribute( atCN );
nbAdded = attr5.add( "a", "b", (String)null, "d" );
assertEquals( 4, nbAdded );
@@ -763,7 +761,7 @@ public class DefaultServerAttributeTest
assertTrue( attr5.contains( NULL_STRING_VALUE ) );
assertTrue( attr5.contains( "d" ) );
- ServerAttribute attr6 = new DefaultServerAttribute( atPwd );
+ EntryAttribute attr6 = new DefaultServerAttribute( atPwd );
nbAdded = attr6.add( "a", (String)null );
assertEquals( 0, nbAdded );
@@ -777,28 +775,28 @@ public class DefaultServerAttributeTest
@Test
public void testAddByteArray() throws LdapInvalidAttributeValueException
{
- ServerAttribute attr1 = new DefaultServerAttribute( atPwd );
+ EntryAttribute attr1 = new DefaultServerAttribute( atPwd );
int nbAdded = attr1.add( (byte[])null );
assertEquals( 1, nbAdded );
assertFalse( attr1.isHR() );
assertTrue( Arrays.equals( NULL_BINARY_VALUE.getBytes(), attr1.getBytes() ) );
- ServerAttribute attr2 = new DefaultServerAttribute( atPwd );
+ EntryAttribute attr2 = new DefaultServerAttribute( atPwd );
nbAdded = attr2.add( StringTools.EMPTY_BYTES );
assertEquals( 1, nbAdded );
assertFalse( attr2.isHR() );
assertTrue( Arrays.equals( StringTools.EMPTY_BYTES, attr2.getBytes() ) );
- ServerAttribute attr3 = new DefaultServerAttribute( atPwd );
+ EntryAttribute attr3 = new DefaultServerAttribute( atPwd );
nbAdded = attr3.add( BYTES1 );
assertEquals( 1, nbAdded );
assertFalse( attr3.isHR() );
assertTrue( Arrays.equals( BYTES1, attr3.getBytes() ) );
- ServerAttribute attr4 = new DefaultServerAttribute( atPwd );
+ EntryAttribute attr4 = new DefaultServerAttribute( atPwd );
nbAdded = attr4.add( BYTES1, BYTES2, BYTES3, BYTES4 );
assertEquals( 4, nbAdded );
@@ -808,7 +806,7 @@ public class DefaultServerAttributeTest
assertTrue( attr4.contains( BYTES3 ) );
assertTrue( attr4.contains( BYTES4 ) );
- ServerAttribute attr5 = new DefaultServerAttribute( atPwd );
+ EntryAttribute attr5 = new DefaultServerAttribute( atPwd );
nbAdded = attr5.add( BYTES1, BYTES2, (byte[])null, BYTES3 );
assertEquals( 4, nbAdded );
@@ -818,7 +816,7 @@ public class DefaultServerAttributeTest
assertTrue( attr5.contains( (byte[])null ) );
assertTrue( attr5.contains( BYTES3 ) );
- ServerAttribute attr6 = new DefaultServerAttribute( atPwd );
+ EntryAttribute attr6 = new DefaultServerAttribute( atPwd );
nbAdded = attr6.add( "ab", (String)null );
assertEquals( 0, nbAdded );
@@ -832,7 +830,7 @@ public class DefaultServerAttributeTest
@Test
public void testClear()
{
- ServerAttribute attr = new DefaultServerAttribute( "cn", atCN );
+ EntryAttribute attr = new DefaultServerAttribute( "cn", atCN );
assertEquals( 0, attr.size() );
@@ -852,7 +850,7 @@ public class DefaultServerAttributeTest
@Test
public void testContainsValueArray()
{
- ServerAttribute attr1 = new DefaultServerAttribute( atCN );
+ EntryAttribute attr1 = new DefaultServerAttribute( atCN );
assertEquals( 0, attr1.size() );
assertFalse( attr1.contains( STR_VALUE1 ) );
@@ -875,7 +873,7 @@ public class DefaultServerAttributeTest
assertFalse( attr1.contains( STR_VALUE4 ) );
assertFalse( attr1.contains( NULL_STRING_VALUE ) );
- ServerAttribute attr2 = new DefaultServerAttribute( atPwd );
+ EntryAttribute attr2 = new DefaultServerAttribute( atPwd );
assertEquals( 0, attr2.size() );
assertFalse( attr2.contains( BYTES1 ) );
assertFalse( attr2.contains( NULL_BINARY_VALUE ) );
@@ -903,7 +901,7 @@ public class DefaultServerAttributeTest
@Test
public void testContainsStringArray()
{
- ServerAttribute attr1 = new DefaultServerAttribute( atCN );
+ EntryAttribute attr1 = new DefaultServerAttribute( atCN );
assertEquals( 0, attr1.size() );
assertFalse( attr1.contains( "a" ) );
@@ -933,7 +931,7 @@ public class DefaultServerAttributeTest
@Test
public void testContainsByteArray()
{
- ServerAttribute attr1 = new DefaultServerAttribute( atPwd );
+ EntryAttribute attr1 = new DefaultServerAttribute( atPwd );
assertEquals( 0, attr1.size() );
assertFalse( attr1.contains( BYTES1 ) );
@@ -963,11 +961,11 @@ public class DefaultServerAttributeTest
@Test
public void testEquals()
{
- ServerAttribute attr1 = new DefaultServerAttribute( atCN );
+ EntryAttribute attr1 = new DefaultServerAttribute( atCN );
assertFalse( attr1.equals( null ) );
- ServerAttribute attr2 = new DefaultServerAttribute( atCN );
+ EntryAttribute attr2 = new DefaultServerAttribute( atCN );
assertTrue( attr1.equals( attr2 ) );
@@ -988,30 +986,30 @@ public class DefaultServerAttributeTest
attr2.setHR( false );
assertTrue( attr1.equals( attr2 ) );
- ServerAttribute attr3 = new DefaultServerAttribute( atPwd );
- ServerAttribute attr4 = new DefaultServerAttribute( atPwd );
+ EntryAttribute attr3 = new DefaultServerAttribute( atPwd );
+ EntryAttribute attr4 = new DefaultServerAttribute( atPwd );
attr3.put( NULL_BINARY_VALUE );
attr4.put( NULL_BINARY_VALUE );
assertTrue( attr3.equals( attr4 ) );
- ServerAttribute attr5 = new DefaultServerAttribute( atPwd );
- ServerAttribute attr6 = new DefaultServerAttribute( atCN );
+ EntryAttribute attr5 = new DefaultServerAttribute( atPwd );
+ EntryAttribute attr6 = new DefaultServerAttribute( atCN );
assertFalse( attr5.equals( attr6 ) );
attr5.put( NULL_BINARY_VALUE );
attr6.put( NULL_STRING_VALUE );
assertFalse( attr5.equals( attr6 ) );
- ServerAttribute attr7 = new DefaultServerAttribute( atCN );
- ServerAttribute attr8 = new DefaultServerAttribute( atPwd );
+ EntryAttribute attr7 = new DefaultServerAttribute( atCN );
+ EntryAttribute attr8 = new DefaultServerAttribute( atPwd );
attr7.put( "a" );
attr8.put( BYTES2 );
assertFalse( attr7.equals( attr8 ) );
- ServerAttribute attr9 = new DefaultServerAttribute( atCN );
- ServerAttribute attr10 = new DefaultServerAttribute( atPwd );
+ EntryAttribute attr9 = new DefaultServerAttribute( atCN );
+ EntryAttribute attr10 = new DefaultServerAttribute( atPwd );
attr7.put( "a" );
attr7.add( BYTES2 );
@@ -1026,12 +1024,12 @@ public class DefaultServerAttributeTest
@Test
public void testGet()
{
- ServerAttribute attr1 = new DefaultServerAttribute( "cn", atCN );
+ EntryAttribute attr1 = new DefaultServerAttribute( "cn", atCN );
attr1.add( (String)null );
assertEquals( NULL_STRING_VALUE,attr1.get() );
- ServerAttribute attr2 = new DefaultServerAttribute( "cn", atCN );
+ EntryAttribute attr2 = new DefaultServerAttribute( "cn", atCN );
attr2.add( "a", "b", "c" );
assertEquals( "a", attr2.get().getString() );
@@ -1045,7 +1043,7 @@ public class DefaultServerAttributeTest
attr2.remove( "c" );
assertNull( attr2.get() );
- ServerAttribute attr3 = new DefaultServerAttribute( "userPassword", atPwd );
+ EntryAttribute attr3 = new DefaultServerAttribute( "userPassword", atPwd );
attr3.add( BYTES1, BYTES2, BYTES3 );
assertTrue( Arrays.equals( BYTES1, attr3.get().getBytes() ) );
@@ -1067,7 +1065,7 @@ public class DefaultServerAttributeTest
@Test
public void testGetAll()
{
- ServerAttribute attr = new DefaultServerAttribute( atCN );
+ EntryAttribute attr = new DefaultServerAttribute( atCN );
Iterator<Value<?>> iterator = attr.getAll();
assertFalse( iterator.hasNext() );
@@ -1099,14 +1097,14 @@ public class DefaultServerAttributeTest
@Test
public void testSize() throws Exception
{
- ServerAttribute attr1 = new DefaultServerAttribute( atCN );
+ EntryAttribute attr1 = new DefaultServerAttribute( atCN );
assertEquals( 0, attr1.size() );
attr1.add( (String)null );
assertEquals( 1, attr1.size() );
- ServerAttribute attr2 = new DefaultServerAttribute( atCN );
+ EntryAttribute attr2 = new DefaultServerAttribute( atCN );
attr2.add( "a", "b" );
assertEquals( 2, attr2.size() );
@@ -1114,7 +1112,7 @@ public class DefaultServerAttributeTest
attr2.clear();
assertEquals( 0, attr2.size() );
- ServerAttribute attr3 = new DefaultServerAttribute( atC );
+ EntryAttribute attr3 = new DefaultServerAttribute( atC );
attr3.add( "US" );
assertEquals( 1, attr3.size() );
@@ -1131,28 +1129,28 @@ public class DefaultServerAttributeTest
@Test
public void testPutByteArray() throws InvalidAttributeValueException, Exception
{
- ServerAttribute attr1 = new DefaultServerAttribute( atPwd );
+ EntryAttribute attr1 = new DefaultServerAttribute( atPwd );
int nbAdded = attr1.put( (byte[])null );
assertEquals( 1, nbAdded );
assertFalse( attr1.isHR() );
assertTrue( Arrays.equals( NULL_BINARY_VALUE.getBytes(), attr1.getBytes() ) );
- ServerAttribute attr2 = new DefaultServerAttribute( atPwd );
+ EntryAttribute attr2 = new DefaultServerAttribute( atPwd );
nbAdded = attr2.put( StringTools.EMPTY_BYTES );
assertEquals( 1, nbAdded );
assertFalse( attr2.isHR() );
assertTrue( Arrays.equals( StringTools.EMPTY_BYTES, attr2.getBytes() ) );
- ServerAttribute attr3 = new DefaultServerAttribute( atPwd );
+ EntryAttribute attr3 = new DefaultServerAttribute( atPwd );
nbAdded = attr3.put( BYTES1 );
assertEquals( 1, nbAdded );
assertFalse( attr3.isHR() );
assertTrue( Arrays.equals( BYTES1, attr3.getBytes() ) );
- ServerAttribute attr4 = new DefaultServerAttribute( atPwd );
+ EntryAttribute attr4 = new DefaultServerAttribute( atPwd );
nbAdded = attr4.put( BYTES1, BYTES2 );
assertEquals( 2, nbAdded );
@@ -1166,7 +1164,7 @@ public class DefaultServerAttributeTest
assertTrue( attr4.contains( BYTES3 ) );
assertTrue( attr4.contains( BYTES4 ) );
- ServerAttribute attr5 = new DefaultServerAttribute( atPwd );
+ EntryAttribute attr5 = new DefaultServerAttribute( atPwd );
nbAdded = attr5.put( BYTES1, BYTES2, (byte[])null, BYTES3 );
assertEquals( 4, nbAdded );
@@ -1176,7 +1174,7 @@ public class DefaultServerAttributeTest
assertTrue( attr5.contains( (byte[])null ) );
assertTrue( attr5.contains( BYTES3 ) );
- ServerAttribute attr6 = new DefaultServerAttribute( atPwd );
+ EntryAttribute attr6 = new DefaultServerAttribute( atPwd );
attr6.setHR( true );
assertFalse( attr6.isHR() );
@@ -1193,28 +1191,28 @@ public class DefaultServerAttributeTest
@Test
public void testPutStringArray() throws LdapInvalidAttributeValueException
{
- ServerAttribute attr1 = new DefaultServerAttribute( atCN );
+ EntryAttribute attr1 = new DefaultServerAttribute( atCN );
int nbAdded = attr1.put( (String)null );
assertEquals( 1, nbAdded );
assertTrue( attr1.isHR() );
assertEquals( NULL_STRING_VALUE, attr1.get() );
- ServerAttribute attr2 = new DefaultServerAttribute( atCN );
+ EntryAttribute attr2 = new DefaultServerAttribute( atCN );
nbAdded = attr2.put( "" );
assertEquals( 1, nbAdded );
assertTrue( attr2.isHR() );
assertEquals( "", attr2.getString() );
- ServerAttribute attr3 = new DefaultServerAttribute( atCN );
+ EntryAttribute attr3 = new DefaultServerAttribute( atCN );
nbAdded = attr3.put( "t" );
assertEquals( 1, nbAdded );
assertTrue( attr3.isHR() );
assertEquals( "t", attr3.getString() );
- ServerAttribute attr4 = new DefaultServerAttribute( atCN );
+ EntryAttribute attr4 = new DefaultServerAttribute( atCN );
nbAdded = attr4.put( "a", "b", "c", "d" );
assertEquals( 4, nbAdded );
@@ -1239,7 +1237,7 @@ public class DefaultServerAttributeTest
assertEquals( 0, nbAdded );
assertTrue( attr4.isHR() );
- ServerAttribute attr5 = new DefaultServerAttribute( atCN );
+ EntryAttribute attr5 = new DefaultServerAttribute( atCN );
nbAdded = attr5.put( "a", "b", (String)null, "d" );
assertEquals( 4, nbAdded );
@@ -1249,7 +1247,7 @@ public class DefaultServerAttributeTest
assertTrue( attr5.contains( NULL_STRING_VALUE ) );
assertTrue( attr5.contains( "d" ) );
- ServerAttribute attr6 = new DefaultServerAttribute( atPwd );
+ EntryAttribute attr6 = new DefaultServerAttribute( atPwd );
nbAdded = attr6.put( "a", (String)null );
assertEquals( 0, nbAdded );
@@ -1263,7 +1261,7 @@ public class DefaultServerAttributeTest
@Test
public void testPutValueArray() throws Exception
{
- ServerAttribute attr1 = new DefaultServerAttribute( atCN );
+ EntryAttribute attr1 = new DefaultServerAttribute( atCN );
assertEquals( 0, attr1.size() );
@@ -1290,7 +1288,7 @@ public class DefaultServerAttributeTest
assertFalse( attr1.contains( STR_VALUE3 ) );
- ServerAttribute attr2 = new DefaultServerAttribute( atPwd );
+ EntryAttribute attr2 = new DefaultServerAttribute( atPwd );
assertEquals( 0, attr2.size() );
attr2.put( NULL_BINARY_VALUE );
@@ -1317,7 +1315,7 @@ public class DefaultServerAttributeTest
@Test
public void testPutListOfValues()
{
- ServerAttribute attr1 = new DefaultServerAttribute( atCN );
+ EntryAttribute attr1 = new DefaultServerAttribute( atCN );
assertEquals( 0, attr1.size() );
@@ -1359,7 +1357,7 @@ public class DefaultServerAttributeTest
assertFalse( attr1.contains( STR_VALUE3 ) );
- ServerAttribute attr2 = new DefaultServerAttribute( atPwd );
+ EntryAttribute attr2 = new DefaultServerAttribute( atPwd );
assertEquals( 0, attr2.size() );
list.clear();
@@ -1396,7 +1394,7 @@ public class DefaultServerAttributeTest
@Test
public void testRemoveValueArray() throws Exception
{
- ServerAttribute attr1 = new DefaultServerAttribute( atCN );
+ EntryAttribute attr1 = new DefaultServerAttribute( atCN );
assertFalse( attr1.remove( STR_VALUE1 ) );
@@ -1427,7 +1425,7 @@ public class DefaultServerAttributeTest
assertFalse( attr1.remove( NULL_STRING_VALUE, STR_VALUE1, BIN_VALUE3 ) );
assertEquals( 1, attr1.size() );
- ServerAttribute attr2 = new DefaultServerAttribute( atPwd );
+ EntryAttribute attr2 = new DefaultServerAttribute( atPwd );
assertFalse( attr2.remove( BIN_VALUE1 ) );
@@ -1466,7 +1464,7 @@ public class DefaultServerAttributeTest
@Test
public void testRemoveByteArray() throws Exception
{
- ServerAttribute attr1 = new DefaultServerAttribute( atPwd );
+ EntryAttribute attr1 = new DefaultServerAttribute( atPwd );
assertFalse( attr1.remove( BYTES1 ) );
@@ -1496,7 +1494,7 @@ public class DefaultServerAttributeTest
@Test
public void testRemoveStringArray() throws Exception
{
- ServerAttribute attr1 = new DefaultServerAttribute( atCN );
+ EntryAttribute attr1 = new DefaultServerAttribute( atCN );
assertFalse( attr1.remove( "a" ) );
@@ -1537,7 +1535,7 @@ public class DefaultServerAttributeTest
@Test
public void testIterator()
{
- ServerAttribute attr1 = new DefaultServerAttribute( atCN );
+ EntryAttribute attr1 = new DefaultServerAttribute( atCN );
attr1.add( "a", "b", "c" );
Iterator<Value<?>> iter = attr1.iterator();
@@ -1561,7 +1559,7 @@ public class DefaultServerAttributeTest
@Test
public void testToString()
{
- ServerAttribute attr = new DefaultServerAttribute( atCN );
+ EntryAttribute attr = new DefaultServerAttribute( atCN );
assertEquals( " cn: (null)\n", attr.toString() );
@@ -1582,7 +1580,7 @@ public class DefaultServerAttributeTest
@Test
public void testInstanceOf() throws Exception
{
- ServerAttribute attr = new DefaultServerAttribute( atCN );
+ EntryAttribute attr = new DefaultServerAttribute( atCN );
assertTrue( attr.instanceOf( "CommonName" ) );
assertTrue( attr.instanceOf( "2.5.4.3" ) );
@@ -1599,7 +1597,7 @@ public class DefaultServerAttributeTest
@Test
public void testSetUpIdStringAttributeType() throws Exception
{
- ServerAttribute attr = new DefaultServerAttribute( atSN );
+ EntryAttribute attr = new DefaultServerAttribute( atSN );
attr.setUpId( null, atCN );
assertEquals( "cn", attr.getId() );
@@ -1613,17 +1611,17 @@ public class DefaultServerAttributeTest
attr.setUpId( " CN ", atCN );
assertEquals( "cn", attr.getId() );
- assertEquals( "CN", attr.getUpId() );
+ assertEquals( " CN ", attr.getUpId() );
assertEquals( atCN, attr.getAttributeType() );
attr.setUpId( " CommonName ", atCN );
assertEquals( "commonname", attr.getId() );
- assertEquals( "CommonName", attr.getUpId() );
+ assertEquals( " CommonName ", attr.getUpId() );
assertEquals( atCN, attr.getAttributeType() );
attr.setUpId( " 2.5.4.3 ", atCN );
assertEquals( "2.5.4.3", attr.getId() );
- assertEquals( "2.5.4.3", attr.getUpId() );
+ assertEquals( " 2.5.4.3 ", attr.getUpId() );
assertEquals( atCN, attr.getAttributeType() );
// Check with wrong IDs
@@ -1655,7 +1653,7 @@ public class DefaultServerAttributeTest
@Test
public void testSetUpIdString() throws Exception
{
- ServerAttribute attr = new DefaultServerAttribute( atCN );
+ EntryAttribute attr = new DefaultServerAttribute( atCN );
attr.setUpId( "cn" );
assertEquals( "cn", attr.getId() );
@@ -1664,17 +1662,17 @@ public class DefaultServerAttributeTest
attr.setUpId( " CN " );
assertEquals( "cn", attr.getId() );
- assertEquals( "CN", attr.getUpId() );
+ assertEquals( " CN ", attr.getUpId() );
assertEquals( atCN, attr.getAttributeType() );
attr.setUpId( " CommonName ");
assertEquals( "commonname", attr.getId() );
- assertEquals( "CommonName", attr.getUpId() );
+ assertEquals( " CommonName ", attr.getUpId() );
assertEquals( atCN, attr.getAttributeType() );
attr.setUpId( " 2.5.4.3 " );
+ assertEquals( " 2.5.4.3 ", attr.getUpId() );
assertEquals( "2.5.4.3", attr.getId() );
- assertEquals( "2.5.4.3", attr.getUpId() );
assertEquals( atCN, attr.getAttributeType() );
// Now check wrong IDs
@@ -1707,7 +1705,7 @@ public class DefaultServerAttributeTest
@Test
public void testSetAttributeType() throws Exception
{
- ServerAttribute attr = new DefaultServerAttribute( atCN );
+ EntryAttribute attr = new DefaultServerAttribute( atCN );
try
{
@@ -1723,6 +1721,7 @@ public class DefaultServerAttributeTest
assertTrue( attr.instanceOf( "Surname" ) );
assertEquals( "sn", attr.getId() );
+ assertEquals( "sn", attr.getUpId() );
}
@@ -1732,7 +1731,7 @@ public class DefaultServerAttributeTest
@Test
public void testGetAttributeType() throws Exception
{
- ServerAttribute attr = new DefaultServerAttribute( atSN );
+ EntryAttribute attr = new DefaultServerAttribute( atSN );
assertEquals( atSN, attr.getAttributeType() );
}
@@ -1743,7 +1742,7 @@ public class DefaultServerAttributeTest
@Test
public void testDefaultServerAttributeAttributeType()
{
- ServerAttribute attr = new DefaultServerAttribute( atCN );
+ EntryAttribute attr = new DefaultServerAttribute( atCN );
assertTrue( attr.isHR() );
assertEquals( 0, attr.size() );
@@ -1759,7 +1758,7 @@ public class DefaultServerAttributeTest
@Test
public void testDefaultServerAttributeStringAttributeType()
{
- ServerAttribute attr1 = new DefaultServerAttribute( "cn", atCN );
+ EntryAttribute attr1 = new DefaultServerAttribute( "cn", atCN );
assertTrue( attr1.isHR() );
assertEquals( 0, attr1.size() );
@@ -1767,15 +1766,15 @@ public class DefaultServerAttributeTest
assertEquals( "cn", attr1.getUpId() );
assertEquals( atCN, attr1.getAttributeType() );
- ServerAttribute attr2 = new DefaultServerAttribute( " CommonName ", atCN );
+ EntryAttribute attr2 = new DefaultServerAttribute( " CommonName ", atCN );
assertTrue( attr2.isHR() );
assertEquals( 0, attr2.size() );
assertEquals( "commonname", attr2.getId() );
- assertEquals( "CommonName", attr2.getUpId() );
+ assertEquals( " CommonName ", attr2.getUpId() );
assertEquals( atCN, attr2.getAttributeType() );
- ServerAttribute attr3 = new DefaultServerAttribute( " ", atCN );
+ EntryAttribute attr3 = new DefaultServerAttribute( " ", atCN );
assertTrue( attr3.isHR() );
assertEquals( 0, attr3.size() );
@@ -1791,7 +1790,7 @@ public class DefaultServerAttributeTest
@Test
public void testDefaultServerAttributeAttributeTypeValueArray() throws Exception
{
- ServerAttribute attr1 = new DefaultServerAttribute( atCN, STR_VALUE1, STR_VALUE2, NULL_STRING_VALUE );
+ EntryAttribute attr1 = new DefaultServerAttribute( atCN, STR_VALUE1, STR_VALUE2, NULL_STRING_VALUE );
assertTrue( attr1.isHR() );
assertEquals( 3, attr1.size() );
@@ -1801,7 +1800,7 @@ public class DefaultServerAttributeTest
assertTrue( attr1.contains( "a", "b" ) );
assertTrue( attr1.contains( NULL_STRING_VALUE ) );
- ServerAttribute attr2 = new DefaultServerAttribute( atCN, STR_VALUE1, BIN_VALUE2, NULL_STRING_VALUE );
+ EntryAttribute attr2 = new DefaultServerAttribute( atCN, STR_VALUE1, BIN_VALUE2, NULL_STRING_VALUE );
assertTrue( attr2.isHR() );
assertEquals( 2, attr2.size() );
@@ -1819,7 +1818,7 @@ public class DefaultServerAttributeTest
@Test
public void testDefaultServerAttributeStringAttributeTypeValueArray()
{
- ServerAttribute attr1 = new DefaultServerAttribute( "cn", atCN, STR_VALUE1, STR_VALUE2, NULL_STRING_VALUE );
+ EntryAttribute attr1 = new DefaultServerAttribute( "cn", atCN, STR_VALUE1, STR_VALUE2, NULL_STRING_VALUE );
assertTrue( attr1.isHR() );
assertEquals( 3, attr1.size() );
@@ -1829,7 +1828,7 @@ public class DefaultServerAttributeTest
assertTrue( attr1.contains( "a", "b" ) );
assertTrue( attr1.contains( NULL_STRING_VALUE ) );
- ServerAttribute attr2 = new DefaultServerAttribute( atCN, STR_VALUE1, BIN_VALUE2, NULL_STRING_VALUE );
+ EntryAttribute attr2 = new DefaultServerAttribute( atCN, STR_VALUE1, BIN_VALUE2, NULL_STRING_VALUE );
assertTrue( attr2.isHR() );
assertEquals( 2, attr2.size() );
@@ -1839,7 +1838,7 @@ public class DefaultServerAttributeTest
assertTrue( attr2.contains( "a" ) );
assertTrue( attr2.contains( NULL_STRING_VALUE ) );
- ServerAttribute attr3 = new DefaultServerAttribute( "CommonName", atCN, STR_VALUE1, STR_VALUE2, NULL_STRING_VALUE );
+ EntryAttribute attr3 = new DefaultServerAttribute( "CommonName", atCN, STR_VALUE1, STR_VALUE2, NULL_STRING_VALUE );
assertTrue( attr3.isHR() );
assertEquals( 3, attr3.size() );
@@ -1849,12 +1848,12 @@ public class DefaultServerAttributeTest
assertTrue( attr3.contains( "a", "b" ) );
assertTrue( attr3.contains( NULL_STRING_VALUE ) );
- ServerAttribute attr4 = new DefaultServerAttribute( " 2.5.4.3 ", atCN, STR_VALUE1, STR_VALUE2, NULL_STRING_VALUE );
+ EntryAttribute attr4 = new DefaultServerAttribute( " 2.5.4.3 ", atCN, STR_VALUE1, STR_VALUE2, NULL_STRING_VALUE );
assertTrue( attr4.isHR() );
assertEquals( 3, attr4.size() );
assertEquals( "2.5.4.3", attr4.getId() );
- assertEquals( "2.5.4.3", attr4.getUpId() );
+ assertEquals( " 2.5.4.3 ", attr4.getUpId() );
assertEquals( atCN, attr4.getAttributeType() );
assertTrue( attr4.contains( "a", "b" ) );
assertTrue( attr4.contains( NULL_STRING_VALUE ) );
@@ -1867,7 +1866,7 @@ public class DefaultServerAttributeTest
@Test
public void testDefaultServerAttributeAttributeTypeStringArray()
{
- ServerAttribute attr1 = new DefaultServerAttribute( atCN, "a", "b", (String)null );
+ EntryAttribute attr1 = new DefaultServerAttribute( atCN, "a", "b", (String)null );
assertTrue( attr1.isHR() );
assertEquals( 3, attr1.size() );
@@ -1877,7 +1876,7 @@ public class DefaultServerAttributeTest
assertTrue( attr1.contains( "a", "b" ) );
assertTrue( attr1.contains( NULL_STRING_VALUE ) );
- ServerAttribute attr2 = new DefaultServerAttribute( atCN, STR_VALUE1, BIN_VALUE2, NULL_STRING_VALUE );
+ EntryAttribute attr2 = new DefaultServerAttribute( atCN, STR_VALUE1, BIN_VALUE2, NULL_STRING_VALUE );
assertTrue( attr2.isHR() );
assertEquals( 2, attr2.size() );
@@ -1895,7 +1894,7 @@ public class DefaultServerAttributeTest
@Test
public void testDefaultServerAttributeStringAttributeTypeStringArray()
{
- ServerAttribute attr1 = new DefaultServerAttribute( "cn", atCN, "a", "b", (String)null );
+ EntryAttribute attr1 = new DefaultServerAttribute( "cn", atCN, "a", "b", (String)null );
assertTrue( attr1.isHR() );
assertEquals( 3, attr1.size() );
@@ -1905,7 +1904,7 @@ public class DefaultServerAttributeTest
assertTrue( attr1.contains( "a", "b" ) );
assertTrue( attr1.contains( NULL_STRING_VALUE ) );
- ServerAttribute attr2 = new DefaultServerAttribute( "CommonName", atCN, "a", "b", (String)null );
+ EntryAttribute attr2 = new DefaultServerAttribute( "CommonName", atCN, "a", "b", (String)null );
assertTrue( attr2.isHR() );
assertEquals( 3, attr2.size() );
@@ -1915,12 +1914,12 @@ public class DefaultServerAttributeTest
assertTrue( attr2.contains( "a", "b" ) );
assertTrue( attr2.contains( NULL_STRING_VALUE ) );
- ServerAttribute attr3 = new DefaultServerAttribute( " 2.5.4.3 ", atCN, "a", "b", (String)null );
+ EntryAttribute attr3 = new DefaultServerAttribute( " 2.5.4.3 ", atCN, "a", "b", (String)null );
assertTrue( attr3.isHR() );
assertEquals( 3, attr3.size() );
assertEquals( "2.5.4.3", attr3.getId() );
- assertEquals( "2.5.4.3", attr3.getUpId() );
+ assertEquals( " 2.5.4.3 ", attr3.getUpId() );
assertEquals( atCN, attr3.getAttributeType() );
assertTrue( attr3.contains( "a", "b" ) );
assertTrue( attr3.contains( NULL_STRING_VALUE ) );
@@ -1933,21 +1932,21 @@ public class DefaultServerAttributeTest
@Test
public void testDefaultServerAttributeAttributeTypeByteArray()
{
- ServerAttribute attr1 = new DefaultServerAttribute( atPwd, BYTES1, BYTES2, (byte[])null );
+ EntryAttribute attr1 = new DefaultServerAttribute( atPwd, BYTES1, BYTES2, (byte[])null );
assertFalse( attr1.isHR() );
assertEquals( 3, attr1.size() );
- assertEquals( "userpassword", attr1.getId() );
+ assertEquals( "userPassword", attr1.getId() );
assertEquals( "userPassword", attr1.getUpId() );
assertEquals( atPwd, attr1.getAttributeType() );
assertTrue( attr1.contains( BYTES1, BYTES2 ) );
assertTrue( attr1.contains( NULL_BINARY_VALUE ) );
- ServerAttribute attr2 = new DefaultServerAttribute( atPwd, STR_VALUE1, BIN_VALUE2, NULL_BINARY_VALUE );
+ EntryAttribute attr2 = new DefaultServerAttribute( atPwd, STR_VALUE1, BIN_VALUE2, NULL_BINARY_VALUE );
assertFalse( attr2.isHR() );
assertEquals( 2, attr2.size() );
- assertEquals( "userpassword", attr2.getId() );
+ assertEquals( "userPassword", attr2.getId() );
assertEquals( "userPassword", attr2.getUpId() );
assertEquals( atPwd, attr2.getAttributeType() );
assertTrue( attr2.contains( BYTES2 ) );
@@ -1961,7 +1960,7 @@ public class DefaultServerAttributeTest
@Test
public void testDefaultServerAttributeStringAttributeTypeByteArray()
{
- ServerAttribute attr1 = new DefaultServerAttribute( "userPassword", atPwd, BYTES1, BYTES2, (byte[])null );
+ EntryAttribute attr1 = new DefaultServerAttribute( "userPassword", atPwd, BYTES1, BYTES2, (byte[])null );
assertFalse( attr1.isHR() );
assertEquals( 3, attr1.size() );
@@ -1971,7 +1970,7 @@ public class DefaultServerAttributeTest
assertTrue( attr1.contains( BYTES1, BYTES2 ) );
assertTrue( attr1.contains( NULL_BINARY_VALUE ) );
- ServerAttribute attr2 = new DefaultServerAttribute( "2.5.4.35", atPwd, STR_VALUE1, BIN_VALUE2, NULL_BINARY_VALUE );
+ EntryAttribute attr2 = new DefaultServerAttribute( "2.5.4.35", atPwd, STR_VALUE1, BIN_VALUE2, NULL_BINARY_VALUE );
assertFalse( attr2.isHR() );
assertEquals( 2, attr2.size() );
@@ -1989,7 +1988,7 @@ public class DefaultServerAttributeTest
@Test
public void testClone()
{
- ServerAttribute attr = new DefaultServerAttribute( atCN );
+ EntryAttribute attr = new DefaultServerAttribute( atCN );
EntryAttribute clone = attr.clone();
@@ -2010,7 +2009,7 @@ public class DefaultServerAttributeTest
/**
- * Test the copy constructor of a ServerAttribute
+ * Test the copy constructor of a EntryAttribute
*/
@Test
public void testCopyConstructorServerAttribute() throws LdapInvalidAttributeValueException
@@ -2041,7 +2040,7 @@ public class DefaultServerAttributeTest
EntryAttribute attribute = new DefaultClientAttribute( "commonName" );
attribute.put( "test" );
- ServerAttribute copy = new DefaultServerAttribute( atCN, attribute );
+ EntryAttribute copy = new DefaultServerAttribute( atCN, attribute );
assertEquals( atCN, copy.getAttributeType() );
assertEquals( "test", copy.getString() );
@@ -2058,12 +2057,11 @@ public class DefaultServerAttributeTest
@Test
public void testToClientAttribute()
{
- ServerAttribute attribute = new DefaultServerAttribute( atCN, "test", "test2" );
+ EntryAttribute attribute = new DefaultServerAttribute( atCN, "test", "test2" );
EntryAttribute clientAttribute = attribute.toClientAttribute();
- assertTrue( clientAttribute instanceof ClientAttribute );
- assertFalse( clientAttribute instanceof ServerAttribute );
+ assertTrue( clientAttribute instanceof EntryAttribute );
assertTrue( clientAttribute.contains( "test", "test2" ) );
assertEquals( "cn", clientAttribute.getId() );
Modified: directory/apacheds/trunk/core-entry/src/test/java/org/apache/directory/server/core/entry/DefaultServerEntryTest.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/core-entry/src/test/java/org/apache/directory/server/core/entry/DefaultServerEntryTest.java?rev=927839&r1=927838&r2=927839&view=diff
==============================================================================
--- directory/apacheds/trunk/core-entry/src/test/java/org/apache/directory/server/core/entry/DefaultServerEntryTest.java (original)
+++ directory/apacheds/trunk/core-entry/src/test/java/org/apache/directory/server/core/entry/DefaultServerEntryTest.java Fri Mar 26 13:25:10 2010
@@ -45,13 +45,11 @@ import org.apache.directory.shared.ldap.
import org.apache.directory.shared.ldap.entry.DefaultServerEntry;
import org.apache.directory.shared.ldap.entry.Entry;
import org.apache.directory.shared.ldap.entry.EntryAttribute;
-import org.apache.directory.shared.ldap.entry.ServerAttribute;
import org.apache.directory.shared.ldap.entry.ServerBinaryValue;
import org.apache.directory.shared.ldap.entry.ServerEntry;
import org.apache.directory.shared.ldap.entry.ServerStringValue;
import org.apache.directory.shared.ldap.entry.Value;
import org.apache.directory.shared.ldap.entry.client.ClientBinaryValue;
-import org.apache.directory.shared.ldap.entry.client.ClientEntry;
import org.apache.directory.shared.ldap.entry.client.ClientStringValue;
import org.apache.directory.shared.ldap.entry.client.DefaultClientEntry;
import org.apache.directory.shared.ldap.exception.LdapException;
@@ -209,7 +207,7 @@ public class DefaultServerEntryTest
assertEquals( 1, entry.size() );
assertTrue( entry.containsAttribute( atOC ) );
assertEquals( "objectclass", entry.get( atOC ).getId() );
- assertEquals( "OBJECTCLASS", entry.get( atOC ).getUpId() );
+ assertEquals( " OBJECTCLASS ", entry.get( atOC ).getUpId() );
}
@@ -225,10 +223,10 @@ public class DefaultServerEntryTest
assertEquals( 2, entry.size() );
assertTrue( entry.containsAttribute( "objectClass" ) );
assertEquals( "objectclass", entry.get( atOC ).getId() );
- assertEquals( "OBJECTCLASS", entry.get( atOC ).getUpId() );
+ assertEquals( " OBJECTCLASS ", entry.get( atOC ).getUpId() );
assertTrue( entry.containsAttribute( "2.5.4.3" ) );
assertEquals( "cn", entry.get( atCN ).getId() );
- assertEquals( "Cn", entry.get( atCN ).getUpId() );
+ assertEquals( " Cn ", entry.get( atCN ).getUpId() );
}
@@ -535,7 +533,7 @@ public class DefaultServerEntryTest
assertTrue( attribute.contains( BYTES1 ) );
assertTrue( attribute.contains( BYTES2 ) );
assertTrue( attribute.contains( (byte[])null ) );
- assertEquals( "UserPassword", attribute.getUpId() );
+ assertEquals( " UserPassword ", attribute.getUpId() );
assertEquals( "userpassword", attribute.getId() );
try
@@ -572,7 +570,7 @@ public class DefaultServerEntryTest
assertTrue( attribute.contains( "test1" ) );
assertTrue( attribute.contains( (String)null ) );
assertTrue( attribute.contains( "test2" ) );
- assertEquals( "CN", attribute.getUpId() );
+ assertEquals( " CN ", attribute.getUpId() );
assertEquals( "cn", attribute.getId() );
entry.clear();
@@ -1902,7 +1900,7 @@ public class DefaultServerEntryTest
{
EntryAttribute attribute = iterator.next();
- AttributeType attributeType = ((ServerAttribute)attribute).getAttributeType();
+ AttributeType attributeType = attribute.getAttributeType();
assertTrue( expectedIds.contains( attributeType ) );
expectedIds.remove( attributeType );
}
@@ -1939,7 +1937,7 @@ public class DefaultServerEntryTest
EntryAttribute replaced = entry.put( atPwd, BYTES1, BYTES2, BYTES1 );
assertNotNull( replaced );
- assertEquals( atPwd, ((ServerAttribute)replaced).getAttributeType() );
+ assertEquals( atPwd, replaced.getAttributeType() );
assertTrue( replaced.contains( (byte[])null ) );
assertEquals( 1, entry.size() );
assertTrue( entry.contains( atPwd, BYTES1, BYTES2 ) );
@@ -1980,7 +1978,7 @@ public class DefaultServerEntryTest
EntryAttribute replaced = entry.put( atCN, "test1", "test2", "test1" );
assertNotNull( replaced );
- assertEquals( atCN, ((ServerAttribute)replaced).getAttributeType() );
+ assertEquals( atCN, replaced.getAttributeType() );
assertTrue( replaced.contains( (String)null ) );
assertEquals( 1, entry.size() );
assertTrue( entry.contains( atCN, "test1", "test2" ) );
@@ -2028,7 +2026,7 @@ public class DefaultServerEntryTest
EntryAttribute replaced = entry.put( atCN, strValue1, strValue2, strValue1 );
assertNotNull( replaced );
- assertEquals( atCN, ((ServerAttribute)replaced).getAttributeType() );
+ assertEquals( atCN, replaced.getAttributeType() );
assertTrue( replaced.contains( (String)null ) );
assertEquals( 1, entry.size() );
assertTrue( entry.contains( atCN, strValue1, strValue2 ) );
@@ -2151,13 +2149,13 @@ public class DefaultServerEntryTest
EntryAttribute replaced = entry.put( "USERpassword ", atPwd, BYTES1, BYTES2, BYTES1 );
assertNotNull( replaced );
- assertEquals( atPwd, ((ServerAttribute)replaced).getAttributeType() );
+ assertEquals( atPwd, replaced.getAttributeType() );
assertTrue( replaced.contains( (byte[])null ) );
assertEquals( 1, entry.size() );
assertTrue( entry.contains( atPwd, BYTES1, BYTES2 ) );
assertFalse( entry.contains( atPwd, BYTES3 ) );
assertEquals( 2, entry.get( atPwd ).size() );
- assertEquals( "USERpassword", entry.get( atPwd ).getUpId() );
+ assertEquals( "USERpassword ", entry.get( atPwd ).getUpId() );
replaced = entry.put( "userpassword", atPwd, "test" );
assertNotNull( replaced );
@@ -2225,7 +2223,7 @@ public class DefaultServerEntryTest
EntryAttribute replaced = entry.put( "commonName", atCN, "test1", "test2", "test1" );
assertNotNull( replaced );
- assertEquals( atCN, ((ServerAttribute)replaced).getAttributeType() );
+ assertEquals( atCN, replaced.getAttributeType() );
assertEquals( "commonName", entry.get( atCN).getUpId() );
assertTrue( replaced.contains( (String)null ) );
assertEquals( 1, entry.size() );
@@ -2306,7 +2304,7 @@ public class DefaultServerEntryTest
EntryAttribute replaced = entry.put( "commonName", atCN, strValue1, strValue2, strValue1 );
assertNotNull( replaced );
- assertEquals( atCN, ((ServerAttribute)replaced).getAttributeType() );
+ assertEquals( atCN, replaced.getAttributeType() );
assertTrue( replaced.contains( (String)null ) );
assertEquals( 1, entry.size() );
assertTrue( entry.contains( atCN, strValue1, strValue2 ) );
@@ -2371,7 +2369,7 @@ public class DefaultServerEntryTest
replaced = entry.put( "UserPassword", BYTES1 );
assertNotNull( replaced );
- assertEquals( atPwd, ((ServerAttribute)replaced).getAttributeType() );
+ assertEquals( atPwd, replaced.getAttributeType() );
assertTrue( replaced.contains( (byte[] )null ) );
assertEquals( 1, entry.size() );
assertNotNull( entry.get( "userPassword" ) );
@@ -2554,7 +2552,7 @@ public class DefaultServerEntryTest
// first test a null SA addition. It should be allowed.
try
{
- entry.put( (ServerAttribute)null );
+ entry.put( (EntryAttribute)null );
fail();
}
catch ( IllegalArgumentException iae )
@@ -2567,16 +2565,16 @@ public class DefaultServerEntryTest
AttributeType atGN = schemaManager.lookupAttributeTypeRegistry( "givenname" );
AttributeType atStreet = schemaManager.lookupAttributeTypeRegistry( "2.5.4.9" );
- ServerAttribute sa = new DefaultServerAttribute( atL, "france" );
+ EntryAttribute sa = new DefaultServerAttribute( atL, "france" );
entry.put( sa );
assertEquals( 1, entry.size() );
assertNotNull( entry.get( "l" ) );
assertEquals( "france", entry.get( "l" ).get().getString() );
- ServerAttribute sb = new DefaultServerAttribute( atC, "countryTest" );
- ServerAttribute sc = new DefaultServerAttribute( atGN, "test" );
- ServerAttribute sd = new DefaultServerAttribute( atStreet, "testStreet" );
+ EntryAttribute sb = new DefaultServerAttribute( atC, "countryTest" );
+ EntryAttribute sc = new DefaultServerAttribute( atGN, "test" );
+ EntryAttribute sd = new DefaultServerAttribute( atStreet, "testStreet" );
entry.put( sb, sc, sd );
assertEquals( 4, entry.size() );
@@ -2605,7 +2603,7 @@ public class DefaultServerEntryTest
// test an ObjectClass replacement
AttributeType OBJECT_CLASS_AT = schemaManager.lookupAttributeTypeRegistry( SchemaConstants.OBJECT_CLASS_AT );
- ServerAttribute oc = new DefaultServerAttribute( "OBJECTCLASS", OBJECT_CLASS_AT, "person", "inetorgperson" );
+ EntryAttribute oc = new DefaultServerAttribute( "OBJECTCLASS", OBJECT_CLASS_AT, "person", "inetorgperson" );
List<EntryAttribute> oldOc = entry.put( oc );
assertNotNull( oldOc );
@@ -2616,7 +2614,7 @@ public class DefaultServerEntryTest
EntryAttribute newOc = entry.get( "objectClass" );
assertNotNull( newOc );
- assertEquals( OBJECT_CLASS_AT, ((ServerAttribute)newOc).getAttributeType() );
+ assertEquals( OBJECT_CLASS_AT, newOc.getAttributeType() );
assertEquals( 2, newOc.size() );
assertEquals( "OBJECTCLASS", newOc.getUpId() );
assertTrue( newOc.contains( "person", "inetOrgPerson" ) );
@@ -3565,8 +3563,8 @@ public class DefaultServerEntryTest
assertNull( result );
EntryAttribute sa = entry.get( "sn" );
assertNotNull( sa );
- assertEquals( atSN, ((ServerAttribute)sa).getAttributeType() );
- assertEquals( "sn", ((ServerAttribute)sa).getAttributeType().getName() );
+ assertEquals( atSN, sa.getAttributeType() );
+ assertEquals( "sn", sa.getAttributeType().getName() );
// Add two AT now
AttributeType atGN = schemaManager.lookupAttributeTypeRegistry( "givenname" );
@@ -3577,23 +3575,23 @@ public class DefaultServerEntryTest
sa = entry.get( "l" );
assertNotNull( sa );
- assertEquals( atL, ((ServerAttribute)sa).getAttributeType() );
- assertEquals( "l", ((ServerAttribute)sa).getAttributeType().getName() );
+ assertEquals( atL, sa.getAttributeType() );
+ assertEquals( "l", sa.getAttributeType().getName() );
sa = entry.get( "c" );
assertNotNull( sa );
- assertEquals( atC, ((ServerAttribute)sa).getAttributeType() );
- assertEquals( "c", ((ServerAttribute)sa).getAttributeType().getName() );
+ assertEquals( atC, sa.getAttributeType() );
+ assertEquals( "c", sa.getAttributeType().getName() );
sa = entry.get( "2.5.4.9" );
assertNotNull( sa );
- assertEquals( atStreet, ((ServerAttribute)sa).getAttributeType() );
- assertEquals( "street", ((ServerAttribute)sa).getAttributeType().getName() );
+ assertEquals( atStreet, sa.getAttributeType() );
+ assertEquals( "street", sa.getAttributeType().getName() );
sa = entry.get( "givenName" );
assertNotNull( sa );
- assertEquals( atGN, ((ServerAttribute)sa).getAttributeType() );
- assertEquals( "givenName", ((ServerAttribute)sa).getAttributeType().getName() );
+ assertEquals( atGN, sa.getAttributeType() );
+ assertEquals( "givenName", sa.getAttributeType().getName() );
// Now try to add existing ATs
// First, set some value to the modified AT
@@ -3619,7 +3617,7 @@ public class DefaultServerEntryTest
EntryAttribute oc = entry.get( "objectClass" );
- assertEquals( OBJECT_CLASS_AT, ((ServerAttribute)oc).getAttributeType() );
+ assertEquals( OBJECT_CLASS_AT, oc.getAttributeType() );
assertNull( oc.get() );
}
@@ -3664,25 +3662,25 @@ public class DefaultServerEntryTest
sa = entry.get( "l" );
assertNotNull( sa );
- assertEquals( atL, ((ServerAttribute)sa).getAttributeType() );
+ assertEquals( atL, sa.getAttributeType() );
assertEquals( "l", sa.getId() );
assertEquals( "L", sa.getUpId() );
sa = entry.get( "c" );
assertNotNull( sa );
- assertEquals( atC, ((ServerAttribute)sa).getAttributeType() );
+ assertEquals( atC, sa.getAttributeType() );
assertEquals( "countryname", sa.getId() );
assertEquals( "CountryName", sa.getUpId() );
sa = entry.get( "2.5.4.9" );
assertNotNull( sa );
- assertEquals( atStreet, ((ServerAttribute)sa).getAttributeType() );
+ assertEquals( atStreet, sa.getAttributeType() );
assertEquals( "2.5.4.9", sa.getId() );
assertEquals( "2.5.4.9", sa.getUpId() );
sa = entry.get( "givenName" );
assertNotNull( sa );
- assertEquals( atGN, ((ServerAttribute)sa).getAttributeType() );
+ assertEquals( atGN, sa.getAttributeType() );
assertEquals( "gn", sa.getId() );
assertEquals( "gn", sa.getUpId() );
@@ -3932,7 +3930,7 @@ public class DefaultServerEntryTest
Entry clientEntry = serverEntry.toClientEntry();
- assertTrue( clientEntry instanceof ClientEntry );
+ assertTrue( clientEntry instanceof Entry );
assertFalse( clientEntry instanceof ServerEntry );
assertTrue( clientEntry.containsAttribute( "cn", "objectClass" ) );
Modified: directory/apacheds/trunk/core-entry/src/test/java/org/apache/directory/server/core/entry/ServerModificationTest.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/core-entry/src/test/java/org/apache/directory/server/core/entry/ServerModificationTest.java?rev=927839&r1=927838&r2=927839&view=diff
==============================================================================
--- directory/apacheds/trunk/core-entry/src/test/java/org/apache/directory/server/core/entry/ServerModificationTest.java (original)
+++ directory/apacheds/trunk/core-entry/src/test/java/org/apache/directory/server/core/entry/ServerModificationTest.java Fri Mar 26 13:25:10 2010
@@ -38,9 +38,7 @@ import org.apache.directory.shared.ldap.
import org.apache.directory.shared.ldap.entry.EntryAttribute;
import org.apache.directory.shared.ldap.entry.Modification;
import org.apache.directory.shared.ldap.entry.ModificationOperation;
-import org.apache.directory.shared.ldap.entry.ServerAttribute;
import org.apache.directory.shared.ldap.entry.ServerModification;
-import org.apache.directory.shared.ldap.entry.client.ClientAttribute;
import org.apache.directory.shared.ldap.entry.client.ClientModification;
import org.apache.directory.shared.ldap.entry.client.DefaultClientAttribute;
import org.apache.directory.shared.ldap.exception.LdapException;
@@ -184,7 +182,7 @@ public class ServerModificationTest
@Test public void testCreateServerModification()
{
- ServerAttribute attribute = new DefaultServerAttribute( atCN );
+ EntryAttribute attribute = new DefaultServerAttribute( atCN );
attribute.add( "test1", "test2" );
Modification mod = new ServerModification( ModificationOperation.ADD_ATTRIBUTE, attribute );
@@ -192,7 +190,7 @@ public class ServerModificationTest
attribute.remove( "test2" );
- ServerAttribute clonedAttribute = (ServerAttribute)clone.getAttribute();
+ EntryAttribute clonedAttribute = clone.getAttribute();
assertEquals( 1, mod.getAttribute().size() );
assertTrue( mod.getAttribute().contains( "test1" ) );
@@ -210,7 +208,7 @@ public class ServerModificationTest
@Test
public void testCopyServerModification()
{
- ServerAttribute attribute = new DefaultServerAttribute( atC );
+ EntryAttribute attribute = new DefaultServerAttribute( atC );
attribute.add( "test1", "test2" );
Modification serverModification = new ServerModification( ModificationOperation.ADD_ATTRIBUTE, attribute );
@@ -222,7 +220,7 @@ public class ServerModificationTest
serverModification.setOperation( ModificationOperation.REMOVE_ATTRIBUTE );
assertEquals( ModificationOperation.ADD_ATTRIBUTE, copy.getOperation() );
- ServerAttribute attribute2 = new DefaultServerAttribute( atCN, "t" );
+ EntryAttribute attribute2 = new DefaultServerAttribute( atCN, "t" );
serverModification.setAttribute( attribute2 );
assertNotSame( attribute2, copy.getAttribute() );
}
@@ -235,7 +233,7 @@ public class ServerModificationTest
@Test
public void testCopyClientModification()
{
- ClientAttribute attribute = new DefaultClientAttribute( atC.getName() );
+ EntryAttribute attribute = new DefaultClientAttribute( atC.getName() );
attribute.add( "test1", "test2" );
Modification clientModification = new ClientModification( ModificationOperation.ADD_ATTRIBUTE, attribute );
@@ -244,15 +242,15 @@ public class ServerModificationTest
assertTrue( copy instanceof ServerModification );
assertFalse( copy instanceof ClientModification );
assertFalse( copy.equals( clientModification ) );
- assertTrue( copy.getAttribute() instanceof ServerAttribute );
- assertEquals( atC, ((ServerAttribute)copy.getAttribute()).getAttributeType() );
+ assertTrue( copy.getAttribute() instanceof EntryAttribute );
+ assertEquals( atC, copy.getAttribute().getAttributeType() );
assertEquals( ModificationOperation.ADD_ATTRIBUTE, copy.getOperation() );
assertTrue( copy.getAttribute().contains( "test1", "test2" ) );
clientModification.setOperation( ModificationOperation.REMOVE_ATTRIBUTE );
assertEquals( ModificationOperation.ADD_ATTRIBUTE, copy.getOperation() );
- ClientAttribute attribute2 = new DefaultClientAttribute( "cn", "t" );
+ EntryAttribute attribute2 = new DefaultClientAttribute( "cn", "t" );
clientModification.setAttribute( attribute2 );
assertNotSame( attribute2, copy.getAttribute() );
}