directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From elecha...@apache.org
Subject svn commit: r1743011 [10/13] - in /directory/shared/branches/shared-value: dsml/parser/src/main/java/org/apache/directory/api/dsmlv2/request/ dsml/parser/src/main/java/org/apache/directory/api/dsmlv2/response/ dsml/parser/src/test/java/org/apache/direc...
Date Mon, 09 May 2016 17:22:21 GMT
Added: directory/shared/branches/shared-value/ldap/model/src/main/java/org/apache/directory/api/ldap/model/schema/PreparedNormalizer.java
URL: http://svn.apache.org/viewvc/directory/shared/branches/shared-value/ldap/model/src/main/java/org/apache/directory/api/ldap/model/schema/PreparedNormalizer.java?rev=1743011&view=auto
==============================================================================
--- directory/shared/branches/shared-value/ldap/model/src/main/java/org/apache/directory/api/ldap/model/schema/PreparedNormalizer.java (added)
+++ directory/shared/branches/shared-value/ldap/model/src/main/java/org/apache/directory/api/ldap/model/schema/PreparedNormalizer.java Mon May  9 17:22:19 2016
@@ -0,0 +1,42 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you under the Apache License, Version 2.0 (the
+ *  "License"); you may not use this file except in compliance
+ *  with the License.  You may obtain a copy of the License at
+ *  
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *  
+ *  Unless required by applicable law or agreed to in writing,
+ *  software distributed under the License is distributed on an
+ *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ *  KIND, either express or implied.  See the License for the
+ *  specific language governing permissions and limitations
+ *  under the License. 
+ *  
+ */
+package org.apache.directory.api.ldap.model.schema;
+
+
+import org.apache.directory.api.ldap.model.exception.LdapException;
+
+
+/**
+ * An interface that is implemented by Normalizers calling the PrepareString class.
+ * 
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ */
+public interface PreparedNormalizer
+{
+    /**
+     * Gets the normalized value.
+     * 
+     * @param value the value to normalize. It must *not* be null !
+     * @param assertionType The tyê pf String we have to normalize
+     * @return the normalized form for a value
+     * @throws LdapException if an error results during normalization
+     */
+    String normalize( String value, PrepareString.AssertionType assertionType ) throws LdapException;
+}

Added: directory/shared/branches/shared-value/ldap/model/src/main/java/org/apache/directory/api/ldap/model/schema/comparators/DeepTrimComparator.java
URL: http://svn.apache.org/viewvc/directory/shared/branches/shared-value/ldap/model/src/main/java/org/apache/directory/api/ldap/model/schema/comparators/DeepTrimComparator.java?rev=1743011&view=auto
==============================================================================
--- directory/shared/branches/shared-value/ldap/model/src/main/java/org/apache/directory/api/ldap/model/schema/comparators/DeepTrimComparator.java (added)
+++ directory/shared/branches/shared-value/ldap/model/src/main/java/org/apache/directory/api/ldap/model/schema/comparators/DeepTrimComparator.java Mon May  9 17:22:19 2016
@@ -0,0 +1,101 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you under the Apache License, Version 2.0 (the
+ *  "License"); you may not use this file except in compliance
+ *  with the License.  You may obtain a copy of the License at
+ *  
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *  
+ *  Unless required by applicable law or agreed to in writing,
+ *  software distributed under the License is distributed on an
+ *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ *  KIND, either express or implied.  See the License for the
+ *  specific language governing permissions and limitations
+ *  under the License. 
+ *  
+ */
+package org.apache.directory.api.ldap.model.schema.comparators;
+
+
+import org.apache.directory.api.ldap.model.exception.LdapException;
+import org.apache.directory.api.ldap.model.schema.LdapComparator;
+import org.apache.directory.api.ldap.model.schema.Normalizer;
+import org.apache.directory.api.ldap.model.schema.normalizers.DeepTrimNormalizer;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+
+/**
+ * A comparator that uses the DeepTrimNormalizer before comparing two values
+ * 
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ */
+public class DeepTrimComparator extends LdapComparator<String>
+{
+    /** The serial version UID */
+    private static final long serialVersionUID = 2L;
+
+    /** A logger for this class */
+    private static final Logger LOG = LoggerFactory.getLogger( DeepTrimComparator.class );
+    
+    /** The associated normalizer */
+    private Normalizer normalizer = new DeepTrimNormalizer();
+
+
+    /**
+     * The NormalizingComparator constructor. Its OID is the  matching rule OID.
+     */
+    public DeepTrimComparator( String oid )
+    {
+        super( oid );
+    }
+
+
+    /**
+     * If any normalization attempt fails we compare using the unnormalized
+     * object.
+     */
+    public int compare( String o1, String o2 )
+    {
+        String n1 = o1;
+        String n2 = o2;
+
+        try
+        {
+            n1 = normalizer.normalize( o1 );
+        }
+        catch ( LdapException e )
+        {
+            LOG.warn( "Failed to normalize: " + o1, e );
+            n1 = o1;
+        }
+
+        try
+        {
+            n2 = normalizer.normalize( o2 );
+        }
+        catch ( LdapException e )
+        {
+            LOG.warn( "Failed to normalize: " + o2, e );
+            n2 = o2;
+        }
+
+        return n1.compareTo( n2 );
+    }
+
+
+    /**
+     * {@inheritDoc}
+     * 
+     * This implementation makes sure we update the oid property of the contained normalizer and 
+     * comparator.
+     */
+    @Override
+    public void setOid( String oid )
+    {
+        super.setOid( oid );
+    }
+}

Added: directory/shared/branches/shared-value/ldap/model/src/main/java/org/apache/directory/api/ldap/model/schema/comparators/DeepTrimToLowerComparator.java
URL: http://svn.apache.org/viewvc/directory/shared/branches/shared-value/ldap/model/src/main/java/org/apache/directory/api/ldap/model/schema/comparators/DeepTrimToLowerComparator.java?rev=1743011&view=auto
==============================================================================
--- directory/shared/branches/shared-value/ldap/model/src/main/java/org/apache/directory/api/ldap/model/schema/comparators/DeepTrimToLowerComparator.java (added)
+++ directory/shared/branches/shared-value/ldap/model/src/main/java/org/apache/directory/api/ldap/model/schema/comparators/DeepTrimToLowerComparator.java Mon May  9 17:22:19 2016
@@ -0,0 +1,101 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you under the Apache License, Version 2.0 (the
+ *  "License"); you may not use this file except in compliance
+ *  with the License.  You may obtain a copy of the License at
+ *  
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *  
+ *  Unless required by applicable law or agreed to in writing,
+ *  software distributed under the License is distributed on an
+ *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ *  KIND, either express or implied.  See the License for the
+ *  specific language governing permissions and limitations
+ *  under the License. 
+ *  
+ */
+package org.apache.directory.api.ldap.model.schema.comparators;
+
+
+import org.apache.directory.api.ldap.model.exception.LdapException;
+import org.apache.directory.api.ldap.model.schema.LdapComparator;
+import org.apache.directory.api.ldap.model.schema.Normalizer;
+import org.apache.directory.api.ldap.model.schema.normalizers.DeepTrimToLowerNormalizer;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+
+/**
+ * A comparator that uses the DeepTrimToLowerNormalizer before comparing two values
+ * 
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ */
+public class DeepTrimToLowerComparator extends LdapComparator<String>
+{
+    /** The serial version UID */
+    private static final long serialVersionUID = 2L;
+
+    /** A logger for this class */
+    private static final Logger LOG = LoggerFactory.getLogger( DeepTrimToLowerComparator.class );
+    
+    /** The associated normalizer */
+    private Normalizer normalizer = new DeepTrimToLowerNormalizer();
+
+
+    /**
+     * The NormalizingComparator constructor. Its OID is the  matching rule OID.
+     */
+    public DeepTrimToLowerComparator( String oid )
+    {
+        super( oid );
+    }
+
+
+    /**
+     * If any normalization attempt fails we compare using the unnormalized
+     * object.
+     */
+    public int compare( String o1, String o2 )
+    {
+        String n1 = o1;
+        String n2 = o2;
+
+        try
+        {
+            n1 = normalizer.normalize( o1 );
+        }
+        catch ( LdapException e )
+        {
+            LOG.warn( "Failed to normalize: " + o1, e );
+            n1 = o1;
+        }
+
+        try
+        {
+            n2 = normalizer.normalize( o2 );
+        }
+        catch ( LdapException e )
+        {
+            LOG.warn( "Failed to normalize: " + o2, e );
+            n2 = o2;
+        }
+
+        return n1.compareTo( n2 );
+    }
+
+
+    /**
+     * {@inheritDoc}
+     * 
+     * This implementation makes sure we update the oid property of the contained normalizer and 
+     * comparator.
+     */
+    @Override
+    public void setOid( String oid )
+    {
+        super.setOid( oid );
+    }
+}

Modified: directory/shared/branches/shared-value/ldap/model/src/main/java/org/apache/directory/api/ldap/model/schema/comparators/DnComparator.java
URL: http://svn.apache.org/viewvc/directory/shared/branches/shared-value/ldap/model/src/main/java/org/apache/directory/api/ldap/model/schema/comparators/DnComparator.java?rev=1743011&r1=1743010&r2=1743011&view=diff
==============================================================================
--- directory/shared/branches/shared-value/ldap/model/src/main/java/org/apache/directory/api/ldap/model/schema/comparators/DnComparator.java (original)
+++ directory/shared/branches/shared-value/ldap/model/src/main/java/org/apache/directory/api/ldap/model/schema/comparators/DnComparator.java Mon May  9 17:22:19 2016
@@ -84,7 +84,17 @@ public class DnComparator extends LdapCo
             return 1;
         }
 
-        return dn0.getNormName().compareTo( dn1.getNormName() );
+        for ( int i = dn0Size; i >= 0; i-- )
+        {
+            int comp = dn0.getRdn( i ).compareTo( dn1.getRdn( i ) );
+            
+            if ( comp != 0 )
+            {
+                return comp;
+            }
+        }
+        
+        return 0;
     }
 
 
@@ -96,7 +106,7 @@ public class DnComparator extends LdapCo
         {
             dn = ( Dn ) obj;
 
-            dn = ( dn.isSchemaAware() ? dn : dn.apply( schemaManager ) );
+            dn = ( dn.isSchemaAware() ? dn : new Dn( schemaManager, dn ) );
         }
         else if ( obj instanceof String )
         {

Modified: directory/shared/branches/shared-value/ldap/model/src/main/java/org/apache/directory/api/ldap/model/schema/comparators/GeneralizedTimeComparator.java
URL: http://svn.apache.org/viewvc/directory/shared/branches/shared-value/ldap/model/src/main/java/org/apache/directory/api/ldap/model/schema/comparators/GeneralizedTimeComparator.java?rev=1743011&r1=1743010&r2=1743011&view=diff
==============================================================================
--- directory/shared/branches/shared-value/ldap/model/src/main/java/org/apache/directory/api/ldap/model/schema/comparators/GeneralizedTimeComparator.java (original)
+++ directory/shared/branches/shared-value/ldap/model/src/main/java/org/apache/directory/api/ldap/model/schema/comparators/GeneralizedTimeComparator.java Mon May  9 17:22:19 2016
@@ -20,12 +20,10 @@
 package org.apache.directory.api.ldap.model.schema.comparators;
 
 
-import java.io.IOException;
 import java.text.ParseException;
 
 import org.apache.directory.api.i18n.I18n;
 import org.apache.directory.api.ldap.model.schema.LdapComparator;
-import org.apache.directory.api.ldap.model.schema.PrepareString;
 import org.apache.directory.api.util.GeneralizedTime;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
@@ -83,12 +81,7 @@ public class GeneralizedTimeComparator e
         GeneralizedTime backendTime;
         try
         {
-            String prepared = PrepareString.normalize( backendValue, PrepareString.StringType.DIRECTORY_STRING );
-            backendTime = new GeneralizedTime( prepared );
-        }
-        catch ( IOException ioe )
-        {
-            throw new IllegalArgumentException( I18n.err( I18n.ERR_04224, backendValue ), ioe );
+            backendTime = new GeneralizedTime( backendValue );
         }
         catch ( ParseException pe )
         {
@@ -99,12 +92,7 @@ public class GeneralizedTimeComparator e
         
         try
         {
-            String prepared = PrepareString.normalize( assertValue, PrepareString.StringType.DIRECTORY_STRING );
-            assertTime = new GeneralizedTime( prepared );
-        }
-        catch ( IOException ioe )
-        {
-            throw new IllegalArgumentException( I18n.err( I18n.ERR_04224, assertValue ), ioe );
+            assertTime = new GeneralizedTime( assertValue );
         }
         catch ( ParseException pe )
         {

Modified: directory/shared/branches/shared-value/ldap/model/src/main/java/org/apache/directory/api/ldap/model/schema/comparators/IntegerComparator.java
URL: http://svn.apache.org/viewvc/directory/shared/branches/shared-value/ldap/model/src/main/java/org/apache/directory/api/ldap/model/schema/comparators/IntegerComparator.java?rev=1743011&r1=1743010&r2=1743011&view=diff
==============================================================================
--- directory/shared/branches/shared-value/ldap/model/src/main/java/org/apache/directory/api/ldap/model/schema/comparators/IntegerComparator.java (original)
+++ directory/shared/branches/shared-value/ldap/model/src/main/java/org/apache/directory/api/ldap/model/schema/comparators/IntegerComparator.java Mon May  9 17:22:19 2016
@@ -20,13 +20,13 @@
 package org.apache.directory.api.ldap.model.schema.comparators;
 
 
-import java.io.IOException;
 import java.io.Serializable;
 import java.math.BigInteger;
 
 import org.apache.directory.api.i18n.I18n;
+import org.apache.directory.api.ldap.model.exception.LdapException;
 import org.apache.directory.api.ldap.model.schema.LdapComparator;
-import org.apache.directory.api.ldap.model.schema.PrepareString;
+import org.apache.directory.api.ldap.model.schema.normalizers.NumericNormalizer;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
@@ -123,21 +123,23 @@ public class IntegerComparator extends L
 
         // Both objects must be stored as String for numeric.
         // But we need to normalize the values first.
+        NumericNormalizer normalizer = new NumericNormalizer();
+        
         try
         {
-            backendValue = PrepareString.normalize( backendValue, PrepareString.StringType.NUMERIC_STRING );
+            backendValue = normalizer.normalize( backendValue );
         }
-        catch ( IOException ioe )
+        catch ( LdapException le )
         {
-            throw new IllegalArgumentException( I18n.err( I18n.ERR_04224, backendValue ), ioe );
+            throw new IllegalArgumentException( I18n.err( I18n.ERR_04224, backendValue ), le );
         }
         try
         {
-            assertValue = PrepareString.normalize( assertValue, PrepareString.StringType.NUMERIC_STRING );
+            assertValue = normalizer.normalize( assertValue );
         }
-        catch ( IOException ioe )
+        catch ( LdapException le )
         {
-            throw new IllegalArgumentException( I18n.err( I18n.ERR_04224, assertValue ), ioe );
+            throw new IllegalArgumentException( I18n.err( I18n.ERR_04224, assertValue ), le );
         }
 
         BigInteger b1 = new BigInteger( backendValue );

Modified: directory/shared/branches/shared-value/ldap/model/src/main/java/org/apache/directory/api/ldap/model/schema/comparators/NormalizingComparator.java
URL: http://svn.apache.org/viewvc/directory/shared/branches/shared-value/ldap/model/src/main/java/org/apache/directory/api/ldap/model/schema/comparators/NormalizingComparator.java?rev=1743011&r1=1743010&r2=1743011&view=diff
==============================================================================
--- directory/shared/branches/shared-value/ldap/model/src/main/java/org/apache/directory/api/ldap/model/schema/comparators/NormalizingComparator.java (original)
+++ directory/shared/branches/shared-value/ldap/model/src/main/java/org/apache/directory/api/ldap/model/schema/comparators/NormalizingComparator.java Mon May  9 17:22:19 2016
@@ -51,6 +51,15 @@ public class NormalizingComparator exten
 
 
     /**
+     * The NormalizingComparator constructor. Its OID is the  matching rule OID.
+     */
+    public NormalizingComparator( String oid )
+    {
+        super( oid );
+    }
+
+
+    /**
      * A comparator which normalizes a value first before comparing them.
      * 
      * @param normalizer the Normalizer to normalize values with before comparing

Modified: directory/shared/branches/shared-value/ldap/model/src/main/java/org/apache/directory/api/ldap/model/schema/comparators/NumericStringComparator.java
URL: http://svn.apache.org/viewvc/directory/shared/branches/shared-value/ldap/model/src/main/java/org/apache/directory/api/ldap/model/schema/comparators/NumericStringComparator.java?rev=1743011&r1=1743010&r2=1743011&view=diff
==============================================================================
--- directory/shared/branches/shared-value/ldap/model/src/main/java/org/apache/directory/api/ldap/model/schema/comparators/NumericStringComparator.java (original)
+++ directory/shared/branches/shared-value/ldap/model/src/main/java/org/apache/directory/api/ldap/model/schema/comparators/NumericStringComparator.java Mon May  9 17:22:19 2016
@@ -20,11 +20,11 @@
 package org.apache.directory.api.ldap.model.schema.comparators;
 
 
-import java.io.IOException;
 
 import org.apache.directory.api.i18n.I18n;
+import org.apache.directory.api.ldap.model.exception.LdapException;
 import org.apache.directory.api.ldap.model.schema.LdapComparator;
-import org.apache.directory.api.ldap.model.schema.PrepareString;
+import org.apache.directory.api.ldap.model.schema.normalizers.NumericNormalizer;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
@@ -78,21 +78,23 @@ public class NumericStringComparator ext
 
         // Both objects must be stored as String for numeric.
         // But we need to normalize the values first.
+        NumericNormalizer normalizer = new NumericNormalizer();
+
         try
         {
-            backendValue = PrepareString.normalize( backendValue, PrepareString.StringType.NUMERIC_STRING );
+            backendValue = normalizer.normalize( backendValue );
         }
-        catch ( IOException ioe )
+        catch ( LdapException le )
         {
-            throw new IllegalArgumentException( I18n.err( I18n.ERR_04224, backendValue ), ioe );
+            throw new IllegalArgumentException( I18n.err( I18n.ERR_04224, backendValue ), le );
         }
         try
         {
-            assertValue = PrepareString.normalize( assertValue, PrepareString.StringType.NUMERIC_STRING );
+            assertValue = normalizer.normalize( assertValue );
         }
-        catch ( IOException ioe )
+        catch ( LdapException le )
         {
-            throw new IllegalArgumentException( I18n.err( I18n.ERR_04224, assertValue ), ioe );
+            throw new IllegalArgumentException( I18n.err( I18n.ERR_04224, assertValue ), le );
         }
 
         return backendValue.compareTo( assertValue );

Modified: directory/shared/branches/shared-value/ldap/model/src/main/java/org/apache/directory/api/ldap/model/schema/comparators/UniqueMemberComparator.java
URL: http://svn.apache.org/viewvc/directory/shared/branches/shared-value/ldap/model/src/main/java/org/apache/directory/api/ldap/model/schema/comparators/UniqueMemberComparator.java?rev=1743011&r1=1743010&r2=1743011&view=diff
==============================================================================
--- directory/shared/branches/shared-value/ldap/model/src/main/java/org/apache/directory/api/ldap/model/schema/comparators/UniqueMemberComparator.java (original)
+++ directory/shared/branches/shared-value/ldap/model/src/main/java/org/apache/directory/api/ldap/model/schema/comparators/UniqueMemberComparator.java Mon May  9 17:22:19 2016
@@ -173,7 +173,7 @@ public class UniqueMemberComparator exte
         {
             dn = ( Dn ) obj;
 
-            dn = ( dn.isSchemaAware() ? dn : dn.apply( schemaManager ) );
+            dn = ( dn.isSchemaAware() ? dn : new Dn( schemaManager, dn ) );
         }
         else if ( obj instanceof String )
         {

Modified: directory/shared/branches/shared-value/ldap/model/src/main/java/org/apache/directory/api/ldap/model/schema/normalizers/BooleanNormalizer.java
URL: http://svn.apache.org/viewvc/directory/shared/branches/shared-value/ldap/model/src/main/java/org/apache/directory/api/ldap/model/schema/normalizers/BooleanNormalizer.java?rev=1743011&r1=1743010&r2=1743011&view=diff
==============================================================================
--- directory/shared/branches/shared-value/ldap/model/src/main/java/org/apache/directory/api/ldap/model/schema/normalizers/BooleanNormalizer.java (original)
+++ directory/shared/branches/shared-value/ldap/model/src/main/java/org/apache/directory/api/ldap/model/schema/normalizers/BooleanNormalizer.java Mon May  9 17:22:19 2016
@@ -55,7 +55,7 @@ public class BooleanNormalizer extends N
             return null;
         }
 
-        String strValue = value.getString();
+        String strValue = value.getValue();
 
         return new Value( Strings.upperCase( strValue.trim() ) );
     }

Modified: directory/shared/branches/shared-value/ldap/model/src/main/java/org/apache/directory/api/ldap/model/schema/normalizers/DeepTrimNormalizer.java
URL: http://svn.apache.org/viewvc/directory/shared/branches/shared-value/ldap/model/src/main/java/org/apache/directory/api/ldap/model/schema/normalizers/DeepTrimNormalizer.java?rev=1743011&r1=1743010&r2=1743011&view=diff
==============================================================================
--- directory/shared/branches/shared-value/ldap/model/src/main/java/org/apache/directory/api/ldap/model/schema/normalizers/DeepTrimNormalizer.java (original)
+++ directory/shared/branches/shared-value/ldap/model/src/main/java/org/apache/directory/api/ldap/model/schema/normalizers/DeepTrimNormalizer.java Mon May  9 17:22:19 2016
@@ -29,6 +29,7 @@ import org.apache.directory.api.ldap.mod
 import org.apache.directory.api.ldap.model.message.ResultCodeEnum;
 import org.apache.directory.api.ldap.model.schema.Normalizer;
 import org.apache.directory.api.ldap.model.schema.PrepareString;
+import org.apache.directory.api.ldap.model.schema.PreparedNormalizer;
 
 
 /**
@@ -39,7 +40,7 @@ import org.apache.directory.api.ldap.mod
  * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
  */
 @SuppressWarnings("serial")
-public class DeepTrimNormalizer extends Normalizer
+public class DeepTrimNormalizer extends Normalizer implements PreparedNormalizer
 {
     /**
      * Creates a new instance of DeepTrimNormalizer with OID known.
@@ -64,34 +65,84 @@ public class DeepTrimNormalizer extends
     /**
      * {@inheritDoc}
      */
-    public Value normalize( Value value ) throws LdapException
+    public String normalize( String value ) throws LdapException
     {
-        try
-        {
-            String normalized = PrepareString.normalize( value.getString(),
-                PrepareString.StringType.DIRECTORY_STRING );
+        return normalize( value, PrepareString.AssertionType.ATTRIBUTE_VALUE );
+    }
 
-            return new Value( normalized );
-        }
-        catch ( IOException ioe )
+
+    /**
+     * {@inheritDoc}
+     */
+    public Value normalize( Value value ) throws LdapException
+    {
+        if ( value == null )
         {
-            throw new LdapInvalidAttributeValueException( ResultCodeEnum.INVALID_ATTRIBUTE_SYNTAX, I18n.err(
-                I18n.ERR_04224, value ), ioe );
+            return null;
         }
+
+        // Transcoding
+        String transcoded = PrepareString.transcode( value.getBytes() );
+
+        String normValue = normalize( transcoded, PrepareString.AssertionType.ATTRIBUTE_VALUE );
+
+        return new Value( value.getAttributeType(), value.getValue() );
     }
 
 
     /**
      * {@inheritDoc}
      */
-    public String normalize( String value ) throws LdapException
+    public String normalize( String value, PrepareString.AssertionType assertionType ) throws LdapException
     {
+        if ( value == null )
+        {
+            return null;
+        }
+
+        String normValue = null;
+
         try
         {
-            String normalized = PrepareString.normalize( value,
-                PrepareString.StringType.DIRECTORY_STRING );
+            // Transcoding is useless
+            // Map
+            String mapped = PrepareString.mapCaseSensitive( value );
+
+            // Normalize
+            String normalized = PrepareString.normalize( mapped );
+            
+            char[] chars = normalized.toCharArray();
+            
+            // Prohibit
+            PrepareString.checkProhibited( chars );
+            
+            // Bidi is ignored
+            
+            // Insignificant Characters Handling
+            switch ( assertionType )
+            {
+                case ATTRIBUTE_VALUE :
+                    normValue = PrepareString.insignificantSpacesStringValue( chars );
+                    break;
+                    
+                case SUBSTRING_INITIAL :
+                    normValue = PrepareString.insignificantSpacesStringInitial( chars );
+                    break;
+                    
+                case SUBSTRING_ANY :
+                    normValue = PrepareString.insignificantSpacesStringAny( chars );
+                    break;
+                    
+                case SUBSTRING_FINAL :
+                    normValue = PrepareString.insignificantSpacesStringFinal( chars );
+                    break;
+                    
+                default :
+                    // Do nothing
+                    break;
+            }
 
-            return normalized;
+            return normValue;
         }
         catch ( IOException ioe )
         {

Modified: directory/shared/branches/shared-value/ldap/model/src/main/java/org/apache/directory/api/ldap/model/schema/normalizers/DeepTrimToLowerNormalizer.java
URL: http://svn.apache.org/viewvc/directory/shared/branches/shared-value/ldap/model/src/main/java/org/apache/directory/api/ldap/model/schema/normalizers/DeepTrimToLowerNormalizer.java?rev=1743011&r1=1743010&r2=1743011&view=diff
==============================================================================
--- directory/shared/branches/shared-value/ldap/model/src/main/java/org/apache/directory/api/ldap/model/schema/normalizers/DeepTrimToLowerNormalizer.java (original)
+++ directory/shared/branches/shared-value/ldap/model/src/main/java/org/apache/directory/api/ldap/model/schema/normalizers/DeepTrimToLowerNormalizer.java Mon May  9 17:22:19 2016
@@ -29,6 +29,7 @@ import org.apache.directory.api.ldap.mod
 import org.apache.directory.api.ldap.model.message.ResultCodeEnum;
 import org.apache.directory.api.ldap.model.schema.Normalizer;
 import org.apache.directory.api.ldap.model.schema.PrepareString;
+import org.apache.directory.api.ldap.model.schema.PreparedNormalizer;
 
 
 /**
@@ -40,7 +41,7 @@ import org.apache.directory.api.ldap.mod
  * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
  */
 @SuppressWarnings("serial")
-public class DeepTrimToLowerNormalizer extends Normalizer
+public class DeepTrimToLowerNormalizer extends Normalizer implements PreparedNormalizer
 {
     /**
      * Creates a new instance of DeepTrimToLowerNormalizer.
@@ -60,8 +61,8 @@ public class DeepTrimToLowerNormalizer e
     public DeepTrimToLowerNormalizer()
     {
     }
-
-
+    
+    
     /**
      * {@inheritDoc}
      */
@@ -72,18 +73,12 @@ public class DeepTrimToLowerNormalizer e
             return null;
         }
 
-        try
-        {
-            String normalized = PrepareString.normalize( value.getString(),
-                PrepareString.StringType.CASE_IGNORE );
+        // Transcoding
+        String transcoded = PrepareString.transcode( value.getBytes() );
 
-            return new Value( normalized );
-        }
-        catch ( IOException ioe )
-        {
-            throw new LdapInvalidAttributeValueException( ResultCodeEnum.INVALID_ATTRIBUTE_SYNTAX, I18n.err(
-                I18n.ERR_04224, value ), ioe );
-        }
+        String normValue = normalize( transcoded, PrepareString.AssertionType.ATTRIBUTE_VALUE );
+
+        return new Value( value.getAttributeType(), normValue );
     }
 
 
@@ -92,17 +87,63 @@ public class DeepTrimToLowerNormalizer e
      */
     public String normalize( String value ) throws LdapException
     {
+        return normalize( value, PrepareString.AssertionType.ATTRIBUTE_VALUE );
+    }
+    
+
+    /**
+     * {@inheritDoc}
+     */
+    public String normalize( String value, PrepareString.AssertionType assertionType ) throws LdapException
+    {
         if ( value == null )
         {
             return null;
         }
 
+        String normValue = null;
+
         try
         {
-            String normalized = PrepareString.normalize( value,
-                PrepareString.StringType.CASE_IGNORE );
+            // Transcoding is useless
+            // Map
+            String mapped = PrepareString.mapIgnoreCase( value );
+
+            // Normalize
+            String normalized = PrepareString.normalize( mapped );
+            
+            char[] chars = normalized.toCharArray();
+            
+            // Prohibit
+            PrepareString.checkProhibited( chars );
+            
+            // Bidi is ignored
+            
+            // Insignificant Characters Handling
+            switch ( assertionType )
+            {
+                case ATTRIBUTE_VALUE :
+                    normValue = PrepareString.insignificantSpacesStringValue( chars );
+                    break;
+                    
+                case SUBSTRING_INITIAL :
+                    normValue = PrepareString.insignificantSpacesStringInitial( chars );
+                    break;
+                    
+                case SUBSTRING_ANY :
+                    normValue = PrepareString.insignificantSpacesStringAny( chars );
+                    break;
+                    
+                case SUBSTRING_FINAL :
+                    normValue = PrepareString.insignificantSpacesStringFinal( chars );
+                    break;
+                    
+                default :
+                    // Do nothing
+                    break;
+            }
 
-            return normalized;
+            return normValue;
         }
         catch ( IOException ioe )
         {

Modified: directory/shared/branches/shared-value/ldap/model/src/main/java/org/apache/directory/api/ldap/model/schema/normalizers/DnNormalizer.java
URL: http://svn.apache.org/viewvc/directory/shared/branches/shared-value/ldap/model/src/main/java/org/apache/directory/api/ldap/model/schema/normalizers/DnNormalizer.java?rev=1743011&r1=1743010&r2=1743011&view=diff
==============================================================================
--- directory/shared/branches/shared-value/ldap/model/src/main/java/org/apache/directory/api/ldap/model/schema/normalizers/DnNormalizer.java (original)
+++ directory/shared/branches/shared-value/ldap/model/src/main/java/org/apache/directory/api/ldap/model/schema/normalizers/DnNormalizer.java Mon May  9 17:22:19 2016
@@ -56,11 +56,11 @@ public class DnNormalizer extends Normal
     {
         Dn dn = null;
 
-        String dnStr = value.getString();
+        String dnStr = value.getValue();
 
         dn = new Dn( schemaManager, dnStr );
 
-        return new Value( dn.getNormName() );
+        return new Value( dn.getName() );
     }
 
 
@@ -73,7 +73,7 @@ public class DnNormalizer extends Normal
 
         dn = new Dn( schemaManager, value );
 
-        return dn.getNormName();
+        return dn.getName();
     }
 
 
@@ -85,11 +85,14 @@ public class DnNormalizer extends Normal
      */
     public String normalize( Dn value ) throws LdapException
     {
-        Dn dn = null;
+        Dn dn = value;
 
-        dn = value.apply( schemaManager );
+        if ( !value.isSchemaAware() )
+        {
+            dn = new Dn( schemaManager, value );
+        }
 
-        return dn.getNormName();
+        return dn.getName();
     }
 
 

Modified: directory/shared/branches/shared-value/ldap/model/src/main/java/org/apache/directory/api/ldap/model/schema/normalizers/GeneralizedTimeNormalizer.java
URL: http://svn.apache.org/viewvc/directory/shared/branches/shared-value/ldap/model/src/main/java/org/apache/directory/api/ldap/model/schema/normalizers/GeneralizedTimeNormalizer.java?rev=1743011&r1=1743010&r2=1743011&view=diff
==============================================================================
--- directory/shared/branches/shared-value/ldap/model/src/main/java/org/apache/directory/api/ldap/model/schema/normalizers/GeneralizedTimeNormalizer.java (original)
+++ directory/shared/branches/shared-value/ldap/model/src/main/java/org/apache/directory/api/ldap/model/schema/normalizers/GeneralizedTimeNormalizer.java Mon May  9 17:22:19 2016
@@ -20,7 +20,6 @@
 package org.apache.directory.api.ldap.model.schema.normalizers;
 
 
-import java.io.IOException;
 import java.text.ParseException;
 
 import org.apache.directory.api.i18n.I18n;
@@ -66,17 +65,9 @@ public class GeneralizedTimeNormalizer e
      */
     public Value normalize( Value value ) throws LdapException
     {
-        try
-        {
-            String normalized = PrepareString.normalize( value.getString(), PrepareString.StringType.DIRECTORY_STRING );
+        String normalized = PrepareString.normalize( value.getValue() );
 
-            return new Value( normalized );
-        }
-        catch ( IOException ioe )
-        {
-            throw new LdapInvalidAttributeValueException( ResultCodeEnum.INVALID_ATTRIBUTE_SYNTAX, I18n.err(
-                I18n.ERR_04224, value ), ioe );
-        }
+        return new Value( normalized );
     }
 
 
@@ -85,21 +76,21 @@ public class GeneralizedTimeNormalizer e
      */
     public String normalize( String value ) throws LdapException
     {
+        if ( value == null )
+        {
+            throw new LdapInvalidAttributeValueException( ResultCodeEnum.INVALID_ATTRIBUTE_SYNTAX, I18n.err(
+                I18n.ERR_04224, value ) );
+        }
+        
+        
         try
         {
-            String prepared = PrepareString.normalize( value, PrepareString.StringType.DIRECTORY_STRING );
-
-            GeneralizedTime time = new GeneralizedTime( prepared );
+            GeneralizedTime time = new GeneralizedTime( value );
             String normalized = time.toGeneralizedTime( Format.YEAR_MONTH_DAY_HOUR_MIN_SEC_FRACTION,
                 FractionDelimiter.DOT, 3, TimeZoneFormat.Z );
 
             return normalized;
         }
-        catch ( IOException ioe )
-        {
-            throw new LdapInvalidAttributeValueException( ResultCodeEnum.INVALID_ATTRIBUTE_SYNTAX, I18n.err(
-                I18n.ERR_04224, value ), ioe );
-        }
         catch ( ParseException pe )
         {
             throw new LdapInvalidAttributeValueException( ResultCodeEnum.INVALID_ATTRIBUTE_SYNTAX, I18n.err(

Modified: directory/shared/branches/shared-value/ldap/model/src/main/java/org/apache/directory/api/ldap/model/schema/normalizers/NameOrNumericIdNormalizer.java
URL: http://svn.apache.org/viewvc/directory/shared/branches/shared-value/ldap/model/src/main/java/org/apache/directory/api/ldap/model/schema/normalizers/NameOrNumericIdNormalizer.java?rev=1743011&r1=1743010&r2=1743011&view=diff
==============================================================================
--- directory/shared/branches/shared-value/ldap/model/src/main/java/org/apache/directory/api/ldap/model/schema/normalizers/NameOrNumericIdNormalizer.java (original)
+++ directory/shared/branches/shared-value/ldap/model/src/main/java/org/apache/directory/api/ldap/model/schema/normalizers/NameOrNumericIdNormalizer.java Mon May  9 17:22:19 2016
@@ -69,7 +69,7 @@ public class NameOrNumericIdNormalizer e
             return null;
         }
 
-        String strValue = value.getString();
+        String strValue = value.getValue();
 
         if ( strValue.length() == 0 )
         {

Modified: directory/shared/branches/shared-value/ldap/model/src/main/java/org/apache/directory/api/ldap/model/schema/normalizers/NumericNormalizer.java
URL: http://svn.apache.org/viewvc/directory/shared/branches/shared-value/ldap/model/src/main/java/org/apache/directory/api/ldap/model/schema/normalizers/NumericNormalizer.java?rev=1743011&r1=1743010&r2=1743011&view=diff
==============================================================================
--- directory/shared/branches/shared-value/ldap/model/src/main/java/org/apache/directory/api/ldap/model/schema/normalizers/NumericNormalizer.java (original)
+++ directory/shared/branches/shared-value/ldap/model/src/main/java/org/apache/directory/api/ldap/model/schema/normalizers/NumericNormalizer.java Mon May  9 17:22:19 2016
@@ -20,15 +20,12 @@
 package org.apache.directory.api.ldap.model.schema.normalizers;
 
 
-import java.io.IOException;
-
-import org.apache.directory.api.i18n.I18n;
 import org.apache.directory.api.ldap.model.constants.SchemaConstants;
 import org.apache.directory.api.ldap.model.entry.Value;
 import org.apache.directory.api.ldap.model.exception.LdapException;
-import org.apache.directory.api.ldap.model.exception.LdapInvalidDnException;
 import org.apache.directory.api.ldap.model.schema.Normalizer;
 import org.apache.directory.api.ldap.model.schema.PrepareString;
+import org.apache.directory.api.ldap.model.schema.PreparedNormalizer;
 
 
 /**
@@ -37,7 +34,7 @@ import org.apache.directory.api.ldap.mod
  * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
  */
 @SuppressWarnings("serial")
-public class NumericNormalizer extends Normalizer
+public class NumericNormalizer extends Normalizer implements PreparedNormalizer
 {
     /**
      * Creates a new instance of NumericNormalizer.
@@ -53,17 +50,9 @@ public class NumericNormalizer extends N
      */
     public Value normalize( Value value ) throws LdapException
     {
-        try
-        {
-            String normalized = PrepareString.normalize( value.getString(),
-                PrepareString.StringType.NUMERIC_STRING );
+        String normalized = normalize( value.getValue() );
 
-            return new Value( normalized );
-        }
-        catch ( IOException ioe )
-        {
-            throw new LdapInvalidDnException( I18n.err( I18n.ERR_04224, value ), ioe );
-        }
+        return new Value( normalized );
     }
 
 
@@ -72,14 +61,25 @@ public class NumericNormalizer extends N
      */
     public String normalize( String value ) throws LdapException
     {
-        try
-        {
-            return PrepareString.normalize( value,
-                PrepareString.StringType.NUMERIC_STRING );
-        }
-        catch ( IOException ioe )
+        return normalize( value, PrepareString.AssertionType.ATTRIBUTE_VALUE );
+    }
+
+
+    /**
+     * {@inheritDoc}
+     */
+    public String normalize( String value, PrepareString.AssertionType assertionType ) throws LdapException
+    {
+        if ( value == null )
         {
-            throw new LdapInvalidDnException( I18n.err( I18n.ERR_04224, value ), ioe );
+            return null;
         }
+
+        char[] chars = value.toCharArray();
+        
+        // Insignificant Characters Handling
+        String normValue = PrepareString.insignificantNumericStringHandling( chars );
+
+        return normValue;
     }
 }
\ No newline at end of file

Modified: directory/shared/branches/shared-value/ldap/model/src/main/java/org/apache/directory/api/ldap/model/schema/normalizers/ObjectIdentifierNormalizer.java
URL: http://svn.apache.org/viewvc/directory/shared/branches/shared-value/ldap/model/src/main/java/org/apache/directory/api/ldap/model/schema/normalizers/ObjectIdentifierNormalizer.java?rev=1743011&r1=1743010&r2=1743011&view=diff
==============================================================================
--- directory/shared/branches/shared-value/ldap/model/src/main/java/org/apache/directory/api/ldap/model/schema/normalizers/ObjectIdentifierNormalizer.java (original)
+++ directory/shared/branches/shared-value/ldap/model/src/main/java/org/apache/directory/api/ldap/model/schema/normalizers/ObjectIdentifierNormalizer.java Mon May  9 17:22:19 2016
@@ -54,7 +54,7 @@ public class ObjectIdentifierNormalizer
             return null;
         }
 
-        String str = value.getString().trim();
+        String str = value.getValue().trim();
 
         if ( str.length() == 0 )
         {

Modified: directory/shared/branches/shared-value/ldap/model/src/main/java/org/apache/directory/api/ldap/model/schema/normalizers/RegexNormalizer.java
URL: http://svn.apache.org/viewvc/directory/shared/branches/shared-value/ldap/model/src/main/java/org/apache/directory/api/ldap/model/schema/normalizers/RegexNormalizer.java?rev=1743011&r1=1743010&r2=1743011&view=diff
==============================================================================
--- directory/shared/branches/shared-value/ldap/model/src/main/java/org/apache/directory/api/ldap/model/schema/normalizers/RegexNormalizer.java (original)
+++ directory/shared/branches/shared-value/ldap/model/src/main/java/org/apache/directory/api/ldap/model/schema/normalizers/RegexNormalizer.java Mon May  9 17:22:19 2016
@@ -83,7 +83,7 @@ public class RegexNormalizer extends Nor
 
         if ( value.isHumanReadable() )
         {
-            String str = value.getString();
+            String str = value.getValue();
 
             for ( int i = 0; i < matchers.length; i++ )
             {

Modified: directory/shared/branches/shared-value/ldap/model/src/main/java/org/apache/directory/api/ldap/model/schema/normalizers/TelephoneNumberNormalizer.java
URL: http://svn.apache.org/viewvc/directory/shared/branches/shared-value/ldap/model/src/main/java/org/apache/directory/api/ldap/model/schema/normalizers/TelephoneNumberNormalizer.java?rev=1743011&r1=1743010&r2=1743011&view=diff
==============================================================================
--- directory/shared/branches/shared-value/ldap/model/src/main/java/org/apache/directory/api/ldap/model/schema/normalizers/TelephoneNumberNormalizer.java (original)
+++ directory/shared/branches/shared-value/ldap/model/src/main/java/org/apache/directory/api/ldap/model/schema/normalizers/TelephoneNumberNormalizer.java Mon May  9 17:22:19 2016
@@ -20,13 +20,9 @@
 package org.apache.directory.api.ldap.model.schema.normalizers;
 
 
-import java.io.IOException;
-
-import org.apache.directory.api.i18n.I18n;
 import org.apache.directory.api.ldap.model.constants.SchemaConstants;
 import org.apache.directory.api.ldap.model.entry.Value;
 import org.apache.directory.api.ldap.model.exception.LdapException;
-import org.apache.directory.api.ldap.model.exception.LdapInvalidDnException;
 import org.apache.directory.api.ldap.model.schema.Normalizer;
 import org.apache.directory.api.ldap.model.schema.PrepareString;
 
@@ -53,17 +49,9 @@ public class TelephoneNumberNormalizer e
      */
     public Value normalize( Value value ) throws LdapException
     {
-        try
-        {
-            String normalized = PrepareString.normalize( value.getString(),
-                PrepareString.StringType.TELEPHONE_NUMBER );
+        String normalized = normalize( value.getValue() );
 
-            return new Value( normalized );
-        }
-        catch ( IOException ioe )
-        {
-            throw new LdapInvalidDnException( I18n.err( I18n.ERR_04224, value ), ioe );
-        }
+        return new Value( normalized );
     }
 
 
@@ -72,14 +60,16 @@ public class TelephoneNumberNormalizer e
      */
     public String normalize( String value ) throws LdapException
     {
-        try
+        if ( value == null )
         {
-            return PrepareString.normalize( value,
-                PrepareString.StringType.TELEPHONE_NUMBER );
-        }
-        catch ( IOException ioe )
-        {
-            throw new LdapInvalidDnException( I18n.err( I18n.ERR_04224, value ), ioe );
+            return null;
         }
+
+        char[] chars = value.toCharArray();
+        
+        // Insignificant Characters Handling
+        String normValue = PrepareString.insignificantTelephoneNumberStringHandling( chars );
+
+        return normValue;
     }
 }
\ No newline at end of file

Modified: directory/shared/branches/shared-value/ldap/model/src/main/java/org/apache/directory/api/ldap/model/schema/normalizers/UniqueMemberNormalizer.java
URL: http://svn.apache.org/viewvc/directory/shared/branches/shared-value/ldap/model/src/main/java/org/apache/directory/api/ldap/model/schema/normalizers/UniqueMemberNormalizer.java?rev=1743011&r1=1743010&r2=1743011&view=diff
==============================================================================
--- directory/shared/branches/shared-value/ldap/model/src/main/java/org/apache/directory/api/ldap/model/schema/normalizers/UniqueMemberNormalizer.java (original)
+++ directory/shared/branches/shared-value/ldap/model/src/main/java/org/apache/directory/api/ldap/model/schema/normalizers/UniqueMemberNormalizer.java Mon May  9 17:22:19 2016
@@ -50,7 +50,7 @@ public class UniqueMemberNormalizer exte
 
     public Value normalize( Value value ) throws LdapException
     {
-        String nameAndUid = value.getString();
+        String nameAndUid = value.getValue();
 
         if ( nameAndUid.length() == 0 )
         {
@@ -79,7 +79,7 @@ public class UniqueMemberNormalizer exte
             {
                 Dn dn = new Dn( schemaManager, nameAndUid.substring( 0, sharpPos ) );
 
-                return new Value( dn.getNormName() + '#' + uid );
+                return new Value( dn.getName() + '#' + uid );
             }
             else
             {
@@ -90,7 +90,7 @@ public class UniqueMemberNormalizer exte
         {
             // No UID, the strValue is a Dn
             // Return the normalized Dn
-            return new Value( new Dn( nameAndUid ).getNormName() );
+            return new Value( new Dn( nameAndUid ).getName() );
         }
     }
 
@@ -124,7 +124,7 @@ public class UniqueMemberNormalizer exte
             {
                 Dn dn = new Dn( schemaManager, value.substring( 0, sharpPos ) );
 
-                return dn.getNormName() + '#' + uid;
+                return dn.getName() + '#' + uid;
             }
             else
             {
@@ -135,7 +135,7 @@ public class UniqueMemberNormalizer exte
         {
             // No UID, the strValue is a Dn
             // Return the normalized Dn
-            return new Dn( schemaManager, value ).getNormName();
+            return new Dn( schemaManager, value ).getName();
         }
     }
 

Modified: directory/shared/branches/shared-value/ldap/model/src/main/java/org/apache/directory/api/ldap/model/schema/registries/AbstractSchemaLoader.java
URL: http://svn.apache.org/viewvc/directory/shared/branches/shared-value/ldap/model/src/main/java/org/apache/directory/api/ldap/model/schema/registries/AbstractSchemaLoader.java?rev=1743011&r1=1743010&r2=1743011&view=diff
==============================================================================
--- directory/shared/branches/shared-value/ldap/model/src/main/java/org/apache/directory/api/ldap/model/schema/registries/AbstractSchemaLoader.java (original)
+++ directory/shared/branches/shared-value/ldap/model/src/main/java/org/apache/directory/api/ldap/model/schema/registries/AbstractSchemaLoader.java Mon May  9 17:22:19 2016
@@ -131,7 +131,7 @@ public abstract class AbstractSchemaLoad
 
         for ( Value value : objectClasses )
         {
-            if ( MetaSchemaConstants.META_SCHEMA_OC.equalsIgnoreCase( value.getString() ) )
+            if ( MetaSchemaConstants.META_SCHEMA_OC.equalsIgnoreCase( value.getValue() ) )
             {
                 isSchema = true;
                 break;
@@ -180,7 +180,7 @@ public abstract class AbstractSchemaLoad
 
             for ( Value value : depsAttr )
             {
-                depsSet.add( value.getString() );
+                depsSet.add( value.getValue() );
             }
 
             dependencies = depsSet.toArray( StringConstants.EMPTY_STRINGS );

Modified: directory/shared/branches/shared-value/ldap/model/src/main/java/org/apache/directory/api/ldap/model/schema/registries/Registries.java
URL: http://svn.apache.org/viewvc/directory/shared/branches/shared-value/ldap/model/src/main/java/org/apache/directory/api/ldap/model/schema/registries/Registries.java?rev=1743011&r1=1743010&r2=1743011&view=diff
==============================================================================
--- directory/shared/branches/shared-value/ldap/model/src/main/java/org/apache/directory/api/ldap/model/schema/registries/Registries.java (original)
+++ directory/shared/branches/shared-value/ldap/model/src/main/java/org/apache/directory/api/ldap/model/schema/registries/Registries.java Mon May  9 17:22:19 2016
@@ -1004,7 +1004,7 @@ public class Registries implements Schem
         {
             // Ok, no normalizer, this is an error
             Throwable error = new LdapSchemaViolationException( ResultCodeEnum.INVALID_ATTRIBUTE_SYNTAX, I18n.err(
-                I18n.ERR_04295, matchingRule.getOid() ) );
+                I18n.ERR_04295_NO_NORMALIZER, matchingRule.getOid() ) );
             errors.add( error );
         }
 

Modified: directory/shared/branches/shared-value/ldap/model/src/main/java/org/apache/directory/api/ldap/model/schema/syntaxCheckers/BooleanSyntaxChecker.java
URL: http://svn.apache.org/viewvc/directory/shared/branches/shared-value/ldap/model/src/main/java/org/apache/directory/api/ldap/model/schema/syntaxCheckers/BooleanSyntaxChecker.java?rev=1743011&r1=1743010&r2=1743011&view=diff
==============================================================================
--- directory/shared/branches/shared-value/ldap/model/src/main/java/org/apache/directory/api/ldap/model/schema/syntaxCheckers/BooleanSyntaxChecker.java (original)
+++ directory/shared/branches/shared-value/ldap/model/src/main/java/org/apache/directory/api/ldap/model/schema/syntaxCheckers/BooleanSyntaxChecker.java Mon May  9 17:22:19 2016
@@ -29,11 +29,11 @@ import org.slf4j.LoggerFactory;
 
 /**
  * A SyntaxChecker which verifies that a value is a Boolean according to RFC 4517.
- * 
+ * <br>
  * From RFC 4517 :
- * 
+ * <pre>
  * Boolean = "TRUE" / "FALSE"
- * 
+ * </pre>
  *
  * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
  */

Modified: directory/shared/branches/shared-value/ldap/model/src/main/java/org/apache/directory/api/ldap/model/url/LdapUrl.java
URL: http://svn.apache.org/viewvc/directory/shared/branches/shared-value/ldap/model/src/main/java/org/apache/directory/api/ldap/model/url/LdapUrl.java?rev=1743011&r1=1743010&r2=1743011&view=diff
==============================================================================
--- directory/shared/branches/shared-value/ldap/model/src/main/java/org/apache/directory/api/ldap/model/url/LdapUrl.java (original)
+++ directory/shared/branches/shared-value/ldap/model/src/main/java/org/apache/directory/api/ldap/model/url/LdapUrl.java Mon May  9 17:22:19 2016
@@ -1298,7 +1298,7 @@ public class LdapUrl
         try
         {
             filter = decode( new String( chars, pos, end - pos ) );
-            FilterParser.parse( null, filter );
+            FilterParser.parse( filter );
         }
         catch ( LdapUriException ue )
         {

Modified: directory/shared/branches/shared-value/ldap/model/src/test/java/org/apache/directory/api/ldap/model/entry/AttributeTest.java
URL: http://svn.apache.org/viewvc/directory/shared/branches/shared-value/ldap/model/src/test/java/org/apache/directory/api/ldap/model/entry/AttributeTest.java?rev=1743011&r1=1743010&r2=1743011&view=diff
==============================================================================
--- directory/shared/branches/shared-value/ldap/model/src/test/java/org/apache/directory/api/ldap/model/entry/AttributeTest.java (original)
+++ directory/shared/branches/shared-value/ldap/model/src/test/java/org/apache/directory/api/ldap/model/entry/AttributeTest.java Mon May  9 17:22:19 2016
@@ -285,7 +285,7 @@ public class AttributeTest
         Attribute attr1 = new DefaultAttribute( "test" );
 
         attr1.add( ( String ) null );
-        assertEquals( "", attr1.getString() );
+        assertEquals( null, attr1.getString() );
 
         Attribute attr2 = new DefaultAttribute( "test" );
 
@@ -458,7 +458,7 @@ public class AttributeTest
         for ( Value val : attr )
         {
             assertTrue( val instanceof Value );
-            assertEquals( values[pos++], val.getString() );
+            assertEquals( values[pos++], val.getValue() );
         }
     }
 
@@ -878,13 +878,13 @@ public class AttributeTest
         Attribute attr2 = new DefaultAttribute( "test" );
 
         attr2.add( "a", "b", "c" );
-        assertEquals( "a", attr2.get().getString() );
+        assertEquals( "a", attr2.get().getValue() );
 
         attr2.remove( "a" );
-        assertEquals( "b", attr2.get().getString() );
+        assertEquals( "b", attr2.get().getValue() );
 
         attr2.remove( "b" );
-        assertEquals( "c", attr2.get().getString() );
+        assertEquals( "c", attr2.get().getValue() );
 
         attr2.remove( "c" );
         assertNull( attr2.get() );
@@ -930,9 +930,9 @@ public class AttributeTest
         attr.add( "a", "b", "c" );
         iterator = attr.iterator();
         assertTrue( iterator.hasNext() );
-        assertEquals( "a", iterator.next().getString() );
-        assertEquals( "b", iterator.next().getString() );
-        assertEquals( "c", iterator.next().getString() );
+        assertEquals( "a", iterator.next().getValue() );
+        assertEquals( "b", iterator.next().getValue() );
+        assertEquals( "c", iterator.next().getValue() );
         assertFalse( iterator.hasNext() );
     }
 
@@ -1504,7 +1504,7 @@ public class AttributeTest
         assertEquals( dca.toString(), dcaSer.toString() );
         assertEquals( "cn", dcaSer.getId() );
         assertEquals( "CN", dcaSer.getUpId() );
-        assertEquals( "", dcaSer.getString() );
+        assertEquals( null, dcaSer.getString() );
         assertEquals( 1, dcaSer.size() );
         assertTrue( dcaSer.contains( ( String ) null ) );
         assertTrue( dcaSer.isHumanReadable() );

Modified: directory/shared/branches/shared-value/ldap/model/src/test/java/org/apache/directory/api/ldap/model/entry/AttributeUtilsTest.java
URL: http://svn.apache.org/viewvc/directory/shared/branches/shared-value/ldap/model/src/test/java/org/apache/directory/api/ldap/model/entry/AttributeUtilsTest.java?rev=1743011&r1=1743010&r2=1743011&view=diff
==============================================================================
--- directory/shared/branches/shared-value/ldap/model/src/test/java/org/apache/directory/api/ldap/model/entry/AttributeUtilsTest.java (original)
+++ directory/shared/branches/shared-value/ldap/model/src/test/java/org/apache/directory/api/ldap/model/entry/AttributeUtilsTest.java Mon May  9 17:22:19 2016
@@ -140,7 +140,7 @@ public class AttributeUtilsTest
 
         for ( Value value : attribute )
         {
-            String valueStr = value.getString();
+            String valueStr = value.getValue();
 
             assertTrue( expectedValues.contains( valueStr ) );
 
@@ -178,7 +178,7 @@ public class AttributeUtilsTest
 
         for ( Value value : cnAttr )
         {
-            String valueStr = value.getString();
+            String valueStr = value.getValue();
 
             assertTrue( expectedValues.contains( valueStr ) );
 
@@ -308,7 +308,7 @@ public class AttributeUtilsTest
             assertTrue( isFirst );
 
             isFirst = false;
-            assertEquals( "apache", value.getString() );
+            assertEquals( "apache", value.getValue() );
         }
     }
 
@@ -390,7 +390,7 @@ public class AttributeUtilsTest
 
         for ( Value value : modifiedAttr )
         {
-            String valueStr = value.getString();
+            String valueStr = value.getValue();
 
             assertTrue( expectedValues.contains( valueStr ) );
 

Modified: directory/shared/branches/shared-value/ldap/model/src/test/java/org/apache/directory/api/ldap/model/entry/BinaryValueAttributeTypeTest.java
URL: http://svn.apache.org/viewvc/directory/shared/branches/shared-value/ldap/model/src/test/java/org/apache/directory/api/ldap/model/entry/BinaryValueAttributeTypeTest.java?rev=1743011&r1=1743010&r2=1743011&view=diff
==============================================================================
--- directory/shared/branches/shared-value/ldap/model/src/test/java/org/apache/directory/api/ldap/model/entry/BinaryValueAttributeTypeTest.java (original)
+++ directory/shared/branches/shared-value/ldap/model/src/test/java/org/apache/directory/api/ldap/model/entry/BinaryValueAttributeTypeTest.java Mon May  9 17:22:19 2016
@@ -250,14 +250,15 @@ public class BinaryValueAttributeTypeTes
 
     /**
      * Test the constructor with a value
+     * @throws LdapInvalidAttributeValueException 
      */
     @Test
-    public void testServerBinaryValueNoValue()
+    public void testServerBinaryValueNoValue() throws LdapInvalidAttributeValueException
     {
         AttributeType attribute = EntryUtils.getBytesAttributeType();
         byte[] val = new byte[]
             { 0x01 };
-        Value bv = new Value( val );
+        Value bv = new Value( attribute, val );
         assertTrue( Arrays.equals( val, bv.getBytes() ) );
         assertFalse( bv.isNull() );
     }
@@ -334,7 +335,7 @@ public class BinaryValueAttributeTypeTes
         assertFalse( value1.equals( "test" ) );
         assertFalse( value1.equals( null ) );
 
-        assertFalse( value1.equals( value6 ) );
+        assertTrue( value1.equals( value6 ) );
         assertFalse( value1.equals( value7 ) );
     }
 
@@ -348,7 +349,7 @@ public class BinaryValueAttributeTypeTes
         AttributeType attribute = EntryUtils.getBytesAttributeType();
 
         Value value = new Value( attribute, ( byte[] ) null );
-        assertNull( value.getNormValue() );
+        assertNull( value.getBytes() );
 
         value = new Value( attribute, StringConstants.EMPTY_BYTES );
         assertTrue( Arrays.equals( StringConstants.EMPTY_BYTES, value.getBytes() ) );
@@ -367,7 +368,7 @@ public class BinaryValueAttributeTypeTes
         AttributeType attribute = EntryUtils.getBytesAttributeType();
 
         Value value = new Value( attribute, ( byte[] ) null );
-        assertNull( value.getNormValue() );
+        assertNull( value.getBytes() );
 
         value = new Value( attribute, StringConstants.EMPTY_BYTES );
         assertTrue( Arrays.equals( StringConstants.EMPTY_BYTES, value.getBytes() ) );
@@ -493,7 +494,7 @@ public class BinaryValueAttributeTypeTes
         AttributeType attribute = EntryUtils.getBytesAttributeType();
         Value bv = Value.createValue( attribute );
 
-        assertEquals( null, bv.getNormValue() );
+        assertEquals( null, bv.getBytes() );
 
         bv = new Value( attribute, StringConstants.EMPTY_BYTES );
         assertTrue( Arrays.equals( StringConstants.EMPTY_BYTES, bv.getBytes() ) );
@@ -576,7 +577,7 @@ public class BinaryValueAttributeTypeTes
         byte[] normalized = sbv.getBytes();
 
         assertEquals( null, normalized );
-        assertEquals( null, sbv.getValue() );
+        assertEquals( "", sbv.getValue() );
 
         Value sbvSer = deserializeValue( serializeValue( sbv ), at );
 

Modified: directory/shared/branches/shared-value/ldap/model/src/test/java/org/apache/directory/api/ldap/model/entry/BinaryValueTest.java
URL: http://svn.apache.org/viewvc/directory/shared/branches/shared-value/ldap/model/src/test/java/org/apache/directory/api/ldap/model/entry/BinaryValueTest.java?rev=1743011&r1=1743010&r2=1743011&view=diff
==============================================================================
--- directory/shared/branches/shared-value/ldap/model/src/test/java/org/apache/directory/api/ldap/model/entry/BinaryValueTest.java (original)
+++ directory/shared/branches/shared-value/ldap/model/src/test/java/org/apache/directory/api/ldap/model/entry/BinaryValueTest.java Mon May  9 17:22:19 2016
@@ -113,7 +113,6 @@ public class BinaryValueTest
                 throw new IllegalStateException( "expected byte[] to normalize" );
             }
 
-
             public String normalize( String value ) throws LdapException
             {
                 throw new IllegalStateException( "expected byte[] to normalize" );
@@ -241,11 +240,11 @@ public class BinaryValueTest
     {
         Value cbv = new Value( ( byte[] ) null );
 
-        assertNull( cbv.getValue() );
+        assertEquals( "", cbv.getValue() );
         assertFalse( cbv.isSchemaAware() );
         assertTrue( cbv.isValid( BINARY_CHECKER ) );
         assertTrue( cbv.isNull() );
-        assertNull( cbv.getNormValue() );
+        assertNull( cbv.getBytes() );
     }
 
 
@@ -258,7 +257,7 @@ public class BinaryValueTest
         assertFalse( cbv.isSchemaAware() );
         assertTrue( cbv.isValid( BINARY_CHECKER ) );
         assertFalse( cbv.isNull() );
-        assertNotNull( cbv.getNormValue() );
+        assertTrue( Arrays.equals( StringConstants.EMPTY_BYTES, cbv.getBytes() ) );
     }
 
 
@@ -397,7 +396,7 @@ public class BinaryValueTest
     {
         Value bv = new Value( ( byte[] ) null );
 
-        assertNull( bv.getValue() );
+        assertEquals( "", bv.getValue() );
 
         bv = new Value( StringConstants.EMPTY_BYTES );
         assertNotNull( bv.getBytes() );
@@ -463,10 +462,10 @@ public class BinaryValueTest
     {
         Value bv = new Value( ( byte[] ) null );
 
-        assertNull( bv.getValue() );
+        assertEquals( "", bv.getValue() );
 
         bv = new Value( StringConstants.EMPTY_BYTES );
-        assertNull( bv.getValue() );
+        assertEquals( "", bv.getValue() );
         assertTrue( Arrays.equals( StringConstants.EMPTY_BYTES, bv.getBytes() ) );
 
         bv = new Value( BYTES1 );
@@ -557,7 +556,7 @@ public class BinaryValueTest
 
         bv = new Value( at, bv );
         assertTrue( bv.isSchemaAware() );
-        assertEquals( null, bv.getNormValue() );
+        assertEquals( null, bv.getBytes() );
 
         bv = new Value( StringConstants.EMPTY_BYTES );
         bv = new Value( at, bv );
@@ -576,13 +575,13 @@ public class BinaryValueTest
     {
         Value bv = new Value( ( byte[] ) null );
 
-        assertNull( bv.getValue() );
+        assertEquals( "", bv.getValue() );
         assertFalse( bv.isSchemaAware() );
         assertTrue( bv.isValid( BINARY_CHECKER ) );
         assertTrue( bv.isNull() );
 
         bv = new Value( StringConstants.EMPTY_BYTES );
-        assertNull( bv.getValue() );
+        assertEquals( "", bv.getValue() );
         assertTrue( Arrays.equals( StringConstants.EMPTY_BYTES, bv.getBytes() ) );
         assertFalse( bv.isSchemaAware() );
         assertTrue( bv.isValid( BINARY_CHECKER ) );

Modified: directory/shared/branches/shared-value/ldap/model/src/test/java/org/apache/directory/api/ldap/model/entry/EntryUtils.java
URL: http://svn.apache.org/viewvc/directory/shared/branches/shared-value/ldap/model/src/test/java/org/apache/directory/api/ldap/model/entry/EntryUtils.java?rev=1743011&r1=1743010&r2=1743011&view=diff
==============================================================================
--- directory/shared/branches/shared-value/ldap/model/src/test/java/org/apache/directory/api/ldap/model/entry/EntryUtils.java (original)
+++ directory/shared/branches/shared-value/ldap/model/src/test/java/org/apache/directory/api/ldap/model/entry/EntryUtils.java Mon May  9 17:22:19 2016
@@ -163,7 +163,7 @@ public class EntryUtils
             {
                 if ( value.isHumanReadable() )
                 {
-                    return new Value( Strings.toLowerCaseAscii( value.getString() ) );
+                    return new Value( Strings.toLowerCaseAscii( value.getValue() ) );
                 }
 
                 throw new IllegalStateException( I18n.err( I18n.ERR_04474 ) );
@@ -198,7 +198,8 @@ public class EntryUtils
 
             public boolean isValidSyntax( Object value )
             {
-                return ( ( String ) value == null ) || ( ( ( String ) value ).length() < 7 );
+                String strValue = Strings.deepTrim( ( String ) value );
+                return ( strValue == null ) || ( strValue.length() < 7 );
             }
         } );
 

Modified: directory/shared/branches/shared-value/ldap/model/src/test/java/org/apache/directory/api/ldap/model/entry/StringValueAttributeTypeTest.java
URL: http://svn.apache.org/viewvc/directory/shared/branches/shared-value/ldap/model/src/test/java/org/apache/directory/api/ldap/model/entry/StringValueAttributeTypeTest.java?rev=1743011&r1=1743010&r2=1743011&view=diff
==============================================================================
--- directory/shared/branches/shared-value/ldap/model/src/test/java/org/apache/directory/api/ldap/model/entry/StringValueAttributeTypeTest.java (original)
+++ directory/shared/branches/shared-value/ldap/model/src/test/java/org/apache/directory/api/ldap/model/entry/StringValueAttributeTypeTest.java Mon May  9 17:22:19 2016
@@ -41,7 +41,6 @@ import java.util.List;
 import org.apache.directory.api.ldap.model.exception.LdapException;
 import org.apache.directory.api.ldap.model.exception.LdapInvalidAttributeValueException;
 import org.apache.directory.api.ldap.model.schema.AttributeType;
-import org.apache.directory.api.ldap.model.schema.LdapComparator;
 import org.apache.directory.api.ldap.model.schema.SyntaxChecker;
 import org.apache.directory.api.ldap.model.schema.comparators.StringComparator;
 import org.apache.directory.api.ldap.model.schema.normalizers.DeepTrimToLowerNormalizer;
@@ -199,17 +198,17 @@ public class StringValueAttributeTypeTes
         Value sv = new Value( attribute, (String)null );
 
         assertTrue( sv.isSchemaAware() );
-        assertNull( sv.getNormValue() );
+        assertNull( sv.getValue() );
         assertTrue( sv.isSchemaAware() );
 
         sv = new Value( attribute, "" );
         assertTrue( sv.isSchemaAware() );
-        assertEquals( "", sv.getNormValue() );
+        assertEquals( 0, sv.compareTo( "  " ) );
         assertTrue( sv.isSchemaAware() );
 
         sv = new Value( attribute, "TEST" );
         assertTrue( sv.isSchemaAware() );
-        assertEquals( "test", sv.getNormValue() );
+        assertEquals( 0, sv.compareTo( " test " ) );
     }
 
 
@@ -249,14 +248,14 @@ public class StringValueAttributeTypeTes
         Value sv = Value.createValue( attribute );
 
         sv = new Value( at, sv );
-        assertEquals( null, sv.getNormValue() );
+        assertEquals( 0, sv.compareTo( ( String ) null ) );
 
         sv = new Value( attribute, "" );
         sv = new Value( at, sv );
-        assertEquals( "", sv.getNormValue() );
+        assertEquals( 0, sv.compareTo( "  " ) );
 
         sv = new Value( attribute, "  A   TEST  " );
-        assertEquals( "a test", sv.getNormValue() );
+        assertEquals( 0, sv.compareTo( " a  test " ) );
     }
 
 
@@ -408,7 +407,7 @@ public class StringValueAttributeTypeTes
         sv = new Value( "" );
 
         assertNotSame( sv, sv1 );
-        assertEquals( "", sv.getString() );
+        assertEquals( "", sv.getValue() );
 
         sv = new Value( "  This is    a   TEST  " );
         sv1 = sv.clone();
@@ -445,66 +444,6 @@ public class StringValueAttributeTypeTes
         } );
 
         mr.setSyntax( s );
-        mr.setLdapComparator( new LdapComparator<String>( mr.getOid() )
-        {
-            public static final long serialVersionUID = 1L;
-
-
-            public int compare( String o1, String o2 )
-            {
-                if ( o1 == null )
-                {
-                    if ( o2 == null )
-                    {
-                        return 0;
-                    }
-                    else
-                    {
-                        return -1;
-                    }
-                }
-                else if ( o2 == null )
-                {
-                    return 1;
-                }
-
-                int i1 = getValue( o1 );
-                int i2 = getValue( o2 );
-
-                if ( i1 == i2 )
-                {
-                    return 0;
-                }
-                if ( i1 > i2 )
-                {
-                    return 1;
-                }
-                if ( i1 < i2 )
-                {
-                    return -1;
-                }
-
-                throw new IllegalStateException( "should not get here at all" );
-            }
-
-
-            public int getValue( String val )
-            {
-                if ( val.equals( "LOW" ) )
-                {
-                    return 0;
-                }
-                if ( val.equals( "MEDIUM" ) )
-                {
-                    return 1;
-                }
-                if ( val.equals( "HIGH" ) )
-                {
-                    return 2;
-                }
-                throw new IllegalArgumentException( "Not a valid value" );
-            }
-        } );
 
         mr.setNormalizer( new NoOpNormalizer( mr.getOid() ) );
         at.setEquality( mr );
@@ -537,8 +476,8 @@ public class StringValueAttributeTypeTes
 
         assertFalse( v2.equals( v3 ) );
         assertFalse( v3.equals( v2 ) );
-        assertTrue( v2.compareTo( v3 ) < 0 );
-        assertTrue( v3.compareTo( v2 ) > 0 );
+        assertTrue( v2.compareTo( v3 ) > 0 );
+        assertTrue( v3.compareTo( v2 ) < 0 );
 
         // add all except v1 and v5 to a set
         HashSet<Value> set = new HashSet<Value>();
@@ -558,13 +497,11 @@ public class StringValueAttributeTypeTes
 
         Collections.sort( list );
 
-        // low ones are at the 3rd and 4th indices
-        assertTrue( "since v0 equals v1 either could be at index 0 & 1", list.get( 0 ).equals( v0 ) );
-        assertTrue( "since v0 equals v1 either could be at index 0 & 1", list.get( 1 ).equals( v1 ) );
-
-        // medium then high next
-        assertTrue( "since v2 \"MEDIUM\" should be at index 2", list.get( 2 ).equals( v2 ) );
-        assertTrue( "since v3 \"HIGH\" should be at index 3", list.get( 3 ).equals( v3 ) );
+        // High, low, low, medium
+        assertTrue( "since v0 equals v1 either could be at index 0 & 1", list.get( 0 ).equals( v3 ) );
+        assertTrue( "since v0 equals v1 either could be at index 0 & 1", list.get( 1 ).equals( v0 ) );
+        assertTrue( "since v2 \"MEDIUM\" should be at index 2", list.get( 2 ).equals( v1 ) );
+        assertTrue( "since v3 \"HIGH\" should be at index 3", list.get( 3 ).equals( v2 ) );
 
         assertEquals( 4, list.size() );
     }
@@ -630,12 +567,12 @@ public class StringValueAttributeTypeTes
 
                 if ( o1 != null )
                 {
-                    n1 = o1.getString();
+                    n1 = o1.getValue();
                 }
 
                 if ( o2 != null )
                 {
-                    n2 = o2.getString();
+                    n2 = o2.getValue();
                 }
 
                 if ( n1 == null )
@@ -679,10 +616,8 @@ public class StringValueAttributeTypeTes
         // First check with a value which will be normalized
         Value ssv = new Value( at, "  Test   Test  " );
 
-        String normalized = ssv.getNormValue();
-
-        assertEquals( "test test", normalized );
-        assertEquals( "  Test   Test  ", ssv.getString() );
+        assertEquals( 0, ssv.compareTo( " test  test " ) );
+        assertEquals( "  Test   Test  ", ssv.getValue() );
 
         Value ssvSer = deserializeValue( serializeValue( ssv ) );
 
@@ -699,10 +634,8 @@ public class StringValueAttributeTypeTes
         // First check with a value which will be normalized
         Value ssv = new Value( at, "test" );
 
-        String normalized = ssv.getNormValue();
-
-        assertEquals( "test", normalized );
-        assertEquals( "test", ssv.getString() );
+        assertEquals( 0, ssv.compareTo( " test " ) );
+        assertEquals( "test", ssv.getValue() );
 
         Value ssvSer = deserializeValue( serializeValue( ssv ) );
 
@@ -719,9 +652,7 @@ public class StringValueAttributeTypeTes
         // First check with a value which will be normalized
         Value ssv = Value.createValue( at );
 
-        String normalized = ssv.getNormValue();
-
-        assertNull( normalized );
+        assertEquals( 0, ssv.compareTo( ( String ) null ) );
         assertNull( ssv.getValue() );
 
         Value ssvSer = deserializeValue( serializeValue( ssv ) );
@@ -739,10 +670,8 @@ public class StringValueAttributeTypeTes
         // First check with a value which will be normalized
         Value ssv = new Value( at, "" );
 
-        String normalized = ssv.getNormValue();
-
-        assertEquals( "", normalized );
-        assertEquals( "", ssv.getString() );
+        assertEquals( 0, ssv.compareTo( "  " ) );
+        assertEquals( "", ssv.getValue() );
 
         Value ssvSer = deserializeValue( serializeValue( ssv ) );
 
@@ -759,7 +688,7 @@ public class StringValueAttributeTypeTes
         // First check with a value which will be normalized
         Value ssv = new Value( "  " );
 
-        assertEquals( "  ", ssv.getString() );
+        assertEquals( "  ", ssv.getValue() );
 
         Value ssvSer = deserializeValue( serializeValue( ssv ) );
 

Modified: directory/shared/branches/shared-value/ldap/model/src/test/java/org/apache/directory/api/ldap/model/entry/StringValueTest.java
URL: http://svn.apache.org/viewvc/directory/shared/branches/shared-value/ldap/model/src/test/java/org/apache/directory/api/ldap/model/entry/StringValueTest.java?rev=1743011&r1=1743010&r2=1743011&view=diff
==============================================================================
--- directory/shared/branches/shared-value/ldap/model/src/test/java/org/apache/directory/api/ldap/model/entry/StringValueTest.java (original)
+++ directory/shared/branches/shared-value/ldap/model/src/test/java/org/apache/directory/api/ldap/model/entry/StringValueTest.java Mon May  9 17:22:19 2016
@@ -31,16 +31,14 @@ import java.io.ByteArrayOutputStream;
 import java.io.IOException;
 import java.io.ObjectInputStream;
 import java.io.ObjectOutputStream;
-import java.util.Arrays;
 
 import org.apache.directory.api.ldap.model.entry.Value;
 import org.apache.directory.api.ldap.model.exception.LdapException;
 import org.apache.directory.api.ldap.model.schema.AttributeType;
 import org.apache.directory.api.ldap.model.schema.comparators.StringComparator;
 import org.apache.directory.api.ldap.model.schema.normalizers.DeepTrimToLowerNormalizer;
+import org.apache.directory.api.ldap.model.schema.syntaxCheckers.DirectoryStringSyntaxChecker;
 import org.apache.directory.api.ldap.model.schema.syntaxCheckers.Ia5StringSyntaxChecker;
-import org.apache.directory.api.ldap.model.schema.syntaxCheckers.OctetStringSyntaxChecker;
-import org.apache.directory.api.util.Strings;
 import org.junit.BeforeClass;
 import org.junit.Test;
 import org.junit.runner.RunWith;
@@ -72,7 +70,7 @@ public class StringValueTest
     public static void initAT()
     {
         s = new EntryUtils.S( "1.1.1.1", true );
-        s.setSyntaxChecker( new OctetStringSyntaxChecker() );
+        s.setSyntaxChecker( new DirectoryStringSyntaxChecker() );
         mr = new EntryUtils.MR( "1.1.2.1" );
         mr.setSyntax( s );
         mr.setLdapComparator( new StringComparator( "1.1.2.1" ) );
@@ -161,7 +159,7 @@ public class StringValueTest
 
         assertNotSame( sv2, sv1 );
         assertNull( sv1.getValue() );
-        assertEquals( "", sv2.getString() );
+        assertEquals( "", sv2.getValue() );
     }
 
 
@@ -178,15 +176,15 @@ public class StringValueTest
         sv1 = sv.clone();
 
         assertEquals( sv, sv1 );
-        assertEquals( "  This is    a   TEST  ", sv.getString() );
+        assertEquals( "  This is    a   TEST  ", sv.getValue() );
 
         sv = new Value( at, sv );
 
         assertNotSame( sv, sv1 );
-        assertEquals( "  This is    a   TEST  ", sv1.getString() );
-        assertEquals( "  This is    a   TEST  ", sv1.getNormValue() );
-        assertEquals( "  This is    a   TEST  ", sv.getString() );
-        assertEquals( "this is a test", sv.getNormValue() );
+        assertEquals( "  This is    a   TEST  ", sv1.getValue() );
+        assertEquals( 0, sv.compareTo( "  This is    a   TEST  " ) );
+        assertEquals( "  This is    a   TEST  ", sv.getValue() );
+        assertEquals( 0, sv.compareTo( " this  is  a  test " ) );
     }
 
 
@@ -198,7 +196,7 @@ public class StringValueTest
     {
         Value csv = new Value( "test" );
 
-        int hash = Arrays.hashCode( Strings.getBytesUtf8( "test" ) );
+        int hash = "test".hashCode();
         assertEquals( hash, csv.hashCode() );
 
         csv = new Value( ( String ) null );
@@ -218,7 +216,7 @@ public class StringValueTest
         assertFalse( csv.isSchemaAware() );
         assertTrue( csv.isValid( new Ia5StringSyntaxChecker() ) );
         assertTrue( csv.isNull() );
-        assertEquals( null, csv.getNormValue() );
+        assertEquals( 0, csv.compareTo( ( String ) null ) );
     }
 
 
@@ -231,12 +229,11 @@ public class StringValueTest
         Value csv = new Value( "" );
 
         assertNotNull( csv.getValue() );
-        assertEquals( "", csv.getString() );
+        assertEquals( "", csv.getValue() );
         assertFalse( csv.isSchemaAware() );
         assertTrue( csv.isValid( new Ia5StringSyntaxChecker() ) );
         assertFalse( csv.isNull() );
-        assertNotNull( csv.getNormValue() );
-        assertEquals( "", csv.getNormValue() );
+        assertEquals( 0, csv.compareTo( "" ) );
     }
 
 
@@ -252,8 +249,7 @@ public class StringValueTest
         assertFalse( csv.isSchemaAware() );
         assertTrue( csv.isValid( new Ia5StringSyntaxChecker() ) );
         assertFalse( csv.isNull() );
-        assertNotNull( csv.getNormValue() );
-        assertEquals( "test", csv.getNormValue() );
+        assertEquals( 0, csv.compareTo( "test" ) );
     }
 
 
@@ -341,7 +337,7 @@ public class StringValueTest
 
         sv = new Value( at, sv );
 
-        assertEquals( "this is a test", sv.getNormValue() );
+        assertEquals( 0, sv.compareTo( " this  is  a  test " ) );
         assertTrue( sv.isSchemaAware() );
 
         sv = new Value( "test" );
@@ -364,7 +360,7 @@ public class StringValueTest
 
         sv = new Value( at, sv );
 
-        assertEquals( "this is a test", sv.getNormValue() );
+        assertEquals( 0, sv.compareTo( " this  is  a  test " ) );
         assertTrue( sv.isSchemaAware() );
     }
 
@@ -377,14 +373,14 @@ public class StringValueTest
     {
         Value sv = new Value( ( String ) null );
 
-        assertEquals( null, sv.getNormValue() );
+        assertEquals( 0, sv.compareTo( ( String ) null ) );
 
         sv = new Value( "  This is    a   TEST  " );
-        assertEquals( "  This is    a   TEST  ", sv.getNormValue() );
+        assertEquals( 0, sv.compareTo( "  This is    a   TEST  " ) );
 
         sv = new Value( at, sv );
 
-        assertEquals( "this is a test", sv.getNormValue() );
+        assertEquals( 0, sv.compareTo( " this  is  a  test " ) );
     }
 
 
@@ -396,14 +392,14 @@ public class StringValueTest
     {
         Value sv = new Value( ( String ) null );
 
-        assertEquals( null, sv.getNormValue() );
+        assertEquals( 0, sv.compareTo( ( String ) null ) );
 
         sv = new Value( "  This is    a   TEST  " );
-        assertEquals( "  This is    a   TEST  ", sv.getNormValue() );
+        assertEquals( 0, sv.compareTo( "  This is    a   TEST  " ) );
 
         sv = new Value( at, sv );
 
-        assertEquals( "this is a test", sv.getNormValue() );
+        assertEquals( 0, sv.compareTo( " this  is  a  test " ) );
     }
 
 
@@ -416,18 +412,18 @@ public class StringValueTest
         Value sv = new Value( ( String ) null );
 
         sv = new Value( at, sv );
-        assertEquals( null, sv.getNormValue() );
+        assertEquals( 0, sv.compareTo( ( String ) null ) );
 
         sv = new Value( "" );
         sv = new Value( at, sv );
-        assertEquals( "", sv.getNormValue() );
+        assertEquals( 0, sv.compareTo( "  " ) );
 
         sv = new Value( "  This is    a   TEST  " );
-        assertEquals( "  This is    a   TEST  ", sv.getNormValue() );
+        assertEquals( 0, sv.compareTo( "  This is    a   TEST  " ) );
 
         sv = new Value( at, sv );
 
-        assertEquals( "this is a test", sv.getNormValue() );
+        assertEquals( 0, sv.compareTo( " this  is  a  test " ) );
     }
 
 
@@ -535,7 +531,7 @@ public class StringValueTest
         Value csvSer = deserializeValue( at, serializeValue( csv ) );
         assertNotSame( csv, csvSer );
         assertEquals( csv.getValue(), csvSer.getValue() );
-        assertEquals( csv.getNormValue(), csvSer.getNormValue() );
+        assertEquals( 0, csv.compareTo( csvSer ) );
         assertTrue( csvSer.isSchemaAware() );
     }
 
@@ -552,7 +548,7 @@ public class StringValueTest
         Value csvSer = deserializeValue( null, serializeValue( csv ) );
         assertNotSame( csv, csvSer );
         assertEquals( csv.getValue(), csvSer.getValue() );
-        assertEquals( csv.getValue(), csvSer.getNormValue() );
+        assertEquals( 0, csv.compareTo( csvSer ) );
         assertFalse( csvSer.isSchemaAware() );
     }
 
@@ -570,7 +566,7 @@ public class StringValueTest
         Value csvSer = deserializeValue( at, serializeValue( csv ) );
         assertNotSame( csv, csvSer );
         assertEquals( csv.getValue(), csvSer.getValue() );
-        assertEquals( csv.getNormValue(), csvSer.getNormValue() );
+        assertEquals( 0, csv.compareTo( csvSer ) );
         assertTrue( csvSer.isSchemaAware() );
     }
 
@@ -588,7 +584,7 @@ public class StringValueTest
         Value csvSer = deserializeValue( at, serializeValue( csv ) );
         assertNotSame( csv, csvSer );
         assertEquals( csv.getValue(), csvSer.getValue() );
-        assertEquals( csv.getNormValue(), csvSer.getNormValue() );
+        assertEquals( 0, csv.compareTo( csvSer ) );
         assertTrue( csvSer.isSchemaAware() );
     }
 
@@ -606,7 +602,7 @@ public class StringValueTest
         Value csvSer = deserializeValue( at, serializeValue( csv ) );
         assertNotSame( csv, csvSer );
         assertEquals( csv.getValue(), csvSer.getValue() );
-        assertEquals( csv.getNormValue(), csvSer.getNormValue() );
+        assertEquals( 0, csv.compareTo( csvSer ) );
         assertTrue( csvSer.isSchemaAware() );
     }
 
@@ -623,7 +619,7 @@ public class StringValueTest
         Value csvSer = deserializeValue( null, serializeValue( csv ) );
         assertNotSame( csv, csvSer );
         assertEquals( csv.getValue(), csvSer.getValue() );
-        assertEquals( csv.getNormValue(), csvSer.getNormValue() );
+        assertEquals( 0, csv.compareTo( csvSer ) );
         assertFalse( csvSer.isSchemaAware() );
     }
 }

Modified: directory/shared/branches/shared-value/ldap/model/src/test/java/org/apache/directory/api/ldap/model/entry/ValueSerializationTest.java
URL: http://svn.apache.org/viewvc/directory/shared/branches/shared-value/ldap/model/src/test/java/org/apache/directory/api/ldap/model/entry/ValueSerializationTest.java?rev=1743011&r1=1743010&r2=1743011&view=diff
==============================================================================
--- directory/shared/branches/shared-value/ldap/model/src/test/java/org/apache/directory/api/ldap/model/entry/ValueSerializationTest.java (original)
+++ directory/shared/branches/shared-value/ldap/model/src/test/java/org/apache/directory/api/ldap/model/entry/ValueSerializationTest.java Mon May  9 17:22:19 2016
@@ -32,6 +32,7 @@ import org.apache.directory.api.ldap.mod
 import org.apache.directory.api.ldap.model.exception.LdapInvalidAttributeValueException;
 import org.apache.directory.api.ldap.model.schema.AttributeType;
 import org.apache.directory.api.ldap.model.schema.Normalizer;
+import org.apache.directory.api.ldap.model.schema.PrepareString;
 import org.apache.directory.api.ldap.model.schema.comparators.ByteArrayComparator;
 import org.apache.directory.api.ldap.model.schema.comparators.StringComparator;
 import org.apache.directory.api.ldap.model.schema.normalizers.DeepTrimToLowerNormalizer;
@@ -118,7 +119,7 @@ public class ValueSerializationTest
                 throw new IllegalStateException( "expected byte[] to normalize" );
             }
 
-
+            
             public String normalize( String value ) throws LdapException
             {
                 throw new IllegalStateException( "expected byte[] to normalize" );

Modified: directory/shared/branches/shared-value/ldap/model/src/test/java/org/apache/directory/api/ldap/model/filter/BranchNormalizedVisitorTest.java
URL: http://svn.apache.org/viewvc/directory/shared/branches/shared-value/ldap/model/src/test/java/org/apache/directory/api/ldap/model/filter/BranchNormalizedVisitorTest.java?rev=1743011&r1=1743010&r2=1743011&view=diff
==============================================================================
--- directory/shared/branches/shared-value/ldap/model/src/test/java/org/apache/directory/api/ldap/model/filter/BranchNormalizedVisitorTest.java (original)
+++ directory/shared/branches/shared-value/ldap/model/src/test/java/org/apache/directory/api/ldap/model/filter/BranchNormalizedVisitorTest.java Mon May  9 17:22:19 2016
@@ -27,8 +27,6 @@ import static org.junit.Assert.assertTru
 import com.mycila.junit.concurrent.Concurrency;
 import com.mycila.junit.concurrent.ConcurrentJunitRunner;
 
-import org.apache.directory.api.ldap.model.filter.BranchNormalizedVisitor;
-import org.apache.directory.api.ldap.model.filter.ExprNode;
 import org.apache.directory.api.ldap.model.filter.FilterParser;
 import org.junit.Test;
 import org.junit.runner.RunWith;



Mime
View raw message