mirror of https://github.com/apache/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
This commit is contained in:
parent
1451e3ef75
commit
2087d187e7
|
@ -90,12 +90,17 @@
|
||||||
<artifactId>log4j</artifactId>
|
<artifactId>log4j</artifactId>
|
||||||
<version>1.2.8</version>
|
<version>1.2.8</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
<!-- TEST DEPS -->
|
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.apache.derby</groupId>
|
<groupId>org.apache.derby</groupId>
|
||||||
<artifactId>derby</artifactId>
|
<artifactId>derby</artifactId>
|
||||||
<version>10.2.1.6</version>
|
<version>10.2.1.6</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
<!-- TEST DEPS -->
|
||||||
|
<dependency>
|
||||||
|
<groupId>hsqldb</groupId>
|
||||||
|
<artifactId>hsqldb</artifactId>
|
||||||
|
<version>1.8.0.7</version>
|
||||||
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.apache.derby</groupId>
|
<groupId>org.apache.derby</groupId>
|
||||||
<artifactId>derbytools</artifactId>
|
<artifactId>derbytools</artifactId>
|
||||||
|
|
|
@ -51,12 +51,13 @@ import javax.jdo.spi.PersistenceCapable;
|
||||||
*
|
*
|
||||||
* @author <a href="mailto:joakim@erdfelt.com">Joakim Erdfelt</a>
|
* @author <a href="mailto:joakim@erdfelt.com">Joakim Erdfelt</a>
|
||||||
* @version $Id$
|
* @version $Id$
|
||||||
|
* @plexus.component role="org.apache.maven.archiva.database.jdo.JdoAccess" role-hint="default"
|
||||||
*/
|
*/
|
||||||
public class JdoAccess
|
public class JdoAccess
|
||||||
implements Initializable, InstanceLifecycleListener, StoreLifecycleListener
|
implements Initializable, InstanceLifecycleListener, StoreLifecycleListener
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* @plexus.requirement role-hint="users"
|
* @plexus.requirement role-hint="archiva"
|
||||||
*/
|
*/
|
||||||
private JdoFactory jdoFactory;
|
private JdoFactory jdoFactory;
|
||||||
|
|
||||||
|
|
|
@ -18,15 +18,14 @@ import java.util.List;
|
||||||
* @author <a href="mailto:joakim@erdfelt.com">Joakim Erdfelt</a>
|
* @author <a href="mailto:joakim@erdfelt.com">Joakim Erdfelt</a>
|
||||||
* @version $Id$
|
* @version $Id$
|
||||||
*
|
*
|
||||||
* @plexus.component role="org.apache.maven.archiva.database.ArchivaDAO"
|
* @plexus.component role-hint="jdo"
|
||||||
* role-hint="jdo"
|
|
||||||
*/
|
*/
|
||||||
public class JdoArchivaDAO
|
public class JdoArchivaDAO
|
||||||
extends AbstractLogEnabled
|
extends AbstractLogEnabled
|
||||||
implements ArchivaDAO
|
implements ArchivaDAO
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* @plexus.requirement
|
* @plexus.requirement role-hint="default"
|
||||||
*/
|
*/
|
||||||
private JdoAccess jdo;
|
private JdoAccess jdo;
|
||||||
|
|
||||||
|
|
|
@ -48,12 +48,6 @@ public class AbstractArchivaDatabaseTestCase
|
||||||
protected void setUp()
|
protected void setUp()
|
||||||
throws Exception
|
throws Exception
|
||||||
{
|
{
|
||||||
File derbyDbDir = new File( "target/plexus-home/testdb" );
|
|
||||||
if ( derbyDbDir.exists() )
|
|
||||||
{
|
|
||||||
FileUtils.deleteDirectory( derbyDbDir );
|
|
||||||
}
|
|
||||||
|
|
||||||
super.setUp();
|
super.setUp();
|
||||||
|
|
||||||
DefaultConfigurableJdoFactory jdoFactory = (DefaultConfigurableJdoFactory) lookup( JdoFactory.ROLE, "archiva" );
|
DefaultConfigurableJdoFactory jdoFactory = (DefaultConfigurableJdoFactory) lookup( JdoFactory.ROLE, "archiva" );
|
||||||
|
@ -61,9 +55,19 @@ public class AbstractArchivaDatabaseTestCase
|
||||||
|
|
||||||
jdoFactory.setPersistenceManagerFactoryClass( "org.jpox.PersistenceManagerFactoryImpl" );
|
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.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.setUserName( System.getProperty( "jdo.test.user", "sa" ) );
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue