Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix spring transaction support and correct the transaction hook location in the example spring-txn #644

Closed

Conversation

brasmusson
Copy link
Contributor

The glue path in @CucumberOption annotation of the RunCukesTest in the spring transaction example, was not updated when the SpringTransactionHook class was moved from cucumber.runtime.java.spring.hooks to cucumber.api.spring. Therefore the example is currently actually a "spring-without-transactions-example".

The root cause is that there will be two separate spring contexts, one based on cucumber/runtime/java/spring/cucumber-glue.xml, and one based one the @ContextConfiguration("<cucumber.xml>") annotation. SpringTransactionHooks will be in the first context, and the step definition class (with the @ContextConfiguration annotation) and the application under test will be in the second context.

A "hack" to make the spring transaction support work is to let the cucumber.runtime.java.spring.SpringFactory "detect" the @ContextConfiguration annotation on the step definition classes and apply that configuration also to the SpringTransactionHooks

Fixes #637.

Make an ugly hack in the SpringFactory to apply the same spring context
to SpringTransactionHooks as the step definition classes.
Make sure search.feature in examples/spring-txn fails if not executed
in a transaction. Remove @TxN annotation from see_messages.feature in
examples/spring-txn, since it cannot run in transaction.
@brasmusson brasmusson removed the Blocked label May 1, 2014
@brasmusson brasmusson changed the title Correct the transaction hook location in the example spring-txn Fix spring transaction support and correct the transaction hook location in the example spring-txn May 1, 2014
@brasmusson
Copy link
Contributor Author

I've added a "hack" to make the spring transaction support work. It is hardly the proper spring way to do it, but it works (as far as I can tell).

@aslakhellesoy
Copy link
Contributor

If you can, please join here Mon, May 12, 3:00 PM - 4:00 PM to discuss: https://plus.google.com/u/0/events/cstdgkbvp61g7gld8lejsap4j3o

@brasmusson
Copy link
Contributor Author

Superseded by #711.

@brasmusson brasmusson closed this May 19, 2014
@brasmusson brasmusson deleted the spring-example-hook-path branch May 19, 2014 18:26
@lock
Copy link

lock bot commented Oct 25, 2018

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@lock lock bot locked as resolved and limited conversation to collaborators Oct 25, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

NullPointerException in SpringTransactionHooks when upgrading to 1.1.5
4 participants