You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@maven.apache.org by Dan Diephouse <da...@envoisolutions.com> on 2003/05/08 03:28:06 UTC

junit runs test twice

Hi,

I'm having issues with junit.  My test is being run twice - 
simultaneously.  This is a problem, becuase it initializes a test 
database and will fail the second time.  I've debugged with JDB and I 
get the exact same stack trace for each invocation of it - which leaves 
me miffed.  Here is the test report.  Notice, there are two test methods 
testStatus and testAddOrders.  The two invocations are mixed in with 
eachother.  You'll see two successful tests and two unsuccessful ones. 
Like this line:

"Testcase: testStatusTestcase: testAddingOrders took 2.159 sec"

Tried jdk1.3.1 and 1.4.1.  Tried forking on and off on both jdks. Seems 
like some kind of classloading/threading issue.

Any ideas?
- Dan

Testsuite: com.moveitthere.delivery.DeliveryServiceTest
Tests run: 2, Failures: 0, Errors: 2, Time elapsed: 6.719 sec
------------- Standard Output ---------------
Creating tables
[DEBUG] Adding property: [torque.database.default] with value: [default].
[DEBUG] Adding property: [torque.database.default.adapter] with value: 
[axion].
[DEBUG] Adding property: [torque.dsfactory.default.factory] with value: 
[org.apache.torque.dsfactory.Jdbc2PoolDataSourceFactory].
[DEBUG] Adding property: [torque.dsfactory.default.connection.driver] 
with value: [org.axiondb.jdbc.AxionDriver].
[DEBUG] Adding property: [torque.dsfactory.default.connection.url] with 
value: [jdbc:axiondb:mit].
[DEBUG] Adding property: [torque.dsfactory.default.connection.user] with 
value: [].
[DEBUG] Adding property: [torque.dsfactory.default.connection.password] 
with value: [].
Finished creating tables
Creating tables
[DEBUG] Adding property: [torque.database.default] with value: [default].
[DEBUG] Adding property: [torque.database.default.adapter] with value: 
[axion].
[DEBUG] Adding property: [torque.dsfactory.default.factory] with value: 
[org.apache.torque.dsfactory.Jdbc2PoolDataSourceFactory].
[DEBUG] Adding property: [torque.dsfactory.default.connection.driver] 
with value: [org.axiondb.jdbc.AxionDriver].
[DEBUG] Adding property: [torque.dsfactory.default.connection.url] with 
value: [jdbc:axiondb:mit].
[DEBUG] Adding property: [torque.dsfactory.default.connection.user] with 
value: [].
[DEBUG] Adding property: [torque.dsfactory.default.connection.password] 
with value: [].
[ERROR] Cannot start component lifecycle with role : 
org.apache.fulcrum.db.DatabaseService
org.apache.avalon.framework.CascadingException: Can't initialize Torque!
         at 
org.apache.fulcrum.db.DefaultDatabaseService.initialize(DefaultDatabaseService.java:98)
         at 
org.apache.plexus.lifecycle.phase.InitializePhase.execute(InitializePhase.java:17)
         at 
org.apache.plexus.lifecycle.AbstractLifecycleHandler.startLifecycle(AbstractLifecycleHandler.java:145)
         at 
org.apache.plexus.service.repository.DefaultComponentRepository.startComponentLifecycle(DefaultComponentRepository.java:423)
         at 
org.apache.plexus.service.repository.DefaultComponentRepository.lookup(DefaultComponentRepository.java:313)
         at 
org.apache.plexus.PlexusTestCase.getComponent(PlexusTestCase.java:247)
         at 
com.moveitthere.delivery.DeliveryServiceTest.setUp(DeliveryServiceTest.java:38)
         at junit.framework.TestCase.runBare(TestCase.java:125)
         at junit.framework.TestResult$1.protect(TestResult.java:106)
         at junit.framework.TestResult.runProtected(TestResult.java:124)
         at junit.framework.TestResult.run(TestResult.java:109)
         at junit.framework.TestCase.run(TestCase.java:118)
         at junit.framework.TestSuite.runTest(TestSuite.java:208)
         at junit.framework.TestSuite.run(TestSuite.java:203)
         at 
org.apache.tools.ant.taskdefs.optional.junit.JUnitTestRunner.run(JUnitTestRunner.java:325)
         at 
org.apache.tools.ant.taskdefs.optional.junit.JUnitTestRunner.main(JUnitTestRunner.java:524)
Caused by: java.lang.NullPointerException
         at org.apache.torque.Torque.initialize(Torque.java:242)
         at org.apache.torque.Torque.init(Torque.java:408)
         at 
org.apache.fulcrum.db.DefaultDatabaseService.initialize(DefaultDatabaseService.java:94)
         ... 15 more
------------- ---------------- ---------------

Testcase: testStatus took 3.73 sec
         Caused an ERROR
null
java.lang.NullPointerException
         at 
com.moveitthere.delivery.om.BaseCompany.save(BaseCompany.java:2596)
         at 
com.moveitthere.delivery.DeliveryServiceTest.setUpDatabase(DeliveryServiceTest.java:60)
         at 
com.moveitthere.delivery.DeliveryServiceTest.setUp(DeliveryServiceTest.java:53)

Testcase: testStatusTestcase: testAddingOrders took 2.159 sec
         Caused an ERROR
org.axiondb.AxionException: A table named ID_TABLE already exists.
java.sql.SQLException: org.axiondb.AxionException: A table named 
ID_TABLE already exists.
         at 
org.axiondb.util.ExceptionConverter.convert(ExceptionConverter.java:65)
         at org.axiondb.jdbc.AxionStatement.execute(AxionStatement.java:90)
         at 
com.moveitthere.delivery.BatchSqlCommandRunner.runCommands(BatchSqlCommandRunner.java:174)
         at 
com.moveitthere.delivery.BatchSqlCommandRunner.runCommands(BatchSqlCommandRunner.java:154)
         at 
com.moveitthere.delivery.DeliveryServiceTest.setUp(DeliveryServiceTest.java:44)

-- 
Dan Diephouse
http://junktoast.com
"Everyone knows that Custer died at the Battle of
Little Big Horn. What this book presupposes is....
maybe he didn't?" -- Eli Cash, Royal Tenenbaums



---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org