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
This commit is contained in:
Joakim Erdfelt 2007-03-21 15:46:41 +00:00
parent 1451e3ef75
commit 2087d187e7
4 changed files with 23 additions and 14 deletions

View File

@ -90,12 +90,17 @@
<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>

View 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 )

View 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;

View 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" );
/* derby version
File derbyDbDir = new File( "target/plexus-home/testdb" );
if ( derbyDbDir.exists() )
{
FileUtils.deleteDirectory( derbyDbDir );
}
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.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", "" ) );