directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ersi...@apache.org
Subject svn commit: r414972 - in /directory/trunks/apacheds/core-unit/src/test/java/org/apache/directory/server/core/trigger: DefaulTriggerServiceTest.java HelloWorldProcedure.java
Date Sat, 17 Jun 2006 00:28:06 GMT
Author: ersiner
Date: Fri Jun 16 17:28:06 2006
New Revision: 414972

URL: http://svn.apache.org/viewvc?rev=414972&view=rev
Log:
Added a test class for loading as SP.
Added test case for firing Triggers with this SP. However tests are failing now.

Added:
    directory/trunks/apacheds/core-unit/src/test/java/org/apache/directory/server/core/trigger/HelloWorldProcedure.java
Modified:
    directory/trunks/apacheds/core-unit/src/test/java/org/apache/directory/server/core/trigger/DefaulTriggerServiceTest.java

Modified: directory/trunks/apacheds/core-unit/src/test/java/org/apache/directory/server/core/trigger/DefaulTriggerServiceTest.java
URL: http://svn.apache.org/viewvc/directory/trunks/apacheds/core-unit/src/test/java/org/apache/directory/server/core/trigger/DefaulTriggerServiceTest.java?rev=414972&r1=414971&r2=414972&view=diff
==============================================================================
--- directory/trunks/apacheds/core-unit/src/test/java/org/apache/directory/server/core/trigger/DefaulTriggerServiceTest.java
(original)
+++ directory/trunks/apacheds/core-unit/src/test/java/org/apache/directory/server/core/trigger/DefaulTriggerServiceTest.java
Fri Jun 16 17:28:06 2006
@@ -18,6 +18,11 @@
 package org.apache.directory.server.core.trigger;
 
 
+import java.io.File;
+import java.io.IOException;
+import java.io.InputStream;
+import java.net.URL;
+
 import javax.naming.NamingException;
 import javax.naming.directory.Attribute;
 import javax.naming.directory.Attributes;
@@ -36,6 +41,7 @@
 public class DefaulTriggerServiceTest extends AbstractTriggerServiceTest
 {
 
+    /*
     public void testOne() throws NamingException
     {
         
@@ -61,6 +67,35 @@
         createTriggerSubentry( "myTriggerSubentry1", "AFTER delete CALL \"Logger.logDelete\"
{ language \"Java\" } ( $name )" );
         createTriggerSubentry( "myTriggerSubentry2", "INSTEADOF delete CALL \"Restrictions.noDelete\"
( $deletedEntry )" );
         createTriggerSubentry( "myTriggerSubentry3", "INSTEADOF add CALL \"Restrictions.noAdd\"
( $entry )" );
+        
+        Attributes testEntry = new BasicAttributes( "ou", "testou", true );
+        Attribute objectClass = new BasicAttribute( "objectClass" );
+        testEntry.put( objectClass );
+        objectClass.add( "top" );
+        objectClass.add( "organizationalUnit" );
+        sysRoot.createSubcontext( "ou=testou", testEntry );
+        
+        sysRoot.destroySubcontext( "ou=testou" );
+
+    }*/
+    
+    public void testThree() throws NamingException, IOException
+    {
+        URL url = getClass().getResource( "HelloWorldProcedure.class" );
+        InputStream in = getClass().getResourceAsStream( "HelloWorldProcedure.class" );
+        File file = new File( url.getFile() );
+        int size = ( int ) file.length();
+        byte[] buf = new byte[size];
+        in.read( buf );
+        in.close();
+        
+        Attributes attributes = new BasicAttributes( "objectClass", "top", true );
+        attributes.get( "objectClass" ).add( "javaClass" );
+        attributes.put( "fullyQualifiedClassName", HelloWorldProcedure.class.getName() );
+        attributes.put( "byteCode", buf );
+        sysRoot.createSubcontext( "fullyQualifiedClassName=" + HelloWorldProcedure.class.getName(),
attributes );
+        
+        createTriggerSubentry( "myTriggerSubentry1", "AFTER delete CALL \"" + HelloWorldProcedure.class.getName()
+ "logDeleted" + "\" ( $name )" );
         
         Attributes testEntry = new BasicAttributes( "ou", "testou", true );
         Attribute objectClass = new BasicAttribute( "objectClass" );

Added: directory/trunks/apacheds/core-unit/src/test/java/org/apache/directory/server/core/trigger/HelloWorldProcedure.java
URL: http://svn.apache.org/viewvc/directory/trunks/apacheds/core-unit/src/test/java/org/apache/directory/server/core/trigger/HelloWorldProcedure.java?rev=414972&view=auto
==============================================================================
--- directory/trunks/apacheds/core-unit/src/test/java/org/apache/directory/server/core/trigger/HelloWorldProcedure.java
(added)
+++ directory/trunks/apacheds/core-unit/src/test/java/org/apache/directory/server/core/trigger/HelloWorldProcedure.java
Fri Jun 16 17:28:06 2006
@@ -0,0 +1,19 @@
+package org.apache.directory.server.core.trigger;
+
+import javax.naming.Name;
+
+import org.apache.directory.server.core.jndi.ServerLdapContext;
+
+
+public class HelloWorldProcedure
+{
+    public static void sayHello()
+    {
+        System.out.println( "Hello World!" );
+    }
+    
+    public static void logDelete( ServerLdapContext ctx, Name name )
+    {
+        System.out.println( "Deleted: " + name );
+    }
+}



Mime
View raw message