>>>>> Grzegorz Grzybek <
gr.grzybek-Re5JQ...@public.gmane.org>:
> `RemoteBundleContextClientImpl` in the stack trace means that it (the stack
> trace) comes from client side of the test.
> Pax Exam is not difficult if it comes about writing @Test-annotated
> methods, but it is very difficult when trying to set everything up
> correctly, so jars not conflict with actual bundles and client/server side
> of things behaves as expected.
> In your stack trace you obviously miss the exception class on client-side
> classpath (when running from Eclipse).
Thanks! When posting this message I thought I had tried adding a maven
dependency to the project (which should be the client side) and it
didn't work.
But maybe I added the wrong dependency, because when I later tried
adding a dependency, the classNotFound exception went away and I got the
underlying database constraint violation instead.
https://github.com/steinarb/liquibase-karaf-feature/commit/fff4b1a0ff88cc2270fe4934e5ec50cc9347e094
And when I fixed it in this way, I forgot about this message to the
mailing list.
On a side note: the constraint violation here is related to the "wrong
assert triggered".
Like you said, this may be caused by database rollback in some way, but
I don't see how this could be caused by the asserts, since the asserts
happens outside of the try-with-resource clauses determining the life
cycle of the JDBC Connection instances interacting with the database.
If I get a constraint violation here there is really only one thing that
could cause it, and that would be me trying to add the same account
username twice.
And my integration test only add the account once.
One thing that would cause this would be if the test itself is run more
than once against the same database.
Could a failing assert cause the test to be re-run somehow?
> To be honest I never run such tests from Eclipse/IDEA, I always run
> from Maven (surefire/failsafe) and do a remote debugging. You can
> debug Maven, surefire itself or Karaf container started from surefire
> (3 separate JVMs involved...).
The test here was originally a minimal karaf application I used to test
my liquibase feature. But testing the feature manually was boring, so I
decided to automate it and put the automated test into the maven build
of the fature.
If I want to test the application in a regular karaf instance, where I
can easily debug, I can still load the feature from the integration
test:
https://github.com/steinarb/liquibase-karaf-feature#testing-and-debugging-in-karaf
See the neighbouring thread for a description of the integration test.
> In your case I'd first look at the server side logs - you're running
> pax-exam-container-karaf, so you should have logs in the Karaf instance
> started by Pax Exam - don't forget to call
> org.ops4j.pax.exam.karaf.options.KarafDistributionOption#keepRuntimeFolder()
> in your Pax Exam configuration method.
The karaf.log of the pax exam test had the
org.apache.derby.shared.common.error.DerbySQLIntegrityConstraintViolationException
with the actual constraints message.
> And to really get
> org.apache.derby.shared.common.error.DerbySQLIntegrityConstraintViolationException
> at client side, be sure to have Derby driver on the classpath.
Yep. Just had to add the right derby dependency...
Thanks!