Eclipse can't find the postgres driver to run DB tests


#1

I am trying to install OG in eclipse on OSX. I have Postgres installed and have added the the Postgres JDBC to the build path but I still get the following error.

Any thoughts?


T E S T S

Running TestSuite
Configuring TestNG with: TestNG652Configurator
Database driver not available: sqlserver2008
Database driver not available: postgres
Using default test.properties file name: tests.properties
Unable to find test properties in known locations
Tests run: 31, Failures: 4, Errors: 0, Skipped: 27, Time elapsed: 1.914 sec <<< FAILURE! - in TestSuite
setUp on hsqldb/auth:1 >>> 2(com.opengamma.enginedb.EngineDbDatabaseUpgradeTest) Time elapsed: 1.869 sec <<< FAILURE!
com.opengamma.OpenGammaRuntimeException: Unable to find test properties in known locations
at com.opengamma.util.test.TestProperties.loadFile(TestProperties.java:110)
at com.opengamma.util.test.TestProperties.getTestProperties(TestProperties.java:55)
at com.opengamma.util.test.DbTest.getDbHost(DbTest.java:154)
at com.opengamma.util.test.DbTest.createDbTool(DbTest.java:132)
at com.opengamma.util.test.AbstractDbUpgradeTest.initDbTool(AbstractDbUpgradeTest.java:101)
at com.opengamma.util.test.AbstractDbUpgradeTest.getDbTool(AbstractDbUpgradeTest.java:87)
at com.opengamma.util.test.AbstractDbUpgradeTest.setUp(AbstractDbUpgradeTest.java:69)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:606)
at org.testng.internal.MethodInvocationHelper.invokeMethod(MethodInvocationHelper.java:84)
at org.testng.internal.Invoker.invokeConfigurationMethod(Invoker.java:564)
at org.testng.internal.Invoker.invokeConfigurations(Invoker.java:213)
at org.testng.internal.Invoker.invokeMethod(Invoker.java:653)
at org.testng.internal.Invoker.invokeTestMethod(Invoker.java:901)
at org.testng.internal.Invoker.invokeTestMethods(Invoker.java:1231)
at org.testng.internal.TestMethodWorker.invokeTestMethods(TestMethodWorker.java:127)
at org.testng.internal.TestMethodWorker.run(TestMethodWorker.java:111)
at org.testng.TestRunner.privateRun(TestRunner.java:767)
at org.testng.TestRunner.run(TestRunner.java:617)
at org.testng.SuiteRunner.runTest(SuiteRunner.java:334)
at org.testng.SuiteRunner.runSequentially(SuiteRunner.java:329)
at org.testng.SuiteRunner.privateRun(SuiteRunner.java:291)
at org.testng.SuiteRunner.run(SuiteRunner.java:240)
at org.testng.SuiteRunnerWorker.runSuite(SuiteRunnerWorker.java:52)
at org.testng.SuiteRunnerWorker.run(SuiteRunnerWorker.java:86)
at org.testng.TestNG.runSuitesSequentially(TestNG.java:1224)
at org.testng.TestNG.runSuitesLocally(TestNG.java:1149)
at org.testng.TestNG.run(TestNG.java:1057)
at org.apache.maven.surefire.testng.TestNGExecutor.run(TestNGExecutor.java:91)
at org.apache.maven.surefire.testng.TestNGDirectoryTestSuite.executeMulti(TestNGDirectoryTestSuite.java:204)
at org.apache.maven.surefire.testng.TestNGDirectoryTestSuite.execute(TestNGDirectoryTestSuite.java:107)
at org.apache.maven.surefire.testng.TestNGProvider.invoke(TestNGProvider.java:113)
at org.apache.maven.surefire.booter.ForkedBooter.invokeProviderInSameClassLoader(ForkedBooter.java:200)
at org.apache.maven.surefire.booter.ForkedBooter.runSuitesInProcess(ForkedBooter.java:153)
at org.apache.maven.surefire.booter.ForkedBooter.main(ForkedBooter.java:103)

setUp on hsqldb:latest(com.opengamma.enginedb.stats.DbFunctionCostsMasterTest) Time elapsed: 0.01 sec <<< FAILURE!
com.opengamma.OpenGammaRuntimeException: Property hsqldb.jdbc.url not found
at com.opengamma.util.test.DbTest.getDbHost(DbTest.java:156)
at com.opengamma.util.test.DbTest.createDbTool(DbTest.java:132)
at com.opengamma.util.test.AbstractDbTest.initDbTool(AbstractDbTest.java:224)
at com.opengamma.util.test.AbstractDbTest.getDbTool(AbstractDbTest.java:182)
at com.opengamma.util.test.AbstractDbTest.setUp(AbstractDbTest.java:90)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:606)
at org.testng.internal.MethodInvocationHelper.invokeMethod(MethodInvocationHelper.java:84)
at org.testng.internal.Invoker.invokeConfigurationMethod(Invoker.java:564)
at org.testng.internal.Invoker.invokeConfigurations(Invoker.java:213)
at org.testng.internal.Invoker.invokeMethod(Invoker.java:653)
at org.testng.internal.Invoker.invokeTestMethod(Invoker.java:901)
at org.testng.internal.Invoker.invokeTestMethods(Invoker.java:1231)
at org.testng.internal.TestMethodWorker.invokeTestMethods(TestMethodWorker.java:127)
at org.testng.internal.TestMethodWorker.run(TestMethodWorker.java:111)
at org.testng.TestRunner.privateRun(TestRunner.java:767)
at org.testng.TestRunner.run(TestRunner.java:617)
at org.testng.SuiteRunner.runTest(SuiteRunner.java:334)
at org.testng.SuiteRunner.runSequentially(SuiteRunner.java:329)
at org.testng.SuiteRunner.privateRun(SuiteRunner.java:291)
at org.testng.SuiteRunner.run(SuiteRunner.java:240)
at org.testng.SuiteRunnerWorker.runSuite(SuiteRunnerWorker.java:52)
at org.testng.SuiteRunnerWorker.run(SuiteRunnerWorker.java:86)
at org.testng.TestNG.runSuitesSequentially(TestNG.java:1224)
at org.testng.TestNG.runSuitesLocally(TestNG.java:1149)
at org.testng.TestNG.run(TestNG.java:1057)
at org.apache.maven.surefire.testng.TestNGExecutor.run(TestNGExecutor.java:91)
at org.apache.maven.surefire.testng.TestNGDirectoryTestSuite.executeMulti(TestNGDirectoryTestSuite.java:204)
at org.apache.maven.surefire.testng.TestNGDirectoryTestSuite.execute(TestNGDirectoryTestSuite.java:107)
at org.apache.maven.surefire.testng.TestNGProvider.invoke(TestNGProvider.java:113)
at org.apache.maven.surefire.booter.ForkedBooter.invokeProviderInSameClassLoader(ForkedBooter.java:200)
at org.apache.maven.surefire.booter.ForkedBooter.runSuitesInProcess(ForkedBooter.java:153)
at org.apache.maven.surefire.booter.ForkedBooter.main(ForkedBooter.java:103)

setUp on hsqldb:latest(com.opengamma.security.auditlog.HibernateAuditLoggerTest) Time elapsed: 0.004 sec <<< FAILURE!
com.opengamma.OpenGammaRuntimeException: Property hsqldb.jdbc.url not found
at com.opengamma.util.test.DbTest.getDbHost(DbTest.java:156)
at com.opengamma.util.test.DbTest.createDbTool(DbTest.java:132)
at com.opengamma.util.test.AbstractDbTest.initDbTool(AbstractDbTest.java:224)
at com.opengamma.util.test.AbstractDbTest.getDbTool(AbstractDbTest.java:182)
at com.opengamma.util.test.AbstractDbTest.setUp(AbstractDbTest.java:90)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:606)
at org.testng.internal.MethodInvocationHelper.invokeMethod(MethodInvocationHelper.java:84)
at org.testng.internal.Invoker.invokeConfigurationMethod(Invoker.java:564)
at org.testng.internal.Invoker.invokeConfigurations(Invoker.java:213)
at org.testng.internal.Invoker.invokeMethod(Invoker.java:653)
at org.testng.internal.Invoker.invokeTestMethod(Invoker.java:901)
at org.testng.internal.Invoker.invokeTestMethods(Invoker.java:1231)
at org.testng.internal.TestMethodWorker.invokeTestMethods(TestMethodWorker.java:127)
at org.testng.internal.TestMethodWorker.run(TestMethodWorker.java:111)
at org.testng.TestRunner.privateRun(TestRunner.java:767)
at org.testng.TestRunner.run(TestRunner.java:617)
at org.testng.SuiteRunner.runTest(SuiteRunner.java:334)
at org.testng.SuiteRunner.runSequentially(SuiteRunner.java:329)
at org.testng.SuiteRunner.privateRun(SuiteRunner.java:291)
at org.testng.SuiteRunner.run(SuiteRunner.java:240)
at org.testng.SuiteRunnerWorker.runSuite(SuiteRunnerWorker.java:52)
at org.testng.SuiteRunnerWorker.run(SuiteRunnerWorker.java:86)
at org.testng.TestNG.runSuitesSequentially(TestNG.java:1224)
at org.testng.TestNG.runSuitesLocally(TestNG.java:1149)
at org.testng.TestNG.run(TestNG.java:1057)
at org.apache.maven.surefire.testng.TestNGExecutor.run(TestNGExecutor.java:91)
at org.apache.maven.surefire.testng.TestNGDirectoryTestSuite.executeMulti(TestNGDirectoryTestSuite.java:204)
at org.apache.maven.surefire.testng.TestNGDirectoryTestSuite.execute(TestNGDirectoryTestSuite.java:107)
at org.apache.maven.surefire.testng.TestNGProvider.invoke(TestNGProvider.java:113)
at org.apache.maven.surefire.booter.ForkedBooter.invokeProviderInSameClassLoader(ForkedBooter.java:200)
at org.apache.maven.surefire.booter.ForkedBooter.runSuitesInProcess(ForkedBooter.java:153)
at org.apache.maven.surefire.booter.ForkedBooter.main(ForkedBooter.java:103)

setUp on hsqldb:latest(com.opengamma.security.user.HibernateUserManagerTest) Time elapsed: 0.006 sec <<< FAILURE!
com.opengamma.OpenGammaRuntimeException: Property hsqldb.jdbc.url not found
at com.opengamma.util.test.DbTest.getDbHost(DbTest.java:156)
at com.opengamma.util.test.DbTest.createDbTool(DbTest.java:132)
at com.opengamma.util.test.AbstractDbTest.initDbTool(AbstractDbTest.java:224)
at com.opengamma.util.test.AbstractDbTest.getDbTool(AbstractDbTest.java:182)
at com.opengamma.util.test.AbstractDbTest.setUp(AbstractDbTest.java:90)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:606)
at org.testng.internal.MethodInvocationHelper.invokeMethod(MethodInvocationHelper.java:84)
at org.testng.internal.Invoker.invokeConfigurationMethod(Invoker.java:564)
at org.testng.internal.Invoker.invokeConfigurations(Invoker.java:213)
at org.testng.internal.Invoker.invokeMethod(Invoker.java:653)
at org.testng.internal.Invoker.invokeTestMethod(Invoker.java:901)
at org.testng.internal.Invoker.invokeTestMethods(Invoker.java:1231)
at org.testng.internal.TestMethodWorker.invokeTestMethods(TestMethodWorker.java:127)
at org.testng.internal.TestMethodWorker.run(TestMethodWorker.java:111)
at org.testng.TestRunner.privateRun(TestRunner.java:767)
at org.testng.TestRunner.run(TestRunner.java:617)
at org.testng.SuiteRunner.runTest(SuiteRunner.java:334)
at org.testng.SuiteRunner.runSequentially(SuiteRunner.java:329)
at org.testng.SuiteRunner.privateRun(SuiteRunner.java:291)
at org.testng.SuiteRunner.run(SuiteRunner.java:240)
at org.testng.SuiteRunnerWorker.runSuite(SuiteRunnerWorker.java:52)
at org.testng.SuiteRunnerWorker.run(SuiteRunnerWorker.java:86)
at org.testng.TestNG.runSuitesSequentially(TestNG.java:1224)
at org.testng.TestNG.runSuitesLocally(TestNG.java:1149)
at org.testng.TestNG.run(TestNG.java:1057)
at org.apache.maven.surefire.testng.TestNGExecutor.run(TestNGExecutor.java:91)
at org.apache.maven.surefire.testng.TestNGDirectoryTestSuite.executeMulti(TestNGDirectoryTestSuite.java:204)
at org.apache.maven.surefire.testng.TestNGDirectoryTestSuite.execute(TestNGDirectoryTestSuite.java:107)
at org.apache.maven.surefire.testng.TestNGProvider.invoke(TestNGProvider.java:113)
at org.apache.maven.surefire.booter.ForkedBooter.invokeProviderInSameClassLoader(ForkedBooter.java:200)
at org.apache.maven.surefire.booter.ForkedBooter.runSuitesInProcess(ForkedBooter.java:153)
at org.apache.maven.surefire.booter.ForkedBooter.main(ForkedBooter.java:103)

Results :

Failed tests:
EngineDbDatabaseUpgradeTest>AbstractDbUpgradeTest.setUp:69->AbstractDbUpgradeTest.getDbTool:87->AbstractDbUpgradeTest.initDbTool:101 » OpenGammaRuntime
DbFunctionCostsMasterTest>AbstractDbTest.setUp:90->AbstractDbTest.getDbTool:182->AbstractDbTest.initDbTool:224 » OpenGammaRuntime
HibernateAuditLoggerTest>AbstractDbTest.setUp:90->AbstractDbTest.getDbTool:182->AbstractDbTest.initDbTool:224 » OpenGammaRuntime
HibernateUserManagerTest>AbstractDbTest.setUp:90->AbstractDbTest.getDbTool:182->AbstractDbTest.initDbTool:224 » OpenGammaRuntime

Tests run: 31, Failures: 4, Errors: 0, Skipped: 27

[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 12.245s
[INFO] Finished at: Tue Oct 07 23:39:35 BST 2014
[INFO] Final Memory: 22M/259M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-surefire-plugin:2.16:test (default-test) on project og-enginedb: There are test failures.
[ERROR]
[ERROR] Please refer to /Users/christos/Projects/OG-Platform/projects/OG-EngineDB/target/surefire-reports for the individual test results.
[ERROR] -> [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoFailureException


#2

Yes. Go into examples-simulated/pom.xml and uncomment the “postgresql” dependency. The dependency is commented out so that pom doesn’t normally pull down the postgresql drivers.


#3

Hi joequant,

Thanks for the input, however I can’t see a postgres element in the pom you mention. Are you certain it’s in the following path?

OG-Platform/examples/examples-simulated/pom.xml

Thanks for the help.
C.


#4

The relevant section is:

<dependency>
  <groupId>postgresql</groupId>
  <artifactId>postgresql</artifactId>
  <scope>test</scope>
</dependency>

This section should be located in the <dependencies> section.

Your stack trace is also complaining about the absence of tests.properties. This is the file, and it must be found at the root of the classpath: