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 2011/03/26 20:19:29 UTC
svn commit: r1085791 - in /directory/apacheds/trunk:
core-api/src/main/java/org/apache/directory/server/core/
core-api/src/main/java/org/apache/directory/server/core/entry/
core-api/src/main/java/org/apache/directory/server/core/interceptor/context/
co...
Author: elecharny
Date: Sat Mar 26 19:19:28 2011
New Revision: 1085791
URL: http://svn.apache.org/viewvc?rev=1085791&view=rev
Log:
Fixed ApacheDS code accordingly to the fixes made in shared (Value classes refactoring)
Modified:
directory/apacheds/trunk/core-api/src/main/java/org/apache/directory/server/core/LdapCoreSessionConnection.java
directory/apacheds/trunk/core-api/src/main/java/org/apache/directory/server/core/entry/ServerEntryUtils.java
directory/apacheds/trunk/core-api/src/main/java/org/apache/directory/server/core/entry/TestServerEntryUtils.java
directory/apacheds/trunk/core-api/src/main/java/org/apache/directory/server/core/interceptor/context/CompareOperationContext.java
directory/apacheds/trunk/core-api/src/test/java/org/apache/directory/server/core/entry/SchemaAwareEntryAttributeTest.java
directory/apacheds/trunk/core-api/src/test/java/org/apache/directory/server/core/entry/SchemaAwareEntryTest.java
directory/apacheds/trunk/core-api/src/test/java/org/apache/directory/server/core/entry/SchemaAwareModificationTest.java
directory/apacheds/trunk/core-integ/src/test/java/org/apache/directory/server/core/authz/CompareAuthorizationIT.java
directory/apacheds/trunk/core-integ/src/test/java/org/apache/directory/server/core/operational/OperationalAttributeServiceIT.java
directory/apacheds/trunk/core-jndi/src/main/java/org/apache/directory/server/core/jndi/ServerLdapContext.java
directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/event/LeafEvaluator.java
directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/hash/PasswordHashingInterceptor.java
directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/normalization/NormalizationInterceptor.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/subtree/SubentryInterceptor.java
directory/apacheds/trunk/core/src/test/java/org/apache/directory/server/core/normalization/NormalizationVisitorTest.java
directory/apacheds/trunk/jdbm-partition/src/test/java/org/apache/directory/server/core/partition/impl/btree/jdbm/ServerEntrySerializerTest.java
directory/apacheds/trunk/ldap-client-test/src/test/java/org/apache/directory/shared/client/api/LdapConnectionTest.java
directory/apacheds/trunk/ldif-partition/src/main/java/org/apache/directory/server/core/partition/ldif/LdifPartition.java
directory/apacheds/trunk/server-config/src/main/java/org/apache/directory/server/config/ConfigWriter.java
directory/apacheds/trunk/server-config/src/test/resources/ldapServer.ldif
directory/apacheds/trunk/xdbm-partition/src/main/java/org/apache/directory/server/xdbm/search/impl/ApproximateEvaluator.java
directory/apacheds/trunk/xdbm-partition/src/main/java/org/apache/directory/server/xdbm/search/impl/EqualityEvaluator.java
directory/apacheds/trunk/xdbm-partition/src/main/java/org/apache/directory/server/xdbm/search/impl/GreaterEqEvaluator.java
directory/apacheds/trunk/xdbm-partition/src/main/java/org/apache/directory/server/xdbm/search/impl/LessEqEvaluator.java
directory/apacheds/trunk/xdbm-partition/src/main/java/org/apache/directory/server/xdbm/search/impl/SubstringEvaluator.java
Modified: directory/apacheds/trunk/core-api/src/main/java/org/apache/directory/server/core/LdapCoreSessionConnection.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/core-api/src/main/java/org/apache/directory/server/core/LdapCoreSessionConnection.java?rev=1085791&r1=1085790&r2=1085791&view=diff
==============================================================================
--- directory/apacheds/trunk/core-api/src/main/java/org/apache/directory/server/core/LdapCoreSessionConnection.java (original)
+++ directory/apacheds/trunk/core-api/src/main/java/org/apache/directory/server/core/LdapCoreSessionConnection.java Sat Mar 26 19:19:28 2011
@@ -310,13 +310,13 @@ public class LdapCoreSessionConnection i
compareRequest.setName( dn );
compareRequest.setAttributeId( attributeName );
- if ( value.isBinary() )
+ if ( value.isHR() )
{
- compareRequest.setAssertionValue( value.getBytes() );
+ compareRequest.setAssertionValue( value.getString() );
}
else
{
- compareRequest.setAssertionValue( value.getString() );
+ compareRequest.setAssertionValue( value.getBytes() );
}
return compare( compareRequest );
Modified: directory/apacheds/trunk/core-api/src/main/java/org/apache/directory/server/core/entry/ServerEntryUtils.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/core-api/src/main/java/org/apache/directory/server/core/entry/ServerEntryUtils.java?rev=1085791&r1=1085790&r2=1085791&view=diff
==============================================================================
--- directory/apacheds/trunk/core-api/src/main/java/org/apache/directory/server/core/entry/ServerEntryUtils.java (original)
+++ directory/apacheds/trunk/core-api/src/main/java/org/apache/directory/server/core/entry/ServerEntryUtils.java Sat Mar 26 19:19:28 2011
@@ -126,7 +126,7 @@ public class ServerEntryUtils
*
* @throws InvalidAttributeIdentifierException If we had an incorrect attribute
*/
- public static EntryAttribute toServerAttribute( Attribute attribute, AttributeType attributeType ) throws LdapInvalidAttributeTypeException
+ public static EntryAttribute toServerAttribute( Attribute attribute, AttributeType attributeType ) throws LdapException
{
if ( attribute == null )
{
@@ -328,7 +328,7 @@ public class ServerEntryUtils
* arguments
* @throws LdapException if there are problems accessing attribute values
*/
- public static EntryAttribute getUnion( EntryAttribute attr0, EntryAttribute attr1 )
+ public static EntryAttribute getUnion( EntryAttribute attr0, EntryAttribute attr1 ) throws LdapException
{
if ( attr0 == null && attr1 == null )
{
@@ -365,8 +365,7 @@ public class ServerEntryUtils
* @param attributeType the associated attributeType
* @return a instance of a ServerModification object
*/
- private static Modification toServerModification( ModificationItem modificationImpl, AttributeType attributeType ) throws LdapInvalidAttributeTypeException
-
+ private static Modification toServerModification( ModificationItem modificationImpl, AttributeType attributeType ) throws LdapException
{
ModificationOperation operation;
@@ -434,7 +433,8 @@ public class ServerEntryUtils
* @param attributeType the associated attributeType
* @return a instance of a ServerModification object
*/
- private static Modification toServerModification( Modification modification, AttributeType attributeType )
+ private static Modification toServerModification( Modification modification, AttributeType attributeType )
+ throws LdapException
{
Modification serverModification = new DefaultModification(
modification.getOperation(),
Modified: directory/apacheds/trunk/core-api/src/main/java/org/apache/directory/server/core/entry/TestServerEntryUtils.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/core-api/src/main/java/org/apache/directory/server/core/entry/TestServerEntryUtils.java?rev=1085791&r1=1085790&r2=1085791&view=diff
==============================================================================
--- directory/apacheds/trunk/core-api/src/main/java/org/apache/directory/server/core/entry/TestServerEntryUtils.java (original)
+++ directory/apacheds/trunk/core-api/src/main/java/org/apache/directory/server/core/entry/TestServerEntryUtils.java Sat Mar 26 19:19:28 2011
@@ -158,7 +158,7 @@ public class TestServerEntryUtils
{
public Value<?> normalize( Value<?> value ) throws LdapException
{
- if ( !value.isBinary() )
+ if ( value.isHR() )
{
return new StringValue( value.getString().toLowerCase() );
}
@@ -241,7 +241,7 @@ public class TestServerEntryUtils
{
public Value<?> normalize( Value<?> value ) throws LdapException
{
- if ( value.isBinary() )
+ if ( !value.isHR() )
{
byte[] val = value.getBytes();
Modified: directory/apacheds/trunk/core-api/src/main/java/org/apache/directory/server/core/interceptor/context/CompareOperationContext.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/core-api/src/main/java/org/apache/directory/server/core/interceptor/context/CompareOperationContext.java?rev=1085791&r1=1085790&r2=1085791&view=diff
==============================================================================
--- directory/apacheds/trunk/core-api/src/main/java/org/apache/directory/server/core/interceptor/context/CompareOperationContext.java (original)
+++ directory/apacheds/trunk/core-api/src/main/java/org/apache/directory/server/core/interceptor/context/CompareOperationContext.java Sat Mar 26 19:19:28 2011
@@ -21,11 +21,11 @@ package org.apache.directory.server.core
import org.apache.directory.server.core.CoreSession;
-import org.apache.directory.shared.ldap.model.message.controls.ManageDsaIT;
+import org.apache.directory.shared.ldap.model.entry.BinaryValue;
import org.apache.directory.shared.ldap.model.entry.Value;
import org.apache.directory.shared.ldap.model.message.CompareRequest;
import org.apache.directory.shared.ldap.model.message.MessageTypeEnum;
-import org.apache.directory.shared.ldap.model.entry.BinaryValue;
+import org.apache.directory.shared.ldap.model.message.controls.ManageDsaIT;
import org.apache.directory.shared.ldap.model.name.Dn;
import org.apache.directory.shared.ldap.model.schema.AttributeType;
import org.apache.directory.shared.util.Strings;
@@ -201,9 +201,9 @@ public class CompareOperationContext ext
return "CompareContext for Dn '" + getDn().getName() + "'" +
( ( oid != null ) ? ", oid : <" + oid + ">" : "" ) +
( ( value != null ) ? ", value :'" +
- ( ( !value.isBinary() ) ?
+ ( ( value.isHR() ) ?
value.getString() :
- ( ( value.isBinary() ) ?
+ ( ( !value.isHR() ) ?
Strings.dumpBytes(((BinaryValue) value).getReference()) :
"unknown value type" ) )
+ "'"
Modified: directory/apacheds/trunk/core-api/src/test/java/org/apache/directory/server/core/entry/SchemaAwareEntryAttributeTest.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/core-api/src/test/java/org/apache/directory/server/core/entry/SchemaAwareEntryAttributeTest.java?rev=1085791&r1=1085790&r2=1085791&view=diff
==============================================================================
--- directory/apacheds/trunk/core-api/src/test/java/org/apache/directory/server/core/entry/SchemaAwareEntryAttributeTest.java (original)
+++ directory/apacheds/trunk/core-api/src/test/java/org/apache/directory/server/core/entry/SchemaAwareEntryAttributeTest.java Sat Mar 26 19:19:28 2011
@@ -433,21 +433,11 @@ public class SchemaAwareEntryAttributeTe
@Test
public void testGetString() throws LdapInvalidAttributeValueException
{
- EntryAttribute attr1 = new DefaultEntryAttribute( atCN );
-
- assertEquals( 0, attr1.add( ( String ) null ) );
+ EntryAttribute attr1 = new DefaultEntryAttribute( atDC );
- try
- {
- attr1.getString();
- fail();
- }
- catch ( LdapInvalidAttributeValueException liave )
- {
- // expected
- }
+ assertEquals( 1, attr1.add( ( String ) null ) );
- EntryAttribute attr2 = new DefaultEntryAttribute( atCN );
+ EntryAttribute attr2 = new DefaultEntryAttribute( atDC );
attr2.add( "a", "b" );
assertEquals( "a", attr2.getString() );
@@ -494,13 +484,13 @@ public class SchemaAwareEntryAttributeTe
* Test method hashCode()
*/
@Test
- public void testHashCode()
+ public void testHashCode() throws LdapException
{
- EntryAttribute attr1 = new DefaultEntryAttribute( atCN );
+ EntryAttribute attr1 = new DefaultEntryAttribute( atDC );
EntryAttribute attr2 = new DefaultEntryAttribute( atSN );
assertNotSame( attr1.hashCode(), attr2.hashCode() );
- attr2.setAttributeType( atCN );
+ attr2.setAttributeType( atDC );
assertEquals( attr1.hashCode(), attr2.hashCode() );
attr1.add( ( String ) null );
@@ -631,11 +621,11 @@ public class SchemaAwareEntryAttributeTe
* Test method add( Value... )
*/
@Test
- public void testAddValueArray()
+ public void testAddValueArray() throws LdapException
{
- EntryAttribute attr1 = new DefaultEntryAttribute( atCN );
+ EntryAttribute attr1 = new DefaultEntryAttribute( atDC );
- int nbAdded = attr1.add( new StringValue( atCN, null ) );
+ int nbAdded = attr1.add( (String)null );
assertEquals( 1, nbAdded );
assertTrue( attr1.isHR() );
assertEquals( NULL_STRING_VALUE, attr1.get() );
@@ -849,7 +839,7 @@ public class SchemaAwareEntryAttributeTe
* Test method clear()
*/
@Test
- public void testClear()
+ public void testClear() throws LdapException
{
EntryAttribute attr = new DefaultEntryAttribute( "dc", atDC );
@@ -866,10 +856,10 @@ public class SchemaAwareEntryAttributeTe
/**
- * Test method contains( Value... )
+ * Test method contains( Value... ) throws LdapException
*/
@Test
- public void testContainsValueArray()
+ public void testContainsValueArray() throws LdapException
{
EntryAttribute attr1 = new DefaultEntryAttribute( atDC );
@@ -920,7 +910,7 @@ public class SchemaAwareEntryAttributeTe
* Test method contains( String... )
*/
@Test
- public void testContainsStringArray()
+ public void testContainsStringArray() throws LdapException
{
EntryAttribute attr1 = new DefaultEntryAttribute( atDC );
@@ -950,7 +940,7 @@ public class SchemaAwareEntryAttributeTe
* Test method contains( byte[]... )
*/
@Test
- public void testContainsByteArray()
+ public void testContainsByteArray() throws LdapException
{
EntryAttribute attr1 = new DefaultEntryAttribute( atPwd );
@@ -980,7 +970,7 @@ public class SchemaAwareEntryAttributeTe
* Test method testEquals()
*/
@Test
- public void testEquals()
+ public void testEquals() throws LdapException
{
EntryAttribute attr1 = new DefaultEntryAttribute( atCN );
@@ -1015,7 +1005,7 @@ public class SchemaAwareEntryAttributeTe
assertTrue( attr3.equals( attr4 ) );
EntryAttribute attr5 = new DefaultEntryAttribute( atPwd );
- EntryAttribute attr6 = new DefaultEntryAttribute( atCN );
+ EntryAttribute attr6 = new DefaultEntryAttribute( atDC );
assertFalse( attr5.equals( attr6 ) );
attr5.add( NULL_BINARY_VALUE );
@@ -1043,7 +1033,7 @@ public class SchemaAwareEntryAttributeTe
* Test method get()
*/
@Test
- public void testGet()
+ public void testGet() throws LdapException
{
EntryAttribute attr1 = new DefaultEntryAttribute( "dc", atDC );
@@ -1084,9 +1074,9 @@ public class SchemaAwareEntryAttributeTe
* Test method getAll()
*/
@Test
- public void testGetAll()
+ public void testGetAll() throws LdapException
{
- EntryAttribute attr = new DefaultEntryAttribute( atCN );
+ EntryAttribute attr = new DefaultEntryAttribute( atDC );
Iterator<Value<?>> iterator = attr.getAll();
assertFalse( iterator.hasNext() );
@@ -1487,7 +1477,7 @@ public class SchemaAwareEntryAttributeTe
* Test method iterator()
*/
@Test
- public void testIterator()
+ public void testIterator() throws LdapException
{
EntryAttribute attr1 = new DefaultEntryAttribute( atCN );
attr1.add( "a", "b", "c" );
@@ -1512,7 +1502,7 @@ public class SchemaAwareEntryAttributeTe
* Test method toString
*/
@Test
- public void testToString()
+ public void testToString() throws LdapException
{
EntryAttribute attr = new DefaultEntryAttribute( atDC );
@@ -1809,7 +1799,7 @@ public class SchemaAwareEntryAttributeTe
* Test constructor DefaultEntryAttribute( String, AttributeType, Value... )
*/
@Test
- public void testDefaultServerAttributeStringAttributeTypeValueArray()
+ public void testDefaultServerAttributeStringAttributeTypeValueArray() throws LdapException
{
EntryAttribute attr1 = new DefaultEntryAttribute( "dc", atDC, STR_VALUE1, STR_VALUE2, NULL_STRING_VALUE );
@@ -1859,7 +1849,7 @@ public class SchemaAwareEntryAttributeTe
* Test constructor DefaultEntryAttribute( AttributeType, String... )
*/
@Test
- public void testDefaultServerAttributeAttributeTypeStringArray()
+ public void testDefaultServerAttributeAttributeTypeStringArray() throws LdapException
{
EntryAttribute attr1 = new DefaultEntryAttribute( atDC, "a", "b", ( String ) null );
@@ -1887,7 +1877,7 @@ public class SchemaAwareEntryAttributeTe
* Test constructor DefaultEntryAttribute( String, AttributeType, String... )
*/
@Test
- public void testDefaultServerAttributeStringAttributeTypeStringArray()
+ public void testDefaultServerAttributeStringAttributeTypeStringArray() throws LdapException
{
EntryAttribute attr1 = new DefaultEntryAttribute( "dc", atDC, "a", "b", ( String ) null );
@@ -1926,7 +1916,7 @@ public class SchemaAwareEntryAttributeTe
* Test method DefaultEntryAttribute( AttributeType, byte[]... )
*/
@Test
- public void testDefaultServerAttributeAttributeTypeByteArray()
+ public void testDefaultServerAttributeAttributeTypeByteArray() throws LdapException
{
EntryAttribute attr1 = new DefaultEntryAttribute( atPwd, BYTES1, BYTES2, ( byte[] ) null );
@@ -1954,7 +1944,7 @@ public class SchemaAwareEntryAttributeTe
* Test method DefaultEntryAttribute( String, AttributeType, byte[]... )
*/
@Test
- public void testDefaultServerAttributeStringAttributeTypeByteArray()
+ public void testDefaultServerAttributeStringAttributeTypeByteArray() throws LdapException
{
EntryAttribute attr1 = new DefaultEntryAttribute( "userPassword", atPwd, BYTES1, BYTES2, ( byte[] ) null );
@@ -1982,15 +1972,15 @@ public class SchemaAwareEntryAttributeTe
* Test method testClone()
*/
@Test
- public void testClone()
+ public void testClone() throws LdapException
{
- EntryAttribute attr = new DefaultEntryAttribute( atCN );
+ EntryAttribute attr = new DefaultEntryAttribute( atDC );
EntryAttribute clone = attr.clone();
assertEquals( attr, clone );
- attr.setUpId( "CommonName" );
- assertEquals( "2.5.4.3", clone.getId() );
+ attr.setUpId( "DomainComponent" );
+ assertEquals( "0.9.2342.19200300.100.1.25", clone.getId() );
attr.add( "a", ( String ) null, "b" );
clone = attr.clone();
@@ -2008,7 +1998,7 @@ public class SchemaAwareEntryAttributeTe
* Test the copy constructor of a EntryAttribute
*/
@Test
- public void testCopyConstructorServerAttribute() throws LdapInvalidAttributeValueException
+ public void testCopyConstructorServerAttribute() throws LdapException
{
EntryAttribute attribute = new DefaultEntryAttribute( atCN );
@@ -2031,7 +2021,7 @@ public class SchemaAwareEntryAttributeTe
* Test the copy constructor of a ClientAttribute
*/
@Test
- public void testCopyConstructorClientAttribute() throws LdapInvalidAttributeValueException
+ public void testCopyConstructorClientAttribute() throws LdapException
{
EntryAttribute attribute = new DefaultEntryAttribute( "commonName" );
attribute.add( "test" );
@@ -2051,7 +2041,7 @@ public class SchemaAwareEntryAttributeTe
* Test the conversion method
*/
@Test
- public void testToClientAttribute()
+ public void testToClientAttribute() throws LdapException
{
EntryAttribute attribute = new DefaultEntryAttribute( atCN, "test", "test2" );
Modified: directory/apacheds/trunk/core-api/src/test/java/org/apache/directory/server/core/entry/SchemaAwareEntryTest.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/core-api/src/test/java/org/apache/directory/server/core/entry/SchemaAwareEntryTest.java?rev=1085791&r1=1085790&r2=1085791&view=diff
==============================================================================
--- directory/apacheds/trunk/core-api/src/test/java/org/apache/directory/server/core/entry/SchemaAwareEntryTest.java (original)
+++ directory/apacheds/trunk/core-api/src/test/java/org/apache/directory/server/core/entry/SchemaAwareEntryTest.java Sat Mar 26 19:19:28 2011
@@ -49,6 +49,7 @@ import org.apache.directory.shared.ldap.
import org.apache.directory.shared.ldap.model.entry.StringValue;
import org.apache.directory.shared.ldap.model.entry.Value;
import org.apache.directory.shared.ldap.model.exception.LdapException;
+import org.apache.directory.shared.ldap.model.exception.LdapInvalidAttributeValueException;
import org.apache.directory.shared.ldap.model.exception.LdapInvalidDnException;
import org.apache.directory.shared.ldap.model.exception.LdapNoSuchAttributeException;
import org.apache.directory.shared.ldap.model.name.Dn;
@@ -331,12 +332,12 @@ public class SchemaAwareEntryTest
{
Entry entry = new DefaultEntry( schemaManager, EXAMPLE_DN );
- entry.add( "cn", ( String ) null );
+ entry.add( "dc", ( String ) null );
assertEquals( 1, entry.size() );
- EntryAttribute attributeCN = entry.get( "cn" );
+ EntryAttribute attributeDC = entry.get( "dc" );
- assertEquals( 0, attributeCN.size() );
- assertNull( attributeCN.get() );
+ assertEquals( 1, attributeDC.size() );
+ assertNotNull( attributeDC.get() );
entry.add( "sn", "test", "test", "TEST" );
assertEquals( 2, entry.size() );
@@ -374,11 +375,11 @@ public class SchemaAwareEntryTest
public void testAddStringValueArray() throws Exception
{
Entry entry = new DefaultEntry( schemaManager, EXAMPLE_DN );
- Value<String> value = new StringValue( atCN, ( String ) null );
+ Value<String> value = new StringValue( atDC, ( String ) null );
- entry.add( "cn", value );
+ entry.add( "dc", value );
assertEquals( 1, entry.size() );
- EntryAttribute attributeCN = entry.get( "cn" );
+ EntryAttribute attributeCN = entry.get( "dc" );
assertEquals( 1, attributeCN.size() );
assertNotNull( attributeCN.get() );
assertNull( attributeCN.get().get() );
@@ -455,14 +456,13 @@ public class SchemaAwareEntryTest
assertEquals( 1, entry.size() );
assertTrue( entry.contains( atC, "fr", "us" ) );
- entry.add( atC, ( String ) null, "de", "fr" );
+ entry.add( atC, "de", "fr" );
assertEquals( 1, entry.size() );
EntryAttribute attribute = entry.get( atC );
assertEquals( 3, attribute.size() );
assertTrue( attribute.contains( "de" ) );
assertTrue( attribute.contains( "fr" ) );
- assertFalse( attribute.contains( ( String ) null ) );
assertTrue( attribute.contains( "us" ) );
entry.clear();
@@ -479,10 +479,10 @@ public class SchemaAwareEntryTest
{
Entry entry = new DefaultEntry( schemaManager, EXAMPLE_DN );
- Value<String> strValue1 = new StringValue( atCN, "test1" );
- Value<String> strValue2 = new StringValue( atCN, "test2" );
- Value<String> strValue3 = new StringValue( atCN, "test3" );
- Value<String> strNullValue = new StringValue( atCN, null );
+ Value<String> strValue1 = new StringValue( atDC, "test1" );
+ Value<String> strValue2 = new StringValue( atDC, "test2" );
+ Value<String> strValue3 = new StringValue( atDC, "test3" );
+ Value<String> strNullValue = new StringValue( atDC, null );
Value<byte[]> binValue1 = new BinaryValue( atPwd, BYTES1 );
Value<byte[]> binValue2 = new BinaryValue( atPwd, BYTES2 );
@@ -498,17 +498,17 @@ public class SchemaAwareEntryTest
assertTrue( true );
}
- entry.add( atCN, strValue1, strValue2, strValue1 );
+ entry.add( atDC, strValue1, strValue2, strValue1 );
entry.add( atPwd, binValue1, binValue2, binValue1 );
assertEquals( 2, entry.size() );
- assertTrue( entry.contains( atCN, "test1", "test2" ) );
+ assertTrue( entry.contains( atDC, "test1", "test2" ) );
assertTrue( entry.contains( atPwd, BYTES1, BYTES2 ) );
- entry.add( atCN, strValue3, strNullValue );
+ entry.add( atDC, strValue3, strNullValue );
- assertEquals( 4, entry.get( atCN ).size() );
- assertTrue( entry.contains( atCN, strNullValue ) );
+ assertEquals( 4, entry.get( atDC ).size() );
+ assertTrue( entry.contains( atDC, strNullValue ) );
entry.add( atCN, binValue3 );
assertFalse( entry.contains( atCN, binValue3 ) );
@@ -595,10 +595,10 @@ public class SchemaAwareEntryTest
{
Entry entry = new DefaultEntry( schemaManager, EXAMPLE_DN );
- Value<String> strValue1 = new StringValue( atCN, "test1" );
- Value<String> strValue2 = new StringValue( atCN, "test2" );
- Value<String> strValue3 = new StringValue( atCN, "test3" );
- Value<String> strNullValue = new StringValue( atCN, null );
+ Value<String> strValue1 = new StringValue( atDC, "test1" );
+ Value<String> strValue2 = new StringValue( atDC, "test2" );
+ Value<String> strValue3 = new StringValue( atDC, "test3" );
+ Value<String> strNullValue = new StringValue( atDC, null );
Value<byte[]> binValue1 = new BinaryValue( atPwd, BYTES1 );
Value<byte[]> binValue2 = new BinaryValue( atPwd, BYTES2 );
@@ -614,28 +614,28 @@ public class SchemaAwareEntryTest
assertTrue( true );
}
- entry.add( "CN", atCN, strValue1, strValue2, strValue1 );
+ entry.add( "DC", atDC, strValue1, strValue2, strValue1 );
entry.add( "UserPassword", atPwd, binValue1, binValue2, binValue1 );
assertEquals( 2, entry.size() );
- assertTrue( entry.contains( atCN, "test1", "test2" ) );
+ assertTrue( entry.contains( atDC, "test1", "test2" ) );
assertTrue( entry.contains( atPwd, BYTES1, BYTES2 ) );
- assertEquals( "CN", entry.get( atCN ).getUpId() );
- assertEquals( "2.5.4.3", entry.get( atCN ).getId() );
+ assertEquals( "DC", entry.get( atDC ).getUpId() );
+ assertEquals( "0.9.2342.19200300.100.1.25", entry.get( atDC ).getId() );
assertEquals( "UserPassword", entry.get( atPwd ).getUpId() );
assertEquals( "2.5.4.35", entry.get( atPwd ).getId() );
- entry.add( "CN", atCN, strValue3, strNullValue );
+ entry.add( "DC", atDC, strValue3, strNullValue );
- assertEquals( 4, entry.get( atCN ).size() );
- assertTrue( entry.contains( atCN, strNullValue ) );
+ assertEquals( 4, entry.get( atDC ).size() );
+ assertTrue( entry.contains( atDC, strNullValue ) );
- entry.add( atCN, binValue3 );
- assertFalse( entry.contains( atCN, binValue3 ) );
+ entry.add( atDC, binValue3 );
+ assertFalse( entry.contains( atDC, binValue3 ) );
try
{
- entry.add( "SN", atCN, "test" );
+ entry.add( "SN", atDC, "test" );
fail();
}
catch ( IllegalArgumentException iae )
@@ -739,7 +739,7 @@ public class SchemaAwareEntryTest
entry.add( atJpegPhoto, ( byte[] ) null );
fail();
}
- catch ( IllegalArgumentException iae )
+ catch ( LdapInvalidAttributeValueException liave )
{
// Expected
}
@@ -1400,8 +1400,8 @@ public class SchemaAwareEntryTest
assertEquals( 2, entry2.get( "cn" ).size() );
assertFalse( entry2.contains( "cn", "test3" ) );
- entry1.add( "sn", ( String ) null );
- assertFalse( entry2.containsAttribute( "sn" ) );
+ entry1.add( "dc", ( String ) null );
+ assertFalse( entry2.containsAttribute( "dc" ) );
}
@@ -1462,10 +1462,10 @@ public class SchemaAwareEntryTest
{
Entry entry = new DefaultEntry( schemaManager, EXAMPLE_DN );
- Value<String> strValue1 = new StringValue( atCN, "test1" );
- Value<String> strValue2 = new StringValue( atCN, "test2" );
- Value<String> strValue3 = new StringValue( atCN, "test3" );
- Value<String> strNullValue = new StringValue( atCN, null );
+ Value<String> strValue1 = new StringValue( atDC, "test1" );
+ Value<String> strValue2 = new StringValue( atDC, "test2" );
+ Value<String> strValue3 = new StringValue( atDC, "test3" );
+ Value<String> strNullValue = new StringValue( atDC, null );
Value<byte[]> binValue1 = new BinaryValue( atPwd, BYTES1 );
Value<byte[]> binValue2 = new BinaryValue( atPwd, BYTES2 );
@@ -1473,18 +1473,18 @@ public class SchemaAwareEntryTest
Value<byte[]> binNullValue = new BinaryValue( atPwd, null );
assertFalse( entry.contains( ( String ) null, strValue1 ) );
- assertFalse( entry.contains( atCN, binValue1 ) );
+ assertFalse( entry.contains( atDC, binValue1 ) );
- EntryAttribute attrCN = new DefaultEntryAttribute( atCN, strValue1, strValue2 );
+ EntryAttribute attrCN = new DefaultEntryAttribute( atDC, strValue1, strValue2 );
EntryAttribute attrPWD = new DefaultEntryAttribute( atPwd, binValue1, binValue2, binNullValue );
entry.add( attrCN, attrPWD );
- assertTrue( entry.contains( atCN, strValue1, strValue2 ) );
+ assertTrue( entry.contains( atDC, strValue1, strValue2 ) );
assertTrue( entry.contains( atPwd, binValue1, binValue2, binNullValue ) );
- assertFalse( entry.contains( atCN, strValue3 ) );
- assertFalse( entry.contains( atCN, strNullValue ) );
+ assertFalse( entry.contains( atDC, strValue3 ) );
+ assertFalse( entry.contains( atDC, strNullValue ) );
assertFalse( entry.contains( atPwd, binValue3 ) );
}
@@ -2060,10 +2060,10 @@ public class SchemaAwareEntryTest
{
Entry entry = new DefaultEntry( schemaManager, EXAMPLE_DN );
- Value<String> strValue1 = new StringValue( atCN, "test1" );
- Value<String> strValue2 = new StringValue( atCN, "test2" );
- Value<String> strValue3 = new StringValue( atCN, "test3" );
- Value<String> strNullValue = new StringValue( atCN, null );
+ Value<String> strValue1 = new StringValue( atDC, "test1" );
+ Value<String> strValue2 = new StringValue( atDC, "test2" );
+ Value<String> strValue3 = new StringValue( atDC, "test3" );
+ Value<String> strNullValue = new StringValue( atDC, null );
Value<byte[]> binValue1 = new BinaryValue( atPwd, BYTES1 );
@@ -2077,25 +2077,25 @@ public class SchemaAwareEntryTest
assertTrue( true );
}
- entry.put( atCN, strNullValue );
+ entry.put( atDC, strNullValue );
assertEquals( 1, entry.size() );
- assertTrue( entry.containsAttribute( atCN ) );
- assertTrue( entry.contains( atCN, ( String ) null ) );
+ assertTrue( entry.containsAttribute( atDC ) );
+ assertTrue( entry.contains( atDC, ( String ) null ) );
- EntryAttribute replaced = entry.put( atCN, strValue1, strValue2, strValue1 );
+ EntryAttribute replaced = entry.put( atDC, strValue1, strValue2, strValue1 );
assertNotNull( replaced );
- assertEquals( atCN, replaced.getAttributeType() );
+ assertEquals( atDC, replaced.getAttributeType() );
assertTrue( replaced.contains( ( String ) null ) );
assertEquals( 1, entry.size() );
- assertTrue( entry.contains( atCN, strValue1, strValue2 ) );
- assertFalse( entry.contains( atCN, strValue3 ) );
- assertEquals( 2, entry.get( atCN ).size() );
+ assertTrue( entry.contains( atDC, strValue1, strValue2 ) );
+ assertFalse( entry.contains( atDC, strValue3 ) );
+ assertEquals( 2, entry.get( atDC ).size() );
- replaced = entry.put( atCN, binValue1 );
+ replaced = entry.put( atDC, binValue1 );
assertNotNull( replaced );
assertTrue( replaced.contains( strValue1, strValue2 ) );
- EntryAttribute attribute = entry.get( atCN );
+ EntryAttribute attribute = entry.get( atDC );
assertEquals( 0, attribute.size() );
}
@@ -2307,10 +2307,10 @@ public class SchemaAwareEntryTest
{
Entry entry = new DefaultEntry( schemaManager, EXAMPLE_DN );
- Value<String> strValue1 = new StringValue( atCN, "test1" );
- Value<String> strValue2 = new StringValue( atCN, "test2" );
- Value<String> strValue3 = new StringValue( atCN, "test3" );
- Value<String> strNullValue = new StringValue( atCN, null );
+ Value<String> strValue1 = new StringValue( atDC, "test1" );
+ Value<String> strValue2 = new StringValue( atDC, "test2" );
+ Value<String> strValue3 = new StringValue( atDC, "test3" );
+ Value<String> strNullValue = new StringValue( atDC, null );
Value<byte[]> binValue1 = new BinaryValue( atPwd, BYTES1 );
@@ -2346,7 +2346,7 @@ public class SchemaAwareEntryTest
try
{
- entry.put( "badAttr", atCN, strValue1 );
+ entry.put( "badAttr", atDC, strValue1 );
fail();
}
catch ( LdapNoSuchAttributeException nsae )
@@ -2354,29 +2354,29 @@ public class SchemaAwareEntryTest
assertTrue( true );
}
- entry.put( "Cn", atCN, strNullValue );
+ entry.put( "Dc", atDC, strNullValue );
assertEquals( 1, entry.size() );
- assertTrue( entry.containsAttribute( atCN ) );
- assertTrue( entry.contains( atCN, ( String ) null ) );
- assertEquals( "Cn", entry.get( atCN ).getUpId() );
+ assertTrue( entry.containsAttribute( atDC ) );
+ assertTrue( entry.contains( atDC, ( String ) null ) );
+ assertEquals( "Dc", entry.get( atDC ).getUpId() );
- EntryAttribute replaced = entry.put( "commonName", atCN, strValue1, strValue2, strValue1 );
+ EntryAttribute replaced = entry.put( "domainComponent", atDC, strValue1, strValue2, strValue1 );
assertNotNull( replaced );
- assertEquals( atCN, replaced.getAttributeType() );
+ assertEquals( atDC, replaced.getAttributeType() );
assertTrue( replaced.contains( ( String ) null ) );
assertEquals( 1, entry.size() );
- assertTrue( entry.contains( atCN, strValue1, strValue2 ) );
- assertFalse( entry.contains( atCN, strValue3 ) );
- assertEquals( 2, entry.get( atCN ).size() );
- assertEquals( "commonName", entry.get( atCN ).getUpId() );
+ assertTrue( entry.contains( atDC, strValue1, strValue2 ) );
+ assertFalse( entry.contains( atDC, strValue3 ) );
+ assertEquals( 2, entry.get( atDC ).size() );
+ assertEquals( "domainComponent", entry.get( atDC ).getUpId() );
- replaced = entry.put( "2.5.4.3", atCN, binValue1 );
+ replaced = entry.put( "0.9.2342.19200300.100.1.25", atDC, binValue1 );
assertNotNull( replaced );
assertTrue( replaced.contains( strValue1, strValue2 ) );
- EntryAttribute attribute = entry.get( atCN );
+ EntryAttribute attribute = entry.get( atDC );
assertEquals( 0, attribute.size() );
- assertEquals( "2.5.4.3", entry.get( atCN ).getUpId() );
+ assertEquals( "0.9.2342.19200300.100.1.25", entry.get( atDC ).getUpId() );
}
@@ -2486,12 +2486,12 @@ public class SchemaAwareEntryTest
assertTrue( true );
}
- EntryAttribute replaced = entry.put( "description", ( String ) null );
+ EntryAttribute replaced = entry.put( "dc", ( String ) null );
assertNull( replaced );
assertEquals( 1, entry.size() );
- assertNotNull( entry.get( "description" ) );
- assertEquals( 0, entry.get( "description" ).size() );
- assertNull( entry.get( "description" ).get() );
+ assertNotNull( entry.get( "dc" ) );
+ assertEquals( 1, entry.get( "dc" ).size() );
+ assertNotNull( entry.get( "dc" ).get() );
replaced = entry.put( "CN", "test" );
assertNull( replaced );
@@ -2521,14 +2521,14 @@ public class SchemaAwareEntryTest
* Test method for put( String, Value<?>... )
*/
@Test
- public void testPutStringValueArray()
+ public void testPutStringValueArray() throws LdapException
{
Entry entry = new DefaultEntry( schemaManager, EXAMPLE_DN );
- Value<String> strValue1 = new StringValue( atCN, "test1" );
- Value<String> strValue2 = new StringValue( atCN, "test2" );
- Value<String> strValue3 = new StringValue( atCN, "test3" );
- Value<String> strNullValue = new StringValue( atCN, null );
+ Value<String> strValue1 = new StringValue( atDC, "test1" );
+ Value<String> strValue2 = new StringValue( atDC, "test2" );
+ Value<String> strValue3 = new StringValue( atDC, "test3" );
+ Value<String> strNullValue = new StringValue( atDC, null );
Value<byte[]> binValue1 = new BinaryValue( atPwd, BYTES1 );
@@ -2562,39 +2562,40 @@ public class SchemaAwareEntryTest
assertTrue( true );
}
- EntryAttribute replaced = entry.put( "description", strNullValue );
+ EntryAttribute replaced = entry.put( "domainComponent", strNullValue );
assertNull( replaced );
assertEquals( 1, entry.size() );
- assertNotNull( entry.get( "description" ) );
- assertEquals( 1, entry.get( "description" ).size() );
- assertNotNull( entry.get( "description" ).get() );
- assertNull( entry.get( "description" ).get().get() );
+ assertNotNull( entry.get( "domainComponent" ) );
+ assertEquals( 1, entry.get( "domainComponent" ).size() );
+ assertNotNull( entry.get( "domainComponent" ).get() );
+ assertNull( entry.get( "domainComponent" ).get().get() );
+ entry.removeAttributes( "dc" );
- replaced = entry.put( "CN", strValue3 );
+ replaced = entry.put( "DC", strValue3 );
assertNull( replaced );
- assertEquals( 2, entry.size() );
- assertNotNull( entry.get( "cn" ) );
- assertEquals( 1, entry.get( "cn" ).size() );
- assertNotNull( entry.get( "cn" ).get().get() );
- assertTrue( entry.get( "cn" ).contains( strValue3 ) );
+ assertEquals( 1, entry.size() );
+ assertNotNull( entry.get( "dc" ) );
+ assertEquals( 1, entry.get( "dc" ).size() );
+ assertNotNull( entry.get( "dc" ).get().get() );
+ assertTrue( entry.get( "dc" ).contains( strValue3 ) );
- replaced = entry.put( "cN", strValue1, strValue2, strValue1 );
+ replaced = entry.put( "dC", strValue1, strValue2, strValue1 );
assertNotNull( replaced );
assertEquals( strValue3, replaced.get() );
- assertEquals( 2, entry.size() );
- assertNotNull( entry.get( "cn" ) );
- assertEquals( 2, entry.get( "CN" ).size() );
+ assertEquals( 1, entry.size() );
+ assertNotNull( entry.get( "dc" ) );
+ assertEquals( 2, entry.get( "DC" ).size() );
- EntryAttribute attribute = entry.get( "cn" );
+ EntryAttribute attribute = entry.get( "dc" );
assertTrue( attribute.contains( strValue1 ) );
assertTrue( attribute.contains( strValue2 ) );
- assertEquals( "2.5.4.3", attribute.getId() );
- assertEquals( "cN", attribute.getUpId() );
+ assertEquals( "0.9.2342.19200300.100.1.25", attribute.getId() );
+ assertEquals( "dC", attribute.getUpId() );
// Bin values are not allowed, so the new CN will be empty
- entry.put( "cn", binValue1 );
- assertNull( entry.get( "cn" ).get() );
+ entry.put( "dc", binValue1 );
+ assertNull( entry.get( "dc" ).get() );
}
@@ -2809,10 +2810,10 @@ public class SchemaAwareEntryTest
DefaultEntry entry = new DefaultEntry( schemaManager, dn );
// Adding a null value to an attribute
- entry.put( atCN, ( Value<?> ) null );
+ entry.put( atDC, ( Value<?> ) null );
assertEquals( 1, entry.size() );
- assertEquals( "cn", entry.get( atCN ).getUpId() );
+ assertEquals( "dc", entry.get( atDC ).getUpId() );
// Check that we can't use invalid arguments
try
@@ -2830,7 +2831,7 @@ public class SchemaAwareEntryTest
Value<?> ssv = new StringValue( atCN, "test" );
entry.put( atCN, ssv );
- assertEquals( 1, entry.size() );
+ assertEquals( 2, entry.size() );
assertEquals( "cn", entry.get( atCN ).getUpId() );
assertEquals( 1, entry.get( atCN ).size() );
assertEquals( "test", entry.get( atCN ).get().getString() );
@@ -2839,7 +2840,7 @@ public class SchemaAwareEntryTest
entry.put( atCN, new StringValue( atCN, "test1" ), new StringValue( atCN, "test2" ), new StringValue( atCN,
"test3" ) );
- assertEquals( 1, entry.size() );
+ assertEquals( 2, entry.size() );
assertEquals( "cn", entry.get( atCN ).getUpId() );
assertEquals( 3, entry.get( atCN ).size() );
assertTrue( entry.contains( "cn", "test1" ) );
@@ -2852,7 +2853,7 @@ public class SchemaAwareEntryTest
assertEquals( 3, sa.size() );
assertTrue( sa.contains( "test1", "test2", "test3" ) );
- assertEquals( 1, entry.size() );
+ assertEquals( 2, entry.size() );
assertEquals( "cn", entry.get( atCN ).getUpId() );
assertEquals( 2, entry.get( atCN ).size() );
assertTrue( entry.contains( "cn", "test1" ) );
@@ -3146,32 +3147,32 @@ public class SchemaAwareEntryTest
}
// Test an empty AT
- entry.put( "commonName", atCN, ( Value<?> ) null );
+ entry.put( "domainComponent", atDC, ( Value<?> ) null );
assertEquals( 1, entry.size() );
- assertEquals( "commonName", entry.get( atCN ).getUpId() );
- assertTrue( entry.containsAttribute( "cn" ) );
- assertNull( entry.get( atCN ).get().get() );
+ assertEquals( "domainComponent", entry.get( atDC ).getUpId() );
+ assertTrue( entry.containsAttribute( "dc" ) );
+ assertNull( entry.get( atDC ).get().get() );
// Check that we can use a null AttributeType
- entry.put( "commonName", ( AttributeType ) null, ( Value<?> ) null );
+ entry.put( "domainComponent", ( AttributeType ) null, ( Value<?> ) null );
assertEquals( 1, entry.size() );
- assertEquals( "commonName", entry.get( atCN ).getUpId() );
- assertTrue( entry.containsAttribute( "cn" ) );
- assertNull( entry.get( atCN ).get().get() );
+ assertEquals( "domainComponent", entry.get( atDC ).getUpId() );
+ assertTrue( entry.containsAttribute( "dc" ) );
+ assertNull( entry.get( atDC ).get().get() );
// Test that we can use a null upId
- entry.put( null, atCN, ( Value<?> ) null );
+ entry.put( null, atDC, ( Value<?> ) null );
assertEquals( 1, entry.size() );
- assertEquals( "cn", entry.get( atCN ).getUpId() );
- assertTrue( entry.containsAttribute( "cn" ) );
- assertNull( entry.get( atCN ).get().get() );
+ assertEquals( "dc", entry.get( atDC ).getUpId() );
+ assertTrue( entry.containsAttribute( "dc" ) );
+ assertNull( entry.get( atDC ).get().get() );
// Test that we can't use an upId which is not compatible
// with the AT
try
{
- entry.put( "sn", atCN, ( Value<?> ) null );
+ entry.put( "sn", atDC, ( Value<?> ) null );
fail();
}
catch ( IllegalArgumentException iae )
@@ -3180,19 +3181,19 @@ public class SchemaAwareEntryTest
}
// Test that we can add some new attributes with values
- Value<String> test1 = new StringValue( atCN, "test1" );
- Value<String> test2 = new StringValue( atCN, "test2" );
- Value<String> test3 = new StringValue( atCN, "test3" );
+ Value<String> test1 = new StringValue( atDC, "test1" );
+ Value<String> test2 = new StringValue( atDC, "test2" );
+ Value<String> test3 = new StringValue( atDC, "test3" );
- EntryAttribute result = entry.put( "CN", atCN, test1, test2, test3 );
+ EntryAttribute result = entry.put( "DC", atDC, test1, test2, test3 );
assertNotNull( result );
- assertEquals( "cn", result.getUpId() );
+ assertEquals( "dc", result.getUpId() );
assertEquals( 1, entry.size() );
- assertEquals( "CN", entry.get( atCN ).getUpId() );
- assertNotNull( entry.get( atCN ).get() );
- assertTrue( entry.contains( "cn", "test1" ) );
- assertTrue( entry.contains( "CN", "test2" ) );
- assertTrue( entry.contains( "commonName", "test3" ) );
+ assertEquals( "DC", entry.get( atDC ).getUpId() );
+ assertNotNull( entry.get( atDC ).get() );
+ assertTrue( entry.contains( "dc", "test1" ) );
+ assertTrue( entry.contains( "DC", "test2" ) );
+ assertTrue( entry.contains( "domainComponent", "test3" ) );
}
@@ -3217,26 +3218,26 @@ public class SchemaAwareEntryTest
}
// Test an null valued AT
- entry.put( "commonName", ( Value<?> ) null );
+ entry.put( "domainComponent", ( Value<?> ) null );
assertEquals( 1, entry.size() );
- assertEquals( "commonName", entry.get( atCN ).getUpId() );
- assertTrue( entry.containsAttribute( "cn" ) );
- assertNull( entry.get( atCN ).get().get() );
+ assertEquals( "domainComponent", entry.get( atDC ).getUpId() );
+ assertTrue( entry.containsAttribute( "dc" ) );
+ assertNull( entry.get( atDC ).get().get() );
// Test that we can add some new attributes with values
- Value<String> test1 = new StringValue( atCN, "test1" );
- Value<String> test2 = new StringValue( atCN, "test2" );
- Value<String> test3 = new StringValue( atCN, "test3" );
+ Value<String> test1 = new StringValue( atDC, "test1" );
+ Value<String> test2 = new StringValue( atDC, "test2" );
+ Value<String> test3 = new StringValue( atDC, "test3" );
- EntryAttribute result = entry.put( "CN", test1, test2, test3 );
+ EntryAttribute result = entry.put( "DC", test1, test2, test3 );
assertNotNull( result );
- assertEquals( "commonName", result.getUpId() );
+ assertEquals( "domainComponent", result.getUpId() );
assertEquals( 1, entry.size() );
- assertEquals( "CN", entry.get( atCN ).getUpId() );
- assertNotNull( entry.get( atCN ).get() );
- assertTrue( entry.contains( "cn", "test1" ) );
- assertTrue( entry.contains( "CN", "test2" ) );
- assertTrue( entry.contains( "commonName", "test3" ) );
+ assertEquals( "DC", entry.get( atDC ).getUpId() );
+ assertNotNull( entry.get( atDC ).get() );
+ assertTrue( entry.contains( "dc", "test1" ) );
+ assertTrue( entry.contains( "DC", "test2" ) );
+ assertTrue( entry.contains( "domainComponent", "test3" ) );
}
@@ -3909,12 +3910,17 @@ public class SchemaAwareEntryTest
Value<byte[]> binValue2 = new BinaryValue( BYTES2 );
Value<byte[]> binNullValue = new BinaryValue( ( byte[] ) null );
- entry.put( "ObjectClass", atOC, strValueTop, strValuePerson, strNullValue );
+ entry.put( "ObjectClass", atOC, strValueTop, strValuePerson );
entry.put( "UserPassword", atPwd, binValue1, binValue2, binNullValue );
- String expected = "Entry\n" + " dn[n]: dc=example,dc=com\n" + " ObjectClass: top\n"
- + " ObjectClass: person\n" + " ObjectClass: ''\n" + " UserPassword: '0x61 0x62 '\n"
- + " UserPassword: '0x62 '\n" + " UserPassword: ''\n";
+ String expected =
+ "Entry\n" +
+ " dn[n]: dc=example,dc=com\n" +
+ " ObjectClass: top\n" +
+ " ObjectClass: person\n" +
+ " UserPassword: '0x61 0x62 '\n" +
+ " UserPassword: '0x62 '\n" +
+ " UserPassword: ''\n";
assertEquals( expected, entry.toString() );
}
Modified: directory/apacheds/trunk/core-api/src/test/java/org/apache/directory/server/core/entry/SchemaAwareModificationTest.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/core-api/src/test/java/org/apache/directory/server/core/entry/SchemaAwareModificationTest.java?rev=1085791&r1=1085790&r2=1085791&view=diff
==============================================================================
--- directory/apacheds/trunk/core-api/src/test/java/org/apache/directory/server/core/entry/SchemaAwareModificationTest.java (original)
+++ directory/apacheds/trunk/core-api/src/test/java/org/apache/directory/server/core/entry/SchemaAwareModificationTest.java Sat Mar 26 19:19:28 2011
@@ -185,7 +185,7 @@ public class SchemaAwareModificationTest
@Test
- public void testCreateClientModification()
+ public void testCreateClientModification() throws LdapException
{
EntryAttribute attribute = new DefaultEntryAttribute( atCN );
attribute.add( "test1", "test2" );
@@ -211,7 +211,7 @@ public class SchemaAwareModificationTest
*
*/
@Test
- public void testCopyClientModification()
+ public void testCopyClientModification() throws LdapException
{
EntryAttribute attribute = new DefaultEntryAttribute( atC );
attribute.add( "test1", "test2" );
@@ -236,7 +236,7 @@ public class SchemaAwareModificationTest
*
*/
@Test
- public void testCopyModification()
+ public void testCopyModification() throws LdapException
{
EntryAttribute attribute = new DefaultEntryAttribute( atC.getName() );
attribute.add( "test1", "test2" );
Modified: directory/apacheds/trunk/core-integ/src/test/java/org/apache/directory/server/core/authz/CompareAuthorizationIT.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/core-integ/src/test/java/org/apache/directory/server/core/authz/CompareAuthorizationIT.java?rev=1085791&r1=1085790&r2=1085791&view=diff
==============================================================================
--- directory/apacheds/trunk/core-integ/src/test/java/org/apache/directory/server/core/authz/CompareAuthorizationIT.java (original)
+++ directory/apacheds/trunk/core-integ/src/test/java/org/apache/directory/server/core/authz/CompareAuthorizationIT.java Sat Mar 26 19:19:28 2011
@@ -151,7 +151,7 @@ public class CompareAuthorizationIT exte
" authenticationLevel none, " +
" itemOrUserFirst userFirst: " +
" { " +
- " userClasses { userGroup { \"cn=Administrators,ou=groups,ou=system\" } }" +
+ " userClasses { userGroup { \"cn=Administrators,ou=groups,ou=system\" } }," +
" userPermissions " +
" { " +
" { " +
Modified: directory/apacheds/trunk/core-integ/src/test/java/org/apache/directory/server/core/operational/OperationalAttributeServiceIT.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/core-integ/src/test/java/org/apache/directory/server/core/operational/OperationalAttributeServiceIT.java?rev=1085791&r1=1085790&r2=1085791&view=diff
==============================================================================
--- directory/apacheds/trunk/core-integ/src/test/java/org/apache/directory/server/core/operational/OperationalAttributeServiceIT.java (original)
+++ directory/apacheds/trunk/core-integ/src/test/java/org/apache/directory/server/core/operational/OperationalAttributeServiceIT.java Sat Mar 26 19:19:28 2011
@@ -96,10 +96,15 @@ public class OperationalAttributeService
@Test
public void testBinaryAttributeFilterExtension() throws Exception
{
- Entry entry = LdifUtils
- .createEntry( new Dn( "ou=test,ou=system" ), "objectClass: top", "objectClass: person",
- "objectClass: organizationalPerson", "objectClass: inetOrgPerson", "ou", "test", "cn", "test", "sn",
- "test" );
+ Entry entry = LdifUtils.createEntry(
+ new Dn( "ou=test,ou=system" ),
+ "objectClass: top",
+ "objectClass: person",
+ "objectClass: organizationalPerson",
+ "objectClass: inetOrgPerson",
+ "ou", "test",
+ "cn", "test",
+ "sn", "test" );
connection.add( entry );
@@ -115,7 +120,7 @@ public class OperationalAttributeService
0x23, 0x7d, 0x7f };
entry.put( "jpegPhoto", keyValue );
entry.setDn( new Dn( "ou=anothertest,ou=system" ) );
- entry.set( "ou", "anothertest" );
+ entry.put( "ou", "anothertest" );
connection.add( entry );
Entry loadedEntry = connection.lookup( "ou=anothertest,ou=system" );
ou = loadedEntry.get( "ou" );
Modified: directory/apacheds/trunk/core-jndi/src/main/java/org/apache/directory/server/core/jndi/ServerLdapContext.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/core-jndi/src/main/java/org/apache/directory/server/core/jndi/ServerLdapContext.java?rev=1085791&r1=1085790&r2=1085791&view=diff
==============================================================================
--- directory/apacheds/trunk/core-jndi/src/main/java/org/apache/directory/server/core/jndi/ServerLdapContext.java (original)
+++ directory/apacheds/trunk/core-jndi/src/main/java/org/apache/directory/server/core/jndi/ServerLdapContext.java Sat Mar 26 19:19:28 2011
@@ -39,15 +39,16 @@ import org.apache.directory.server.core.
import org.apache.directory.server.i18n.I18n;
import org.apache.directory.shared.asn1.DecoderException;
import org.apache.directory.shared.asn1.EncoderException;
-import org.apache.directory.shared.ldap.model.name.Dn;
-import org.apache.directory.shared.ldap.util.JndiUtils;
-import org.apache.directory.shared.util.exception.NotImplementedException;
import org.apache.directory.shared.ldap.model.entry.BinaryValue;
import org.apache.directory.shared.ldap.model.entry.StringValue;
import org.apache.directory.shared.ldap.model.entry.Value;
import org.apache.directory.shared.ldap.model.exception.LdapException;
+import org.apache.directory.shared.ldap.model.exception.LdapInvalidAttributeValueException;
+import org.apache.directory.shared.ldap.model.name.Dn;
import org.apache.directory.shared.ldap.model.schema.AttributeType;
+import org.apache.directory.shared.ldap.util.JndiUtils;
import org.apache.directory.shared.util.Strings;
+import org.apache.directory.shared.util.exception.NotImplementedException;
/**
@@ -202,39 +203,46 @@ public class ServerLdapContext extends S
}
// make sure we add the request controls to operation
- if ( attributeType.getSyntax().isHumanReadable() )
- {
- if ( value instanceof String )
- {
- val = new StringValue( attributeType, (String)value );
- }
- else if ( value instanceof byte[] )
+ try
+ {
+ if ( attributeType.getSyntax().isHumanReadable() )
{
- val = new StringValue( attributeType, Strings.utf8ToString((byte[]) value) );
+ if ( value instanceof String )
+ {
+ val = new StringValue( attributeType, (String)value );
+ }
+ else if ( value instanceof byte[] )
+ {
+ val = new StringValue( attributeType, Strings.utf8ToString((byte[]) value) );
+ }
+ else
+ {
+ throw new NamingException( I18n.err( I18n.ERR_309, oid ) );
+ }
}
else
{
- throw new NamingException( I18n.err( I18n.ERR_309, oid ) );
+ if ( value instanceof String )
+ {
+ val = new BinaryValue( attributeType, Strings.getBytesUtf8((String) value) );
+ }
+ else if ( value instanceof byte[] )
+ {
+ val = new BinaryValue( attributeType, (byte[])value );
+ }
+ else
+ {
+ throw new NamingException( I18n.err( I18n.ERR_309, oid ) );
+ }
}
}
- else
+ catch ( LdapInvalidAttributeValueException liave )
{
- if ( value instanceof String )
- {
- val = new BinaryValue( attributeType, Strings.getBytesUtf8((String) value) );
- }
- else if ( value instanceof byte[] )
- {
- val = new BinaryValue( attributeType, (byte[])value );
- }
- else
- {
- throw new NamingException( I18n.err( I18n.ERR_309, oid ) );
- }
+ throw new NamingException( I18n.err( I18n.ERR_309, oid ) );
}
-
CompareOperationContext opCtx = new CompareOperationContext( getSession(), name, oid, val );
+
try
{
opCtx.addRequestControls( JndiUtils.fromJndiControls( getDirectoryService().getLdapCodecService(),
Modified: directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/event/LeafEvaluator.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/event/LeafEvaluator.java?rev=1085791&r1=1085790&r2=1085791&view=diff
==============================================================================
--- directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/event/LeafEvaluator.java (original)
+++ directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/event/LeafEvaluator.java Sat Mar 26 19:19:28 2011
@@ -22,8 +22,6 @@ package org.apache.directory.server.core
import java.util.Comparator;
-import javax.management.modelmbean.ModelMBean;
-
import org.apache.directory.server.i18n.I18n;
import org.apache.directory.shared.ldap.model.entry.Entry;
import org.apache.directory.shared.ldap.model.entry.EntryAttribute;
@@ -265,13 +263,13 @@ public class LeafEvaluator implements Ev
if ( attributeType.getSyntax().isHumanReadable() )
{
- if ( node.getValue().isBinary() )
+ if ( node.getValue().isHR() )
{
- value = new org.apache.directory.shared.ldap.model.entry.StringValue( node.getValue().getString() );
+ value = node.getValue();
}
else
{
- value = node.getValue();
+ value = new org.apache.directory.shared.ldap.model.entry.StringValue( node.getValue().getString() );
}
}
else
Modified: directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/hash/PasswordHashingInterceptor.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/hash/PasswordHashingInterceptor.java?rev=1085791&r1=1085790&r2=1085791&view=diff
==============================================================================
--- directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/hash/PasswordHashingInterceptor.java (original)
+++ directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/hash/PasswordHashingInterceptor.java Sat Mar 26 19:19:28 2011
@@ -124,7 +124,7 @@ public class PasswordHashingInterceptor
*
* @param pwdAt the password attribute
*/
- private void includeHashedPassword( EntryAttribute pwdAt )
+ private void includeHashedPassword( EntryAttribute pwdAt ) throws LdapException
{
if ( pwdAt == null )
{
Modified: directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/normalization/NormalizationInterceptor.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/normalization/NormalizationInterceptor.java?rev=1085791&r1=1085790&r2=1085791&view=diff
==============================================================================
--- directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/normalization/NormalizationInterceptor.java (original)
+++ directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/normalization/NormalizationInterceptor.java Sat Mar 26 19:19:28 2011
@@ -365,7 +365,7 @@ public class NormalizationInterceptor ex
AttributeType attributeType = schemaManager.lookupAttributeTypeRegistry( compareContext.getOid() );
// Translate the value from binary to String if the AT is HR
- if ( attributeType.getSyntax().isHumanReadable() && ( compareContext.getValue().isBinary() ) )
+ if ( attributeType.getSyntax().isHumanReadable() && ( !compareContext.getValue().isHR() ) )
{
String value = compareContext.getValue().getString();
compareContext.setValue( new StringValue( value ) );
Modified: directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/schema/SchemaInterceptor.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/schema/SchemaInterceptor.java?rev=1085791&r1=1085790&r2=1085791&view=diff
==============================================================================
--- directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/schema/SchemaInterceptor.java (original)
+++ directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/schema/SchemaInterceptor.java Sat Mar 26 19:19:28 2011
@@ -989,7 +989,7 @@ public class SchemaInterceptor extends B
/**
* Create a new attribute using the given values
*/
- private EntryAttribute createNewAttribute( EntryAttribute attribute )
+ private EntryAttribute createNewAttribute( EntryAttribute attribute ) throws LdapException
{
AttributeType attributeType = attribute.getAttributeType();
@@ -1743,7 +1743,7 @@ public class SchemaInterceptor extends B
// Then loop on all values
for ( Value<?> value : attribute )
{
- if ( value.isValid() )
+ if ( value.isSchemaAware() )
{
// No need to validate something which is already ok
continue;
Modified: directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/subtree/SubentryInterceptor.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/subtree/SubentryInterceptor.java?rev=1085791&r1=1085790&r2=1085791&view=diff
==============================================================================
--- directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/subtree/SubentryInterceptor.java (original)
+++ directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/subtree/SubentryInterceptor.java Sat Mar 26 19:19:28 2011
@@ -587,7 +587,8 @@ public class SubentryInterceptor extends
* Update the list of modifications with a modification associated with a specific
* role, if it's requested.
*/
- private void getOperationalModForReplace( boolean hasRole, AttributeType attributeType, Entry entry, Dn oldDn, Dn newDn, List<Modification> modifications )
+ private void getOperationalModForReplace( boolean hasRole, AttributeType attributeType, Entry entry, Dn oldDn, Dn newDn, List<Modification> modifications )
+ throws LdapInvalidAttributeValueException
{
String oldDnStr = oldDn.getNormName();
String newDnStr = newDn.getNormName();
Modified: directory/apacheds/trunk/core/src/test/java/org/apache/directory/server/core/normalization/NormalizationVisitorTest.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/core/src/test/java/org/apache/directory/server/core/normalization/NormalizationVisitorTest.java?rev=1085791&r1=1085790&r2=1085791&view=diff
==============================================================================
--- directory/apacheds/trunk/core/src/test/java/org/apache/directory/server/core/normalization/NormalizationVisitorTest.java (original)
+++ directory/apacheds/trunk/core/src/test/java/org/apache/directory/server/core/normalization/NormalizationVisitorTest.java Sat Mar 26 19:19:28 2011
@@ -27,9 +27,11 @@ import static org.junit.Assert.fail;
import java.text.ParseException;
-import com.mycila.junit.concurrent.Concurrency;
-import com.mycila.junit.concurrent.ConcurrentJunitRunner;
-import org.apache.directory.shared.ldap.model.filter.*;
+import org.apache.directory.shared.ldap.model.filter.EqualityNode;
+import org.apache.directory.shared.ldap.model.filter.ExprNode;
+import org.apache.directory.shared.ldap.model.filter.FilterParser;
+import org.apache.directory.shared.ldap.model.filter.NotNode;
+import org.apache.directory.shared.ldap.model.filter.PresenceNode;
import org.apache.directory.shared.ldap.model.schema.SchemaManager;
import org.apache.directory.shared.ldap.model.schema.normalizers.ConcreteNameComponentNormalizer;
import org.apache.directory.shared.ldap.model.schema.normalizers.NameComponentNormalizer;
@@ -40,6 +42,9 @@ import org.junit.BeforeClass;
import org.junit.Test;
import org.junit.runner.RunWith;
+import com.mycila.junit.concurrent.Concurrency;
+import com.mycila.junit.concurrent.ConcurrentJunitRunner;
+
/**
* A class to test the normalizing Visitor
@@ -87,7 +92,7 @@ public class NormalizationVisitorTest
assertTrue( result instanceof EqualityNode<?>);
EqualityNode<?> equalityNode = ( EqualityNode<?> ) result;
- assertEquals( "test 1", equalityNode.getValue().getNormalizedValue() );
+ assertEquals( "test 1", equalityNode.getValue().getNormValue() );
assertEquals( "2.5.4.11", equalityNode.getAttributeType().getOid() );
}
Modified: directory/apacheds/trunk/jdbm-partition/src/test/java/org/apache/directory/server/core/partition/impl/btree/jdbm/ServerEntrySerializerTest.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/jdbm-partition/src/test/java/org/apache/directory/server/core/partition/impl/btree/jdbm/ServerEntrySerializerTest.java?rev=1085791&r1=1085790&r2=1085791&view=diff
==============================================================================
--- directory/apacheds/trunk/jdbm-partition/src/test/java/org/apache/directory/server/core/partition/impl/btree/jdbm/ServerEntrySerializerTest.java (original)
+++ directory/apacheds/trunk/jdbm-partition/src/test/java/org/apache/directory/server/core/partition/impl/btree/jdbm/ServerEntrySerializerTest.java Sat Mar 26 19:19:28 2011
@@ -195,7 +195,7 @@ public class ServerEntrySerializerTest
Entry entry = new DefaultEntry( schemaManager, dn );
entry.add( "objectClass", "top", "person", "inetOrgPerson", "organizationalPerson" );
entry.add( "cn", "text", "test" );
- entry.add( "SN", ( String ) null );
+ entry.add( "SN", "Test" );
entry.add( "userPassword", Strings.getBytesUtf8("password") );
ServerEntrySerializer ses = new ServerEntrySerializer( schemaManager );
@@ -221,7 +221,7 @@ public class ServerEntrySerializerTest
Entry entry = new DefaultEntry( schemaManager, dn );
entry.add( "objectClass", "top", "person", "inetOrgPerson", "organizationalPerson" );
entry.add( "cn", "text", "test" );
- entry.add( "SN", ( String ) null );
+ entry.add( "SN", "Test" );
entry.add( "userPassword", Strings.getBytesUtf8("password") );
ServerEntrySerializer ses = new ServerEntrySerializer( schemaManager );
Modified: directory/apacheds/trunk/ldap-client-test/src/test/java/org/apache/directory/shared/client/api/LdapConnectionTest.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/ldap-client-test/src/test/java/org/apache/directory/shared/client/api/LdapConnectionTest.java?rev=1085791&r1=1085790&r2=1085791&view=diff
==============================================================================
--- directory/apacheds/trunk/ldap-client-test/src/test/java/org/apache/directory/shared/client/api/LdapConnectionTest.java (original)
+++ directory/apacheds/trunk/ldap-client-test/src/test/java/org/apache/directory/shared/client/api/LdapConnectionTest.java Sat Mar 26 19:19:28 2011
@@ -167,12 +167,12 @@ public class LdapConnectionTest extends
public void testRetrieveBinaryAttibute() throws Exception
{
Entry entry = connection.lookup( "uid=admin,ou=system" );
- assertFalse( entry.get( SchemaConstants.USER_PASSWORD_AT ).get().isBinary() );
+ assertTrue( entry.get( SchemaConstants.USER_PASSWORD_AT ).get().isHR() );
connection.loadSchema();
entry = connection.lookup( "uid=admin,ou=system" );
- assertTrue( entry.get( SchemaConstants.USER_PASSWORD_AT ).get().isBinary() );
+ assertFalse( entry.get( SchemaConstants.USER_PASSWORD_AT ).get().isHR() );
}
Modified: directory/apacheds/trunk/ldif-partition/src/main/java/org/apache/directory/server/core/partition/ldif/LdifPartition.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/ldif-partition/src/main/java/org/apache/directory/server/core/partition/ldif/LdifPartition.java?rev=1085791&r1=1085790&r2=1085791&view=diff
==============================================================================
--- directory/apacheds/trunk/ldif-partition/src/main/java/org/apache/directory/server/core/partition/ldif/LdifPartition.java (original)
+++ directory/apacheds/trunk/ldif-partition/src/main/java/org/apache/directory/server/core/partition/ldif/LdifPartition.java Sat Mar 26 19:19:28 2011
@@ -772,7 +772,14 @@ public class LdifPartition extends Abstr
// What can we do here ???
}
- this.contextEntry = new DefaultEntry( schemaManager, entries.get( 0 ).getEntry() );
+ try
+ {
+ this.contextEntry = new DefaultEntry( schemaManager, entries.get( 0 ).getEntry() );
+ }
+ catch ( LdapException le )
+ {
+ throw new LdapLdifException( le.getMessage() );
+ }
}
Modified: directory/apacheds/trunk/server-config/src/main/java/org/apache/directory/server/config/ConfigWriter.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/server-config/src/main/java/org/apache/directory/server/config/ConfigWriter.java?rev=1085791&r1=1085790&r2=1085791&view=diff
==============================================================================
--- directory/apacheds/trunk/server-config/src/main/java/org/apache/directory/server/config/ConfigWriter.java (original)
+++ directory/apacheds/trunk/server-config/src/main/java/org/apache/directory/server/config/ConfigWriter.java Sat Mar 26 19:19:28 2011
@@ -603,7 +603,7 @@ public class ConfigWriter
* @param value
* the value
*/
- private void addAttributeTypeValue( EntryAttribute attribute, Object value )
+ private void addAttributeTypeValue( EntryAttribute attribute, Object value ) throws LdapException
{
// We don't store a 'null' value
if ( value != null )
Modified: directory/apacheds/trunk/server-config/src/test/resources/ldapServer.ldif
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/server-config/src/test/resources/ldapServer.ldif?rev=1085791&r1=1085790&r2=1085791&view=diff
==============================================================================
--- directory/apacheds/trunk/server-config/src/test/resources/ldapServer.ldif (original)
+++ directory/apacheds/trunk/server-config/src/test/resources/ldapServer.ldif Sat Mar 26 19:19:28 2011
@@ -171,7 +171,7 @@ objectclass: ads-base
objectclass: ads-replConsumer
ads-replConsumerId: test
ads-dsReplicaId: test
-ads-replAliasDerefMode: NEVER_DEREF
+ads-replAliasDerefMode: NEVER
ads-searchBaseDN: ads-directoryServiceId=default,ou=config
ads-replLastSentCsn: 20100509111949.005000Z#000000#000#000000
ads-replSearchScope: SUBTREE
@@ -190,7 +190,7 @@ ads-dsReplicaId: test
ads-searchBaseDN: ads-directoryServiceId=default,ou=config
ads-replProvHostName: localhost
ads-replProvPort: 12345
-ads-replAliasDerefMode: NEVER_DEREF
+ads-replAliasDerefMode: NEVER
ads-replAttribute: acme
ads-replRefreshInterval: 100
ads-replRefreshNPersist: TRUE
Modified: directory/apacheds/trunk/xdbm-partition/src/main/java/org/apache/directory/server/xdbm/search/impl/ApproximateEvaluator.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/xdbm-partition/src/main/java/org/apache/directory/server/xdbm/search/impl/ApproximateEvaluator.java?rev=1085791&r1=1085790&r2=1085791&view=diff
==============================================================================
--- directory/apacheds/trunk/xdbm-partition/src/main/java/org/apache/directory/server/xdbm/search/impl/ApproximateEvaluator.java (original)
+++ directory/apacheds/trunk/xdbm-partition/src/main/java/org/apache/directory/server/xdbm/search/impl/ApproximateEvaluator.java Sat Mar 26 19:19:28 2011
@@ -147,7 +147,7 @@ public class ApproximateEvaluator<T, ID
}
- // TODO - determine if comaparator and index entry should have the Value
+ // TODO - determine if comparator and index entry should have the Value
// wrapper or the raw normalized value
private boolean evaluate( EntryAttribute attribute ) throws Exception
{
@@ -160,10 +160,8 @@ public class ApproximateEvaluator<T, ID
for ( Value value : attribute )
{
- value.normalize( normalizer );
-
//noinspection unchecked
- if ( ldapComparator.compare( value.getNormalizedValue(), node.getValue().getNormalizedValue() ) == 0 )
+ if ( ldapComparator.compare( value.getNormValue(), node.getValue().getNormValue() ) == 0 )
{
return true;
}
Modified: directory/apacheds/trunk/xdbm-partition/src/main/java/org/apache/directory/server/xdbm/search/impl/EqualityEvaluator.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/xdbm-partition/src/main/java/org/apache/directory/server/xdbm/search/impl/EqualityEvaluator.java?rev=1085791&r1=1085790&r2=1085791&view=diff
==============================================================================
--- directory/apacheds/trunk/xdbm-partition/src/main/java/org/apache/directory/server/xdbm/search/impl/EqualityEvaluator.java (original)
+++ directory/apacheds/trunk/xdbm-partition/src/main/java/org/apache/directory/server/xdbm/search/impl/EqualityEvaluator.java Sat Mar 26 19:19:28 2011
@@ -174,25 +174,32 @@ public class EqualityEvaluator<T, ID ext
*/
for ( Value<?> value : attribute )
{
- value.normalize( normalizer );
-
//noinspection unchecked
- if ( value.isBinary() )
+ if ( value.isHR() )
{
- // Deal with a binary value
- byte[] serverValue = ( (Value<byte[]>) value ).getNormalizedValue();
- byte[] nodeValue = ( ( Value<byte[]> ) node.getValue() ).getNormalizedValue();
+ // Deal with a String value
+ String serverValue = ( ( Value<String> ) value ).getNormValue();
+ String nodeValue = null;
+
+ if ( node.getValue().isHR() )
+ {
+ nodeValue = ( ( Value<String> ) node.getValue() ).getNormValue();
+ }
+ else
+ {
+ nodeValue = Strings.utf8ToString(((Value<byte[]>) node.getValue()).getNormValue());
+ }
if ( ldapComparator != null )
{
- if ( ldapComparator.compare( (Object)serverValue, (Object)nodeValue ) == 0 )
+ if ( ldapComparator.compare( serverValue, nodeValue ) == 0 )
{
return true;
}
}
else
{
- if ( BINARY_COMPARATOR.compare( serverValue, nodeValue ) == 0 )
+ if ( STRING_COMPARATOR.compare( serverValue, nodeValue ) == 0 )
{
return true;
}
@@ -200,29 +207,20 @@ public class EqualityEvaluator<T, ID ext
}
else
{
- // Deal with a String value
- String serverValue = ( ( Value<String> ) value ).getNormalizedValue();
- String nodeValue = null;
-
- if ( node.getValue().isBinary() )
- {
- nodeValue = Strings.utf8ToString(((Value<byte[]>) node.getValue()).getNormalizedValue());
- }
- else
- {
- nodeValue = ( ( Value<String> ) node.getValue() ).getNormalizedValue();
- }
+ // Deal with a binary value
+ byte[] serverValue = ( (Value<byte[]>) value ).getNormValue();
+ byte[] nodeValue = ( ( Value<byte[]> ) node.getValue() ).getNormValue();
if ( ldapComparator != null )
{
- if ( ldapComparator.compare( serverValue, nodeValue ) == 0 )
+ if ( ldapComparator.compare( (Object)serverValue, (Object)nodeValue ) == 0 )
{
return true;
}
}
else
{
- if ( STRING_COMPARATOR.compare( serverValue, nodeValue ) == 0 )
+ if ( BINARY_COMPARATOR.compare( serverValue, nodeValue ) == 0 )
{
return true;
}
Modified: directory/apacheds/trunk/xdbm-partition/src/main/java/org/apache/directory/server/xdbm/search/impl/GreaterEqEvaluator.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/xdbm-partition/src/main/java/org/apache/directory/server/xdbm/search/impl/GreaterEqEvaluator.java?rev=1085791&r1=1085790&r2=1085791&view=diff
==============================================================================
--- directory/apacheds/trunk/xdbm-partition/src/main/java/org/apache/directory/server/xdbm/search/impl/GreaterEqEvaluator.java (original)
+++ directory/apacheds/trunk/xdbm-partition/src/main/java/org/apache/directory/server/xdbm/search/impl/GreaterEqEvaluator.java Sat Mar 26 19:19:28 2011
@@ -213,14 +213,12 @@ public class GreaterEqEvaluator<T, ID ex
*/
for ( Value value : attribute )
{
- value.normalize( normalizer );
-
//noinspection unchecked
- if ( ldapComparator.compare( value.getNormalizedValue(), node.getValue().getNormalizedValue() ) >= 0 )
+ if ( ldapComparator.compare( value.getNormValue(), node.getValue().getNormValue() ) >= 0 )
{
if ( indexEntry != null )
{
- indexEntry.setValue( value.getNormalizedValue() );
+ indexEntry.setValue( value.getNormValue() );
}
return true;
}
Modified: directory/apacheds/trunk/xdbm-partition/src/main/java/org/apache/directory/server/xdbm/search/impl/LessEqEvaluator.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/xdbm-partition/src/main/java/org/apache/directory/server/xdbm/search/impl/LessEqEvaluator.java?rev=1085791&r1=1085790&r2=1085791&view=diff
==============================================================================
--- directory/apacheds/trunk/xdbm-partition/src/main/java/org/apache/directory/server/xdbm/search/impl/LessEqEvaluator.java (original)
+++ directory/apacheds/trunk/xdbm-partition/src/main/java/org/apache/directory/server/xdbm/search/impl/LessEqEvaluator.java Sat Mar 26 19:19:28 2011
@@ -210,14 +210,12 @@ public class LessEqEvaluator<T, ID exten
*/
for ( Value<?> value : attribute )
{
- value.normalize( normalizer );
-
//noinspection unchecked
- if ( ldapComparator.compare( value.getNormalizedValue(), node.getValue().getNormalizedValue() ) <= 0 )
+ if ( ldapComparator.compare( value.getNormValue(), node.getValue().getNormValue() ) <= 0 )
{
if ( indexEntry != null )
{
- indexEntry.setValue( value.getNormalizedValue() );
+ indexEntry.setValue( value.getNormValue() );
}
return true;
}
Modified: directory/apacheds/trunk/xdbm-partition/src/main/java/org/apache/directory/server/xdbm/search/impl/SubstringEvaluator.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/xdbm-partition/src/main/java/org/apache/directory/server/xdbm/search/impl/SubstringEvaluator.java?rev=1085791&r1=1085790&r2=1085791&view=diff
==============================================================================
--- directory/apacheds/trunk/xdbm-partition/src/main/java/org/apache/directory/server/xdbm/search/impl/SubstringEvaluator.java (original)
+++ directory/apacheds/trunk/xdbm-partition/src/main/java/org/apache/directory/server/xdbm/search/impl/SubstringEvaluator.java Sat Mar 26 19:19:28 2011
@@ -268,8 +268,7 @@ public class SubstringEvaluator<ID exten
*/
for ( Value<?> value : attr )
{
- value.normalize( normalizer );
- String strValue = ( String ) value.getNormalizedValue();
+ String strValue = ( String ) value.getNormValue();
// Once match is found cleanup and return true
if ( regex.matcher( strValue ).matches() )
@@ -308,8 +307,7 @@ public class SubstringEvaluator<ID exten
*/
for ( Value<?> value : attr )
{
- value.normalize( normalizer );
- String strValue = ( String ) value.getNormalizedValue();
+ String strValue = ( String ) value.getNormValue();
// Once match is found cleanup and return true
if ( regex.matcher( strValue ).matches() )
@@ -361,8 +359,7 @@ public class SubstringEvaluator<ID exten
{
for ( Value<?> value : attr )
{
- value.normalize( normalizer );
- String strValue = ( String ) value.getNormalizedValue();
+ String strValue = ( String ) value.getNormValue();
// Once match is found cleanup and return true
if ( regex.matcher( strValue ).matches() )
@@ -379,8 +376,7 @@ public class SubstringEvaluator<ID exten
// the value.
for ( Value<?> value : attr )
{
- value.normalize( normalizer );
- byte[] byteValue = (byte[])value.getNormalizedValue();
+ byte[] byteValue = (byte[])value.getNormValue();
// Once match is found cleanup and return true
// @TODO : implement this check.
@@ -425,8 +421,7 @@ public class SubstringEvaluator<ID exten
*/
for ( Value<?> value : attr )
{
- value.normalize( normalizer );
- String strValue = ( String ) value.getNormalizedValue();
+ String strValue = ( String ) value.getNormValue();
// Once match is found cleanup and return true
if ( regex.matcher( strValue ).matches() )