directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From elecha...@apache.org
Subject svn commit: r809637 - in /directory/shared/branches/shared-schema/ldap-schema-loader/src: main/java/org/apache/directory/shared/schema/loader/ldif/LdifSchemaLoader.java test/java/org/apache/directory/server/schema/loader/ldif/LdifSchemaLoaderTest.java
Date Mon, 31 Aug 2009 15:50:38 GMT
Author: elecharny
Date: Mon Aug 31 15:50:38 2009
New Revision: 809637

URL: http://svn.apache.org/viewvc?rev=809637&view=rev
Log:
o Added some error logs
o Using Junit 4.5 annotations

Modified:
    directory/shared/branches/shared-schema/ldap-schema-loader/src/main/java/org/apache/directory/shared/schema/loader/ldif/LdifSchemaLoader.java
    directory/shared/branches/shared-schema/ldap-schema-loader/src/test/java/org/apache/directory/server/schema/loader/ldif/LdifSchemaLoaderTest.java

Modified: directory/shared/branches/shared-schema/ldap-schema-loader/src/main/java/org/apache/directory/shared/schema/loader/ldif/LdifSchemaLoader.java
URL: http://svn.apache.org/viewvc/directory/shared/branches/shared-schema/ldap-schema-loader/src/main/java/org/apache/directory/shared/schema/loader/ldif/LdifSchemaLoader.java?rev=809637&r1=809636&r2=809637&view=diff
==============================================================================
--- directory/shared/branches/shared-schema/ldap-schema-loader/src/main/java/org/apache/directory/shared/schema/loader/ldif/LdifSchemaLoader.java
(original)
+++ directory/shared/branches/shared-schema/ldap-schema-loader/src/main/java/org/apache/directory/shared/schema/loader/ldif/LdifSchemaLoader.java
Mon Aug 31 15:50:38 2009
@@ -151,15 +151,20 @@
 
         if ( ! baseDirectory.exists() )
         {
-            throw new IllegalArgumentException( "Provided baseDirectory '" +
-                    baseDirectory.getAbsolutePath() + "' does not exist." );
+            String msg = "Provided baseDirectory '" +
+                baseDirectory.getAbsolutePath() + "' does not exist.";
+            LOG.error( msg );
+            throw new IllegalArgumentException( msg );
         }
 
         File schemaLdif = new File( baseDirectory, OU_SCHEMA_LDIF );
+        
         if ( ! schemaLdif.exists() )
         {
-            throw new FileNotFoundException( "Expecting to find a schema.ldif file in provided
baseDirectory " +
-                    "path '" + baseDirectory.getAbsolutePath() + "' but no such file found."
);
+            String msg = "Expecting to find a schema.ldif file in provided baseDirectory
path '" +
+                baseDirectory.getAbsolutePath() + "' but no such file found.";
+            LOG.error( msg );
+            throw new FileNotFoundException( msg );
         }
 
         if ( IS_DEBUG )
@@ -187,11 +192,11 @@
         File schemaDirectory = new File( baseDirectory, "schema" );
         String[] ldifFiles = schemaDirectory.list( ldifFilter );
 
-        for ( int ii = 0; ii < ldifFiles.length; ii++ )
+        for ( String ldifFile : ldifFiles )
         {
             try
             {
-                LdifReader reader = new LdifReader( new File( schemaDirectory, ldifFiles[ii]
) );
+                LdifReader reader = new LdifReader( new File( schemaDirectory, ldifFile )
);
                 LdifEntry entry = reader.next();
                 Schema schema = factory.getSchema( entry.getEntry() );
                 schemaMap.put( schema.getSchemaName(), schema );
@@ -203,7 +208,7 @@
             }
             catch ( Exception e )
             {
-                LOG.error( "Failed to load schema LDIF file " + ldifFiles[ii], e );
+                LOG.error( "Failed to load schema LDIF file " + ldifFile, e );
                 throw e;
             }
         }

Modified: directory/shared/branches/shared-schema/ldap-schema-loader/src/test/java/org/apache/directory/server/schema/loader/ldif/LdifSchemaLoaderTest.java
URL: http://svn.apache.org/viewvc/directory/shared/branches/shared-schema/ldap-schema-loader/src/test/java/org/apache/directory/server/schema/loader/ldif/LdifSchemaLoaderTest.java?rev=809637&r1=809636&r2=809637&view=diff
==============================================================================
--- directory/shared/branches/shared-schema/ldap-schema-loader/src/test/java/org/apache/directory/server/schema/loader/ldif/LdifSchemaLoaderTest.java
(original)
+++ directory/shared/branches/shared-schema/ldap-schema-loader/src/test/java/org/apache/directory/server/schema/loader/ldif/LdifSchemaLoaderTest.java
Mon Aug 31 15:50:38 2009
@@ -20,13 +20,12 @@
 package org.apache.directory.server.schema.loader.ldif;
 
 
-import junit.framework.TestCase;
-
 import java.io.File;
 
 import org.apache.directory.shared.ldap.schema.ldif.extractor.SchemaLdifExtractor;
 import org.apache.directory.shared.ldap.schema.registries.Registries;
 import org.apache.directory.shared.schema.loader.ldif.LdifSchemaLoader;
+import org.junit.Test;
 
 
 /**
@@ -35,9 +34,10 @@
  * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
  * @version $Revision$
  */
-public class LdifSchemaLoaderTest extends TestCase
+public class LdifSchemaLoaderTest
 {
-    public static void testLoader() throws Exception
+    @Test
+    public void testLoader() throws Exception
     {
         File workingDirectory = new File( System.getProperty( "workingDirectory" ) );
         SchemaLdifExtractor extractor = new SchemaLdifExtractor( workingDirectory );



Mime
View raw message