From: Joakim Erdfelt Date: Wed, 21 Mar 2007 15:46:41 +0000 (+0000) Subject: Changing to hsqldb for unit testing. X-Git-Tag: archiva-1.0-alpha-1~113^2~107 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=2087d187e72013e87f86c6ddeaa617a8a2cea6d5;p=archiva.git Changing to hsqldb for unit testing. git-svn-id: https://svn.apache.org/repos/asf/maven/archiva/branches/archiva-jpox-database-refactor@520921 13f79535-47bb-0310-9956-ffa450edef68 --- diff --git a/archiva-database/pom.xml b/archiva-database/pom.xml index b5ce7540f..e3f1be31c 100755 --- a/archiva-database/pom.xml +++ b/archiva-database/pom.xml @@ -90,12 +90,17 @@ log4j 1.2.8 - org.apache.derby derby 10.2.1.6 + + + hsqldb + hsqldb + 1.8.0.7 + org.apache.derby derbytools diff --git a/archiva-database/src/main/java/org/apache/maven/archiva/database/jdo/JdoAccess.java b/archiva-database/src/main/java/org/apache/maven/archiva/database/jdo/JdoAccess.java index 7ab55087e..2c4f5a3ec 100644 --- a/archiva-database/src/main/java/org/apache/maven/archiva/database/jdo/JdoAccess.java +++ b/archiva-database/src/main/java/org/apache/maven/archiva/database/jdo/JdoAccess.java @@ -51,12 +51,13 @@ import javax.jdo.spi.PersistenceCapable; * * @author Joakim Erdfelt * @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 ) diff --git a/archiva-database/src/main/java/org/apache/maven/archiva/database/jdo/JdoArchivaDAO.java b/archiva-database/src/main/java/org/apache/maven/archiva/database/jdo/JdoArchivaDAO.java index 92f48abb4..87565a825 100644 --- a/archiva-database/src/main/java/org/apache/maven/archiva/database/jdo/JdoArchivaDAO.java +++ b/archiva-database/src/main/java/org/apache/maven/archiva/database/jdo/JdoArchivaDAO.java @@ -18,15 +18,14 @@ import java.util.List; * @author Joakim Erdfelt * @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; diff --git a/archiva-database/src/test/java/org/apache/maven/archiva/database/AbstractArchivaDatabaseTestCase.java b/archiva-database/src/test/java/org/apache/maven/archiva/database/AbstractArchivaDatabaseTestCase.java index 175fb29be..4fd4e261c 100644 --- a/archiva-database/src/test/java/org/apache/maven/archiva/database/AbstractArchivaDatabaseTestCase.java +++ b/archiva-database/src/test/java/org/apache/maven/archiva/database/AbstractArchivaDatabaseTestCase.java @@ -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", "" ) );