From: Miskell, C. <Cra...@ag...> - 2006-12-11 20:59:51
|
OK, I've gotten a little further. The test is trying to create an ifservice record without a nodeid. The code showing up the issue is populateDB(DistPollerDao dao) in AbstractDaoTestCase, when it's building the items in the database. The services are created, and some additional debugging logs show that the service does indeed know it's nodeid: =20 OnmsMonitoredService service=3Dbuilder.addService(getServiceType("ICMP")); =20 System.out.println("service says node id is "+service.getNodeId()); Outputs=20 service says node id is 1 But by the time Hibernate generates sql, it doesn't use the nodeid. The following appears just before the error stack trace (along with a bunch of other good looking sql) 2006-12-12 09:50:24,775 DEBUG [Thread-31] org.hibernate.SQL: =20 insert =20 into =20 ifServices =20 (source, serviceId, ipInterfaceId, lastGood, lastFail, qualifier, status, notify, id) =20 values =20 (?, ?, ?, ?, ?, ?, ?, ?, ?) No nodeid in the list of fields. The node is in the database, with nodeid 1 (as expected) This looks like something weird going on with Hibernate doing it's mappings from Object to Relation, but I have no idea where to look now (and have limited time... Dammit). Is anyone else experiencing these problems running tests, or am I alone? BTW, I make the tests run by removing "-Dmaven.test.skip=3Dtrue" from the= final line of build.sh - is that correct? Ta, Craig > -----Original Message----- > From: ope...@li...=20 > [mailto:ope...@li...] On=20 > Behalf Of Miskell, Craig > Sent: Monday, 11 December 2006 4:47 p.m. > To: ope...@li... > Subject: [opennms-devel] Test failures... ZOMG!!11!!eleven!!! >=20 > <Ahem> >=20 > I'm about to do some real coding, and want to get my test=20 > environment up > and running so I can run tests properly. Unfortunately, the DAO/DB > related tests fail. I'm at revision 5274 (the latest as of this > writing), and they all seem to fail during test setup with=20 >=20 > "org.hibernate.util.JDBCExceptionReporter: ERROR: null value in column > "nodeid" violates not-null constraint" in the output, and the=20 > following > snippet in the xml: > junit.framework.AssertionFailedError: populateDB failed: > org.springframework.dao.DataIntegrityViolationException: could not > insert: [org.opennms.netmgt.model.OnmsMonitoredService]; nested > exception is=20 > org.hibernate.exception.ConstraintViolationException: could > not insert: [org.opennms.netmgt.model.OnmsMonitoredService]; Nested > exception is:=20 > [org.springframework.dao.DataIntegrityViolationException] > could not insert: [org.opennms.netmgt.model.OnmsMonitoredService]; > nested exception is > org.hibernate.exception.ConstraintViolationException: could=20 > not insert: > [org.opennms.netmgt.model.OnmsMonitoredService] > at > org.opennms.netmgt.dao.AbstractDaoTestCase.fail(AbstractDaoTes > tCase.java > :352) > at > org.opennms.netmgt.dao.AbstractDaoTestCase.populateDB(Abstract > DaoTestCas > e.java:344) > at > org.opennms.netmgt.dao.AbstractDaoTestCase.setUp(AbstractDaoTe > stCase.jav > a:282) > at > org.opennms.netmgt.dao.OutageDaoTest.setUp(OutageDaoTest.java:55) >=20 > With nested exceptions being about constraint violation. Something is > odd, but I'm not sure what - any suggestions for where to look? Full > stack traces below - nb: I can't yet figure out why > org.opennms.netmgt.dao.AbstractDaoTestCase.populateDB(Abstract > DaoTestCas > e.java:424) > Ends up failing a constraint test... It should just be finding the > service. Incidentally, the service table is empty in the "test" > database, which is where I think the tests are being executed. >=20 > junit.framework.AssertionFailedError: populateDB failed: > org.springframework.dao.DataIntegrityViolationException: could not > insert: [org.opennms.netmgt.model.OnmsMonitoredService]; nested > exception is=20 > org.hibernate.exception.ConstraintViolationException: could > not insert: [org.opennms.netmgt.model.OnmsMonitoredService]; Nested > exception is:=20 > [org.springframework.dao.DataIntegrityViolationException] > could not insert: [org.opennms.netmgt.model.OnmsMonitoredService]; > nested exception is > org.hibernate.exception.ConstraintViolationException: could=20 > not insert: > [org.opennms.netmgt.model.OnmsMonitoredService] > at > org.opennms.netmgt.dao.AbstractDaoTestCase.fail(AbstractDaoTes > tCase.java > :352) > at > org.opennms.netmgt.dao.AbstractDaoTestCase.populateDB(Abstract > DaoTestCas > e.java:344) > at > org.opennms.netmgt.dao.AbstractDaoTestCase.setUp(AbstractDaoTe > stCase.jav > a:282) > at > org.opennms.netmgt.dao.OutageDaoTest.setUp(OutageDaoTest.java:55) > at junit.framework.TestCase.runBare(TestCase.java:125) > at junit.framework.TestResult$1.protect(TestResult.java:106) > at=20 > 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 sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) > at > sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccess > orImpl.jav > a:39) > at > sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMeth > odAccessor > Impl.java:25) > at java.lang.reflect.Method.invoke(Method.java:585) > at > org.apache.maven.surefire.junit.JUnitTestSet.execute(JUnitTest > Set.java:2 > 10) > at > org.apache.maven.surefire.suite.AbstractDirectoryTestSuite.exe > cuteTestSe > t(AbstractDirectoryTestSuite.java:135) > at > org.apache.maven.surefire.suite.AbstractDirectoryTestSuite.exe > cute(Abstr > actDirectoryTestSuite.java:160) > at org.apache.maven.surefire.Surefire.run(Surefire.java:81) > at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) > at > sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccess > orImpl.jav > a:39) > at > sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMeth > odAccessor > Impl.java:25) > at java.lang.reflect.Method.invoke(Method.java:585) > at > org.apache.maven.surefire.booter.SurefireBooter.runSuitesInPro > cess(Suref > ireBooter.java:182) > at > org.apache.maven.surefire.booter.SurefireBooter.main(SurefireB > ooter.java > :743) > Caused by: org.springframework.dao.DataIntegrityViolationException: > could not insert: [org.opennms.netmgt.model.OnmsMonitoredService]; > nested exception is > org.hibernate.exception.ConstraintViolationException: could=20 > not insert: > [org.opennms.netmgt.model.OnmsMonitoredService] > at > org.springframework.orm.hibernate3.SessionFactoryUtils.convert > HibernateA > ccessException(SessionFactoryUtils.java:628) > at > org.springframework.orm.hibernate3.HibernateAccessor.convertHi > bernateAcc > essException(HibernateAccessor.java:408) > at > org.springframework.orm.hibernate3.HibernateTemplate.execute(H > ibernateTe > mplate.java:367) > at > org.springframework.orm.hibernate3.HibernateTemplate.execute(H > ibernateTe > mplate.java:328) > at > org.opennms.netmgt.dao.hibernate.AbstractDaoHibernate.findUniq > ue(Abstrac > tDaoHibernate.java:155) > at > org.opennms.netmgt.dao.hibernate.ServiceTypeDaoHibernate.findB > yName(Serv > iceTypeDaoHibernate.java:44) > at > org.opennms.netmgt.dao.AbstractDaoTestCase.getServiceType(Abst > ractDaoTes > tCase.java:520) > at > org.opennms.netmgt.dao.AbstractDaoTestCase.populateDB(Abstract > DaoTestCas > e.java:424) > at > org.opennms.netmgt.dao.AbstractDaoTestCase.access$1(AbstractDa > oTestCase. > java:402) > at > org.opennms.netmgt.dao.AbstractDaoTestCase$1.doInTransaction(A > bstractDao > TestCase.java:320) > at > org.springframework.transaction.support.TransactionTemplate.ex > ecute(Tran > sactionTemplate.java:134) > at > org.opennms.netmgt.dao.AbstractDaoTestCase$2.run(AbstractDaoTe > stCase.jav > a:329) > at java.lang.Thread.run(Thread.java:595) > Caused by: org.hibernate.exception.ConstraintViolationException: could > not insert: [org.opennms.netmgt.model.OnmsMonitoredService] > at > org.hibernate.exception.SQLStateConverter.convert(SQLStateConv > erter.java > :71) > at > org.hibernate.exception.JDBCExceptionHelper.convert(JDBCExcept > ionHelper. > java:43) > at > org.hibernate.persister.entity.AbstractEntityPersister.insert( > AbstractEn > tityPersister.java:2202) > at > org.hibernate.persister.entity.AbstractEntityPersister.insert( > AbstractEn > tityPersister.java:2595) > at > org.hibernate.action.EntityInsertAction.execute(EntityInsertAc > tion.java: > 51) > at > org.hibernate.engine.ActionQueue.execute(ActionQueue.java:248) > at > org.hibernate.engine.ActionQueue.executeActions(ActionQueue.java:232) > at > org.hibernate.engine.ActionQueue.executeActions(ActionQueue.java:139) > at > org.hibernate.event.def.AbstractFlushingEventListener.performE > xecutions( > AbstractFlushingEventListener.java:298) > at > org.hibernate.event.def.DefaultFlushEventListener.onFlush(Defa > ultFlushEv > entListener.java:27) > at org.hibernate.impl.SessionImpl.flush(SessionImpl.java:1000) > at > org.springframework.orm.hibernate3.HibernateAccessor.flushIfNe > cessary(Hi > bernateAccessor.java:388) > at > org.springframework.orm.hibernate3.HibernateTemplate.execute(H > ibernateTe > mplate.java:363) > ... 10 more > Caused by: org.postgresql.util.PSQLException: ERROR: null value in > column "nodeid" violates not-null constraint > at > org.postgresql.core.v3.QueryExecutorImpl.receiveErrorResponse( > QueryExecu > torImpl.java:1525) > at > org.postgresql.core.v3.QueryExecutorImpl.processResults(QueryE > xecutorImp > l.java:1309) > at > org.postgresql.core.v3.QueryExecutorImpl.execute(QueryExecutor > Impl.java: > 188) > at > org.postgresql.jdbc2.AbstractJdbc2Statement.execute(AbstractJd > bc2Stateme > nt.java:452) > at > org.postgresql.jdbc2.AbstractJdbc2Statement.executeWithFlags(A > bstractJdb > c2Statement.java:354) > at > org.postgresql.jdbc2.AbstractJdbc2Statement.executeUpdate(Abst > ractJdbc2S > tatement.java:308) > at > org.hibernate.jdbc.NonBatchingBatcher.addToBatch(NonBatchingBa > tcher.java > :23) > at > org.hibernate.persister.entity.AbstractEntityPersister.insert( > AbstractEn > tityPersister.java:2182) > ... 20 more >=20 >=20 >=20 > Craig Miskell, > Technical Support, > AgResearch Invermay > 03 489-9279 > Come to think of it, there are already a million monkeys on a million > typewriters,=20 > and Usenet is NOTHING like Shakespeare.=20 > -- Blair Houghton.=20 > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D > =3D=3D=3D=3D=3D=3D=3D=3D=3D > Attention: The information contained in this message and/or=20 > attachments > from AgResearch Limited is intended only for the persons or entities > to which it is addressed and may contain confidential and/or=20 > privileged > material. Any review, retransmission, dissemination or other=20 > use of, or > taking of any action in reliance upon, this information by persons or > entities other than the intended recipients is prohibited by=20 > AgResearch > Limited. If you have received this message in error, please notify the > sender immediately. > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D > =3D=3D=3D=3D=3D=3D=3D=3D=3D >=20 > -------------------------------------------------------------- > ----------- > Take Surveys. Earn Cash. Influence the Future of IT > Join SourceForge.net's Techsay panel and you'll get the=20 > chance to share your > opinions on IT & business topics through brief surveys - and earn cash > http://www.techsay.com/default.php?page=3Djoin.php&p=3Dsourceforge > &CID=3DDEVDEV > _______________________________________________ > Please read the OpenNMS Mailing List FAQ: > http://www.opennms.org/index.php/Mailing_List_FAQ >=20 > opennms-devel mailing list >=20 > To *unsubscribe* or change your subscription options, see the=20 > bottom of this page: > https://lists.sourceforge.net/lists/listinfo/opennms-devel >=20 =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D Attention: The information contained in this message and/or attachments from AgResearch Limited is intended only for the persons or entities to which it is addressed and may contain confidential and/or privileged material. Any review, retransmission, dissemination or other use of, or taking of any action in reliance upon, this information by persons or entities other than the intended recipients is prohibited by AgResearch Limited. If you have received this message in error, please notify the sender immediately. =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D |