]> source.dussan.org Git - archiva.git/commitdiff
Changing to hsqldb for unit testing.
authorJoakim Erdfelt <joakime@apache.org>
Wed, 21 Mar 2007 15:46:41 +0000 (15:46 +0000)
committerJoakim Erdfelt <joakime@apache.org>
Wed, 21 Mar 2007 15:46:41 +0000 (15:46 +0000)
git-svn-id: https://svn.apache.org/repos/asf/maven/archiva/branches/archiva-jpox-database-refactor@520921 13f79535-47bb-0310-9956-ffa450edef68

archiva-database/pom.xml
archiva-database/src/main/java/org/apache/maven/archiva/database/jdo/JdoAccess.java
archiva-database/src/main/java/org/apache/maven/archiva/database/jdo/JdoArchivaDAO.java
archiva-database/src/test/java/org/apache/maven/archiva/database/AbstractArchivaDatabaseTestCase.java

index b5ce7540fe5711f098688af2b5666c1f7841aa2e..e3f1be31cbd1341a3149279672afb4de7ded8989 100755 (executable)
       <artifactId>log4j</artifactId>
       <version>1.2.8</version>
     </dependency>
-    <!--  TEST DEPS  -->
     <dependency>
       <groupId>org.apache.derby</groupId>
       <artifactId>derby</artifactId>
       <version>10.2.1.6</version>
     </dependency>
+    <!--  TEST DEPS  -->
+    <dependency>
+      <groupId>hsqldb</groupId>
+      <artifactId>hsqldb</artifactId>
+      <version>1.8.0.7</version>
+    </dependency>
     <dependency>
       <groupId>org.apache.derby</groupId>
       <artifactId>derbytools</artifactId>
index 7ab55087eea96a35f4abc21e420494ce7ed1b253..2c4f5a3ece8ec8b32b753c157995ad26382122f1 100644 (file)
@@ -51,12 +51,13 @@ import javax.jdo.spi.PersistenceCapable;
  *
  * @author <a href="mailto:joakim@erdfelt.com">Joakim Erdfelt</a>
  * @version $Id$
+ * @plexus.component role="org.apache.maven.archiva.database.jdo.JdoAccess" role-hint="default"
  */
 public class JdoAccess
     implements Initializable, InstanceLifecycleListener, StoreLifecycleListener
 {
     /**
-     * @plexus.requirement role-hint="users"
+     * @plexus.requirement role-hint="archiva"
      */
     private JdoFactory jdoFactory;
 
@@ -326,7 +327,7 @@ public class JdoAccess
                 + "' from jdo using null/empty id." );
         }
         
-        return getObjectById( clazz, (Object) id, fetchGroup ); 
+        return getObjectById( clazz, (Object) id, fetchGroup );
     }
 
     public boolean objectExists( Object object )
index 92f48abb47f32b832547b7744a14409ed9d0f832..87565a825bccbdac6904a9ff925891749ed6c2c0 100644 (file)
@@ -18,15 +18,14 @@ import java.util.List;
  * @author <a href="mailto:joakim@erdfelt.com">Joakim Erdfelt</a>
  * @version $Id$
  * 
- * @plexus.component role="org.apache.maven.archiva.database.ArchivaDAO"
- *                   role-hint="jdo"
+ * @plexus.component role-hint="jdo"
  */
 public class JdoArchivaDAO
     extends AbstractLogEnabled
     implements ArchivaDAO
 {
     /**
-     * @plexus.requirement
+     * @plexus.requirement role-hint="default"
      */
     private JdoAccess jdo;
 
index 175fb29be0d6198209d36077cc4036ce3ad362a3..4fd4e261c05a3cb3200a0e873754d2025d334c71 100644 (file)
@@ -48,12 +48,6 @@ public class AbstractArchivaDatabaseTestCase
     protected void setUp()
         throws Exception
     {
-        File derbyDbDir = new File( "target/plexus-home/testdb" );
-        if ( derbyDbDir.exists() )
-        {
-            FileUtils.deleteDirectory( derbyDbDir );
-        }
-
         super.setUp();
         
         DefaultConfigurableJdoFactory jdoFactory = (DefaultConfigurableJdoFactory) lookup( JdoFactory.ROLE, "archiva" );
@@ -61,10 +55,20 @@ public class AbstractArchivaDatabaseTestCase
 
         jdoFactory.setPersistenceManagerFactoryClass( "org.jpox.PersistenceManagerFactoryImpl" ); 
 
-        jdoFactory.setDriverName( System.getProperty( "jdo.test.driver", "org.apache.derby.jdbc.EmbeddedDriver" ) );   
+        /* derby version
+        File derbyDbDir = new File( "target/plexus-home/testdb" );
+        if ( derbyDbDir.exists() )
+        {
+            FileUtils.deleteDirectory( derbyDbDir );
+        }
 
-        jdoFactory.setUrl( System.getProperty( "jdo.test.url", "jdbc:derby:" + derbyDbDir.getAbsolutePath() + ";create=true" ) );   
+        jdoFactory.setDriverName( System.getProperty( "jdo.test.driver", "org.apache.derby.jdbc.EmbeddedDriver" ) );   
+        jdoFactory.setUrl( System.getProperty( "jdo.test.url", "jdbc:derby:" + derbyDbDir.getAbsolutePath() + ";create=true" ) );
+         */   
 
+        jdoFactory.setDriverName( System.getProperty( "jdo.test.driver", "org.hsqldb.jdbcDriver" ) );   
+        jdoFactory.setUrl( System.getProperty( "jdo.test.url", "jdbc:hsqldb:mem:" + getName() ) );
+        
         jdoFactory.setUserName( System.getProperty( "jdo.test.user", "sa" ) ); 
 
         jdoFactory.setPassword( System.getProperty( "jdo.test.pass", "" ) );