-
-
Notifications
You must be signed in to change notification settings - Fork 2k
[DeltaSpike] Add ObjectFactory for Apache DeltaSpike #1616
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
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could you add a README.md
to explain how this module should be used? It doesn't appear to be trivial.
deltaspike/src/main/java/cucumber/runtime/java/deltaspike/DeltaSpikeObjectFactory.java
Outdated
Show resolved
Hide resolved
849e1bc
to
e4970d5
Compare
Have found this old pr #971 this should be deprecated with this one? |
I'm happy to take both PR's. While CDI containers are used only by a fraction of the users they're relatively low maintenance and have a relatively high number of contributors. I do however have a rather limited knowledge of either so I'd like both implementations to be correct, in line with the frameworks expected use (so as to limit future questions/issues) and focused on the basic use case. For advanced use cases I expect that people re-implement the factory. At least until we come up with something better. Also if you can both review and approve each others PR's then I can have some confidence that both implementations are good. |
I've pushed some fixes so it will work wit the latest 5.0.0-SNAPSHOT. Would you mind adding a short guide on how to use this module in the read me? |
sry complete forgotten this pr, will try to add requested guide next week. for 5.0.0 I think this objectfactory should replace weld and openejb do you think I should update this pr to do this also? |
Cheers. Generally speaking its good practice not to remove something withouth a deprecation period. It also doesn't hurt to keep weld around for a bit. So leave it alone for now. |
Side note: this does not fully superseed openejb due to DD impl but an EJBContainer based impl could happily do it and enable to support tomee at the same time - can also be done behind DS API if you want to do the pr ;). |
That'd be quite useful. If you're interested in doing this please do go ahead. |
after reading cucumber/docs#369, do you think it will be better to replace |
Makes sense if configurable cause any setup can break tests from my experience. Often request is started by default but you can need session or need to not have request commonly too. Depends how you write it and which container you use sometimes. Can make more sense to decorate step instance with an interceptor starting/stopping scope at request (@scopes on the step ?). |
Cucumber currently puts step definitions in the container. Because step definitions generally speaking get dirty the sensible default would be to restart the container completely. If this operation is expensive you may also consider removing only the step definition classes (everything provided by |
Operation is cheap but it is a state app code can rely on, this is why it must be configurable IMO. That said, can be a "given" statement with implicit close. |
I'm not following. Each scenario should run in an clean context. The following feature should always pass no matter what FOO might be.
Do you agree? |
Depending how you run or impl each step context can be different. Typically a client step will have a request context per http request whereas a server step can share it state within the scenario. This is why it must be configurable. |
What are sever steps and client steps? Could you write some scenarios to show the difference.
I don't see how this is relevant. Could you write some scenarios to show when it matters? |
|
Let's start with no scope activated (basically selenium). As defaults go that is pretty sensible. Then we can work out how to activate other scopes, but given that object factory needs to start the context before the scenario can start I don't think it will be possible. Unless you can change the scope once the factory has started. In that case you tag a scenario with the required scope and used tagged hooks to setup that scope. |
allow to replace cdi-impl without any change at cucumber.
2e7d8fe
to
29e1362
Compare
rebased to master and add a readme, but somebody with better English should take a look. |
deltaspike/src/main/java/io/cucumber/deltaspike/DeltaSpikeObjectFactory.java
Outdated
Show resolved
Hide resolved
29e1362
to
0775763
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good to me! Anything you'd like to add before I merge this?
Currently I do not see anything missing, please merge it and hope we find some user which get some input what we have forgotten. |
All merged. Thanks |
Summary
objectfactory for cdi with deltaspike
Details
Deltaspike abstract underlining cdi-container. so it is possible to change cdi-impl. only by replace the dependencies.
Motivation and Context
No longer to modules for cdi, only one with can replace the old one (weld and openejb) and in the same time support for another cdi-impl (OpenWebBeans).
How Has This Been Tested?
Add Testcases and profiles to change cdi-impl.
Screenshots (if appropriate):
Types of changes
Checklist: