You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@directory.apache.org by ak...@apache.org on 2006/08/20 22:44:21 UTC

svn commit: r433037 [1/3] - in /directory/trunks: apacheds/core/src/main/java/org/apache/directory/server/core/operational/ shared/ldap/src/test/java/org/apache/directory/shared/ldap/name/

Author: akarasulu
Date: Sun Aug 20 13:44:20 2006
New Revision: 433037

URL: http://svn.apache.org/viewvc?rev=433037&view=rev
Log:
merging changes in 1.0 branch for DIRSERVER-631 fix

Modified:
    directory/trunks/apacheds/core/src/main/java/org/apache/directory/server/core/operational/OperationalAttributeService.java
    directory/trunks/shared/ldap/src/test/java/org/apache/directory/shared/ldap/name/AttributeTypeAndValueTest.java
    directory/trunks/shared/ldap/src/test/java/org/apache/directory/shared/ldap/name/DnParserDIRSERVER_584_Test.java
    directory/trunks/shared/ldap/src/test/java/org/apache/directory/shared/ldap/name/LdapDNTest.java
    directory/trunks/shared/ldap/src/test/java/org/apache/directory/shared/ldap/name/LdapDnParserTest.java
    directory/trunks/shared/ldap/src/test/java/org/apache/directory/shared/ldap/name/RdnTest.java

Modified: directory/trunks/apacheds/core/src/main/java/org/apache/directory/server/core/operational/OperationalAttributeService.java
URL: http://svn.apache.org/viewvc/directory/trunks/apacheds/core/src/main/java/org/apache/directory/server/core/operational/OperationalAttributeService.java?rev=433037&r1=433036&r2=433037&view=diff
==============================================================================
--- directory/trunks/apacheds/core/src/main/java/org/apache/directory/server/core/operational/OperationalAttributeService.java (original)
+++ directory/trunks/apacheds/core/src/main/java/org/apache/directory/server/core/operational/OperationalAttributeService.java Sun Aug 20 13:44:20 2006
@@ -410,7 +410,7 @@
             }
             else if ( rdn.size() == 1 )
             {
-                newDn.add( new Rdn( registry.lookup( rdn.getType() ).getName(), rdn.getAtav().getValue() ) );
+                newDn.add( new Rdn( registry.lookup( rdn.getType() ).getName(), (String)rdn.getAtav().getValue() ) );
                 continue;
             }
 

Modified: directory/trunks/shared/ldap/src/test/java/org/apache/directory/shared/ldap/name/AttributeTypeAndValueTest.java
URL: http://svn.apache.org/viewvc/directory/trunks/shared/ldap/src/test/java/org/apache/directory/shared/ldap/name/AttributeTypeAndValueTest.java?rev=433037&r1=433036&r2=433037&view=diff
==============================================================================
--- directory/trunks/shared/ldap/src/test/java/org/apache/directory/shared/ldap/name/AttributeTypeAndValueTest.java (original)
+++ directory/trunks/shared/ldap/src/test/java/org/apache/directory/shared/ldap/name/AttributeTypeAndValueTest.java Sun Aug 20 13:44:20 2006
@@ -1,5 +1,5 @@
 /*
- *   Copyright 2005 The Apache Software Foundation
+ *   Copyright 2006 The Apache Software Foundation
  *
  *   Licensed under the Apache License, Version 2.0 (the "License");
  *   you may not use this file except in compliance with the License.
@@ -27,137 +27,146 @@
 
 /**
  * Test the class AttributeTypeAndValue
- * 
+ *
  * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
  */
 public class AttributeTypeAndValueTest extends TestCase
 {
-    // ~ Methods
-    // ------------------------------------------------------------------------------------
+   // ~ Methods
+   // ------------------------------------------------------------------------------------
+
+   /**
+    * Setup the test
+    */
+   protected void setUp()
+   {
+   }
+
+
+   /**
+    * Test a null AttributeTypeAndValue
+    */
+   public void testAttributeTypeAndValueNull() throws InvalidNameException
+   {
+       AttributeTypeAndValue atav = new AttributeTypeAndValue();
+       assertEquals( "", atav.toString() );
+       assertEquals( "", atav.getUpName());
+       assertEquals( -1, atav.getStart());
+       assertEquals( 0, atav.getLength());
+   }
+
+
+   /**
+    * test an empty AttributeTypeAndValue
+    */
+   public void testLdapRDNEmpty() throws InvalidNameException
+   {
+       try
+       {
+           new AttributeTypeAndValue( "", "" );
+           Assert.fail( "Should not occurs ... " );
+       }
+       catch ( InvalidNameException ine )
+       {
+           assertTrue( true );
+       }
+   }
+
+
+   /**
+    * test a simple AttributeTypeAndValue : a = b
+    */
+   public void testLdapRDNSimple() throws InvalidNameException
+   {
+       AttributeTypeAndValue atav = new AttributeTypeAndValue( "a", "b" );
+       assertEquals( "a=b", atav.toString() );
+       assertEquals( "a=b", atav.getUpName());
+       assertEquals( 0, atav.getStart());
+       assertEquals( 3, atav.getLength());
+   }
+
+
+   /**
+    * Compares two equals atavs
+    */
+   public void testCompareToEquals() throws InvalidNameException
+   {
+       AttributeTypeAndValue atav1 = new AttributeTypeAndValue( "a", "b" );
+       AttributeTypeAndValue atav2 = new AttributeTypeAndValue( "a", "b" );
+
+       assertEquals( 0, atav1.compareTo( atav2 ) );
+   }
+
+
+   /**
+    * Compares two equals atavs but with a type in different case
+    */
+   public void testCompareToEqualsCase() throws InvalidNameException
+   {
+       AttributeTypeAndValue atav1 = new AttributeTypeAndValue( "a", "b" );
+       AttributeTypeAndValue atav2 = new AttributeTypeAndValue( "A", "b" );
+
+       assertEquals( 0, atav1.compareTo( atav2 ) );
+   }
+
+
+   /**
+    * Compare two atavs : the first one is superior because its type is
+    * superior
+    */
+   public void testCompareAtav1TypeSuperior() throws InvalidNameException
+   {
+       AttributeTypeAndValue atav1 = new AttributeTypeAndValue( "b", "b" );
+       AttributeTypeAndValue atav2 = new AttributeTypeAndValue( "a", "b" );
+
+       assertEquals( 1, atav1.compareTo( atav2 ) );
+   }
+
+
+   /**
+    * Compare two atavs : the second one is superior because its type is
+    * superior
+    */
+   public void testCompareAtav2TypeSuperior() throws InvalidNameException
+   {
+       AttributeTypeAndValue atav1 = new AttributeTypeAndValue( "a", "b" );
+       AttributeTypeAndValue atav2 = new AttributeTypeAndValue( "b", "b" );
+
+       assertEquals( -1, atav1.compareTo( atav2 ) );
+   }
+
+
+   /**
+    * Compare two atavs : the first one is superior because its type is
+    * superior
+    */
+   public void testCompareAtav1ValueSuperior() throws InvalidNameException
+   {
+       AttributeTypeAndValue atav1 = new AttributeTypeAndValue( "a", "b" );
+       AttributeTypeAndValue atav2 = new AttributeTypeAndValue( "a", "a" );
+
+       assertEquals( 1, atav1.compareTo( atav2 ) );
+   }
+
+
+   /**
+    * Compare two atavs : the second one is superior because its type is
+    * superior
+    */
+   public void testCompareAtav2ValueSuperior() throws InvalidNameException
+   {
+       AttributeTypeAndValue atav1 = new AttributeTypeAndValue( "a", "a" );
+       AttributeTypeAndValue atav2 = new AttributeTypeAndValue( "a", "b" );
+
+       assertEquals( -1, atav1.compareTo( atav2 ) );
+   }
+
+
+   public void testNormalize() throws InvalidNameException
+   {
+       AttributeTypeAndValue atav = new AttributeTypeAndValue( " A ", "a" );
 
-    /**
-     * Setup the test
-     */
-    protected void setUp()
-    {
-    }
-
-
-    /**
-     * Test a null AttributeTypeAndValue
-     */
-    public void testAttributeTypeAndValueNull() throws InvalidNameException
-    {
-        Assert.assertEquals( "", new AttributeTypeAndValue().toString() );
-    }
-
-
-    /**
-     * test an empty AttributeTypeAndValue
-     */
-    public void testLdapRDNEmpty() throws InvalidNameException
-    {
-        try
-        {
-            new AttributeTypeAndValue( "", "" );
-            Assert.fail( "Should not occurs ... " );
-        }
-        catch ( InvalidNameException ine )
-        {
-            Assert.assertTrue( true );
-        }
-    }
-
-
-    /**
-     * test a simple AttributeTypeAndValue : a = b
-     */
-    public void testLdapRDNSimple() throws InvalidNameException
-    {
-        Assert.assertEquals( "a=b", new AttributeTypeAndValue( "a", "b" ).toString() );
-    }
-
-
-    /**
-     * Compares two equals atavs
-     */
-    public void testCompareToEquals() throws InvalidNameException
-    {
-        AttributeTypeAndValue atav1 = new AttributeTypeAndValue( "a", "b" );
-        AttributeTypeAndValue atav2 = new AttributeTypeAndValue( "a", "b" );
-
-        Assert.assertEquals( 0, atav1.compareTo( atav2 ) );
-    }
-
-
-    /**
-     * Compares two equals atavs but with a type in different case
-     */
-    public void testCompareToEqualsCase() throws InvalidNameException
-    {
-        AttributeTypeAndValue atav1 = new AttributeTypeAndValue( "a", "b" );
-        AttributeTypeAndValue atav2 = new AttributeTypeAndValue( "A", "b" );
-
-        Assert.assertEquals( 0, atav1.compareTo( atav2 ) );
-    }
-
-
-    /**
-     * Compare two atavs : the first one is superior because its type is
-     * superior
-     */
-    public void testCompareAtav1TypeSuperior() throws InvalidNameException
-    {
-        AttributeTypeAndValue atav1 = new AttributeTypeAndValue( "b", "b" );
-        AttributeTypeAndValue atav2 = new AttributeTypeAndValue( "a", "b" );
-
-        Assert.assertEquals( 1, atav1.compareTo( atav2 ) );
-    }
-
-
-    /**
-     * Compare two atavs : the second one is superior because its type is
-     * superior
-     */
-    public void testCompareAtav2TypeSuperior() throws InvalidNameException
-    {
-        AttributeTypeAndValue atav1 = new AttributeTypeAndValue( "a", "b" );
-        AttributeTypeAndValue atav2 = new AttributeTypeAndValue( "b", "b" );
-
-        Assert.assertEquals( -1, atav1.compareTo( atav2 ) );
-    }
-
-
-    /**
-     * Compare two atavs : the first one is superior because its type is
-     * superior
-     */
-    public void testCompareAtav1ValueSuperior() throws InvalidNameException
-    {
-        AttributeTypeAndValue atav1 = new AttributeTypeAndValue( "a", "b" );
-        AttributeTypeAndValue atav2 = new AttributeTypeAndValue( "a", "a" );
-
-        Assert.assertEquals( 1, atav1.compareTo( atav2 ) );
-    }
-
-
-    /**
-     * Compare two atavs : the second one is superior because its type is
-     * superior
-     */
-    public void testCompareAtav2ValueSuperior() throws InvalidNameException
-    {
-        AttributeTypeAndValue atav1 = new AttributeTypeAndValue( "a", "a" );
-        AttributeTypeAndValue atav2 = new AttributeTypeAndValue( "a", "b" );
-
-        Assert.assertEquals( -1, atav1.compareTo( atav2 ) );
-    }
-
-
-    public void testNormalize() throws InvalidNameException
-    {
-        AttributeTypeAndValue atav = new AttributeTypeAndValue( " A ", "a" );
+       assertEquals( "a=a", atav.normalize() );
 
-        Assert.assertEquals( "a=a", atav.normalize() );
-    }
+   }
 }

Modified: directory/trunks/shared/ldap/src/test/java/org/apache/directory/shared/ldap/name/DnParserDIRSERVER_584_Test.java
URL: http://svn.apache.org/viewvc/directory/trunks/shared/ldap/src/test/java/org/apache/directory/shared/ldap/name/DnParserDIRSERVER_584_Test.java?rev=433037&r1=433036&r2=433037&view=diff
==============================================================================
--- directory/trunks/shared/ldap/src/test/java/org/apache/directory/shared/ldap/name/DnParserDIRSERVER_584_Test.java (original)
+++ directory/trunks/shared/ldap/src/test/java/org/apache/directory/shared/ldap/name/DnParserDIRSERVER_584_Test.java Sun Aug 20 13:44:20 2006
@@ -1,5 +1,5 @@
 /*
- *   Copyright 2004 The Apache Software Foundation
+ *   Copyright 2006 The Apache Software Foundation
  *
  *   Licensed under the Apache License, Version 2.0 (the "License");
  *   you may not use this file except in compliance with the License.
@@ -26,35 +26,35 @@
 
 /**
  * Testcase devised specifically for DIRSERVER-584.
- * 
+ *
  * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
  * @version $Rev$
  * @see <a href="https://issues.apache.org/jira/browse/DIRSERVER-584">DIRSERVER-584</a>
  */
 public class DnParserDIRSERVER_584_Test extends TestCase
 {
-    /**
-     * Need this testa() to run first to mess up the state of the static parser.
-     */
-    public void testa() throws Exception
-    {
-        try
-        {
-            LdapDnParser.parseInternal( "ou=test=testing", new ArrayList() );
-            fail( "should never get here" );
-        }
-        catch ( InvalidNameException e )
-        {
-        }
-    }
-    
-    
-    /**
-     * Need this testb() to run second to use the mess up static parser.  This 
-     * test should succeed but fails.
-     */
-    public void testb() throws Exception
-    {
-        LdapDnParser.parseInternal( "ou=system", new ArrayList() );
-    }
-}
+   /**
+    * Need this testa() to run first to mess up the state of the static parser.
+    */
+   public void testa() throws Exception
+   {
+       try
+       {
+           LdapDnParser.parseInternal( "ou=test=testing", new ArrayList() );
+           fail( "should never get here" );
+       }
+       catch ( InvalidNameException e )
+       {
+       }
+   }
+
+
+   /**
+    * Need this testb() to run second to use the mess up static parser.  This
+    * test should succeed but fails.
+    */
+   public void testb() throws Exception
+   {
+       LdapDnParser.parseInternal( "ou=system", new ArrayList() );
+   }
+}
\ No newline at end of file