Sep 9th, 2010, 02:41 AM
Spring Roo 1.1.0.M3 ManyToMany Unit Tests fail
I have created a project that has several ManyToMany relationships and the Unit tests are failing when running them all at once. If I run the tests individually most of them succeed. But when I run all of them together, they get a bunch of errors where test data is unable to be deleted because it is in use by a different test case. Do I need to manually code the Integration Tests and DataOnDemand modules, to handle this relationship? Everything else works, the site works, and the selenium:selenese succeeds. The only thing failing is the roo perform tests.
Attached is my roo script and one of the test results files, I am using MySql and I have already made sure the tables are being created in InnoDB.
If I do need to manually create the tests for these relationships, is there a good site to check out for this. I haven't been able to find much on the errors, except that having the notNull in there causes it, but I need the notNull, and I need the tests to succeed.
I haven't done any modifications to the Roo generated code, just ran the roo script, and then did a perform tests.
Any help would be much appreciated.
Here are a couple of the errors.
testRemove(com.iaim.trainingguide.domain.ConcernTy peIntegrationTest) Time elapsed: 0.062 sec <<< ERROR!
org.springframework.orm.jpa.JpaSystemException: org.hibernate.exception.ConstraintViolationExcepti on: could not delete: [com.iaim.trainingguide.domain.ConcernType#87]; nested exception is javax.persistence.PersistenceException: org.hibernate.exception.ConstraintViolationExcepti on: could not delete: [com.iaim.trainingguide.domain.ConcernType#87]
testRemove(com.iaim.trainingguide.domain.AudienceI ntegrationTest) Time elapsed: 0.078 sec <<< ERROR!
org.springframework.orm.jpa.JpaSystemException: org.hibernate.exception.ConstraintViolationExcepti on: could not delete: [com.iaim.trainingguide.domain.Audience#10]; nested exception is javax.persistence.PersistenceException: org.hibernate.exception.ConstraintViolationExcepti on: could not delete: [com.iaim.trainingguide.domain.Audience#10]
Ok I think I found 2 issues.
1. --sizeMax 3 or --sizeMax 4 -- it looks like a string defined with a small amount of characters causes a ConstraintViolationException while running the tests.
2. --notNull on referenced/set fields -- it looks like --notNull causes the could not delete error, looks like having --notNull allows the tests to try and remove test data that is still being used by other test cases. i.e. it tries to delete a record that violates a foreign key constraint.
I uploaded test-works.zip that has the roo script, with all --sizeMax 3 or 4 removed or set to 255, and all --notNull removed.
Last edited by btlife; Sep 9th, 2010 at 10:25 AM.
Reason: Found possible issues
Sep 18th, 2010, 01:45 AM
Given you've been able to provide so much detail with this apparent bug, would you mind logging a ticket at https://jira.springsource.org/browse/ROO so we can track this issue and get it resolved?
Sep 18th, 2010, 12:15 PM
For the String Size issue created ROO-1418
Originally Posted by Ben Alex
Sep 18th, 2010, 01:14 PM
Thanks for logging it. We'll take care of it.
Sep 18th, 2010, 09:24 PM
The String size issue in ROO-1418 has been fixed in Git ID 3f53c0ea83d1c2ed242d6a92f0eba27fab29edeb
Sep 19th, 2010, 03:29 AM
Furthermore, I used your test.roo and all the 144 tests pass in MySQL and Hsql. Would you please verify now using the latest Roo code from Git?
Sep 19th, 2010, 07:35 AM
Originally Posted by Alan Stewart
Thanks for looking at that, I tried to reproduce it as well, I couldn't so I am thinking it must have been something I had wrong on my side, but have changed since it happened. I didn't create a bug for it because I couldn't reproduce it.
Tags for this Thread