directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ersi...@apache.org
Subject svn commit: r415449 - /directory/trunks/apacheds/server-unit/src/test/java/org/apache/directory/server/DefaultServerTriggerServiceTest.java
Date Mon, 19 Jun 2006 22:52:20 GMT
Author: ersiner
Date: Mon Jun 19 15:52:19 2006
New Revision: 415449

URL: http://svn.apache.org/viewvc?rev=415449&view=rev
Log:
Made Trigger Tests use new SP Utils.

Modified:
    directory/trunks/apacheds/server-unit/src/test/java/org/apache/directory/server/DefaultServerTriggerServiceTest.java

Modified: directory/trunks/apacheds/server-unit/src/test/java/org/apache/directory/server/DefaultServerTriggerServiceTest.java
URL: http://svn.apache.org/viewvc/directory/trunks/apacheds/server-unit/src/test/java/org/apache/directory/server/DefaultServerTriggerServiceTest.java?rev=415449&r1=415448&r2=415449&view=diff
==============================================================================
--- directory/trunks/apacheds/server-unit/src/test/java/org/apache/directory/server/DefaultServerTriggerServiceTest.java
(original)
+++ directory/trunks/apacheds/server-unit/src/test/java/org/apache/directory/server/DefaultServerTriggerServiceTest.java
Mon Jun 19 15:52:19 2006
@@ -18,10 +18,6 @@
 package org.apache.directory.server;
 
 
-import java.io.File;
-import java.io.IOException;
-import java.io.InputStream;
-import java.net.URL;
 import java.util.HashSet;
 import java.util.Hashtable;
 import java.util.Set;
@@ -35,6 +31,7 @@
 import javax.naming.ldap.LdapContext;
 
 import org.apache.directory.server.ldap.support.extended.StoredProcedureExtendedOperationHandler;
+import org.apache.directory.shared.ldap.sp.StoredProcedureUtils;
 
 
 /**
@@ -72,40 +69,10 @@
         super.tearDown();
     }
     
-    private void loadStoredProcedureUnit( LdapContext ctx, String fullClassName ) throws
NamingException
-    {
-        int lastDot = fullClassName.lastIndexOf( '.' );
-        String classFileName = fullClassName.substring( lastDot + 1 ) + ".class";
-        
-        URL url = getClass().getResource( classFileName );
-        InputStream in = getClass().getResourceAsStream( classFileName );
-        File file = new File( url.getFile() );
-        int size = ( int ) file.length();
-        byte[] buf = new byte[size];
-        try
-        {
-            in.read( buf );
-            in.close();
-        }
-        catch ( IOException e )
-        {
-            NamingException ne = new NamingException();
-            ne.setRootCause( e );
-            throw ne;
-        }
-        
-        Attributes attributes = new BasicAttributes( "objectClass", "top", true );
-        attributes.get( "objectClass" ).add( "javaClass" );
-        attributes.put( "fullyQualifiedClassName", fullClassName );
-        attributes.put( "byteCode", buf );
-        
-        ctx.createSubcontext( "fullyQualifiedClassName=" + fullClassName, attributes );
-    }
-    
     public void testAfterDeleteBackupDeletedEntry() throws NamingException
     {
         // Load the stored procedure unit which has the stored procedure to be triggered.
-        loadStoredProcedureUnit( ctx, BackupUtilities.class.getName() );
+        StoredProcedureUtils.loadStoredProcedureClass( ctx, BackupUtilities.class.getName(),
this.getClass() );
         
         // Create a container for backing up deleted entries.
         Attributes backupContext = new BasicAttributes( "ou", "backupContext", true );



Mime
View raw message