directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From elecha...@apache.org
Subject svn commit: r1743011 [11/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
Modified: directory/shared/branches/shared-value/ldap/model/src/test/java/org/apache/directory/api/ldap/model/filter/FilterCloneTest.java
URL: http://svn.apache.org/viewvc/directory/shared/branches/shared-value/ldap/model/src/test/java/org/apache/directory/api/ldap/model/filter/FilterCloneTest.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/FilterCloneTest.java (original)
+++ directory/shared/branches/shared-value/ldap/model/src/test/java/org/apache/directory/api/ldap/model/filter/FilterCloneTest.java Mon May  9 17:22:19 2016
@@ -30,18 +30,7 @@ import java.text.ParseException;
 import com.mycila.junit.concurrent.Concurrency;
 import com.mycila.junit.concurrent.ConcurrentJunitRunner;
 
-import org.apache.directory.api.ldap.model.filter.AndNode;
-import org.apache.directory.api.ldap.model.filter.ApproximateNode;
-import org.apache.directory.api.ldap.model.filter.BranchNode;
-import org.apache.directory.api.ldap.model.filter.EqualityNode;
-import org.apache.directory.api.ldap.model.filter.ExprNode;
-import org.apache.directory.api.ldap.model.filter.ExtensibleNode;
 import org.apache.directory.api.ldap.model.filter.FilterParser;
-import org.apache.directory.api.ldap.model.filter.NotNode;
-import org.apache.directory.api.ldap.model.filter.OrNode;
-import org.apache.directory.api.ldap.model.filter.PresenceNode;
-import org.apache.directory.api.ldap.model.filter.SimpleNode;
-import org.apache.directory.api.ldap.model.filter.SubstringNode;
 import org.junit.Test;
 import org.junit.runner.RunWith;
 
@@ -62,7 +51,7 @@ public class FilterCloneTest
         // just check that it doesn't throw for now
         node = ( SimpleNode<?> ) node.clone();
         assertEquals( "ou", node.getAttribute() );
-        assertEquals( "people", node.getValue().getString() );
+        assertEquals( "people", node.getValue().getValue() );
         assertTrue( node instanceof ApproximateNode );
     }
 
@@ -129,7 +118,7 @@ public class FilterCloneTest
         // just check that it doesn't throw for now
         node = ( SimpleNode<?> ) node.clone();
         assertEquals( "ou;lang-de", node.getAttribute() );
-        assertEquals( "#Basdl fkajsd", node.getValue().getString() );
+        assertEquals( "#Basdl fkajsd", node.getValue().getValue() );
     }
 
 
@@ -141,7 +130,7 @@ public class FilterCloneTest
         // just check that it doesn't throw for now
         node = ( SimpleNode<?> ) node.clone();
         assertEquals( "ou;lang-de;version-124", node.getAttribute() );
-        assertEquals( "#Basdl fkajsd", node.getValue().getString() );
+        assertEquals( "#Basdl fkajsd", node.getValue().getValue() );
     }
 
 
@@ -153,7 +142,7 @@ public class FilterCloneTest
         // just check that it doesn't throw for now
         node = ( SimpleNode<?> ) node.clone();
         assertEquals( "1.3.4.2;lang-de;version-124", node.getAttribute() );
-        assertEquals( "#Basdl fkajsd", node.getValue().getString() );
+        assertEquals( "#Basdl fkajsd", node.getValue().getValue() );
     }
 
 
@@ -186,7 +175,7 @@ public class FilterCloneTest
         // just check that it doesn't throw for now
         node = ( SimpleNode<?> ) node.clone();
         assertEquals( "ou", node.getAttribute() );
-        assertEquals( "people", node.getValue().getString() );
+        assertEquals( "people", node.getValue().getValue() );
         assertTrue( node instanceof EqualityNode );
     }
 
@@ -198,7 +187,7 @@ public class FilterCloneTest
         // just check that it doesn't throw for now
         node = ( SimpleNode<?> ) node.clone();
         assertEquals( "ou", node.getAttribute() );
-        assertEquals( "people/in/my/company", node.getValue().getString() );
+        assertEquals( "people/in/my/company", node.getValue().getValue() );
         assertTrue( node instanceof EqualityNode );
     }
 
@@ -211,7 +200,7 @@ public class FilterCloneTest
         // just check that it doesn't throw for now
         node = ( ExtensibleNode ) node.clone();
         assertEquals( "ou", node.getAttribute() );
-        assertEquals( "dummyAssertion#*", node.getValue().getString() );
+        assertEquals( "dummyAssertion#*", node.getValue().getValue() );
         assertEquals( "stupidMatch", node.getMatchingRuleId() );
         assertTrue( node.hasDnAttributes() );
         assertTrue( node instanceof ExtensibleNode );
@@ -226,7 +215,7 @@ public class FilterCloneTest
         // just check that it doesn't throw for now
         node = ( ExtensibleNode ) node.clone();
         assertEquals( "1.2.3.4", node.getAttribute() );
-        assertEquals( "dummyAssertion#*", node.getValue().getString() );
+        assertEquals( "dummyAssertion#*", node.getValue().getValue() );
         assertEquals( "1.3434.23.2", node.getMatchingRuleId() );
         assertTrue( node.hasDnAttributes() );
         assertTrue( node instanceof ExtensibleNode );
@@ -240,7 +229,7 @@ public class FilterCloneTest
         // just check that it doesn't throw for now
         node = ( ExtensibleNode ) node.clone();
         assertEquals( "ou", node.getAttribute() );
-        assertEquals( "dummyAssertion#*", node.getValue().getString() );
+        assertEquals( "dummyAssertion#*", node.getValue().getValue() );
         assertEquals( "stupidMatch", node.getMatchingRuleId() );
         assertFalse( node.hasDnAttributes() );
         assertTrue( node instanceof ExtensibleNode );
@@ -254,7 +243,7 @@ public class FilterCloneTest
         // just check that it doesn't throw for now
         node = ( ExtensibleNode ) node.clone();
         assertEquals( "ou", node.getAttribute() );
-        assertEquals( "dummyAssertion#*", node.getValue().getString() );
+        assertEquals( "dummyAssertion#*", node.getValue().getValue() );
         assertEquals( null, node.getMatchingRuleId() );
         assertFalse( node.hasDnAttributes() );
         assertTrue( node instanceof ExtensibleNode );
@@ -268,7 +257,7 @@ public class FilterCloneTest
         // just check that it doesn't throw for now
         node = ( ExtensibleNode ) node.clone();
         assertEquals( null, node.getAttribute() );
-        assertEquals( "dummyAssertion#*", node.getValue().getString() );
+        assertEquals( "dummyAssertion#*", node.getValue().getValue() );
         assertEquals( "stupidMatch", node.getMatchingRuleId() );
         assertTrue( node.hasDnAttributes() );
         assertTrue( node instanceof ExtensibleNode );
@@ -280,7 +269,7 @@ public class FilterCloneTest
     {
         ExtensibleNode node = ( ExtensibleNode ) FilterParser.parse( null, "(:dn:1.3434.23.2:=dummyAssertion\\23\\2A)" );
         assertEquals( null, node.getAttribute() );
-        assertEquals( "dummyAssertion#*", node.getValue().getString() );
+        assertEquals( "dummyAssertion#*", node.getValue().getValue() );
         assertEquals( "1.3434.23.2", node.getMatchingRuleId() );
         assertTrue( node.hasDnAttributes() );
         assertTrue( node instanceof ExtensibleNode );
@@ -294,7 +283,7 @@ public class FilterCloneTest
         // just check that it doesn't throw for now
         ExtensibleNode node = ( ExtensibleNode ) node1.clone();
         assertEquals( null, node.getAttribute() );
-        assertEquals( "dummyAssertion#*", node.getValue().getString() );
+        assertEquals( "dummyAssertion#*", node.getValue().getValue() );
         assertEquals( "stupidMatch", node.getMatchingRuleId() );
         assertFalse( node.hasDnAttributes() );
         assertTrue( node instanceof ExtensibleNode );
@@ -308,7 +297,7 @@ public class FilterCloneTest
         // just check that it doesn't throw for now
         node = ( ExtensibleNode ) node.clone();
         assertEquals( null, node.getAttribute() );
-        assertEquals( "dummyAssertion#*", node.getValue().getString() );
+        assertEquals( "dummyAssertion#*", node.getValue().getValue() );
         assertEquals( "1.3434.23.2", node.getMatchingRuleId() );
         assertFalse( node.hasDnAttributes() );
         assertTrue( node instanceof ExtensibleNode );
@@ -516,7 +505,7 @@ public class FilterCloneTest
         node = ( SimpleNode<?> ) node.clone();
 
         assertEquals( "ou", node.getAttribute() );
-        assertEquals( "", node.getValue().getString() );
+        assertEquals( "", node.getValue().getValue() );
         assertTrue( node instanceof EqualityNode );
     }
 
@@ -531,7 +520,7 @@ public class FilterCloneTest
         // just check that it doesn't throw for now
         node = ( SimpleNode<?> ) node.clone();
         assertEquals( "uid", node.getAttribute() );
-        assertEquals( "#f1", node.getValue().getString() );
+        assertEquals( "#f1", node.getValue().getValue() );
         assertTrue( node instanceof EqualityNode );
     }
 

Modified: directory/shared/branches/shared-value/ldap/model/src/test/java/org/apache/directory/api/ldap/model/filter/FilterNodeEqualityTest.java
URL: http://svn.apache.org/viewvc/directory/shared/branches/shared-value/ldap/model/src/test/java/org/apache/directory/api/ldap/model/filter/FilterNodeEqualityTest.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/FilterNodeEqualityTest.java (original)
+++ directory/shared/branches/shared-value/ldap/model/src/test/java/org/apache/directory/api/ldap/model/filter/FilterNodeEqualityTest.java Mon May  9 17:22:19 2016
@@ -24,11 +24,6 @@ import com.mycila.junit.concurrent.Concu
 import com.mycila.junit.concurrent.ConcurrentJunitRunner;
 
 import org.apache.directory.api.ldap.model.entry.Value;
-import org.apache.directory.api.ldap.model.filter.ApproximateNode;
-import org.apache.directory.api.ldap.model.filter.EqualityNode;
-import org.apache.directory.api.ldap.model.filter.GreaterEqNode;
-import org.apache.directory.api.ldap.model.filter.LessEqNode;
-import org.apache.directory.api.ldap.model.filter.PresenceNode;
 import org.junit.Test;
 import org.junit.runner.RunWith;
 
@@ -48,22 +43,22 @@ public class FilterNodeEqualityTest
     @Test
     public void testEqualityEquals()
     {
-        EqualityNode<String> eqNode1 = new EqualityNode<String>( "attr1", new Value( "test" ) );
-        EqualityNode<String> eqNode2 = new EqualityNode<String>( "attr1", new Value( "test" ) );
+        EqualityNode<String> eqNode1 = new EqualityNode<String>( "attr1", "test" );
+        EqualityNode<String> eqNode2 = new EqualityNode<String>( "attr1", "test" );
 
         assertEquals( "two exact nodes should be equal", eqNode1, eqNode2 );
 
-        eqNode2 = new EqualityNode<String>( "attr2", new Value( "test" ) );
+        eqNode2 = new EqualityNode<String>( "attr2", "test" );
         assertFalse( "different attribute in node should return false on equals()", eqNode1.equals( eqNode2 ) );
 
-        eqNode2 = new EqualityNode<String>( "attr2", new Value( "foobar" ) );
+        eqNode2 = new EqualityNode<String>( "attr2", "foobar" );
         assertFalse( "different value in node should return false on equals()", eqNode1.equals( eqNode2 ) );
 
         PresenceNode presenceNode = new PresenceNode( "attr1" );
         assertFalse( "two different leaf nodes should not be equal", eqNode1.equals( presenceNode ) );
         assertFalse( "two different leaf nodes should not be equal", presenceNode.equals( eqNode1 ) );
 
-        GreaterEqNode<String> greaterEqNode = new GreaterEqNode<String>( "attr1", new Value( "test" ) );
+        GreaterEqNode<String> greaterEqNode = new GreaterEqNode<String>( "attr1", "test" );
         assertFalse( "two different simple nodes should not be equal", eqNode1.equals( greaterEqNode ) );
         assertFalse( "two different simple nodes should not be equal", greaterEqNode.equals( eqNode1 ) );
     }
@@ -72,16 +67,16 @@ public class FilterNodeEqualityTest
     @Test
     public void testGreaterEqEquals()
     {
-        GreaterEqNode<String> greaterEqNode1 = new GreaterEqNode<String>( "attr1", new Value( "test" ) );
-        GreaterEqNode<String> greaterEqNode2 = new GreaterEqNode<String>( "attr1", new Value( "test" ) );
+        GreaterEqNode<String> greaterEqNode1 = new GreaterEqNode<String>( "attr1", "test" );
+        GreaterEqNode<String> greaterEqNode2 = new GreaterEqNode<String>( "attr1", "test" );
 
         assertEquals( "two exact nodes should be equal", greaterEqNode1, greaterEqNode2 );
 
-        greaterEqNode2 = new GreaterEqNode<String>( "attr2", new Value( "test" ) );
+        greaterEqNode2 = new GreaterEqNode<String>( "attr2", "test" );
         assertFalse( "different attribute in node should return false on equals()", greaterEqNode1
             .equals( greaterEqNode2 ) );
 
-        greaterEqNode2 = new GreaterEqNode<String>( "attr2", new Value( "foobar" ) );
+        greaterEqNode2 = new GreaterEqNode<String>( "attr2", "foobar" );
         assertFalse( "different value in node should return false on equals()", greaterEqNode1.equals( greaterEqNode2 ) );
     }
 
@@ -89,15 +84,15 @@ public class FilterNodeEqualityTest
     @Test
     public void testLessEqEquals()
     {
-        LessEqNode<String> lessEqNode1 = new LessEqNode<String>( "attr1", new Value( "test" ) );
-        LessEqNode<String> lessEqNode2 = new LessEqNode<String>( "attr1", new Value( "test" ) );
+        LessEqNode<String> lessEqNode1 = new LessEqNode<String>( "attr1", "test" );
+        LessEqNode<String> lessEqNode2 = new LessEqNode<String>( "attr1", "test" );
 
         assertEquals( "two exact nodes should be equal", lessEqNode1, lessEqNode2 );
 
-        lessEqNode2 = new LessEqNode<String>( "attr2", new Value( "test" ) );
+        lessEqNode2 = new LessEqNode<String>( "attr2", "test" );
         assertFalse( "different attribute in node should return false on equals()", lessEqNode1.equals( lessEqNode2 ) );
 
-        lessEqNode2 = new LessEqNode<String>( "attr2", new Value( "foobar" ) );
+        lessEqNode2 = new LessEqNode<String>( "attr2", "foobar" );
         assertFalse( "different value in node should return false on equals()", lessEqNode1.equals( lessEqNode2 ) );
     }
 
@@ -105,16 +100,16 @@ public class FilterNodeEqualityTest
     @Test
     public void testApproximateEqEquals()
     {
-        ApproximateNode<String> approximateNode1 = new ApproximateNode<String>( "attr1", new Value( "test" ) );
-        ApproximateNode<String> approximateNode2 = new ApproximateNode<String>( "attr1", new Value( "test" ) );
+        ApproximateNode<String> approximateNode1 = new ApproximateNode<String>( "attr1", "test" );
+        ApproximateNode<String> approximateNode2 = new ApproximateNode<String>( "attr1", "test" );
 
         assertEquals( "two exact nodes should be equal", approximateNode1, approximateNode2 );
 
-        approximateNode2 = new ApproximateNode<String>( "attr2", new Value( "test" ) );
+        approximateNode2 = new ApproximateNode<String>( "attr2", "test" );
         assertFalse( "different attribute in node should return false on equals()", approximateNode1
             .equals( approximateNode2 ) );
 
-        approximateNode2 = new ApproximateNode<String>( "attr2", new Value( "foobar" ) );
+        approximateNode2 = new ApproximateNode<String>( "attr2", "foobar" );
         assertFalse( "different value in node should return false on equals()", approximateNode1
             .equals( approximateNode2 ) );
     }

Modified: directory/shared/branches/shared-value/ldap/model/src/test/java/org/apache/directory/api/ldap/model/filter/FilterParserTest.java
URL: http://svn.apache.org/viewvc/directory/shared/branches/shared-value/ldap/model/src/test/java/org/apache/directory/api/ldap/model/filter/FilterParserTest.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/FilterParserTest.java (original)
+++ directory/shared/branches/shared-value/ldap/model/src/test/java/org/apache/directory/api/ldap/model/filter/FilterParserTest.java Mon May  9 17:22:19 2016
@@ -34,18 +34,7 @@ import com.mycila.junit.concurrent.Concu
 import com.mycila.junit.concurrent.ConcurrentJunitRunner;
 
 import org.apache.directory.api.ldap.model.entry.Value;
-import org.apache.directory.api.ldap.model.filter.AndNode;
-import org.apache.directory.api.ldap.model.filter.ApproximateNode;
-import org.apache.directory.api.ldap.model.filter.BranchNode;
-import org.apache.directory.api.ldap.model.filter.EqualityNode;
-import org.apache.directory.api.ldap.model.filter.ExprNode;
-import org.apache.directory.api.ldap.model.filter.ExtensibleNode;
 import org.apache.directory.api.ldap.model.filter.FilterParser;
-import org.apache.directory.api.ldap.model.filter.NotNode;
-import org.apache.directory.api.ldap.model.filter.OrNode;
-import org.apache.directory.api.ldap.model.filter.PresenceNode;
-import org.apache.directory.api.ldap.model.filter.SimpleNode;
-import org.apache.directory.api.ldap.model.filter.SubstringNode;
 import org.apache.directory.api.util.Strings;
 import org.junit.Test;
 import org.junit.runner.RunWith;
@@ -103,7 +92,7 @@ public class FilterParserTest
 
         SimpleNode<?> node = ( SimpleNode<?> ) FilterParser.parse( str );
         assertEquals( "ou", node.getAttribute() );
-        assertEquals( "people", node.getValue().getString() );
+        assertEquals( "people", node.getValue().getValue() );
         assertTrue( node instanceof ApproximateNode );
         String str2 = node.toString();
         assertEquals( str, str2 );
@@ -176,7 +165,7 @@ public class FilterParserTest
         String str = "(ou;lang-de>=\\23\\42asdl fkajsd)"; // \23 = '#'
         SimpleNode<?> node = ( SimpleNode<?> ) FilterParser.parse( str );
         assertEquals( "ou;lang-de", node.getAttribute() );
-        assertEquals( "#Basdl fkajsd", node.getValue().getString() );
+        assertEquals( "#Basdl fkajsd", node.getValue().getValue() );
         String str2 = node.toString();
         assertEquals( "(ou;lang-de>=#Basdl fkajsd)", str2 );
     }
@@ -188,7 +177,7 @@ public class FilterParserTest
         String str = "(ou;lang-de;version-124>=\\23\\42asdl fkajsd)";
         SimpleNode<?> node = ( SimpleNode<?> ) FilterParser.parse( str );
         assertEquals( "ou;lang-de;version-124", node.getAttribute() );
-        assertEquals( "#Basdl fkajsd", node.getValue().getString() );
+        assertEquals( "#Basdl fkajsd", node.getValue().getValue() );
         String str2 = node.toString();
         assertEquals( "(ou;lang-de;version-124>=#Basdl fkajsd)", str2 );
     }
@@ -200,7 +189,7 @@ public class FilterParserTest
         String str = "(1.3.4.2;lang-de;version-124>=\\23\\42afdl fkajsd)";
         SimpleNode<?> node = ( SimpleNode<?> ) FilterParser.parse( str );
         assertEquals( "1.3.4.2;lang-de;version-124", node.getAttribute() );
-        assertEquals( "#Bafdl fkajsd", node.getValue().getString() );
+        assertEquals( "#Bafdl fkajsd", node.getValue().getValue() );
         String str2 = node.toString();
         assertEquals( "(1.3.4.2;lang-de;version-124>=#Bafdl fkajsd)", str2 );
     }
@@ -236,7 +225,7 @@ public class FilterParserTest
         String str = "(ou=people)";
         SimpleNode<?> node = ( SimpleNode<?> ) FilterParser.parse( str );
         assertEquals( "ou", node.getAttribute() );
-        assertEquals( "people", node.getValue().getString() );
+        assertEquals( "people", node.getEscapedValue() );
         assertTrue( node instanceof EqualityNode );
         String str2 = node.toString();
         assertEquals( str, str2 );
@@ -266,7 +255,7 @@ public class FilterParserTest
         String str = "(ou=people/in/my/company)";
         SimpleNode<?> node = ( SimpleNode<?> ) FilterParser.parse( str );
         assertEquals( "ou", node.getAttribute() );
-        assertEquals( "people/in/my/company", node.getValue().getString() );
+        assertEquals( "people/in/my/company", node.getValue().getValue() );
         assertTrue( node instanceof EqualityNode );
         String str2 = node.toString();
         assertEquals( str, str2 );
@@ -279,7 +268,7 @@ public class FilterParserTest
         String str = "(ou:dn:stupidMatch:=dummyAssertion\\23\\c4\\8d)";
         ExtensibleNode node = ( ExtensibleNode ) FilterParser.parse( str );
         assertEquals( "ou", node.getAttribute() );
-        assertEquals( "dummyAssertion#\u010D", node.getValue().getString() );
+        assertEquals( "dummyAssertion#\u010D", node.getValue().getValue() );
         assertEquals( "stupidMatch", node.getMatchingRuleId() );
         assertTrue( node.hasDnAttributes() );
         assertTrue( node instanceof ExtensibleNode );
@@ -292,7 +281,7 @@ public class FilterParserTest
         String str = "(1.2.3.4:dn:1.3434.23.2:=dummyAssertion\\23\\c4\\8d)";
         ExtensibleNode node = ( ExtensibleNode ) FilterParser.parse( str );
         assertEquals( "1.2.3.4", node.getAttribute() );
-        assertEquals( "dummyAssertion#\u010D", node.getValue().getString() );
+        assertEquals( "dummyAssertion#\u010D", node.getValue().getValue() );
         assertEquals( "1.3434.23.2", node.getMatchingRuleId() );
         assertTrue( node.hasDnAttributes() );
         assertTrue( node instanceof ExtensibleNode );
@@ -305,7 +294,7 @@ public class FilterParserTest
         String str = "(ou:stupidMatch:=dummyAssertion\\23\\c4\\8d)";
         ExtensibleNode node = ( ExtensibleNode ) FilterParser.parse( str );
         assertEquals( "ou", node.getAttribute() );
-        assertEquals( "dummyAssertion#\u010D", node.getValue().getString() );
+        assertEquals( "dummyAssertion#\u010D", node.getValue().getValue() );
         assertEquals( "stupidMatch", node.getMatchingRuleId() );
         assertFalse( node.hasDnAttributes() );
         assertTrue( node instanceof ExtensibleNode );
@@ -333,7 +322,7 @@ public class FilterParserTest
         String str = "(ou:=dummyAssertion\\23\\c4\\8d)";
         ExtensibleNode node = ( ExtensibleNode ) FilterParser.parse( str );
         assertEquals( "ou", node.getAttribute() );
-        assertEquals( "dummyAssertion#\u010D", node.getValue().getString() );
+        assertEquals( "dummyAssertion#\u010D", node.getValue().getValue() );
         assertEquals( null, node.getMatchingRuleId() );
         assertFalse( node.hasDnAttributes() );
         assertTrue( node instanceof ExtensibleNode );
@@ -346,7 +335,7 @@ public class FilterParserTest
         String str = "(:dn:stupidMatch:=dummyAssertion\\23\\c4\\8d)";
         ExtensibleNode node = ( ExtensibleNode ) FilterParser.parse( str );
         assertEquals( null, node.getAttribute() );
-        assertEquals( "dummyAssertion#\u010D", node.getValue().getString() );
+        assertEquals( "dummyAssertion#\u010D", node.getValue().getValue() );
         assertEquals( "stupidMatch", node.getMatchingRuleId() );
         assertTrue( node.hasDnAttributes() );
         assertTrue( node instanceof ExtensibleNode );
@@ -374,7 +363,7 @@ public class FilterParserTest
         String str = "(:dn:1.3434.23.2:=dummyAssertion\\23\\c4\\8d)";
         ExtensibleNode node = ( ExtensibleNode ) FilterParser.parse( str );
         assertEquals( null, node.getAttribute() );
-        assertEquals( "dummyAssertion#\u010D", node.getValue().getString() );
+        assertEquals( "dummyAssertion#\u010D", node.getValue().getValue() );
         assertEquals( "1.3434.23.2", node.getMatchingRuleId() );
         assertTrue( node.hasDnAttributes() );
         assertTrue( node instanceof ExtensibleNode );
@@ -387,7 +376,7 @@ public class FilterParserTest
         String str = "(:stupidMatch:=dummyAssertion\\23\\c4\\8d)";
         ExtensibleNode node = ( ExtensibleNode ) FilterParser.parse( str );
         assertEquals( null, node.getAttribute() );
-        assertEquals( "dummyAssertion#\u010D", node.getValue().getString() );
+        assertEquals( "dummyAssertion#\u010D", node.getValue().getValue() );
         assertEquals( "stupidMatch", node.getMatchingRuleId() );
         assertFalse( node.hasDnAttributes() );
         assertTrue( node instanceof ExtensibleNode );
@@ -400,7 +389,7 @@ public class FilterParserTest
         String str = "(:1.3434.23.2:=dummyAssertion\\23\\c4\\8d)";
         ExtensibleNode node = ( ExtensibleNode ) FilterParser.parse( str );
         assertEquals( null, node.getAttribute() );
-        assertEquals( "dummyAssertion#\u010D", node.getValue().getString() );
+        assertEquals( "dummyAssertion#\u010D", node.getValue().getValue() );
         assertEquals( "1.3434.23.2", node.getMatchingRuleId() );
         assertFalse( node.hasDnAttributes() );
         assertTrue( node instanceof ExtensibleNode );
@@ -743,7 +732,7 @@ public class FilterParserTest
         SimpleNode<?> node = ( SimpleNode<?> ) FilterParser.parse( str );
 
         assertEquals( "cn", node.getAttribute() );
-        String val = node.getValue().getString();
+        String val = node.getValue().getValue();
         assertEquals( "a2", Integer.toHexString( val.charAt( 0 ) ) ); // char is U+00A2
         String str2 = node.toString();
         assertEquals( str, str2 );
@@ -762,7 +751,7 @@ public class FilterParserTest
         SimpleNode<?> node = ( SimpleNode<?> ) FilterParser.parse( str );
 
         assertEquals( "cn", node.getAttribute() );
-        String val = node.getValue().getString();
+        String val = node.getValue().getValue();
         assertEquals( "a2", Integer.toHexString( val.charAt( 0 ) ) ); // char is U+00A2
         String str2 = node.toString();
         assertEquals( str, str2 );
@@ -777,10 +766,10 @@ public class FilterParserTest
 
         new String( bytes, StandardCharsets.UTF_8 );
         String str = "(cn=\\E2\\89\\A0)";
-        SimpleNode<?> node = ( SimpleNode<?> ) FilterParser.parse( str );
+        SimpleNode<?> node = (SimpleNode<?> ) FilterParser.parse( str );
 
         assertEquals( "cn", node.getAttribute() );
-        String val = node.getValue().getString();
+        String val = node.getValue().getValue();
         assertEquals( "2260", Integer.toHexString( val.charAt( 0 ) ) );
         String str2 = node.toString();
         assertEquals( str, str2 );
@@ -794,15 +783,16 @@ public class FilterParserTest
             { ( byte ) 0xE2, ( byte ) 0x89, ( byte ) 0xA0 }; // unicode U+2260: "not equal to" sign in decimal signed bytes is -30, -119, -96
 
         String str = "(cn=\\E2\\89\\A0aa)";
+        String strEscaped = "(cn=\\E2\\89\\A0\\61\\61)";
         new String( bytes, StandardCharsets.UTF_8 );
 
         SimpleNode<?> node = ( SimpleNode<?> ) FilterParser.parse( str );
 
         assertEquals( "cn", node.getAttribute() );
-        String val = node.getValue().getString();
+        String val = node.getValue().getValue();
         assertEquals( "2260", Integer.toHexString( val.charAt( 0 ) ) );
         String str2 = node.toString();
-        assertEquals( str, str2 );
+        assertEquals( strEscaped, str2 );
     }
 
 
@@ -817,7 +807,7 @@ public class FilterParserTest
         SimpleNode<?> node = ( SimpleNode<?> ) FilterParser.parse( str );
 
         assertEquals( "cn", node.getAttribute() );
-        String val = node.getValue().getString();
+        String val = node.getValue().getValue();
         assertEquals( "3059", Integer.toHexString( val.charAt( 0 ) ) );
         String str2 = node.toString();
         assertEquals( str, str2 );
@@ -835,7 +825,7 @@ public class FilterParserTest
 
         SimpleNode<?> node = ( SimpleNode<?> ) FilterParser.parse( str );
         assertEquals( "cn", node.getAttribute() );
-        String val = node.getValue().getString();
+        String val = node.getValue().getValue();
         assertEquals( "3059", Integer.toHexString( val.charAt( 0 ) ) );
         String str2 = node.toString();
         assertEquals( str, str2 );
@@ -851,7 +841,7 @@ public class FilterParserTest
         String str = "(uid=#f1)";
         SimpleNode<?> node = ( SimpleNode<?> ) FilterParser.parse( str );
         assertEquals( "uid", node.getAttribute() );
-        assertEquals( "#f1", node.getValue().getString() );
+        assertEquals( "#f1", node.getValue().getValue() );
         assertTrue( node instanceof EqualityNode );
         assertEquals( str, node.toString() );
     }
@@ -896,7 +886,7 @@ public class FilterParserTest
             ExprNode aEqb = node.getFirstChild();
             assertTrue( aEqb instanceof EqualityNode );
             assertEquals( "objectClass", ( ( EqualityNode<?> ) aEqb ).getAttribute() );
-            assertEquals( "nisNetgroup", ( ( EqualityNode<?> ) aEqb ).getValue().getString() );
+            assertEquals( "nisNetgroup", ( ( EqualityNode<?> ) aEqb ).getValue().getValue() );
 
             // Check the or node
             ExprNode orNode = node.getChildren().get( 1 );
@@ -946,7 +936,7 @@ public class FilterParserTest
         String str = "(cn='~%\\28'$'\\5C)"; // note \28='(' and \5c='\'
         ExprNode node = FilterParser.parse( str );
         assertTrue( node instanceof EqualityNode );
-        assertEquals( "'~%('$'\\", ( ( EqualityNode<?> ) node ).getValue().getString() );
+        assertEquals( "'~%('$'\\", ( ( EqualityNode<?> ) node ).getValue().getValue() );
         String str2 = node.toString();
         assertEquals( str, str2 );
     }
@@ -958,7 +948,7 @@ public class FilterParserTest
         String str = "(cn='~%\\28'$'\\5Cac)"; // note \28='(' and \5c='\'
         ExprNode node = FilterParser.parse( str );
         assertTrue( node instanceof EqualityNode );
-        assertEquals( "'~%('$'\\ac", ( ( EqualityNode<?> ) node ).getValue().getString() );
+        assertEquals( "'~%('$'\\ac", ( ( EqualityNode<?> ) node ).getValue().getValue() );
         String str2 = node.toString();
         assertEquals( Strings.upperCase( str ), Strings.upperCase( str2 ) );
     }
@@ -1057,7 +1047,7 @@ public class FilterParserTest
         ExprNode child1 = children1.get( 0 );
         assertTrue( child1 instanceof EqualityNode );
         assertEquals( "jagplayUserGroup", ( ( EqualityNode<?> ) child1 ).getAttribute() );
-        assertEquals( "Active", ( ( EqualityNode<?> ) child1 ).getValue().getString() );
+        assertEquals( "Active", ( ( EqualityNode<?> ) child1 ).getValue().getValue() );
 
         // Second child : (!(jagplayUserGroup=Banned))
         ExprNode child2 = children1.get( 1 );
@@ -1067,13 +1057,13 @@ public class FilterParserTest
         ExprNode notNodeChild1 = notNode1.getFirstChild();
         assertTrue( notNodeChild1 instanceof EqualityNode );
         assertEquals( "jagplayUserGroup", ( ( EqualityNode<?> ) notNodeChild1 ).getAttribute() );
-        assertEquals( "Banned", ( ( EqualityNode<?> ) notNodeChild1 ).getValue().getString() );
+        assertEquals( "Banned", ( ( EqualityNode<?> ) notNodeChild1 ).getValue().getValue() );
 
         // Third child : (jagplayUserNickname=admin)
         ExprNode child3 = children1.get( 2 );
         assertTrue( child3 instanceof EqualityNode );
         assertEquals( "jagplayUserNickname", ( ( EqualityNode<?> ) child3 ).getAttribute() );
-        assertEquals( "admin", ( ( EqualityNode<?> ) child3 ).getValue().getString() );
+        assertEquals( "admin", ( ( EqualityNode<?> ) child3 ).getValue().getValue() );
 
         // Check Node 2 : (&(jagplayUserNickname=admin)(&(jagplayUserGroup=Active)(!(jagplayUserGroup=Banned))))
         assertEquals( 2, node2.getChildren().size() );
@@ -1082,7 +1072,7 @@ public class FilterParserTest
         child1 = node2.getChildren().get( 0 );
         assertTrue( child1 instanceof EqualityNode );
         assertEquals( "jagplayUserNickname", ( ( EqualityNode<?> ) child1 ).getAttribute() );
-        assertEquals( "admin", ( ( EqualityNode<?> ) child1 ).getValue().getString() );
+        assertEquals( "admin", ( ( EqualityNode<?> ) child1 ).getValue().getValue() );
 
         child2 = node2.getChildren().get( 1 );
         assertTrue( child2 instanceof AndNode );
@@ -1093,7 +1083,7 @@ public class FilterParserTest
         child1 = andNode2.getChildren().get( 0 );
         assertTrue( child1 instanceof EqualityNode );
         assertEquals( "jagplayUserGroup", ( ( EqualityNode<?> ) child1 ).getAttribute() );
-        assertEquals( "Active", ( ( EqualityNode<?> ) child1 ).getValue().getString() );
+        assertEquals( "Active", ( ( EqualityNode<?> ) child1 ).getValue().getValue() );
 
         // second child : (!(jagplayUserGroup=Banned))
         child2 = andNode2.getChildren().get( 1 );
@@ -1103,7 +1093,7 @@ public class FilterParserTest
         notNodeChild1 = notNode1.getFirstChild();
         assertTrue( notNodeChild1 instanceof EqualityNode );
         assertEquals( "jagplayUserGroup", ( ( EqualityNode<?> ) notNodeChild1 ).getAttribute() );
-        assertEquals( "Banned", ( ( EqualityNode<?> ) notNodeChild1 ).getValue().getString() );
+        assertEquals( "Banned", ( ( EqualityNode<?> ) notNodeChild1 ).getValue().getValue() );
     }
 
 
@@ -1113,7 +1103,7 @@ public class FilterParserTest
         String str = "(a_b_=people)";
         SimpleNode<?> node = ( SimpleNode<?> ) FilterParser.parse( str, true );
         assertEquals( "a_b_", node.getAttribute() );
-        assertEquals( "people", node.getValue().getString() );
+        assertEquals( "people", node.getValue().getValue() );
         assertTrue( node instanceof EqualityNode );
         String str2 = node.toString();
         assertEquals( str, str2 );

Modified: directory/shared/branches/shared-value/ldap/model/src/test/java/org/apache/directory/api/ldap/model/filter/FilterToStringTest.java
URL: http://svn.apache.org/viewvc/directory/shared/branches/shared-value/ldap/model/src/test/java/org/apache/directory/api/ldap/model/filter/FilterToStringTest.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/FilterToStringTest.java (original)
+++ directory/shared/branches/shared-value/ldap/model/src/test/java/org/apache/directory/api/ldap/model/filter/FilterToStringTest.java Mon May  9 17:22:19 2016
@@ -27,7 +27,6 @@ import java.text.ParseException;
 import com.mycila.junit.concurrent.Concurrency;
 import com.mycila.junit.concurrent.ConcurrentJunitRunner;
 
-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;

Modified: directory/shared/branches/shared-value/ldap/model/src/test/java/org/apache/directory/api/ldap/model/filter/SubstringNodeTest.java
URL: http://svn.apache.org/viewvc/directory/shared/branches/shared-value/ldap/model/src/test/java/org/apache/directory/api/ldap/model/filter/SubstringNodeTest.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/SubstringNodeTest.java (original)
+++ directory/shared/branches/shared-value/ldap/model/src/test/java/org/apache/directory/api/ldap/model/filter/SubstringNodeTest.java Mon May  9 17:22:19 2016
@@ -23,7 +23,6 @@ package org.apache.directory.api.ldap.mo
 import com.mycila.junit.concurrent.Concurrency;
 import com.mycila.junit.concurrent.ConcurrentJunitRunner;
 
-import org.apache.directory.api.ldap.model.filter.SubstringNode;
 import org.junit.Test;
 import org.junit.runner.RunWith;
 

Modified: directory/shared/branches/shared-value/ldap/model/src/test/java/org/apache/directory/api/ldap/model/filter/UndefinedNodeTest.java
URL: http://svn.apache.org/viewvc/directory/shared/branches/shared-value/ldap/model/src/test/java/org/apache/directory/api/ldap/model/filter/UndefinedNodeTest.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/UndefinedNodeTest.java (original)
+++ directory/shared/branches/shared-value/ldap/model/src/test/java/org/apache/directory/api/ldap/model/filter/UndefinedNodeTest.java Mon May  9 17:22:19 2016
@@ -30,11 +30,7 @@ import java.util.List;
 import com.mycila.junit.concurrent.Concurrency;
 import com.mycila.junit.concurrent.ConcurrentJunitRunner;
 
-import org.apache.directory.api.ldap.model.filter.AssertionType;
-import org.apache.directory.api.ldap.model.filter.BranchNode;
-import org.apache.directory.api.ldap.model.filter.ExprNode;
 import org.apache.directory.api.ldap.model.filter.FilterVisitor;
-import org.apache.directory.api.ldap.model.filter.UndefinedNode;
 import org.junit.Test;
 import org.junit.runner.RunWith;
 
@@ -48,7 +44,6 @@ import org.junit.runner.RunWith;
 @Concurrency()
 public class UndefinedNodeTest
 {
-
     ExprNode undefinedNode = UndefinedNode.UNDEFINED_NODE;
 
 

Modified: directory/shared/branches/shared-value/ldap/model/src/test/java/org/apache/directory/api/ldap/model/ldif/LdifAttributesReaderTest.java
URL: http://svn.apache.org/viewvc/directory/shared/branches/shared-value/ldap/model/src/test/java/org/apache/directory/api/ldap/model/ldif/LdifAttributesReaderTest.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/ldif/LdifAttributesReaderTest.java (original)
+++ directory/shared/branches/shared-value/ldap/model/src/test/java/org/apache/directory/api/ldap/model/ldif/LdifAttributesReaderTest.java Mon May  9 17:22:19 2016
@@ -232,10 +232,10 @@ public class LdifAttributesReaderTest
         assertTrue( attr.contains( "app1" ) );
 
         attr = entry.get( "dependencies" );
-        assertNull( attr.get().getValue() );
+        assertEquals( "", attr.get().getValue() );
 
         attr = entry.get( "envvars" );
-        assertNull( attr.get().getValue() );
+        assertEquals( "", attr.get().getValue() );
         reader.close();
     }
 
@@ -272,10 +272,10 @@ public class LdifAttributesReaderTest
         assertTrue( attr.contains( "app1" ) );
 
         attr = entry.get( "dependencies" );
-        assertNull( attr.get().getValue() );
+        assertEquals( "", attr.get().getValue() );
 
         attr = entry.get( "envvars" );
-        assertNull( attr.get().getValue() );
+        assertEquals( "", attr.get().getValue() );
         reader.close();
     }
 
@@ -312,10 +312,10 @@ public class LdifAttributesReaderTest
         assertTrue( attr.contains( "app1" ) );
 
         attr = entry.get( "dependencies" );
-        assertNull( attr.get().getValue() );
+        assertEquals( "", attr.get().getValue() );
 
         attr = entry.get( "envvars" );
-        assertNull( attr.get().getValue() );
+        assertEquals( "", attr.get().getValue() );
         reader.close();
     }
 
@@ -351,10 +351,10 @@ public class LdifAttributesReaderTest
         assertTrue( attr.contains( "app1" ) );
 
         attr = entry.get( "dependencies" );
-        assertNull( attr.get().getValue() );
+        assertEquals( "", attr.get().getValue() );
 
         attr = entry.get( "envvars" );
-        assertNull( attr.get().getValue() );
+        assertEquals( "", attr.get().getValue() );
         reader.close();
     }
 
@@ -391,10 +391,10 @@ public class LdifAttributesReaderTest
         assertTrue( attr.contains( "app1" ) );
 
         attr = entry.get( "dependencies" );
-        assertNull( attr.get().getValue() );
+        assertEquals( "", attr.get().getValue() );
 
         attr = entry.get( "envvars" );
-        assertNull( attr.get().getValue() );
+        assertEquals( "", attr.get().getValue() );
         reader.close();
     }
 

Modified: directory/shared/branches/shared-value/ldap/model/src/test/java/org/apache/directory/api/ldap/model/ldif/LdifReaderTest.java
URL: http://svn.apache.org/viewvc/directory/shared/branches/shared-value/ldap/model/src/test/java/org/apache/directory/api/ldap/model/ldif/LdifReaderTest.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/ldif/LdifReaderTest.java (original)
+++ directory/shared/branches/shared-value/ldap/model/src/test/java/org/apache/directory/api/ldap/model/ldif/LdifReaderTest.java Mon May  9 17:22:19 2016
@@ -538,10 +538,10 @@ public class LdifReaderTest
         assertTrue( attr.contains( "app1" ) );
 
         attr = entry.get( "dependencies" );
-        assertNull( attr.get().getValue() );
+        assertEquals( "", attr.get().getValue() );
 
         attr = entry.get( "envvars" );
-        assertNull( attr.get().getValue() );
+        assertEquals( "", attr.get().getValue() );
     }
 
 
@@ -584,10 +584,10 @@ public class LdifReaderTest
         assertTrue( attr.contains( "app1" ) );
 
         attr = entry.get( "dependencies" );
-        assertNull( attr.get().getValue() );
+        assertEquals( "", attr.get().getValue() );
 
         attr = entry.get( "envvars" );
-        assertNull( attr.get().getValue() );
+        assertEquals( "", attr.get().getValue() );
     }
 
 
@@ -630,10 +630,10 @@ public class LdifReaderTest
         assertTrue( attr.contains( "app1" ) );
 
         attr = entry.get( "dependencies" );
-        assertNull( attr.get().getValue() );
+        assertEquals( "", attr.get().getValue() );
 
         attr = entry.get( "envvars" );
-        assertNull( attr.get().getValue() );
+        assertEquals( "", attr.get().getValue() );
     }
 
 
@@ -675,10 +675,10 @@ public class LdifReaderTest
         assertTrue( attr.contains( "app1" ) );
 
         attr = entry.get( "dependencies" );
-        assertNull( attr.get().getValue() );
+        assertEquals( "", attr.get().getValue() );
 
         attr = entry.get( "envvars" );
-        assertNull( attr.get().getValue() );
+        assertEquals( "", attr.get().getValue() );
     }
 
 
@@ -721,10 +721,10 @@ public class LdifReaderTest
         assertTrue( attr.contains( "app1" ) );
 
         attr = entry.get( "dependencies" );
-        assertNull( attr.get().getValue() );
+        assertEquals( "", attr.get().getValue() );
 
         attr = entry.get( "envvars" );
-        assertNull( attr.get().getValue() );
+        assertEquals( "", attr.get().getValue() );
     }
 
 
@@ -2371,10 +2371,10 @@ public class LdifReaderTest
         assertTrue( attr.contains( "app1" ) );
 
         attr = entry.get( "dependencies" );
-        assertNull( attr.get().getValue() );
+        assertEquals( "", attr.get().getValue() );
 
         attr = entry.get( "envvars" );
-        assertNull( attr.get().getValue() );
+        assertEquals( "", attr.get().getValue() );
     }
 
 

Modified: directory/shared/branches/shared-value/ldap/model/src/test/java/org/apache/directory/api/ldap/model/name/AvaSerializationTest.java
URL: http://svn.apache.org/viewvc/directory/shared/branches/shared-value/ldap/model/src/test/java/org/apache/directory/api/ldap/model/name/AvaSerializationTest.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/name/AvaSerializationTest.java (original)
+++ directory/shared/branches/shared-value/ldap/model/src/test/java/org/apache/directory/api/ldap/model/name/AvaSerializationTest.java Mon May  9 17:22:19 2016
@@ -34,6 +34,7 @@ import org.apache.directory.api.ldap.mod
 import org.apache.directory.api.ldap.model.name.Ava;
 import org.apache.directory.api.ldap.model.schema.SchemaManager;
 import org.apache.directory.api.util.Strings;
+import org.junit.Ignore;
 import org.junit.Test;
 import org.junit.runner.RunWith;
 
@@ -62,8 +63,6 @@ public class AvaSerializationTest
     {
         Ava atav = new Ava( schemaManager, "CN", "Test" );
 
-        atav.normalize();
-
         ByteArrayOutputStream baos = new ByteArrayOutputStream();
         ObjectOutputStream out = new ObjectOutputStream( baos );
 
@@ -88,8 +87,6 @@ public class AvaSerializationTest
 
         Ava atav = new Ava( schemaManager, "CN", upValue );
 
-        atav.normalize();
-
         ByteArrayOutputStream baos = new ByteArrayOutputStream();
         ObjectOutputStream out = new ObjectOutputStream( baos );
 
@@ -224,8 +221,6 @@ public class AvaSerializationTest
     {
         Ava atav = new Ava( schemaManager, "CN", "Test" );
 
-        atav.normalize();
-
         ByteArrayOutputStream baos = new ByteArrayOutputStream();
         ObjectOutputStream out = new ObjectOutputStream( baos );
 
@@ -250,8 +245,6 @@ public class AvaSerializationTest
 
         Ava atav = new Ava( schemaManager, "CN", upValue );
 
-        atav.normalize();
-
         ByteArrayOutputStream baos = new ByteArrayOutputStream();
         ObjectOutputStream out = new ObjectOutputStream( baos );
 
@@ -355,4 +348,34 @@ public class AvaSerializationTest
 
         assertEquals( atav, atav2 );
     }
+
+
+    @Test
+    @Ignore
+    public void testSerializationPerf() throws LdapException, IOException, ClassNotFoundException
+    {
+        Ava atav = new Ava( schemaManager, "cn", "This is a serialization test" );
+
+        long t0 = System.currentTimeMillis();
+        
+        for ( int j = 0; j < 1000; j++ )
+        {
+            ByteArrayOutputStream baos = new ByteArrayOutputStream();
+            ObjectOutputStream out = new ObjectOutputStream( baos );
+            
+            for ( int i = 0; i < 100000; i++ )
+            {
+        
+                atav.writeExternal( out );
+                
+                out.flush();
+            }
+        
+            out.close();
+            baos.close();
+        }
+        
+        long t1 = System.currentTimeMillis();
+        System.out.println( "delta AVA new serialization : " + ( t1 - t0 ) );
+    }
 }

Modified: directory/shared/branches/shared-value/ldap/model/src/test/java/org/apache/directory/api/ldap/model/name/AvaTest.java
URL: http://svn.apache.org/viewvc/directory/shared/branches/shared-value/ldap/model/src/test/java/org/apache/directory/api/ldap/model/name/AvaTest.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/name/AvaTest.java (original)
+++ directory/shared/branches/shared-value/ldap/model/src/test/java/org/apache/directory/api/ldap/model/name/AvaTest.java Mon May  9 17:22:19 2016
@@ -104,15 +104,13 @@ public class AvaTest
     @Test
     public void testAttributeTypeAndValueValidType() throws LdapException
     {
-        Ava atav = new Ava( schemaManager, "A", ( String ) null );
-        assertEquals( "A=", atav.toString() );
-        assertEquals( "a=", atav.getNormName() );
-        assertEquals( "A=", atav.getName() );
-
-        atav = new Ava( schemaManager, "  A  ", ( String ) null );
-        assertEquals( "a=", atav.getNormName() );
-        assertEquals( "  A  =", atav.toString() );
-        assertEquals( "  A  =", atav.getName() );
+        Ava atav = new Ava( schemaManager, "DC", ( String ) null );
+        assertEquals( "DC=", atav.toString() );
+        assertEquals( "DC=", atav.getName() );
+
+        atav = new Ava( schemaManager, "  DC  ", ( String ) null );
+        assertEquals( "  DC  =", atav.toString() );
+        assertEquals( "  DC  =", atav.getName() );
 
         try
         {
@@ -244,7 +242,7 @@ public class AvaTest
     {
         Ava atav = new Ava( schemaManager, " A ", "a" );
 
-        assertEquals( "a=a", atav.normalize() );
+        assertEquals( " A =a", atav.getName() );
 
     }
 
@@ -254,7 +252,230 @@ public class AvaTest
     {
         Ava atav = new Ava( schemaManager, " CommonName ", " This is    a TEST " );
         assertEquals( " CommonName =\\ This is    a TEST\\ ", atav.toString() );
-        assertEquals( "commonname=\\ This is    a TEST\\ ", atav.getNormName() );
         assertEquals( " CommonName =\\ This is    a TEST\\ ", atav.getName() );
     }
+
+
+    @Test
+    public void testAvaEscapedLeadChar() throws LdapException
+    {
+        // Lead char : 0x00
+        Ava atav = new Ava( schemaManager, "cn", new byte[] { 0x00 } );
+        assertEquals( "cn=\\00", atav.getName() );
+        assertEquals( "cn=\\00", atav.getEscaped() );
+
+        // Lead char : 0x20
+        atav = new Ava( schemaManager, "cn", new byte[] { 0x20 } );
+        assertEquals( "cn=\\ ", atav.getName() );
+        assertEquals( "cn=\\ ", atav.getEscaped() );
+
+        // Lead char : '#'
+        atav = new Ava( schemaManager, "cn", new byte[] { '#' } );
+        assertEquals( "cn=\\#", atav.getName() );
+        assertEquals( "cn=\\#", atav.getEscaped() );
+
+        // Lead char : ','
+        atav = new Ava( schemaManager, "cn", new byte[] { ',' } );
+        assertEquals( "cn=\\,", atav.getName() );
+        assertEquals( "cn=\\,", atav.getEscaped() );
+
+        // Lead char : ';'
+        atav = new Ava( schemaManager, "cn", new byte[] { ';' } );
+        assertEquals( "cn=\\;", atav.getName() );
+        assertEquals( "cn=\\;", atav.getEscaped() );
+
+        // Lead char : '+'
+        atav = new Ava( schemaManager, "cn", new byte[] { '+' } );
+        assertEquals( "cn=\\+", atav.getName() );
+        assertEquals( "cn=\\+", atav.getEscaped() );
+
+        // Lead char : '"'
+        atav = new Ava( schemaManager, "cn", new byte[] { '"' } );
+        assertEquals( "cn=\\\"", atav.getName() );
+        assertEquals( "cn=\\\"", atav.getEscaped() );
+
+        // Lead char : '<'
+        atav = new Ava( schemaManager, "cn", new byte[] { '<' } );
+        assertEquals( "cn=\\<", atav.getName() );
+        assertEquals( "cn=\\<", atav.getEscaped() );
+
+        // Lead char : '>'
+        atav = new Ava( schemaManager, "cn", new byte[] { '>' } );
+        assertEquals( "cn=\\>", atav.getName() );
+        assertEquals( "cn=\\>", atav.getEscaped() );
+
+        // Lead char : '\'
+        atav = new Ava( schemaManager, "cn", new byte[] { '\\' } );
+        assertEquals( "cn=\\\\", atav.getName() );
+        assertEquals( "cn=\\\\", atav.getEscaped() );
+    }
+
+
+    @Test
+    public void testAvaEscapedTrailChar() throws LdapException
+    {
+        // Trail char : 0x00
+        Ava atav = new Ava( schemaManager, "cn", new byte[] { 'a', 0x00 } );
+        assertEquals( "cn=a\\00", atav.getName() );
+        assertEquals( "cn=a\\00", atav.getEscaped() );
+
+        // Trail char : 0x20
+        atav = new Ava( schemaManager, "cn", new byte[] { 'a', 0x20 } );
+        assertEquals( "cn=a\\ ", atav.getName() );
+        assertEquals( "cn=a\\ ", atav.getEscaped() );
+
+        // Trail char : '#' (it should not be escaped)
+        atav = new Ava( schemaManager, "cn", new byte[] { 'a', '#' } );
+        assertEquals( "cn=a#", atav.getName() );
+        assertEquals( "cn=a#", atav.getEscaped() );
+
+        // Trail char : ','
+        atav = new Ava( schemaManager, "cn", new byte[] { 'a', ',' } );
+        assertEquals( "cn=a\\,", atav.getName() );
+        assertEquals( "cn=a\\,", atav.getEscaped() );
+
+        // Trail char : ';'
+        atav = new Ava( schemaManager, "cn", new byte[] { 'a', ';' } );
+        assertEquals( "cn=a\\;", atav.getName() );
+        assertEquals( "cn=a\\;", atav.getEscaped() );
+
+        // Trail char : '+'
+        atav = new Ava( schemaManager, "cn", new byte[] { 'a', '+' } );
+        assertEquals( "cn=a\\+", atav.getName() );
+        assertEquals( "cn=a\\+", atav.getEscaped() );
+
+        // Trail char : '"'
+        atav = new Ava( schemaManager, "cn", new byte[] { 'a', '"' } );
+        assertEquals( "cn=a\\\"", atav.getName() );
+        assertEquals( "cn=a\\\"", atav.getEscaped() );
+
+        // Trail char : '<'
+        atav = new Ava( schemaManager, "cn", new byte[] { 'a', '<' } );
+        assertEquals( "cn=a\\<", atav.getName() );
+        assertEquals( "cn=a\\<", atav.getEscaped() );
+
+        // Trail char : '>'
+        atav = new Ava( schemaManager, "cn", new byte[] { 'a', '>' } );
+        assertEquals( "cn=a\\>", atav.getName() );
+        assertEquals( "cn=a\\>", atav.getEscaped() );
+
+        // Trail char : '\'
+        atav = new Ava( schemaManager, "cn", new byte[] { 'a', '\\' } );
+        assertEquals( "cn=a\\\\", atav.getName() );
+        assertEquals( "cn=a\\\\", atav.getEscaped() );
+    }
+
+
+    @Test
+    public void testAvaEscapedMiddleChar() throws LdapException
+    {
+        // Trail char : 0x00
+        Ava atav = new Ava( schemaManager, "cn", new byte[] { 'a', 0x00, 'b' } );
+        assertEquals( "cn=a\\00b", atav.getName() );
+        assertEquals( "cn=a\\00b", atav.getEscaped() );
+
+        // Trail char : 0x20 (it should not be escaped)
+        atav = new Ava( schemaManager, "cn", new byte[] { 'a', 0x20, 'b' } );
+        assertEquals( "cn=a b", atav.getName() );
+        assertEquals( "cn=a b", atav.getEscaped() );
+
+        // Trail char : '#' (it should not be escaped)
+        atav = new Ava( schemaManager, "cn", new byte[] { 'a', '#', 'b' } );
+        assertEquals( "cn=a#b", atav.getName() );
+        assertEquals( "cn=a#b", atav.getEscaped() );
+
+        // Trail char : ','
+        atav = new Ava( schemaManager, "cn", new byte[] { 'a', ',', 'b' } );
+        assertEquals( "cn=a\\,b", atav.getName() );
+        assertEquals( "cn=a\\,b", atav.getEscaped() );
+
+        // Trail char : ';'
+        atav = new Ava( schemaManager, "cn", new byte[] { 'a', ';', 'b' } );
+        assertEquals( "cn=a\\;b", atav.getName() );
+        assertEquals( "cn=a\\;b", atav.getEscaped() );
+
+        // Trail char : '+'
+        atav = new Ava( schemaManager, "cn", new byte[] { 'a', '+', 'b' } );
+        assertEquals( "cn=a\\+b", atav.getName() );
+        assertEquals( "cn=a\\+b", atav.getEscaped() );
+
+        // Trail char : '"'
+        atav = new Ava( schemaManager, "cn", new byte[] { 'a', '"', 'b' } );
+        assertEquals( "cn=a\\\"b", atav.getName() );
+        assertEquals( "cn=a\\\"b", atav.getEscaped() );
+
+        // Trail char : '<'
+        atav = new Ava( schemaManager, "cn", new byte[] { 'a', '<', 'b' } );
+        assertEquals( "cn=a\\<b", atav.getName() );
+        assertEquals( "cn=a\\<b", atav.getEscaped() );
+
+        // Trail char : '>'
+        atav = new Ava( schemaManager, "cn", new byte[] { 'a', '>', 'b' } );
+        assertEquals( "cn=a\\>b", atav.getName() );
+        assertEquals( "cn=a\\>b", atav.getEscaped() );
+
+        // Trail char : '\'
+        atav = new Ava( schemaManager, "cn", new byte[] { 'a', '\\', 'b' } );
+        assertEquals( "cn=a\\\\b", atav.getName() );
+        assertEquals( "cn=a\\\\b", atav.getEscaped() );
+    }
+
+
+    @Test
+    public void testAvaUTF2() throws LdapException
+    {
+        // The '¡' char (U+00A1)
+        Ava atav = new Ava( schemaManager, "cn", new byte[] { ( byte ) 0xC2, ( byte ) 0xA1 } );
+        assertEquals( "cn=\u00A1", atav.toString() );
+        assertEquals( "cn=\u00A1", atav.getName() );
+
+        // Some octets, which are not UTF-2
+        atav = new Ava( schemaManager, "cn", new byte[] { ( byte ) 0xFE, ( byte ) 0xC2, ( byte ) 0xC0, ( byte ) 0xC2 } );
+        assertEquals( "cn=\\FE\\C2\\C0\\C2", atav.getName() );
+        assertEquals( "cn=\\FE\\C2\\C0\\C2", atav.getEscaped() );
+    }
+
+
+    @Test
+    public void testAvaUTF3() throws LdapException
+    {
+        // UTF-3 starting with 0xE0
+        // 0x090E unicode is 0xE0 0xA4 0x8E UTF-8, ie DEVANAGARI LETTER SHORT E ('ऎ')
+        Ava atav = new Ava( schemaManager, "cn", new byte[]{ ( byte ) 0xE0, ( byte ) 0xA4, ( byte ) 0x8E } );
+        assertEquals( "cn=\u090E", atav.getName() );
+        assertEquals("cn=\u090E", atav.getEscaped() );
+
+        // UTF-3 between 0xE1 and 0xEC
+        // 0x1000 unicode is 0xE1 0x80 0x80 UTF-8, ie MYANMAR LETTER KA ('က')
+        atav = new Ava( schemaManager, "cn", new byte[]{ ( byte ) 0xE1, ( byte ) 0x80, ( byte ) 0x80 } );
+        assertEquals( "cn=\u1000", atav.getName() );
+        assertEquals("cn=\u1000", atav.getEscaped() );
+
+        // 0xCFFF unicode is 0xEC 0xBF 0xBF UTF-8 ('ì¿¿')
+        atav = new Ava( schemaManager, "cn", new byte[]{ ( byte ) 0xEC, ( byte ) 0xBF, ( byte ) 0xBF } );
+        assertEquals( "cn=\uCFFF", atav.getName() );
+        assertEquals("cn=\uCFFF", atav.getEscaped() );
+
+        // UTF-3 starting with 0xED
+        // 0xD000 unicode is 0xED 0x80 0x80 UTF-8 ('퀀')
+        atav = new Ava( schemaManager, "cn", new byte[]{ ( byte ) 0xED, ( byte ) 0x80, ( byte ) 0x80 } );
+        assertEquals( "cn=\uD000", atav.getName() );
+        assertEquals("cn=\uD000", atav.getEscaped() );
+
+        // UTF-3 starting with 0xEE or 0xEF
+        // 0xFC00 unicode is 0xEF 0xB0 0x80 UTF-8, ie ARABIC LIGATURE YEH WITH HAMZA ABOVE WITH JEEM ISOLATED FORM ('ﰀ')
+        atav = new Ava( schemaManager, "cn", new byte[]{ ( byte ) 0xEF, ( byte ) 0xB0, ( byte ) 0x80 } );
+        assertEquals( "cn=\uFC00", atav.getName() );
+        assertEquals("cn=\uFC00", atav.getEscaped() );
+
+        // Some octets, which are not UTF-3
+        atav = new Ava( schemaManager, "cn", new byte[] { ( byte ) 0xE0, 0x61, ( byte ) 0xE0, ( byte ) 0xA0, 0x61 } );
+        assertEquals( "cn=\\E0a\\E0\\A0a", atav.getName() );
+        assertEquals( "cn=\\E0a\\E0\\A0a", atav.getEscaped() );
+
+        // Some octets, which are not UTF-3
+        atav = new Ava( schemaManager, "cn", new byte[] { ( byte ) 0xE0, ( byte ) 0xA0 } );
+        assertEquals( "cn=\\E0\\A0", atav.getName() );
+        assertEquals( "cn=\\E0\\A0", atav.getEscaped() );
+    }
 }

Modified: directory/shared/branches/shared-value/ldap/model/src/test/java/org/apache/directory/api/ldap/model/name/DnParserTest.java
URL: http://svn.apache.org/viewvc/directory/shared/branches/shared-value/ldap/model/src/test/java/org/apache/directory/api/ldap/model/name/DnParserTest.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/name/DnParserTest.java (original)
+++ directory/shared/branches/shared-value/ldap/model/src/test/java/org/apache/directory/api/ldap/model/name/DnParserTest.java Mon May  9 17:22:19 2016
@@ -30,6 +30,7 @@ import org.apache.directory.api.ldap.mod
 import org.apache.directory.api.ldap.model.name.Dn;
 import org.apache.directory.api.ldap.model.name.Rdn;
 import org.apache.directory.api.util.Strings;
+import org.junit.Ignore;
 import org.junit.Test;
 import org.junit.runner.RunWith;
 
@@ -67,7 +68,6 @@ public class DnParserTest
         Dn dn = new Dn( "a = b" );
 
         assertEquals( "a = b", dn.getName() );
-        assertEquals( "a=b", dn.getNormName() );
     }
 
 
@@ -79,7 +79,7 @@ public class DnParserTest
     {
         Dn dn = new Dn( "a = b, c = d" );
 
-        assertEquals( "a=b,c=d", dn.getNormName() );
+        assertEquals( "a=b,c=d", dn.getEscaped() );
         assertEquals( "a = b, c = d", dn.getName() );
     }
 
@@ -91,7 +91,7 @@ public class DnParserTest
     public void testLdapDNCompositeWithSpace() throws LdapException
     {
         Dn dn = new Dn( "a=b, a =b, a= b, a = b, a  =  b" );
-        assertEquals( "a=b,a=b,a=b,a=b,a=b", dn.getNormName() );
+        assertEquals( "a=b,a=b,a=b,a=b,a=b", dn.getEscaped() );
         assertEquals( "a=b, a =b, a= b, a = b, a  =  b", dn.getName() );
     }
 
@@ -104,7 +104,7 @@ public class DnParserTest
     public void testLdapDNCompositeSepators() throws LdapException
     {
         Dn dn = new Dn( "a=b;c=d,e=f" );
-        assertEquals( "a=b,c=d,e=f", dn.getNormName() );
+        assertEquals( "a=b,c=d,e=f", dn.getEscaped() );
         assertEquals( "a=b;c=d,e=f", dn.getName() );
     }
 
@@ -116,7 +116,7 @@ public class DnParserTest
     public void testAttributeTypeWithUnderscore() throws LdapException
     {
         Dn dn = new Dn( "a_a = b + c_c = d" );
-        assertEquals( "a_a=b+c_c=d", dn.getNormName() );
+        assertEquals( "a_a=b+c_c=d", dn.getEscaped() );
         assertEquals( "a_a = b + c_c = d", dn.getName() );
     }
 
@@ -128,7 +128,7 @@ public class DnParserTest
     public void testAttributeValueWithUnderscore() throws LdapException
     {
         Dn dn = new Dn( "cn=\\#ACL_AD-Projects_Author,ou=Notes_Group,o=Contacts,c=DE" );
-        assertEquals( "cn=\\#ACL_AD-Projects_Author,ou=Notes_Group,o=Contacts,c=DE", dn.getNormName() );
+        assertEquals( "cn=\\#ACL_AD-Projects_Author,ou=Notes_Group,o=Contacts,c=DE", dn.getEscaped() );
         assertEquals( "cn=\\#ACL_AD-Projects_Author,ou=Notes_Group,o=Contacts,c=DE", dn.getName() );
     }
 
@@ -140,7 +140,7 @@ public class DnParserTest
     public void testLdapDNSimpleMultivaluedAttribute() throws LdapException
     {
         Dn dn = new Dn( "a = b + c = d" );
-        assertEquals( "a=b+c=d", dn.getNormName() );
+        assertEquals( "a=b+c=d", dn.getEscaped() );
         assertEquals( "a = b + c = d", dn.getName() );
     }
 
@@ -153,7 +153,7 @@ public class DnParserTest
     public void testLdapDNCompositeMultivaluedAttribute() throws LdapException
     {
         Dn dn = new Dn( "a=b+c=d, e=f + g=h + i=j" );
-        assertEquals( "a=b+c=d,e=f+g=h+i=j", dn.getNormName() );
+        assertEquals( "a=b+c=d,e=f+g=h+i=j", dn.getEscaped() );
         assertEquals( "a=b+c=d, e=f + g=h + i=j", dn.getName() );
     }
 
@@ -165,7 +165,7 @@ public class DnParserTest
     public void testLdapDNOidUpper() throws LdapException
     {
         Dn dn = new Dn( "OID.12.34.56 = azerty" );
-        assertEquals( "oid.12.34.56=azerty", dn.getNormName() );
+        assertEquals( "OID.12.34.56=azerty", dn.getEscaped() );
         assertEquals( "OID.12.34.56 = azerty", dn.getName() );
     }
 
@@ -177,7 +177,7 @@ public class DnParserTest
     public void testLdapDNOidLower() throws LdapException
     {
         Dn dn = new Dn( "oid.12.34.56 = azerty" );
-        assertEquals( "oid.12.34.56=azerty", dn.getNormName() );
+        assertEquals( "oid.12.34.56=azerty", dn.getEscaped() );
         assertEquals( "oid.12.34.56 = azerty", dn.getName() );
     }
 
@@ -190,7 +190,7 @@ public class DnParserTest
     public void testLdapDNOidWithoutPrefix() throws LdapException
     {
         Dn dn = new Dn( "12.34.56 = azerty" );
-        assertEquals( "12.34.56=azerty", dn.getNormName() );
+        assertEquals( "12.34.56=azerty", dn.getEscaped() );
         assertEquals( "12.34.56 = azerty", dn.getName() );
     }
 
@@ -203,7 +203,7 @@ public class DnParserTest
     public void testLdapDNCompositeOidWithoutPrefix() throws LdapException
     {
         Dn dn = new Dn( "12.34.56 = azerty; 7.8 = test" );
-        assertEquals( "12.34.56=azerty,7.8=test", dn.getNormName() );
+        assertEquals( "12.34.56=azerty,7.8=test", dn.getEscaped() );
         assertEquals( "12.34.56 = azerty; 7.8 = test", dn.getName() );
     }
 
@@ -215,11 +215,11 @@ public class DnParserTest
     public void testLdapDNPairCharAttributeValue() throws LdapException
     {
         Dn dn = new Dn( "a = \\,\\=\\+\\<\\>\\#\\;\\\\\\\"\\C3\\A9" );
-        assertEquals( "a=\\,\\=\\+\\<\\>#\\;\\\\\\\"\u00e9", dn.getNormName() );
+        assertEquals( "a=\\,=\\+\\<\\>#\\;\\\\\\\"\u00e9", dn.getEscaped() );
         assertEquals( "a = \\,\\=\\+\\<\\>\\#\\;\\\\\\\"\\C3\\A9", dn.getName() );
 
         dn = new Dn( "a = \\,\\=\\+\\<\\>\\#\\;\\\\\\\"\u00e9" );
-        assertEquals( "a=\\,\\=\\+\\<\\>#\\;\\\\\\\"\u00e9", dn.getNormName() );
+        assertEquals( "a=\\,=\\+\\<\\>#\\;\\\\\\\"\u00e9", dn.getEscaped() );
         assertEquals( "a = \\,\\=\\+\\<\\>\\#\\;\\\\\\\"\u00e9", dn.getName() );
     }
 
@@ -231,7 +231,7 @@ public class DnParserTest
     public void testLdapDNHexStringAttributeValue() throws LdapException
     {
         Dn dn = new Dn( "a = #0010A0AAFF" );
-        assertEquals( "a=#0010A0AAFF", dn.getNormName() );
+        assertEquals( "a=\\00\u0010\\A0\\AA\\FF", dn.getEscaped() );
         assertEquals( "a = #0010A0AAFF", dn.getName() );
     }
 
@@ -261,11 +261,11 @@ public class DnParserTest
     public void testLdapDNQuotedAttributeValue() throws LdapException
     {
         Dn dn = new Dn( "a = quoted \\\"value" );
-        assertEquals( "a=quoted \\\"value", dn.getNormName() );
+        assertEquals( "a=quoted \\\"value", dn.getEscaped() );
         assertEquals( "a = quoted \\\"value", dn.getName() );
 
         dn = new Dn( "cn=Mackie \\\"The Knife\\\" Messer" );
-        assertEquals( "cn=Mackie \\\"The Knife\\\" Messer", dn.getNormName() );
+        assertEquals( "cn=Mackie \\\"The Knife\\\" Messer", dn.getEscaped() );
         assertEquals( "cn=Mackie \\\"The Knife\\\" Messer", dn.getName() );
     }
 
@@ -277,26 +277,11 @@ public class DnParserTest
     public void testLdapDNBackslashInAttributeValue() throws LdapException
     {
         Dn dn = new Dn( "a = AC\\\\DC" );
-        assertEquals( "a=AC\\\\DC", dn.getNormName() );
+        assertEquals( "a=AC\\\\DC", dn.getEscaped() );
         assertEquals( "a = AC\\\\DC", dn.getName() );
     }
 
 
-    /**
-     * Test the encoding of a LdanDN
-     */
-    @Test
-    public void testNameToBytes() throws LdapException
-    {
-        Dn dn = new Dn( "cn = John, ou = People, OU = Marketing" );
-
-        byte[] bytes = Dn.getBytes( dn );
-
-        assertEquals( 30, bytes.length );
-        assertEquals( "cn=John,ou=People,ou=Marketing", Strings.utf8ToString( bytes ) );
-    }
-
-
     @Test
     public void testStringParser() throws LdapException
     {
@@ -307,7 +292,7 @@ public class DnParserTest
         Dn name = new Dn( dn );
 
         assertEquals( "CN = Emmanuel  L\u00e9charny", name.getName() );
-        assertEquals( "cn=Emmanuel  L\u00e9charny", name.getNormName() );
+        assertEquals( "CN=Emmanuel  L\u00e9charny", name.getEscaped() );
     }
 
 
@@ -320,7 +305,7 @@ public class DnParserTest
         Dn name = new Dn( dn );
 
         assertEquals( "C= E\u00e9c", name.getName() );
-        assertEquals( "c=E\u00e9c", name.getNormName() );
+        assertEquals( "C=E\u00e9c", name.getEscaped() );
     }
 
 
@@ -334,8 +319,8 @@ public class DnParserTest
             "cn=Billy Bakers, OID.2.5.4.11=Corporate Tax, ou=Fin-Accounting, ou=Americas, ou=Search, o=IMC, c=US", name
                 .getName() );
         assertEquals(
-            "cn=Billy Bakers,oid.2.5.4.11=Corporate Tax,ou=Fin-Accounting,ou=Americas,ou=Search,o=IMC,c=US", name
-                .getNormName() );
+            "cn=Billy Bakers,OID.2.5.4.11=Corporate Tax,ou=Fin-Accounting,ou=Americas,ou=Search,o=IMC,c=US", name
+                .getEscaped() );
     }
 
 
@@ -384,8 +369,8 @@ public class DnParserTest
         assertEquals( "RFC1779_1 : ",
             "CN=Marshall T. Rose, O=Dover Beach Consulting, L=Santa Clara, ST=California, C=US",
             nameRFC1779_1.getName() );
-        assertEquals( "RFC1779_1 : ", "cn=Marshall T. Rose,o=Dover Beach Consulting,l=Santa Clara,st=California,c=US",
-            nameRFC1779_1.getNormName() );
+        assertEquals( "RFC1779_1 : ", "CN=Marshall T. Rose,O=Dover Beach Consulting,L=Santa Clara,ST=California,C=US",
+            nameRFC1779_1.getEscaped() );
     }
 
 
@@ -417,7 +402,7 @@ public class DnParserTest
 
         assertEquals( "RFC2253_2 : ", "OU = Sales + CN =   J. Smith , O = Widget Inc. , C = US",
             nameRFC2253_2.getName() );
-        assertEquals( "RFC2253_2 : ", "ou=Sales+cn=J. Smith,o=Widget Inc.,c=US", nameRFC2253_2.getNormName() );
+        assertEquals( "RFC2253_2 : ", "OU=Sales+CN=J. Smith,O=Widget Inc.,C=US", nameRFC2253_2.getEscaped() );
     }
 
 
@@ -434,7 +419,7 @@ public class DnParserTest
 
         assertEquals( "RFC2253_3 : ", "CN=L. Eagle,   O=Sue\\, Grabbit and Runn, C=GB", nameRFC2253_3
             .getName() );
-        assertEquals( "RFC2253_3 : ", "cn=L. Eagle,o=Sue\\, Grabbit and Runn,c=GB", nameRFC2253_3.getNormName() );
+        assertEquals( "RFC2253_3 : ", "CN=L. Eagle,O=Sue\\, Grabbit and Runn,C=GB", nameRFC2253_3.getEscaped() );
     }
 
 
@@ -529,7 +514,7 @@ public class DnParserTest
         String path = "windowsFilePath=C:\\\\cygwin";
         Dn result = new Dn( path );
         assertEquals( path, result.getName() );
-        assertEquals( "windowsfilepath=C:\\\\cygwin", result.getNormName() );
+        assertEquals( "windowsFilePath=C:\\\\cygwin", result.getEscaped() );
     }
 
 
@@ -584,7 +569,7 @@ public class DnParserTest
         Dn dn = new Dn( cn );
 
         assertEquals( "cn=\u00c4\\2B", dn.getName() );
-        assertEquals( "cn=\u00c4\\+", dn.getNormName() );
+        assertEquals( "cn=\u00c4\\+", dn.getEscaped() );
     }
 
 
@@ -597,7 +582,7 @@ public class DnParserTest
         Dn dn = new Dn( cn );
 
         assertEquals( "cn=\u00E4\\+", dn.getName() );
-        assertEquals( "cn=\u00E4\\+", dn.getNormName() );
+        assertEquals( "cn=\u00E4\\+", dn.getEscaped() );
     }
 
 
@@ -693,4 +678,124 @@ public class DnParserTest
     {
         //Dn dn = new Dn( "l=eu + l=de + l=Berlin + l=Brandenburger Tor,dc=example,dc=org" );
     }
+    
+    
+    @Test
+    //@Ignore
+    public void testDnParsing() throws LdapInvalidDnException
+    {
+        long[] deltas = new long[10];
+        
+        for ( int j = 0; j < 10; j++ )
+        {
+            long t0 = System.currentTimeMillis();
+            
+            for ( int i = 0; i < 10000000; i++ )
+            {
+                new Dn( "dc=example" + i );
+            }
+            
+            long t1 = System.currentTimeMillis();
+            
+            deltas[j] = t1 - t0;
+            System.out.println( "Iteration[" + j + "] : " + deltas[j] );
+        }
+        
+        long allDeltas = 0L;
+        
+        for ( int i = 0; i < 10; i++ )
+        {
+            allDeltas += deltas[i];
+        }
+        
+        System.out.println( "delta new 1 RDN : " + ( allDeltas / 10 ) );
+
+        for ( int j = 0; j < 10; j++ )
+        {
+            long t0 = System.currentTimeMillis();
+            
+            for ( int i = 0; i < 10000000; i++ )
+            {
+                new Dn( "dc=example" + i + ",dc=com" );
+            }
+            
+            long t1 = System.currentTimeMillis();
+            
+            deltas[j] = t1 - t0;
+            System.out.println( "Iteration[" + j + "] : " + deltas[j] );
+        }
+        
+        allDeltas = 0L;
+        
+        for ( int i = 0; i < 10; i++ )
+        {
+            allDeltas += deltas[i];
+        }
+        
+        System.out.println( "delta new 2 RDNs : " + ( allDeltas / 10 ) );
+
+        for ( int j = 0; j < 10; j++ )
+        {
+            long t0 = System.currentTimeMillis();
+            
+            for ( int i = 0; i < 10000000; i++ )
+            {
+                new Dn( "uid=" + i + ",dc=example,dc=com" );
+            }
+            
+            long t1 = System.currentTimeMillis();
+            
+            deltas[j] = t1 - t0;
+            System.out.println( "Iteration[" + j + "] : " + deltas[j] );
+        }
+        
+        allDeltas = 0L;
+        
+        for ( int i = 0; i < 10; i++ )
+        {
+            allDeltas += deltas[i];
+        }
+        
+        System.out.println( "delta new 3 RDNs : " + ( allDeltas / 10 ) );
+
+        for ( int j = 0; j < 10; j++ )
+        {
+            long t0 = System.currentTimeMillis();
+            
+            for ( int i = 0; i < 10000000; i++ )
+            {
+                new Dn( "uid=" + i + ",ou=people,dc=example,dc=com" );
+            }
+            
+            long t1 = System.currentTimeMillis();
+            
+            deltas[j] = t1 - t0;
+            System.out.println( "Iteration[" + j + "] : " + deltas[j] );
+        }
+        
+        allDeltas = 0L;
+        
+        for ( int i = 0; i < 10; i++ )
+        {
+            allDeltas += deltas[i];
+        }
+        
+        System.out.println( "delta new 4 RDNs : " + ( allDeltas / 10 ) );
+    }
+    
+    
+    @Test
+    @Ignore
+    public void testDnParsingOneRdn() throws LdapInvalidDnException
+    {
+        long t0 = System.currentTimeMillis();
+        
+        for ( int i = 0; i < 1000000; i++ )
+        {
+            new Dn( "dc=example" + i );
+        }
+        
+        long t1 = System.currentTimeMillis();
+        System.out.println( "delta new 1 RDN : " + ( t1 - t0 ) );
+    }
 }

Modified: directory/shared/branches/shared-value/ldap/model/src/test/java/org/apache/directory/api/ldap/model/name/DnSerializationTest.java
URL: http://svn.apache.org/viewvc/directory/shared/branches/shared-value/ldap/model/src/test/java/org/apache/directory/api/ldap/model/name/DnSerializationTest.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/name/DnSerializationTest.java (original)
+++ directory/shared/branches/shared-value/ldap/model/src/test/java/org/apache/directory/api/ldap/model/name/DnSerializationTest.java Mon May  9 17:22:19 2016
@@ -21,7 +21,6 @@ package org.apache.directory.api.ldap.mo
 
 
 import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNotNull;
 
 import java.io.ByteArrayInputStream;
 import java.io.ByteArrayOutputStream;
@@ -111,7 +110,6 @@ public class DnSerializationTest
 
         assertEquals( dn1, dn2 );
         assertEquals( "Cn = Doe", dn2.getName() );
-        assertEquals( "cn=Doe", dn2.getNormName() );
-        assertNotNull( Dn.getBytes( dn2 ) );
+        assertEquals( "Cn=Doe", dn2.getEscaped() );
     }
 }

Modified: directory/shared/branches/shared-value/ldap/model/src/test/java/org/apache/directory/api/ldap/model/name/FastDnParserTest.java
URL: http://svn.apache.org/viewvc/directory/shared/branches/shared-value/ldap/model/src/test/java/org/apache/directory/api/ldap/model/name/FastDnParserTest.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/name/FastDnParserTest.java (original)
+++ directory/shared/branches/shared-value/ldap/model/src/test/java/org/apache/directory/api/ldap/model/name/FastDnParserTest.java Mon May  9 17:22:19 2016
@@ -163,19 +163,19 @@ public class FastDnParserTest
         Dn dn = FastDnParser.parse( "a = b" );
 
         assertEquals( "a = b", dn.getName() );
-        assertEquals( "a=b", dn.getNormName() );
+        assertEquals( "a=b", dn.getEscaped() );
         assertEquals( "a = b", dn.toString() );
 
         assertEquals( "a = b", dn.getRdn().getName() );
-        assertEquals( "a=b", dn.getRdn().getNormName() );
+        assertEquals( "a=b", dn.getRdn().getEscaped() );
 
-        assertEquals( "a = b", dn.getRdn().getAva().getName() );
-        assertEquals( "a=b", dn.getRdn().getAva().getNormName() );
+        assertEquals( "a=b", dn.getRdn().getAva().getName() );
+        assertEquals( "a=b", dn.getRdn().getAva().getEscaped() );
 
         assertEquals( "a", dn.getRdn().getAva().getType() );
         assertEquals( "a", dn.getRdn().getAva().getNormType() );
         assertEquals( "b", dn.getRdn().getAva().getValue().getValue() );
-        assertEquals( "b", dn.getRdn().getAva().getValue().getNormValue() );
+        assertEquals( "b", dn.getRdn().getAva().getValue().getValue() );
     }
 
 
@@ -186,7 +186,7 @@ public class FastDnParserTest
     public void testLdapDNComposite() throws LdapException
     {
         Dn dn = FastDnParser.parse( "a = b, c = d" );
-        assertEquals( "a=b,c=d", dn.getNormName() );
+        assertEquals( "a=b,c=d", dn.getEscaped() );
         assertEquals( "a = b, c = d", dn.getName() );
     }
 
@@ -198,7 +198,7 @@ public class FastDnParserTest
     public void testLdapDNCompositeWithSpace() throws LdapException
     {
         Dn dn = FastDnParser.parse( "a=b, a =b, a= b, a = b, a  =  b" );
-        assertEquals( "a=b,a=b,a=b,a=b,a=b", dn.getNormName() );
+        assertEquals( "a=b,a=b,a=b,a=b,a=b", dn.getEscaped() );
         assertEquals( "a=b, a =b, a= b, a = b, a  =  b", dn.getName() );
     }
 
@@ -211,7 +211,7 @@ public class FastDnParserTest
     public void testLdapDNCompositeSepators() throws LdapException
     {
         Dn dn = FastDnParser.parse( "a=b;c=d,e=f" );
-        assertEquals( "a=b,c=d,e=f", dn.getNormName() );
+        assertEquals( "a=b,c=d,e=f", dn.getEscaped() );
         assertEquals( "a=b;c=d,e=f", dn.getName() );
     }
 
@@ -222,7 +222,7 @@ public class FastDnParserTest
     public void testAttributeTypeWithUnderscore() throws LdapException
     {
         Dn dn = FastDnParser.parse( "microsoft_developpers=morons" );
-        assertEquals( "microsoft_developpers=morons", dn.getNormName() );
+        assertEquals( "microsoft_developpers=morons", dn.getEscaped() );
     }
 
     
@@ -279,7 +279,7 @@ public class FastDnParserTest
     public void testLdapDNOidWithoutPrefix() throws LdapException
     {
         Dn dn = FastDnParser.parse( "12.34.56 = azerty" );
-        assertEquals( "12.34.56=azerty", dn.getNormName() );
+        assertEquals( "12.34.56=azerty", dn.getEscaped() );
         assertEquals( "12.34.56 = azerty", dn.getName() );
     }
 
@@ -292,7 +292,7 @@ public class FastDnParserTest
     public void testLdapDNCompositeOidWithoutPrefix() throws LdapException
     {
         Dn dn = FastDnParser.parse( "12.34.56 = azerty; 7.8 = test" );
-        assertEquals( "12.34.56=azerty,7.8=test", dn.getNormName() );
+        assertEquals( "12.34.56=azerty,7.8=test", dn.getEscaped() );
         assertEquals( "12.34.56 = azerty; 7.8 = test", dn.getName() );
     }
 
@@ -341,21 +341,6 @@ public class FastDnParserTest
     }
 
 
-    /**
-     * Test the encoding of a LdanDN
-     */
-    @Test
-    public void testNameToBytes() throws LdapException
-    {
-        Dn dn = FastDnParser.parse( "cn = John, ou = People, OU = Marketing" );
-
-        byte[] bytes = Dn.getBytes( dn );
-
-        assertEquals( 30, bytes.length );
-        assertEquals( "cn=John,ou=People,ou=Marketing", Strings.utf8ToString( bytes ) );
-    }
-
-
     @Test
     public void testStringParser() throws LdapException
     {
@@ -366,7 +351,7 @@ public class FastDnParserTest
         Dn name = FastDnParser.parse( dn );
 
         assertEquals( "CN = Emmanuel  L\u00e9charny", name.getName() );
-        assertEquals( "cn=Emmanuel  L\u00e9charny", name.getNormName() );
+        assertEquals( "CN=Emmanuel  L\u00e9charny", name.getEscaped() );
     }
 
 
@@ -379,7 +364,7 @@ public class FastDnParserTest
         Dn name = FastDnParser.parse( dn );
 
         assertEquals( "C= E\u00e9c", name.getName() );
-        assertEquals( "c=E\u00e9c", name.getNormName() );
+        assertEquals( "C=E\u00e9c", name.getEscaped() );
     }
 
 
@@ -428,8 +413,8 @@ public class FastDnParserTest
         assertEquals( "RFC1779_1 : ",
             "CN=Marshall T. Rose, O=Dover Beach Consulting, L=Santa Clara, ST=California, C=US",
             nameRFC1779_1.getName() );
-        assertEquals( "RFC1779_1 : ", "cn=Marshall T. Rose,o=Dover Beach Consulting,l=Santa Clara,st=California,c=US",
-            nameRFC1779_1.getNormName() );
+        assertEquals( "RFC1779_1 : ", "CN=Marshall T. Rose,O=Dover Beach Consulting,L=Santa Clara,ST=California,C=US",
+            nameRFC1779_1.getEscaped() );
     }
 
 

Modified: directory/shared/branches/shared-value/ldap/model/src/test/java/org/apache/directory/api/ldap/model/name/RdnSerializationTest.java
URL: http://svn.apache.org/viewvc/directory/shared/branches/shared-value/ldap/model/src/test/java/org/apache/directory/api/ldap/model/name/RdnSerializationTest.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/name/RdnSerializationTest.java (original)
+++ directory/shared/branches/shared-value/ldap/model/src/test/java/org/apache/directory/api/ldap/model/name/RdnSerializationTest.java Mon May  9 17:22:19 2016
@@ -121,8 +121,6 @@ public class RdnSerializationTest
     {
         Rdn rdn = new Rdn( "" );
 
-        rdn.normalize();
-
         ByteArrayOutputStream baos = new ByteArrayOutputStream();
         ObjectOutputStream out = new ObjectOutputStream( baos );
 
@@ -145,8 +143,6 @@ public class RdnSerializationTest
     {
         Rdn rdn = new Rdn();
 
-        rdn.normalize();
-
         ByteArrayOutputStream baos = new ByteArrayOutputStream();
         ObjectOutputStream out = new ObjectOutputStream( baos );
 
@@ -171,7 +167,6 @@ public class RdnSerializationTest
     public void testSimpleRdnStaticSerialization() throws LdapException, IOException, ClassNotFoundException
     {
         Rdn rdn = new Rdn( "a=b" );
-        rdn.normalize();
 
         ByteArrayOutputStream baos = new ByteArrayOutputStream();
         ObjectOutputStream out = new ObjectOutputStream( baos );
@@ -197,7 +192,6 @@ public class RdnSerializationTest
     public void testSimpleRdn2StaticSerialization() throws LdapException, IOException, ClassNotFoundException
     {
         Rdn rdn = new Rdn( " ABC  = DEF " );
-        rdn.normalize();
 
         ByteArrayOutputStream baos = new ByteArrayOutputStream();
         ObjectOutputStream out = new ObjectOutputStream( baos );
@@ -223,7 +217,6 @@ public class RdnSerializationTest
     public void testSimpleRdnNoValueStaticSerialization() throws LdapException, IOException, ClassNotFoundException
     {
         Rdn rdn = new Rdn( " ABC  =" );
-        rdn.normalize();
 
         ByteArrayOutputStream baos = new ByteArrayOutputStream();
         ObjectOutputStream out = new ObjectOutputStream( baos );
@@ -249,7 +242,6 @@ public class RdnSerializationTest
     public void testSimpleRdnOneValueStaticSerialization() throws LdapException, IOException, ClassNotFoundException
     {
         Rdn rdn = new Rdn( " ABC  = def " );
-        rdn.normalize();
 
         ByteArrayOutputStream baos = new ByteArrayOutputStream();
         ObjectOutputStream out = new ObjectOutputStream( baos );
@@ -276,7 +268,6 @@ public class RdnSerializationTest
         ClassNotFoundException
     {
         Rdn rdn = new Rdn( " A = a + B = b + C = c " );
-        rdn.normalize();
 
         ByteArrayOutputStream baos = new ByteArrayOutputStream();
         ObjectOutputStream out = new ObjectOutputStream( baos );
@@ -303,7 +294,6 @@ public class RdnSerializationTest
         ClassNotFoundException
     {
         Rdn rdn = new Rdn( " B = b + A = a + C = c " );
-        rdn.normalize();
 
         ByteArrayOutputStream baos = new ByteArrayOutputStream();
         ObjectOutputStream out = new ObjectOutputStream( baos );



Mime
View raw message