Michael Schröder
2010-01-15 22:38:26 UTC
Hi, my name's Michael, I'm one of the students working on the new
cascading feature. To that end, I'm currently trying to restructure
our tests but I keep running into problems...
Backstory: Previously, we patched ourselves into the cpactf package
(test2860; see the corresponding JIRA issue) but that hasn't been
working out so well, so Werner suggested we create our own package
(cascading-it) and make use of the Spring framework, like the JPA
extensions tests do (in jpa-extensions-it).
So I pretty much copied their stuff and tried to understand it and to
trim it down to for our purposes. I've attached a patch of the current
state of my efforts. I think it's pretty self-explanatory if you take
a quick look at the directory structure. (Note: the test functions in
the files are all the same because I know for sure that that one
works.)
Using "mvn clean test" all tests should and do finish successfully,
but here are the problems:
1) It doesn't seem to use the current state of it's parent castor
source, so the changes we've made to our trunk aren't there. (That's
why autostore is set to true, so the tests can run without making use
of our cascading feature.) I guess you can configure that in the
pom.xml?
2) @Transactional doesn't work. The tests run because all ids are
different, but if you were to e.g. make create2() use the same ids as
create() you'll get an error. The test classes are all
AbstractTransactionalJUnit4SpringContextTests and I'm pretty sure the
transactionManager gets injected correctly (at least everything's done
exactly like in jpa-extension-it). I've got to be missing something
here...
3) It doesn't work with JUnit in Eclipse. It can't find the database.
(I used to get something along the lines of "schema TEST doesn't
exist" but now all I'm getting is "Database target/test not found")
I hope it's not all just dumb mistakes, but it's getting late and I'm
pretty much stuck. Thanks in advance for all advice!
cascading feature. To that end, I'm currently trying to restructure
our tests but I keep running into problems...
Backstory: Previously, we patched ourselves into the cpactf package
(test2860; see the corresponding JIRA issue) but that hasn't been
working out so well, so Werner suggested we create our own package
(cascading-it) and make use of the Spring framework, like the JPA
extensions tests do (in jpa-extensions-it).
So I pretty much copied their stuff and tried to understand it and to
trim it down to for our purposes. I've attached a patch of the current
state of my efforts. I think it's pretty self-explanatory if you take
a quick look at the directory structure. (Note: the test functions in
the files are all the same because I know for sure that that one
works.)
Using "mvn clean test" all tests should and do finish successfully,
but here are the problems:
1) It doesn't seem to use the current state of it's parent castor
source, so the changes we've made to our trunk aren't there. (That's
why autostore is set to true, so the tests can run without making use
of our cascading feature.) I guess you can configure that in the
pom.xml?
2) @Transactional doesn't work. The tests run because all ids are
different, but if you were to e.g. make create2() use the same ids as
create() you'll get an error. The test classes are all
AbstractTransactionalJUnit4SpringContextTests and I'm pretty sure the
transactionManager gets injected correctly (at least everything's done
exactly like in jpa-extension-it). I've got to be missing something
here...
3) It doesn't work with JUnit in Eclipse. It can't find the database.
(I used to get something along the lines of "schema TEST doesn't
exist" but now all I'm getting is "Database target/test not found")
I hope it's not all just dumb mistakes, but it's getting late and I'm
pretty much stuck. Thanks in advance for all advice!