directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ersi...@apache.org
Subject svn commit: r415017 - in /directory/trunks/apacheds/core-unit/src/test/java/org/apache/directory/server/core/trigger: BackupUtilities.java DefaulTriggerServiceTest.java
Date Sat, 17 Jun 2006 09:02:41 GMT
Author: ersiner
Date: Sat Jun 17 02:02:41 2006
New Revision: 415017

URL: http://svn.apache.org/viewvc?rev=415017&view=rev
Log:
Cosmetic changes to Trigger test.

Modified:
    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/DefaulTriggerServiceTest.java

Modified: 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=415017&r1=415016&r2=415017&view=diff
==============================================================================
--- directory/trunks/apacheds/core-unit/src/test/java/org/apache/directory/server/core/trigger/BackupUtilities.java
(original)
+++ directory/trunks/apacheds/core-unit/src/test/java/org/apache/directory/server/core/trigger/BackupUtilities.java
Sat Jun 17 02:02:41 2006
@@ -3,17 +3,20 @@
 import javax.naming.Name;
 import javax.naming.NamingException;
 import javax.naming.directory.Attributes;
+import javax.naming.ldap.LdapContext;
 
 import org.apache.directory.server.core.jndi.ServerLdapContext;
 
 
 public class BackupUtilities
 {
-    public static void backupDeleted( ServerLdapContext ctx, Name deletedEntryName, Attributes
deletedEntry ) throws NamingException
+    public static void backupDeleted( LdapContext ctx, Name deletedEntryName, Name operationPrincipal,
Attributes deletedEntry ) throws NamingException
     {
-        System.out.println( "Backing up deleted entry: " + deletedEntryName );
-        System.out.println( "Entry content is: " + deletedEntry );
+        System.out.println( "User \"" + operationPrincipal + "\" has deleted entry \"" +
deletedEntryName + "\"" );
+        System.out.println( "Entry content was: " + deletedEntry );
+        
         ServerLdapContext backupCtx = ( ServerLdapContext ) ctx.lookup( "ou=backupContext,ou=system"
);
         backupCtx.createSubcontext( deletedEntryName.get( 1 ), deletedEntry );
+        System.out.println( "Backed up deleted entry to \"" + ( ( LdapContext ) backupCtx.lookup(
deletedEntryName.get( 1 ) ) ).getNameInNamespace() + "\"" );
     }
 }

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=415017&r1=415016&r2=415017&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
Sat Jun 17 02:02:41 2006
@@ -82,7 +82,7 @@
         
         // Create the Triger Specification via the Trigger Subentry.
         createTriggerSubentry( "triggerSubentry1", "AFTER delete CALL \"" +
-            "org.apache.directory.server.core.trigger.BackupUtilities.backupDeleted\" ( $name,
$deletedEntry )" );
+            "org.apache.directory.server.core.trigger.BackupUtilities.backupDeleted\" ( $name,
$operationPrincipal, $deletedEntry )" );
         
         // Create a test entry which is selected by the Trigger Subentry.
         Attributes testEntry = new BasicAttributes( "ou", "testou", true );
@@ -92,11 +92,15 @@
         objectClass.add( "organizationalUnit" );
         sysRoot.createSubcontext( "ou=testou", testEntry );
         
-        // Delete the test entry in order to fire the Trigger!
+        // Delete the test entry in order to fire the Trigger.
         sysRoot.destroySubcontext( "ou=testou" );
         
+        // ------------------------------------------
+        // The trigger should be fired at this point.
+        // ------------------------------------------
+        
         // Check if the Trigger really worked (backed up the deleted entry).
-        assertNotNull( sysRoot.lookup( "ou=testou," + "ou=backupContext" ) );
+        assertNotNull( sysRoot.lookup( "ou=testou,ou=backupContext" ) );
     }
     
 }



Mime
View raw message