You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cvs@avalon.apache.org by bl...@apache.org on 2003/06/17 20:36:58 UTC
cvs commit: avalon-logkit/src/test/org/apache/log/output/test DBTargetTestCase.java
bloritsch 2003/06/17 11:36:58
Modified: . project.xml
src/test/org/apache/log/output/test DBTargetTestCase.java
Log:
make sure the tests pass even when there is no DB present
Revision Changes Path
1.3 +1 -1 avalon-logkit/project.xml
Index: project.xml
===================================================================
RCS file: /home/cvs/avalon-logkit/project.xml,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- project.xml 17 Jun 2003 17:10:26 -0000 1.2
+++ project.xml 17 Jun 2003 18:36:58 -0000 1.3
@@ -4,7 +4,7 @@
<extend>${avalon.buildsystem}/project-common.xml</extend>
<name>Avalon-LogKit</name>
- <id>logkid</id>
+ <id>logkit</id>
<groupId>logkit</groupId>
<currentVersion>1.2.2-dev</currentVersion>
<inceptionYear>2003</inceptionYear>
1.6 +37 -3 avalon-logkit/src/test/org/apache/log/output/test/DBTargetTestCase.java
Index: DBTargetTestCase.java
===================================================================
RCS file: /home/cvs/avalon-logkit/src/test/org/apache/log/output/test/DBTargetTestCase.java,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -r1.5 -r1.6
--- DBTargetTestCase.java 9 Feb 2003 23:33:25 -0000 1.5
+++ DBTargetTestCase.java 17 Jun 2003 18:36:58 -0000 1.6
@@ -72,19 +72,51 @@
public final class DBTargetTestCase
extends TestCase
{
+ private String m_connectString;
+ private String m_userName;
+ private String m_userPassword;
+ private boolean m_doDBTest;
+
public DBTargetTestCase( final String name )
throws Exception
{
super( name );
+ }
- Class.forName( "org.postgresql.Driver" );
+ public void setUp() throws Exception
+ {
+ String driverName = System.getProperty("test.db.driver");
+ m_connectString = System.getProperty("test.db.jdbc", "");
+ m_userName = System.getProperty( "test.db.user", "" );
+ m_userPassword = System.getProperty( "test.db.pword", "" );
+ m_doDBTest = System.getProperty( "test.db.run", "false" ).equalsIgnoreCase("true");
+
+ if (m_doDBTest)
+ {
+ Class.forName(driverName);
+ }
+ else
+ {
+ System.out.println("[WARNING] Database Testing is not being done");
+ System.out.println();
+ System.out.println("To enable database testing, please provide the");
+ System.out.println("following properties:");
+ System.out.println();
+ System.out.println( "test.db.driver -> Class name for the JDBC driver" );
+ System.out.println( "test.db.jdbc -> JDBC connect string" );
+ System.out.println( "test.db.user -> User ID" );
+ System.out.println( "test.db.pword -> User password" );
+ System.out.println( "test.db.run -> \"true\"" );
+ }
}
public void testBasicTarget()
throws Exception
{
+ if (! m_doDBTest) return;
+
final DefaultDataSource dataSource =
- new DefaultDataSource( "jdbc:postgresql:avalon-logkit", "avalon", "" );
+ new DefaultDataSource( m_connectString, m_userName, m_userPassword );
final ColumnInfo[] columns =
{
@@ -105,8 +137,10 @@
public void testNumericConstants()
throws Exception
{
+ if ( !m_doDBTest ) return;
+
final DefaultDataSource dataSource =
- new DefaultDataSource( "jdbc:postgresql:avalon-logkit", "avalon", "" );
+ new DefaultDataSource( m_connectString, m_userName, m_userPassword );
final ColumnInfo[] columns =
{
---------------------------------------------------------------------
To unsubscribe, e-mail: cvs-unsubscribe@avalon.apache.org
For additional commands, e-mail: cvs-help@avalon.apache.org