-
-
Notifications
You must be signed in to change notification settings - Fork 946
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
#2399 Add OSGi Declarative Services as Component Model #2400
base: main
Are you sure you want to change the base?
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.
Thanks for the PR @ktor. I have extremely limited knowledge with OSGi, so I would trust your judgement here.
I've left some comments, which I think need addressing.
I have a trouble creating OSGi container in the test so it could check if references are properly binded as it is done for Spring Component Model implementation. Maybe it is too much trouble anyways and there is a better / simpler way to test if it is correctly generated. Please advise.
Before merging this we should have tests for this. Otherwise, we won't be able to maintain this. I don't know what kind of troubles you had. I guess it is something with our custom test harness and our custom class loaders. I would suggest checking CompilingStatement
, most likely you'll need to add the reference to the jar in the same way it is done for spring-beans
.
processor/src/main/java/org/mapstruct/ap/internal/processor/DsComponentProcessor.java
Outdated
Show resolved
Hide resolved
processor/src/main/java/org/mapstruct/ap/internal/processor/DsComponentProcessor.java
Outdated
Show resolved
Hide resolved
Thank you for code review @filiphr. I've made the changes you've proposed and added simple test to confirm that generated mappers contain required annotations. So far I had no luck with integration test where junit would invoke simple osgi container that would confirm that components are initialized and bind correctly but the DS annotations are pretty simple. I believe the simple test could suffice if maintained: would only change once OSGi DS specification changes (very rare). |
Changed to draft because after changes in |
Can you please show me an example test case that I can look into, to see why it isn't working in our test setup. We do have some complex setup of course 😄 |
80ecb53
to
9387774
Compare
…sgi-ds component mode annotation generation, what is missing are injection tests with some king of osgi runtime that would be invoked from the tests as it is done for spring, all places where that is missing are annotated with "TODO osgi" comment
Hi @filiphr, I've finished the "simple" tests, meaning I've copied all the tests from spring decorator and injection strategy to All places that I've failed to test are now commented with TODO osgi. Those are methods like
|
Hello @cschneider, Thank you for your presentation: https://www.youtube.com/watch?v=9WGbnfa2BaM. I write to you in hope that you could help me to implement OSGi DS test for services generated with mapstruct mapper generator. I would be very grateful if you could take a look at one particular test: https://github.com/mapstruct/mapstruct/pull/2400/files#diff-54dfa14bd76fc710acc684c990077482d0fc184f6b440d4e5b05b1d8d22666ccR56 and suggest a way to test if OSGi DS annotations generated with the mapstruct tooling would work in osgi container supporting OSGi R7. Classes generated with Thank you! |
It is work in progress. I've created the pull request to collaborate on the code. It is missing tests but otherwise generates OSGi DS annotations correctly, at least for my use case.
I have a trouble creating OSGi container in the test so it could check if references are properly binded as it is done for Spring Component Model implementation. Maybe it is too much trouble anyways and there is a better / simpler way to test if it is correctly generated. Please advise.
Example of usage
Factory
Mapper
MapperImpl