Return-Path: Delivered-To: apmail-directory-commits-archive@www.apache.org Received: (qmail 73963 invoked from network); 29 May 2007 23:26:39 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 29 May 2007 23:26:39 -0000 Received: (qmail 22745 invoked by uid 500); 29 May 2007 23:26:43 -0000 Delivered-To: apmail-directory-commits-archive@directory.apache.org Received: (qmail 22702 invoked by uid 500); 29 May 2007 23:26:43 -0000 Mailing-List: contact commits-help@directory.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@directory.apache.org Delivered-To: mailing list commits@directory.apache.org Received: (qmail 22691 invoked by uid 99); 29 May 2007 23:26:43 -0000 Received: from herse.apache.org (HELO herse.apache.org) (140.211.11.133) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 29 May 2007 16:26:43 -0700 X-ASF-Spam-Status: No, hits=-99.5 required=10.0 tests=ALL_TRUSTED,NO_REAL_NAME X-Spam-Check-By: apache.org Received: from [140.211.11.3] (HELO eris.apache.org) (140.211.11.3) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 29 May 2007 16:26:38 -0700 Received: by eris.apache.org (Postfix, from userid 65534) id 7A40C1A981A; Tue, 29 May 2007 16:26:18 -0700 (PDT) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r542695 - /directory/apacheds/trunk/server-unit/src/test/java/org/apache/directory/server/DefaultServerTriggerServiceTest.java Date: Tue, 29 May 2007 23:26:18 -0000 To: commits@directory.apache.org From: ersiner@apache.org X-Mailer: svnmailer-1.1.0 Message-Id: <20070529232618.7A40C1A981A@eris.apache.org> X-Virus-Checked: Checked by ClamAV on apache.org Author: ersiner Date: Tue May 29 16:26:17 2007 New Revision: 542695 URL: http://svn.apache.org/viewvc?view=rev&rev=542695 Log: Used previously developed TriggerUtils in TriggerService tests. Did some minor cleanup. Modified: directory/apacheds/trunk/server-unit/src/test/java/org/apache/directory/server/DefaultServerTriggerServiceTest.java Modified: directory/apacheds/trunk/server-unit/src/test/java/org/apache/directory/server/DefaultServerTriggerServiceTest.java URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/server-unit/src/test/java/org/apache/directory/server/DefaultServerTriggerServiceTest.java?view=diff&rev=542695&r1=542694&r2=542695 ============================================================================== --- directory/apacheds/trunk/server-unit/src/test/java/org/apache/directory/server/DefaultServerTriggerServiceTest.java (original) +++ directory/apacheds/trunk/server-unit/src/test/java/org/apache/directory/server/DefaultServerTriggerServiceTest.java Tue May 29 16:26:17 2007 @@ -21,28 +21,15 @@ package org.apache.directory.server; -import java.util.HashSet; import java.util.Hashtable; -import java.util.Iterator; -import java.util.List; -import java.util.Set; import javax.naming.NamingException; -import javax.naming.directory.Attribute; import javax.naming.directory.Attributes; import javax.naming.ldap.InitialLdapContext; import javax.naming.ldap.LdapContext; -import org.apache.directory.server.ldap.LdapConfiguration; -import org.apache.directory.server.ldap.support.extended.StoredProcedureExtendedOperationHandler; -import org.apache.directory.shared.ldap.constants.SchemaConstants; -import org.apache.directory.shared.ldap.ldif.Entry; -import org.apache.directory.shared.ldap.ldif.LdifReader; -import org.apache.directory.shared.ldap.message.AttributeImpl; -import org.apache.directory.shared.ldap.message.AttributesImpl; -import org.apache.directory.shared.ldap.name.LdapDN; -import org.apache.directory.shared.ldap.name.Rdn; import org.apache.directory.shared.ldap.sp.JavaStoredProcedureUtils; +import org.apache.directory.shared.ldap.trigger.TriggerUtils; import org.apache.directory.shared.ldap.util.AttributeUtils; @@ -56,17 +43,11 @@ { private LdapContext ctx; - // public void setUp() throws Exception { - LdapConfiguration ldapCfg = super.configuration.getLdapConfiguration(); - Set handlers = new HashSet( ldapCfg.getExtendedOperationHandlers() ); - handlers.add( new StoredProcedureExtendedOperationHandler() ); - ldapCfg.setExtendedOperationHandlers( handlers ); - super.setUp(); - Hashtable env = new Hashtable(); + Hashtable env = new Hashtable(); env.put( "java.naming.factory.initial", "com.sun.jndi.ldap.LdapCtxFactory" ); env.put( "java.naming.provider.url", "ldap://localhost:" + port + "/ou=system" ); env.put( "java.naming.security.principal", "uid=admin,ou=system" ); @@ -111,10 +92,15 @@ String staffDN = "cn=staff, ou=system"; String teachersDN = "cn=teachers, ou=system"; - createTriggerSubentry( ctx, "triggerSubentry1", - "AFTER Add " + - "CALL \"" + ListUtilsSP.class.getName() + ".subscribeToGroup\" ( $entry , $ldapContext \"" + staffDN + "\" ); " + - "CALL \"" + ListUtilsSP.class.getName() + ".subscribeToGroup\" ( $entry , $ldapContext \"" + teachersDN + "\" );" ); + + // Create the Triger Specification within a Trigger Subentry. + TriggerUtils.defineTriggerExecutionSpecificPoint( ctx ); + TriggerUtils.createTriggerExecutionSubentry( ctx, + "triggerSubentry1", + "{}", + "AFTER Add " + + "CALL \"" + ListUtilsSP.class.getName() + ".subscribeToGroup\" ( $entry , $ldapContext \"" + staffDN + "\" ); " + + "CALL \"" + ListUtilsSP.class.getName() + ".subscribeToGroup\" ( $entry , $ldapContext \"" + teachersDN + "\" );" ); // Create a test entry which is selected by the Trigger Subentry. String testEntry = @@ -133,7 +119,7 @@ // The trigger should be fired at this point. // ------------------------------------------ - // Check if the Trigger really worked (subscribed the user to give grpups). + // Check if the Trigger really worked (subscribed the user to the groups). Attributes staff = sysRoot.getAttributes( "cn=staff" ); Attributes teachers = sysRoot.getAttributes( "cn=teachers" ); String testEntryName = ( ( LdapContext )sysRoot.lookup( "cn=The Teacher of All Times" ) ).getNameInNamespace(); @@ -159,9 +145,14 @@ injectEntries( ldif ); // Create the Triger Specification within a Trigger Subentry. - createTriggerSubentry( ctx, "triggerSubentry1", - "AFTER Delete CALL \"" + BackupUtilitiesSP.class.getName() + ".backupDeleted\" ( $ldapContext \"\", $name, $operationPrincipal, $deletedEntry );" ); - + TriggerUtils.defineTriggerExecutionSpecificPoint( ctx ); + TriggerUtils.createTriggerExecutionSubentry( ctx, + "triggerSubentry1", + "{}", + "AFTER Delete " + + "CALL \"" + BackupUtilitiesSP.class.getName() + ".backupDeleted\" " + + " ( $ldapContext \"\", $name, $operationPrincipal, $deletedEntry );" ); + // Create a test entry which is selected by the Trigger Subentry. String ldif2 = "version: 1\n" +