directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From akaras...@apache.org
Subject svn commit: r414989 - in /directory/trunks: apacheds/core-unit/src/test/java/org/apache/directory/server/core/trigger/ apacheds/core/src/main/java/org/apache/directory/server/core/trigger/ shared/ldap/src/main/java/org/apache/directory/shared/ldap/util/
Date Sat, 17 Jun 2006 03:07:14 GMT
Author: akarasulu
Date: Fri Jun 16 20:07:13 2006
New Revision: 414989

URL: http://svn.apache.org/viewvc?rev=414989&view=rev
Log:
making test cases one and two work in trigger service tests by adding required stored procedures

Added:
    directory/trunks/apacheds/core-unit/src/test/java/org/apache/directory/server/core/trigger/Audit.java
    directory/trunks/apacheds/core-unit/src/test/java/org/apache/directory/server/core/trigger/BackupUtilities.java
    directory/trunks/apacheds/core-unit/src/test/java/org/apache/directory/server/core/trigger/Logger.java
    directory/trunks/apacheds/core-unit/src/test/java/org/apache/directory/server/core/trigger/Restrictions.java
Modified:
    directory/trunks/apacheds/core-unit/src/test/java/org/apache/directory/server/core/trigger/DefaulTriggerServiceTest.java
    directory/trunks/apacheds/core/src/main/java/org/apache/directory/server/core/trigger/TriggerService.java
    directory/trunks/shared/ldap/src/main/java/org/apache/directory/shared/ldap/util/DirectoryClassUtils.java

Added: directory/trunks/apacheds/core-unit/src/test/java/org/apache/directory/server/core/trigger/Audit.java
URL: http://svn.apache.org/viewvc/directory/trunks/apacheds/core-unit/src/test/java/org/apache/directory/server/core/trigger/Audit.java?rev=414989&view=auto
==============================================================================
--- directory/trunks/apacheds/core-unit/src/test/java/org/apache/directory/server/core/trigger/Audit.java
(added)
+++ directory/trunks/apacheds/core-unit/src/test/java/org/apache/directory/server/core/trigger/Audit.java
Fri Jun 16 20:07:13 2006
@@ -0,0 +1,15 @@
+package org.apache.directory.server.core.trigger;
+
+import javax.naming.Name;
+import javax.naming.directory.Attributes;
+
+import org.apache.directory.server.core.jndi.ServerLdapContext;
+
+
+public class Audit
+{
+    public static void userDeletedAnEntry( ServerLdapContext ctx, Attributes entry, Name
name )
+    {
+        System.out.println( "Auditing deletion of entry " + name + " by user " + ctx.getPrincipal().getName()
);
+    }
+}

Added: directory/trunks/apacheds/core-unit/src/test/java/org/apache/directory/server/core/trigger/BackupUtilities.java
URL: http://svn.apache.org/viewvc/directory/trunks/apacheds/core-unit/src/test/java/org/apache/directory/server/core/trigger/BackupUtilities.java?rev=414989&view=auto
==============================================================================
--- directory/trunks/apacheds/core-unit/src/test/java/org/apache/directory/server/core/trigger/BackupUtilities.java
(added)
+++ directory/trunks/apacheds/core-unit/src/test/java/org/apache/directory/server/core/trigger/BackupUtilities.java
Fri Jun 16 20:07:13 2006
@@ -0,0 +1,14 @@
+package org.apache.directory.server.core.trigger;
+
+import javax.naming.Name;
+
+import org.apache.directory.server.core.jndi.ServerLdapContext;
+
+
+public class BackupUtilities
+{
+    public static void backupDeleted( ServerLdapContext ctx, Name name )
+    {
+        System.out.println( "Backing up: " + name );
+    }
+}

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=414989&r1=414988&r2=414989&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 20:07:13 2006
@@ -40,13 +40,13 @@
  */
 public class DefaulTriggerServiceTest extends AbstractTriggerServiceTest
 {
-
-    /*
     public void testOne() throws NamingException
     {
         
-        createTriggerSubentry( "triggerSubentry1", "BEFORE delete CALL \"BackupUtilities.backupDeleted\"
( $deletedEntry )" );
-        createTriggerSubentry( "triggerSubentry2", "AFTER delete CALL \"Logger.logDelete\"
{ language \"Java\" } ( $name )" );
+        createTriggerSubentry( "triggerSubentry1", "BEFORE delete CALL \"" +
+                "org.apache.directory.server.core.trigger.BackupUtilities.backupDeleted\"
( $deletedEntry )" );
+        createTriggerSubentry( "triggerSubentry2", "AFTER delete CALL \"" +
+                "org.apache.directory.server.core.trigger.Logger.logDelete\" { language \"Java\"
} ( $name )" );
         
         Attributes testEntry = new BasicAttributes( "ou", "testou", true );
         Attribute objectClass = new BasicAttribute( "objectClass" );
@@ -55,18 +55,23 @@
         objectClass.add( "organizationalUnit" );
         sysRoot.createSubcontext( "ou=testou", testEntry );
         
-        addEntryTrigger( new LdapDN( "ou=testou" ), "AFTER delete CALL \"Audit.userDeletedAnEntry\"
( $deletedEntry, $operationPrincipal )" );
+        addEntryTrigger( new LdapDN( "ou=testou" ), "AFTER delete CALL \"" +
+                "org.apache.directory.server.core.trigger.Audit.userDeletedAnEntry\" ( $deletedEntry,
$operationPrincipal )" );
         
         sysRoot.destroySubcontext( "ou=testou" );
 
     }
     
+    
     public void testTwo() throws NamingException
     {
         
-        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 )" );
+        createTriggerSubentry( "myTriggerSubentry1", "AFTER delete CALL \"" +
+                "org.apache.directory.server.core.trigger.Logger.logDelete\" { language \"Java\"
} ( $name )" );
+        createTriggerSubentry( "myTriggerSubentry2", "INSTEADOF delete CALL \"" +
+                "org.apache.directory.server.core.trigger.Restrictions.noDelete\" ( $deletedEntry
)" );
+        createTriggerSubentry( "myTriggerSubentry3", "INSTEADOF add CALL \"" +
+                "org.apache.directory.server.core.trigger.Restrictions.noAdd\" ( $entry )"
);
         
         Attributes testEntry = new BasicAttributes( "ou", "testou", true );
         Attribute objectClass = new BasicAttribute( "objectClass" );
@@ -76,8 +81,8 @@
         sysRoot.createSubcontext( "ou=testou", testEntry );
         
         sysRoot.destroySubcontext( "ou=testou" );
-
-    }*/
+    }
+    
     
     public void testThree() throws NamingException, IOException
     {

Added: directory/trunks/apacheds/core-unit/src/test/java/org/apache/directory/server/core/trigger/Logger.java
URL: http://svn.apache.org/viewvc/directory/trunks/apacheds/core-unit/src/test/java/org/apache/directory/server/core/trigger/Logger.java?rev=414989&view=auto
==============================================================================
--- directory/trunks/apacheds/core-unit/src/test/java/org/apache/directory/server/core/trigger/Logger.java
(added)
+++ directory/trunks/apacheds/core-unit/src/test/java/org/apache/directory/server/core/trigger/Logger.java
Fri Jun 16 20:07:13 2006
@@ -0,0 +1,14 @@
+package org.apache.directory.server.core.trigger;
+
+import javax.naming.Name;
+
+import org.apache.directory.server.core.jndi.ServerLdapContext;
+
+
+public class Logger
+{
+    public static void logDelete( ServerLdapContext ctx, Name name )
+    {
+        System.out.println( "Deleted: " + name );
+    }
+}

Added: directory/trunks/apacheds/core-unit/src/test/java/org/apache/directory/server/core/trigger/Restrictions.java
URL: http://svn.apache.org/viewvc/directory/trunks/apacheds/core-unit/src/test/java/org/apache/directory/server/core/trigger/Restrictions.java?rev=414989&view=auto
==============================================================================
--- directory/trunks/apacheds/core-unit/src/test/java/org/apache/directory/server/core/trigger/Restrictions.java
(added)
+++ directory/trunks/apacheds/core-unit/src/test/java/org/apache/directory/server/core/trigger/Restrictions.java
Fri Jun 16 20:07:13 2006
@@ -0,0 +1,20 @@
+package org.apache.directory.server.core.trigger;
+
+import javax.naming.Name;
+
+import org.apache.directory.server.core.jndi.ServerLdapContext;
+
+
+public class Restrictions
+{
+    public static void noDelete( ServerLdapContext ctx, Name name )
+    {
+        System.out.println( "Delete restriction on: " + name );
+    }
+
+
+    public static void noAdd( ServerLdapContext ctx, Name name )
+    {
+        System.out.println( "Add restriction on: " + name );
+    }
+}

Modified: directory/trunks/apacheds/core/src/main/java/org/apache/directory/server/core/trigger/TriggerService.java
URL: http://svn.apache.org/viewvc/directory/trunks/apacheds/core/src/main/java/org/apache/directory/server/core/trigger/TriggerService.java?rev=414989&r1=414988&r2=414989&view=diff
==============================================================================
--- directory/trunks/apacheds/core/src/main/java/org/apache/directory/server/core/trigger/TriggerService.java
(original)
+++ directory/trunks/apacheds/core/src/main/java/org/apache/directory/server/core/trigger/TriggerService.java
Fri Jun 16 20:07:13 2006
@@ -18,10 +18,6 @@
 package org.apache.directory.server.core.trigger;
 
 
-import java.io.ByteArrayOutputStream;
-import java.io.IOException;
-import java.io.ObjectOutputStream;
-import java.io.UnsupportedEncodingException;
 import java.lang.reflect.Method;
 import java.text.ParseException;
 import java.util.ArrayList;
@@ -34,7 +30,6 @@
 import javax.naming.NamingException;
 import javax.naming.directory.Attribute;
 import javax.naming.directory.Attributes;
-import javax.naming.ldap.InitialLdapContext;
 
 import org.apache.directory.server.core.DirectoryServiceConfiguration;
 import org.apache.directory.server.core.authn.LdapPrincipal;
@@ -50,8 +45,6 @@
 import org.apache.directory.server.core.sp.LdapClassLoader;
 import org.apache.directory.shared.ldap.exception.LdapNamingException;
 import org.apache.directory.shared.ldap.message.ResultCodeEnum;
-import org.apache.directory.shared.ldap.message.extended.StoredProcedureRequest;
-import org.apache.directory.shared.ldap.message.extended.StoredProcedureResponse;
 import org.apache.directory.shared.ldap.name.LdapDN;
 import org.apache.directory.shared.ldap.schema.NormalizerMappingResolver;
 import org.apache.directory.shared.ldap.trigger.ActionTime;

Modified: directory/trunks/shared/ldap/src/main/java/org/apache/directory/shared/ldap/util/DirectoryClassUtils.java
URL: http://svn.apache.org/viewvc/directory/trunks/shared/ldap/src/main/java/org/apache/directory/shared/ldap/util/DirectoryClassUtils.java?rev=414989&r1=414988&r2=414989&view=diff
==============================================================================
--- directory/trunks/shared/ldap/src/main/java/org/apache/directory/shared/ldap/util/DirectoryClassUtils.java
(original)
+++ directory/trunks/shared/ldap/src/main/java/org/apache/directory/shared/ldap/util/DirectoryClassUtils.java
Fri Jun 16 20:07:13 2006
@@ -47,7 +47,11 @@
         try
         {
             // Look for exactly the same signature.
-            clazz.getMethod( candidateMethodName, candidateParameterTypes );
+            Method exactMethod = clazz.getMethod( candidateMethodName, candidateParameterTypes
);
+            if ( exactMethod != null )
+            {
+                return exactMethod;
+            }
         }
         catch ( SecurityException e ) { }
         catch ( NoSuchMethodException e ) { }



Mime
View raw message