directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From akaras...@apache.org
Subject svn commit: r149490 - in incubator/directory: apacheds/trunk/core/src/main/java/org/apache/ldap/server/AbstractServerTest.java codesize.sh
Date Wed, 02 Feb 2005 06:04:29 GMT
Author: akarasulu
Date: Tue Feb  1 22:04:28 2005
New Revision: 149490

URL: http://svn.apache.org/viewcvs?view=rev&rev=149490
Log:
just to calc the amount of code in trunk and all of directory

Added:
    incubator/directory/codesize.sh   (with props)
Modified:
    incubator/directory/apacheds/trunk/core/src/main/java/org/apache/ldap/server/AbstractServerTest.java

Modified: incubator/directory/apacheds/trunk/core/src/main/java/org/apache/ldap/server/AbstractServerTest.java
URL: http://svn.apache.org/viewcvs/incubator/directory/apacheds/trunk/core/src/main/java/org/apache/ldap/server/AbstractServerTest.java?view=diff&r1=149489&r2=149490
==============================================================================
--- incubator/directory/apacheds/trunk/core/src/main/java/org/apache/ldap/server/AbstractServerTest.java
(original)
+++ incubator/directory/apacheds/trunk/core/src/main/java/org/apache/ldap/server/AbstractServerTest.java
Tue Feb  1 22:04:28 2005
@@ -19,10 +19,13 @@
 
 import java.io.File;
 import java.io.IOException;
+import java.io.InputStream;
 import java.util.Hashtable;
 import javax.naming.Context;
 import javax.naming.InitialContext;
 import javax.naming.NamingException;
+import javax.naming.Name;
+import javax.naming.directory.Attributes;
 import javax.naming.ldap.InitialLdapContext;
 import javax.naming.ldap.LdapContext;
 
@@ -30,6 +33,12 @@
 import org.apache.commons.io.FileUtils;
 import org.apache.apseda.listener.AvailablePortFinder;
 import org.apache.ldap.server.jndi.EnvKeys;
+import org.apache.ldap.common.ldif.LdifParser;
+import org.apache.ldap.common.ldif.LdifParserImpl;
+import org.apache.ldap.common.ldif.LdifIterator;
+import org.apache.ldap.common.message.LockableAttributesImpl;
+import org.apache.ldap.common.name.LdapName;
+import org.apache.ldap.common.exception.LdapConfigurationException;
 
 
 /**
@@ -63,7 +72,14 @@
     {
         super.setUp();
 
-        doDelete( new File( "target" + File.separator + "apacheds" ) );
+        if ( overrides.containsKey( EnvKeys.WKDIR ) )
+        {
+            doDelete( new File( ( String ) overrides.get( EnvKeys.WKDIR ) ) );
+        }
+        else
+        {
+            doDelete( new File( "target" + File.separator + "apacheds" ) );
+        }
 
         int port = AvailablePortFinder.getNextAvailable( 1024 );
 
@@ -171,5 +187,56 @@
         try { new InitialContext( env ); } catch( Exception e ) {}
 
         sysRoot = null;
+    }
+
+
+    /**
+     * Imports the LDIF entries packaged with the Eve JNDI provider jar into
+     * the newly created system partition to prime it up for operation.  Note
+     * that only ou=system entries will be added - entries for other partitions
+     * cannot be imported and will blow chunks.
+     *
+     * @throws NamingException if there are problems reading the ldif file and
+     * adding those entries to the system partition
+     */
+    protected void importLdif( InputStream in ) throws NamingException
+    {
+        Hashtable env = new Hashtable();
+
+        env.putAll( sysRoot.getEnvironment() );
+
+        LdapContext ctx = new InitialLdapContext( env, null );
+
+        LdifParser parser = new LdifParserImpl();
+
+        try
+        {
+            LdifIterator iterator = new LdifIterator( in );
+
+            while ( iterator.hasNext() )
+            {
+                Attributes attributes = new LockableAttributesImpl();
+
+                String ldif = ( String ) iterator.next();
+
+                parser.parse( attributes, ldif );
+
+                Name dn = new LdapName( ( String ) attributes.remove( "dn" ).get() );
+
+                dn.remove( 0 );
+
+                ctx.createSubcontext( dn, attributes );
+            }
+        }
+        catch ( Exception e )
+        {
+            String msg = "failed while trying to parse system ldif file";
+
+            NamingException ne = new LdapConfigurationException( msg );
+
+            ne.setRootCause( e );
+
+            throw ne;
+        }
     }
 }

Added: incubator/directory/codesize.sh
URL: http://svn.apache.org/viewcvs/incubator/directory/codesize.sh?view=auto&rev=149490
==============================================================================
--- incubator/directory/codesize.sh (added)
+++ incubator/directory/codesize.sh Tue Feb  1 22:04:28 2005
@@ -0,0 +1,22 @@
+#!/bin/bash
+
+total=0;
+
+for trunk in `find . -type d -regex '.*trunk'`; do 
+        if [ -n "`echo $trunk | grep sitedocs`" ]; then
+           	continue;
+        fi;
+
+	mkdir temp
+    	for file in `find $trunk -type f -regex '.*\.java'`; do
+    		cp $file temp;
+        done;
+        cd temp;
+        lines=`wc -l * | grep total | awk '{print $1}'`;
+        cd ../
+        rm -rf temp;
+        echo "lines of code in $trunk = $lines";
+        total=$(($lines + $total));
+done;
+
+echo Total: $total

Propchange: incubator/directory/codesize.sh
------------------------------------------------------------------------------
    svn:executable = *



Mime
View raw message