Database Connection Pool causing JUnit tests to timeout [message #1816657] |
Mon, 04 November 2019 09:03 |
Mark Ashworth Messages: 40 Registered: January 2012 |
Member |
|
|
The application uses two instances of AbstractSQLService, one for Microsoft SQL Server and another for PostgreSQL because of the partitioning of the data between these two database servers.
The problem arises when I try to write unit tests for the retrieve, delete, insert and update methods that use the AbstractMsSqlSqlService (i.e. I have tried this on Derby and MS SQL Server and got the same results).
The problem is that the unit test does not report success because the Scout Test Library is indicating that the connection pool job indicated that there are open connections.
However all the transactions have passed through phase 1 and phase 2 commit stage at this point, so I am not sure what further I should do.
Also I also tried to destroy the connection pool in the @AfterClass method of the unit test but this is only called after the previous error indicates that there are connections in the pool that caused the unit test to fail.
Also tried committing to the transactions explicitly in the service methods that perform the retrieval from the database but this also does not work.
This only seems to be an issue in the unit test and the application uses the services correctly when running the application.
Thank you in advance for any help.
java.lang.AssertionError: Test failed because some jobs did not complete yet. [context=Test method, jobs=[Managing SQL connection pool for xxx.xxx.xxx.xxx.server.sql.SomeSqlService]]
at org.junit.Assert.fail(Assert.java:88)
at org.eclipse.scout.rt.testing.platform.runner.statement.AssertNoRunningJobsStatement.assertNoRunningJobs(AssertNoRunningJobsStatement.java:87)
at org.eclipse.scout.rt.testing.platform.runner.statement.AssertNoRunningJobsStatement.evaluate(AssertNoRunningJobsStatement.java:70)
at org.eclipse.scout.rt.testing.platform.runner.statement.TimesStatement.evaluate(TimesStatement.java:44)
at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:325)
at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:78)
at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:57)
at org.junit.runners.ParentRunner$3.run(ParentRunner.java:290)
at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:71)
at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:288)
at org.junit.runners.ParentRunner.access$000(ParentRunner.java:58)
at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:268)
at org.eclipse.scout.rt.testing.platform.runner.PlatformTestRunner$2.evaluate(PlatformTestRunner.java:104)
at org.eclipse.scout.rt.testing.platform.runner.PlatformTestRunner$InterceptedAfterStatement.evaluate(PlatformTestRunner.java:355)
at org.eclipse.scout.rt.testing.platform.runner.SafeStatementInvoker.run(SafeStatementInvoker.java:39)
at org.eclipse.scout.rt.platform.util.concurrent.Callables.lambda$0(Callables.java:31)
at org.eclipse.scout.rt.platform.chain.callable.CallableChain$Chain.continueChain(CallableChain.java:227)
at org.eclipse.scout.rt.platform.transaction.TransactionProcessor.runTxRequiresNew(TransactionProcessor.java:100)
at org.eclipse.scout.rt.platform.transaction.TransactionProcessor.intercept(TransactionProcessor.java:69)
at org.eclipse.scout.rt.platform.chain.callable.CallableChain$Chain.continueChain(CallableChain.java:222)
at org.eclipse.scout.rt.platform.chain.callable.CallableChain.call(CallableChain.java:170)
at org.eclipse.scout.rt.platform.context.RunContext.call(RunContext.java:156)
at org.eclipse.scout.rt.platform.context.RunContext.call(RunContext.java:137)
at org.eclipse.scout.rt.platform.context.RunContext.run(RunContext.java:108)
at org.eclipse.scout.rt.testing.platform.runner.statement.RunContextStatement.evaluate(RunContextStatement.java:41)
at org.eclipse.scout.rt.testing.platform.runner.statement.AssertNoRunningJobsStatement.evaluate(AssertNoRunningJobsStatement.java:62)
at org.eclipse.scout.rt.testing.platform.runner.statement.PlatformStatement.evaluateWithGlobalPlatform(PlatformStatement.java:96)
at org.eclipse.scout.rt.testing.platform.runner.statement.PlatformStatement.evaluate(PlatformStatement.java:75)
at org.junit.runners.ParentRunner.run(ParentRunner.java:363)
at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:89)
at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:41)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:541)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:763)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:463)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:209)
[Updated on: Mon, 04 November 2019 09:06] Report message to a moderator
|
|
|
|
Powered by
FUDForum. Page generated in 0.04289 seconds