Laszlo, You want to revert your commit. I caused the original issue. I moved the initialization of LockMasterListener to be a class member to work around a different intiailization issue somebody reported. It was a hasty change and I shouldn't have done it like that. So that broke the unit tests. I did the proper change and checked it in. I'll watch the builds to make sure everything is green again.
I'd prefer not to have mysql-java at test scope for anything to specifically avoid things like this. The way that I ran the unit tests was not really proper and it added the mysql driver to the classpath which ended up connecting to the DB, so I didn't notice the issue. If I had ran the proper mvn build it would have failed with the issue saying it can't find the mysql driver. For unit tests we obviously don't want them hitting the DB and not having the driver on the classpath helps prevent accidentally connecting to the DB on desktops where you might have a local MySQL. Darren On Fri, Oct 25, 2013 at 3:19 PM, Laszlo Hornyak <laszlo.horn...@gmail.com> wrote: > I have just sent a fix for that, looks like everything is green now. Please > check! > > > On Fri, Oct 25, 2013 at 11:52 PM, Darren Shepherd < > darren.s.sheph...@gmail.com> wrote: > >> I'll fix that. >> >> Darren >> >> On Fri, Oct 25, 2013 at 1:54 PM, Alex Huang <alex.hu...@citrix.com> wrote: >> > I'm getting this failing unit test when building with the latest from >> master. Anyone working on it or know what it is already? From the stack, >> it looks like it's a problem location the jdbc driver. This was working >> just yesterday. >> > >> > Test set: com.cloud.alert.AlertControlsUnitTest >> > >> ------------------------------------------------------------------------------- >> > Tests run: 1, Failures: 1, Errors: 0, Skipped: 0, Time elapsed: 0.175 >> sec <<< FAILURE! >> > warning(junit.framework.TestSuite$1) Time elapsed: 0.004 sec <<< >> FAILURE! >> > junit.framework.AssertionFailedError: Exception in constructor: >> testInjected (java.lang.ExceptionInInitializerError >> > at >> com.cloud.alert.AlertControlsUnitTest.<init>(AlertControlsUnitTest.java:46) >> > at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native >> Method) >> > at >> sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:57) >> > at >> sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45) >> > at >> java.lang.reflect.Constructor.newInstance(Constructor.java:526) >> > at junit.framework.TestSuite.createTest(TestSuite.java:61) >> > at junit.framework.TestSuite.addTestMethod(TestSuite.java:294) >> > at >> junit.framework.TestSuite.addTestsFromTestCase(TestSuite.java:150) >> > at junit.framework.TestSuite.<init>(TestSuite.java:129) >> > at >> org.junit.internal.runners.JUnit38ClassRunner.<init>(JUnit38ClassRunner.java:71) >> > at >> org.junit.internal.builders.JUnit3Builder.runnerForClass(JUnit3Builder.java:14) >> > at >> org.junit.runners.model.RunnerBuilder.safeRunnerForClass(RunnerBuilder.java:57) >> > at >> org.junit.internal.builders.AllDefaultPossibilitiesBuilder.runnerForClass(AllDefaultPossibilitiesBuilder.java:29) >> > at >> org.junit.runners.model.RunnerBuilder.safeRunnerForClass(RunnerBuilder.java:57) >> > at >> org.junit.internal.requests.ClassRequest.getRunner(ClassRequest.java:24) >> > at >> org.apache.maven.surefire.junit4.JUnit4Provider.execute(JUnit4Provider.java:234) >> > at >> org.apache.maven.surefire.junit4.JUnit4Provider.executeTestSet(JUnit4Provider.java:134) >> > at >> org.apache.maven.surefire.junit4.JUnit4Provider.invoke(JUnit4Provider.java:113) >> > 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.apache.maven.surefire.util.ReflectionUtils.invokeMethodWithArray(ReflectionUtils.java:189) >> > at >> org.apache.maven.surefire.booter.ProviderFactory$ProviderProxy.invoke(ProviderFactory.java:165) >> > at >> org.apache.maven.surefire.booter.ProviderFactory.invokeProvider(ProviderFactory.java:85) >> > at >> org.apache.maven.surefire.booter.ForkedBooter.runSuitesInProcess(ForkedBooter.java:103) >> > at >> org.apache.maven.surefire.booter.ForkedBooter.main(ForkedBooter.java:74) >> > Caused by: com.cloud.utils.exception.CloudRuntimeException: Unable to >> initialize a connection to the database for locking purposes: >> > at com.cloud.utils.db.Merovingian2.<init>(Merovingian2.java:74) >> > at >> com.cloud.utils.db.Merovingian2.createLockMaster(Merovingian2.java:80) >> > at >> com.cloud.server.LockMasterListener.<init>(LockMasterListener.java:33) >> > at >> com.cloud.server.ManagementServerImpl.<clinit>(ManagementServerImpl.java:602) >> > ... 27 more >> > Caused by: java.sql.SQLException: No suitable driver found for >> jdbc:mysql://localhost:3306/cloud?autoReconnect=true&prepStmtCacheSize=517&cachePrepStmts=true&prepStmtCacheSqlLimit=4096 >> > at java.sql.DriverManager.getConnection(DriverManager.java:596) >> > at java.sql.DriverManager.getConnection(DriverManager.java:215) >> > at >> org.apache.commons.dbcp.DriverManagerConnectionFactory.createConnection(DriverManagerConnectionFactory.java:75) >> > at >> org.apache.commons.dbcp.PoolableConnectionFactory.makeObject(PoolableConnectionFactory.java:582) >> > >> > --Alex >> > > > > -- > > EOF