You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@directory.apache.org by el...@apache.org on 2010/03/28 01:51:20 UTC

svn commit: r928315 - in /directory: apacheds/trunk/core-entry/src/test/java/org/apache/directory/server/core/entry/ shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/entry/ shared/trunk/ldap/src/main/java/org/apache/directory/shared/lda...

Author: elecharny
Date: Sun Mar 28 00:51:19 2010
New Revision: 928315

URL: http://svn.apache.org/viewvc?rev=928315&view=rev
Log:
o Moved tests from core-entry to shared-ldap
o Renamed and moved ClientStringValue and ServerStringValue tests
o Moved some more methods to CLinetStringValue

Added:
    directory/shared/trunk/ldap/src/test/java/org/apache/directory/shared/ldap/entry/StringValueAttributeTypeTest.java
      - copied, changed from r928296, directory/apacheds/trunk/core-entry/src/test/java/org/apache/directory/server/core/entry/ServerStringValueTest.java
    directory/shared/trunk/ldap/src/test/java/org/apache/directory/shared/ldap/entry/StringValueTest.java
      - copied, changed from r928178, directory/shared/trunk/ldap/src/test/java/org/apache/directory/shared/ldap/entry/client/ClientStringValueTest.java
Removed:
    directory/apacheds/trunk/core-entry/src/test/java/org/apache/directory/server/core/entry/ServerStringValueTest.java
    directory/shared/trunk/ldap/src/test/java/org/apache/directory/shared/ldap/entry/client/ClientStringValueTest.java
Modified:
    directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/entry/ServerStringValue.java
    directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/entry/client/ClientStringValue.java

Modified: directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/entry/ServerStringValue.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/entry/ServerStringValue.java?rev=928315&r1=928314&r2=928315&view=diff
==============================================================================
--- directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/entry/ServerStringValue.java (original)
+++ directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/entry/ServerStringValue.java Sun Mar 28 00:51:19 2010
@@ -188,28 +188,6 @@ public class ServerStringValue extends C
 
 
     /**
-     * Uses the syntaxChecker associated with the attributeType to check if the
-     * value is valid.  Repeated calls to this method do not attempt to re-check
-     * the syntax of the wrapped value every time if the wrapped value does not
-     * change. Syntax checks only result on the first check, and when the wrapped
-     * value changes.
-     *
-     * @see Value#isValid()
-     */
-    public final boolean isValid()
-    {
-        if ( valid != null )
-        {
-            return valid;
-        }
-
-        valid = attributeType.getSyntax().getSyntaxChecker().isValidSyntax( get() );
-        
-        return valid;
-    }
-
-
-    /**
      * @see Value#compareTo(Object)
      * @throws IllegalStateException on failures to extract the comparator, or the
      * normalizers needed to perform the required comparisons based on the schema

Modified: directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/entry/client/ClientStringValue.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/entry/client/ClientStringValue.java?rev=928315&r1=928314&r2=928315&view=diff
==============================================================================
--- directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/entry/client/ClientStringValue.java (original)
+++ directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/entry/client/ClientStringValue.java Sun Mar 28 00:51:19 2010
@@ -325,6 +325,35 @@ public class ClientStringValue extends A
     {
         return false;
     }
+
+    
+    /**
+     * Uses the syntaxChecker associated with the attributeType to check if the
+     * value is valid.  Repeated calls to this method do not attempt to re-check
+     * the syntax of the wrapped value every time if the wrapped value does not
+     * change. Syntax checks only result on the first check, and when the wrapped
+     * value changes.
+     *
+     * @see Value#isValid()
+     */
+    public final boolean isValid()
+    {
+        if ( valid != null )
+        {
+            return valid;
+        }
+
+        if ( attributeType != null )
+        {
+            valid = attributeType.getSyntax().getSyntaxChecker().isValidSyntax( get() );
+        }
+        else
+        {
+            valid = false;
+        }
+        
+        return valid;
+    }
     
     
     /**

Copied: directory/shared/trunk/ldap/src/test/java/org/apache/directory/shared/ldap/entry/StringValueAttributeTypeTest.java (from r928296, directory/apacheds/trunk/core-entry/src/test/java/org/apache/directory/server/core/entry/ServerStringValueTest.java)
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/src/test/java/org/apache/directory/shared/ldap/entry/StringValueAttributeTypeTest.java?p2=directory/shared/trunk/ldap/src/test/java/org/apache/directory/shared/ldap/entry/StringValueAttributeTypeTest.java&p1=directory/apacheds/trunk/core-entry/src/test/java/org/apache/directory/server/core/entry/ServerStringValueTest.java&r1=928296&r2=928315&rev=928315&view=diff
==============================================================================
--- directory/apacheds/trunk/core-entry/src/test/java/org/apache/directory/server/core/entry/ServerStringValueTest.java (original)
+++ directory/shared/trunk/ldap/src/test/java/org/apache/directory/shared/ldap/entry/StringValueAttributeTypeTest.java Sun Mar 28 00:51:19 2010
@@ -17,7 +17,7 @@
  *  under the License. 
  *  
  */
-package org.apache.directory.server.core.entry;
+package org.apache.directory.shared.ldap.entry;
 
 
 import static org.junit.Assert.assertEquals;
@@ -66,11 +66,11 @@ import org.junit.Test;
  * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
  * @version $Rev$, $Date$
  */
-public class ServerStringValueTest
+public class StringValueAttributeTypeTest
 {
-    private TestServerEntryUtils.S s;
-    private TestServerEntryUtils.AT at;
-    private TestServerEntryUtils.MR mr;
+    private EntryUtils.S s;
+    private EntryUtils.AT at;
+    private EntryUtils.MR mr;
 
     
     /**
@@ -79,13 +79,13 @@ public class ServerStringValueTest
      */
     @Before public void initAT()
     {
-        s = new TestServerEntryUtils.S( "1.1.1.1", false );
+        s = new EntryUtils.S( "1.1.1.1", false );
         s.setSyntaxChecker( new OctetStringSyntaxChecker() );
-        mr = new TestServerEntryUtils.MR( "1.1.2.1" );
+        mr = new EntryUtils.MR( "1.1.2.1" );
         mr.setSyntax( s );
         mr.setLdapComparator( new StringComparator( "1.1.2.1" ) );
         mr.setNormalizer( new DeepTrimToLowerNormalizer( "1.1.2.1" ) );
-        at = new TestServerEntryUtils.AT( "1.1.3.1" );
+        at = new EntryUtils.AT( "1.1.3.1" );
         at.setEquality( mr );
         at.setOrdering( mr );
         at.setSubstring( mr );
@@ -174,7 +174,7 @@ public class ServerStringValueTest
     @Test 
     public void testServerStringValueNullValue()
     {
-        AttributeType attribute = TestServerEntryUtils.getIA5StringAttributeType();
+        AttributeType attribute = EntryUtils.getIA5StringAttributeType();
         
         ServerStringValue value = new ServerStringValue( attribute, null );
         
@@ -188,7 +188,7 @@ public class ServerStringValueTest
      */
     @Test public void testGetNormalizedValue()
     {
-        AttributeType attribute = TestServerEntryUtils.getIA5StringAttributeType();
+        AttributeType attribute = EntryUtils.getIA5StringAttributeType();
         
         ServerStringValue value = new ServerStringValue( attribute, null );
         
@@ -215,7 +215,7 @@ public class ServerStringValueTest
      */
     @Test public void testIsValid()
     {
-        AttributeType attribute = TestServerEntryUtils.getIA5StringAttributeType();
+        AttributeType attribute = EntryUtils.getIA5StringAttributeType();
         
         ServerStringValue value = new ServerStringValue( attribute, null );
         assertTrue( value.isValid() );
@@ -237,7 +237,7 @@ public class ServerStringValueTest
     @Test
     public void testNormalize() throws LdapException
     {
-        AttributeType attribute = TestServerEntryUtils.getIA5StringAttributeType();
+        AttributeType attribute = EntryUtils.getIA5StringAttributeType();
         ServerStringValue ssv = new ServerStringValue( attribute );
 
         ssv.normalize();
@@ -259,12 +259,12 @@ public class ServerStringValueTest
     @Test
     public void testInstanceOf() throws LdapException
     {
-        AttributeType attribute = TestServerEntryUtils.getIA5StringAttributeType();
+        AttributeType attribute = EntryUtils.getIA5StringAttributeType();
         ServerStringValue ssv = new ServerStringValue( attribute );
         
         assertTrue( ssv.instanceOf( attribute ) );
         
-        attribute = TestServerEntryUtils.getBytesAttributeType();
+        attribute = EntryUtils.getBytesAttributeType();
         
         assertFalse( ssv.instanceOf( attribute ) );
     }    
@@ -276,7 +276,7 @@ public class ServerStringValueTest
     @Test
     public void testgetAttributeType()
     {
-        AttributeType attribute = TestServerEntryUtils.getIA5StringAttributeType();
+        AttributeType attribute = EntryUtils.getIA5StringAttributeType();
         ServerStringValue ssv = new ServerStringValue( attribute );
         
         assertEquals( attribute, ssv.getAttributeType() );
@@ -288,8 +288,8 @@ public class ServerStringValueTest
      */
     @Test public void testEquals()
     {
-        AttributeType at1 = TestServerEntryUtils.getIA5StringAttributeType();
-        AttributeType at2 = TestServerEntryUtils.getBytesAttributeType();
+        AttributeType at1 = EntryUtils.getIA5StringAttributeType();
+        AttributeType at2 = EntryUtils.getBytesAttributeType();
         
         ServerStringValue value1 = new ServerStringValue( at1, "test" );
         ServerStringValue value2 = new ServerStringValue( at1, "test" );
@@ -336,7 +336,7 @@ public class ServerStringValueTest
         }
         
         // create a AT without any syntax
-        AttributeType attribute = new TestServerEntryUtils.AT( "1.1.3.1" );
+        AttributeType attribute = new EntryUtils.AT( "1.1.3.1" );
         
         try
         {
@@ -356,7 +356,7 @@ public class ServerStringValueTest
      */
     @Test public void testHashCode()
     {
-        AttributeType at1 = TestServerEntryUtils.getCaseIgnoringAttributeNoNumbersType();
+        AttributeType at1 = EntryUtils.getCaseIgnoringAttributeNoNumbersType();
         ServerStringValue v0 = new ServerStringValue( at1, "Alex" );
         ServerStringValue v1 = new ServerStringValue( at1, "ALEX" );
         ServerStringValue v2 = new ServerStringValue( at1, "alex" );
@@ -390,7 +390,7 @@ public class ServerStringValueTest
     @Test
     public void testCompareTo()
     {
-        AttributeType at1 = TestServerEntryUtils.getCaseIgnoringAttributeNoNumbersType();
+        AttributeType at1 = EntryUtils.getCaseIgnoringAttributeNoNumbersType();
         ServerStringValue v0 = new ServerStringValue( at1, "Alex" );
         ServerStringValue v1 = new ServerStringValue( at1, "ALEX" );
         
@@ -410,7 +410,7 @@ public class ServerStringValueTest
     @Test
     public void testClone() throws LdapException
     {
-        AttributeType at1 = TestServerEntryUtils.getCaseIgnoringAttributeNoNumbersType();
+        AttributeType at1 = EntryUtils.getCaseIgnoringAttributeNoNumbersType();
         ServerStringValue ssv = new ServerStringValue( at1, "Test" );
         
         ServerStringValue ssv1 = ssv.clone();

Copied: directory/shared/trunk/ldap/src/test/java/org/apache/directory/shared/ldap/entry/StringValueTest.java (from r928178, directory/shared/trunk/ldap/src/test/java/org/apache/directory/shared/ldap/entry/client/ClientStringValueTest.java)
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/src/test/java/org/apache/directory/shared/ldap/entry/StringValueTest.java?p2=directory/shared/trunk/ldap/src/test/java/org/apache/directory/shared/ldap/entry/StringValueTest.java&p1=directory/shared/trunk/ldap/src/test/java/org/apache/directory/shared/ldap/entry/client/ClientStringValueTest.java&r1=928178&r2=928315&rev=928315&view=diff
==============================================================================
--- directory/shared/trunk/ldap/src/test/java/org/apache/directory/shared/ldap/entry/client/ClientStringValueTest.java (original)
+++ directory/shared/trunk/ldap/src/test/java/org/apache/directory/shared/ldap/entry/StringValueTest.java Sun Mar 28 00:51:19 2010
@@ -16,7 +16,7 @@
  * specific language governing permissions and limitations
  * under the License.
  */
-package org.apache.directory.shared.ldap.entry.client;
+package org.apache.directory.shared.ldap.entry;
 
 import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.assertNull;
@@ -31,6 +31,7 @@ import java.io.IOException;
 import java.io.ObjectInputStream;
 import java.io.ObjectOutputStream;
 
+import org.apache.directory.shared.ldap.entry.client.ClientStringValue;
 import org.apache.directory.shared.ldap.exception.LdapException;
 import org.apache.directory.shared.ldap.schema.normalizers.DeepTrimToLowerNormalizer;
 import org.apache.directory.shared.ldap.schema.syntaxCheckers.Ia5StringSyntaxChecker;
@@ -43,7 +44,7 @@ import org.junit.Test;
  * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
  * @version $Rev$, $Date$
  */
-public class ClientStringValueTest
+public class StringValueTest
 {
     /**
      * Serialize a ClientStringValue
@@ -552,11 +553,11 @@ public class ClientStringValueTest
         csv.isValid( new Ia5StringSyntaxChecker() );
 
         ClientStringValue csvSer = deserializeValue( serializeValue( csv ) );
-         assertNotSame( csv, csvSer );
-         assertEquals( csv.get(), csvSer.get() );
-         assertEquals( csv.getNormalizedValue(), csvSer.getNormalizedValue() );
-         assertTrue( csvSer.isNormalized() );
-         assertFalse( csvSer.isValid() );
+        assertNotSame( csv, csvSer );
+        assertEquals( csv.get(), csvSer.get() );
+        assertEquals( csv.getNormalizedValue(), csvSer.getNormalizedValue() );
+        assertTrue( csvSer.isNormalized() );
+        assertFalse( csvSer.isValid() );
     }