directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From kayyag...@apache.org
Subject svn commit: r895271 - /directory/apacheds/branches/apacheds-schema/server-integ/src/test/java/org/apache/directory/server/operations/extended/StoredProcedureIT.java
Date Sat, 02 Jan 2010 19:35:21 GMT
Author: kayyagari
Date: Sat Jan  2 19:35:19 2010
New Revision: 895271

URL: http://svn.apache.org/viewvc?rev=895271&view=rev
Log:
o fixed failing test after migrating to the new testing framework
o removed useless factory code

Modified:
    directory/apacheds/branches/apacheds-schema/server-integ/src/test/java/org/apache/directory/server/operations/extended/StoredProcedureIT.java

Modified: directory/apacheds/branches/apacheds-schema/server-integ/src/test/java/org/apache/directory/server/operations/extended/StoredProcedureIT.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-schema/server-integ/src/test/java/org/apache/directory/server/operations/extended/StoredProcedureIT.java?rev=895271&r1=895270&r2=895271&view=diff
==============================================================================
--- directory/apacheds/branches/apacheds-schema/server-integ/src/test/java/org/apache/directory/server/operations/extended/StoredProcedureIT.java
(original)
+++ directory/apacheds/branches/apacheds-schema/server-integ/src/test/java/org/apache/directory/server/operations/extended/StoredProcedureIT.java
Sat Jan  2 19:35:19 2010
@@ -24,38 +24,29 @@
 import static org.junit.Assert.assertNotNull;
 
 import java.util.HashMap;
-import java.util.HashSet;
 import java.util.Hashtable;
 import java.util.Map;
-import java.util.Set;
 
 import javax.naming.directory.Attributes;
 import javax.naming.directory.BasicAttributes;
 import javax.naming.ldap.InitialLdapContext;
 import javax.naming.ldap.LdapContext;
 
-import org.apache.directory.server.core.DefaultDirectoryService;
-import org.apache.directory.server.core.DirectoryService;
+import org.apache.directory.server.annotations.CreateLdapServer;
+import org.apache.directory.server.annotations.CreateTransport;
+import org.apache.directory.server.annotations.SaslMechanism;
 import org.apache.directory.server.core.integ.AbstractLdapTestUnit;
 import org.apache.directory.server.core.integ.FrameworkRunner;
-import org.apache.directory.server.core.integ.IntegrationUtils;
-import org.apache.directory.server.core.integ.annotations.Factory;
-import org.apache.directory.server.integ.LdapServerFactory;
-import org.apache.directory.server.ldap.ExtendedOperationHandler;
-import org.apache.directory.server.ldap.LdapServer;
-import org.apache.directory.server.ldap.handlers.bind.MechanismHandler;
-import org.apache.directory.server.ldap.handlers.bind.SimpleMechanismHandler;
 import org.apache.directory.server.ldap.handlers.bind.cramMD5.CramMd5MechanismHandler;
 import org.apache.directory.server.ldap.handlers.bind.digestMD5.DigestMd5MechanismHandler;
 import org.apache.directory.server.ldap.handlers.bind.gssapi.GssapiMechanismHandler;
 import org.apache.directory.server.ldap.handlers.bind.ntlm.NtlmMechanismHandler;
+import org.apache.directory.server.ldap.handlers.bind.plain.PlainMechanismHandler;
 import org.apache.directory.server.ldap.handlers.extended.StoredProcedureExtendedOperationHandler;
-import org.apache.directory.server.protocol.shared.transport.TcpTransport;
 import org.apache.directory.shared.ldap.constants.SupportedSaslMechanisms;
 import org.apache.directory.shared.ldap.schema.normalizers.DeepTrimToLowerNormalizer;
 import org.apache.directory.shared.ldap.schema.normalizers.OidNormalizer;
 import org.apache.directory.shared.ldap.sp.JavaStoredProcUtils;
-import org.apache.mina.util.AvailablePortFinder;
 import org.junit.Before;
 import org.junit.Test;
 import org.junit.runner.RunWith;
@@ -66,7 +57,25 @@
  * @version $Rev:$
  */
 @RunWith ( FrameworkRunner.class ) 
-@Factory ( StoredProcedureIT.Factory.class )
+@CreateLdapServer ( 
+    transports = 
+    {
+        @CreateTransport( protocol = "LDAP" )
+    },
+    saslHost="localhost",
+    saslMechanisms = 
+    {
+        @SaslMechanism( name=SupportedSaslMechanisms.PLAIN, implClass=PlainMechanismHandler.class
),
+        @SaslMechanism( name=SupportedSaslMechanisms.CRAM_MD5, implClass=CramMd5MechanismHandler.class),
+        @SaslMechanism( name=SupportedSaslMechanisms.DIGEST_MD5, implClass=DigestMd5MechanismHandler.class),
+        @SaslMechanism( name=SupportedSaslMechanisms.GSSAPI, implClass=GssapiMechanismHandler.class),
+        @SaslMechanism( name=SupportedSaslMechanisms.NTLM, implClass=NtlmMechanismHandler.class),
+        @SaslMechanism( name=SupportedSaslMechanisms.GSS_SPNEGO, implClass=NtlmMechanismHandler.class)
+    },
+    extendedOpHandlers = 
+    {
+        StoredProcedureExtendedOperationHandler.class
+    })
 public class StoredProcedureIT extends AbstractLdapTestUnit
 {
     private LdapContext ctx;
@@ -74,55 +83,6 @@
     private Map<String, OidNormalizer> oids;
 
     
-    public static class Factory implements LdapServerFactory
-    {
-        public LdapServer newInstance() throws Exception
-        {
-            DirectoryService service = new DefaultDirectoryService();
-            IntegrationUtils.doDelete( service.getWorkingDirectory() );
-            service.getChangeLog().setEnabled( true );
-            service.setShutdownHookEnabled( false );
-
-            // change the working directory to something that is unique
-            // on the system and somewhere either under target directory
-            // or somewhere in a temp area of the machine.
-
-            LdapServer ldapServer = new LdapServer();
-            ldapServer.setDirectoryService( service );
-            int port = AvailablePortFinder.getNextAvailable( 1024 );
-            ldapServer.setTransports( new TcpTransport( port ) );
-            ldapServer.setEnabled( true );
-            ldapServer.addExtendedOperationHandler( new StoredProcedureExtendedOperationHandler()
);
-
-            // Setup SASL Mechanisms
-            
-            Map<String, MechanismHandler> mechanismHandlerMap = new HashMap<String,MechanismHandler>();
-            mechanismHandlerMap.put( SupportedSaslMechanisms.PLAIN, new SimpleMechanismHandler()
);
-
-            CramMd5MechanismHandler cramMd5MechanismHandler = new CramMd5MechanismHandler();
-            mechanismHandlerMap.put( SupportedSaslMechanisms.CRAM_MD5, cramMd5MechanismHandler
);
-
-            DigestMd5MechanismHandler digestMd5MechanismHandler = new DigestMd5MechanismHandler();
-            mechanismHandlerMap.put( SupportedSaslMechanisms.DIGEST_MD5, digestMd5MechanismHandler
);
-
-            GssapiMechanismHandler gssapiMechanismHandler = new GssapiMechanismHandler();
-            mechanismHandlerMap.put( SupportedSaslMechanisms.GSSAPI, gssapiMechanismHandler
);
-
-            NtlmMechanismHandler ntlmMechanismHandler = new NtlmMechanismHandler();
-            mechanismHandlerMap.put( SupportedSaslMechanisms.NTLM, ntlmMechanismHandler );
-            mechanismHandlerMap.put( SupportedSaslMechanisms.GSS_SPNEGO, ntlmMechanismHandler
);
-
-            ldapServer.setSaslMechanismHandlers( mechanismHandlerMap );
-
-            Set<ExtendedOperationHandler> handlers = new HashSet<ExtendedOperationHandler>(
ldapServer.getExtendedOperationHandlers() );
-            handlers.add( new StoredProcedureExtendedOperationHandler() );
-            ldapServer.setExtendedOperationHandlers( handlers );
-
-            return ldapServer;
-        }
-    }
-    
-    
     @Before 
     public void setUp() throws Exception
     {



Mime
View raw message