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

Run QuarkusTestResource in the runtime ClassLoader #7897

Merged
merged 1 commit into from
Mar 17, 2020

Conversation

stuartwdouglas
Copy link
Member

This is only for QuarkusTest, QuarkusUnitTest will need
a slightly different solution if we decide it is a problem, as
the lifecycles don't match.

Fixes #7880

This is only for QuarkusTest, QuarkusUnitTest will need
a slightly different solution if we decide it is a problem, as
the lifecycles don't match.

Fixes quarkusio#7880
@geoand
Copy link
Contributor

geoand commented Mar 17, 2020

@lkrzyzanek @aldettinger @andrejpetras any chance you can test this?

@lkrzyzanek
Copy link
Contributor

@geoand how can I get build of this PR? Is there a SNAPSHOT maven build to try?

@geoand
Copy link
Contributor

geoand commented Mar 17, 2020

@lkrzyzanek you will need to build the PR locally and use 999-SNAPSHOT as the quarkus version in your code

@andrejpetras
Copy link
Contributor

@geoand
I created branch with this PR: https://github.com/andrejpetras/quarkus/tree/quarkustest
Test project: https://github.com/andrejpetras/quarkus-test

1.2.1.Final -> OK

[INFO] Running org.acme.rest.json.FruitResourceTest
############### Resource started! ###################
2020-03-17 11:40:49,315 WARN  [io.qua.boo.res.mav.MavenRepoInitializer] (main) Settings problem encountered at /home/andrej/.m2/settings.xml
2020-03-17 11:40:51,786 INFO  [io.quarkus] (main) Quarkus 1.2.1.Final started in 0.446s. Listening on: http://0.0.0.0:8081
2020-03-17 11:40:51,787 INFO  [io.quarkus] (main) Profile test activated. 
2020-03-17 11:40:51,787 INFO  [io.quarkus] (main) Installed features: [cdi, resteasy, resteasy-jackson]
Find class: org.acme.rest.json.FruitResourceTest
Find field: service
Find annotation: @org.acme.rest.json.DockerService(value="test")
RESULT: test
[INFO] Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 3.346 s - in org.acme.rest.json.FruitResourceTest

1.3.0.CR2, 1.3.0.Final -> Error

[INFO] Running org.acme.rest.json.FruitResourceTest
############### Resource started! ###################
2020-03-17 11:41:45,903 WARN  [io.qua.boo.res.mav.MavenRepoInitializer] (main) Settings problem encountered at /home/andrej/.m2/settings.xml
2020-03-17 11:41:48,372 INFO  [io.quarkus] (main) Quarkus 1.3.0.Final started in 1.301s. Listening on: http://0.0.0.0:8081
2020-03-17 11:41:48,372 INFO  [io.quarkus] (main) Profile test activated. 
2020-03-17 11:41:48,372 INFO  [io.quarkus] (main) Installed features: [cdi, resteasy, resteasy-jackson]
Find class: org.acme.rest.json.FruitResourceTest
Find field: service
Find annotation: null
Find class: org.acme.rest.json.AbstractTest
[ERROR] Tests run: 1, Failures: 0, Errors: 1, Skipped: 0, Time elapsed: 2.872 s <<< FAILURE! - in org.acme.rest.json.FruitResourceTest
[ERROR] testHelloEndpoint  Time elapsed: 0.259 s  <<< ERROR!
java.lang.NullPointerException
	at org.acme.rest.json.FruitResourceTest.testHelloEndpoint(FruitResourceTest.java:17)

[PR] -> OK

[INFO] Running org.acme.rest.json.FruitResourceTest
############### Resource started! ###################
2020-03-17 11:42:30,586 WARN  [io.qua.boo.res.mav.MavenRepoInitializer] (main) Settings problem encountered at /home/andrej/.m2/settings.xml
2020-03-17 11:42:37,760 INFO  [io.quarkus] (main) Quarkus 999-SNAPSHOT started in 1.347s. Listening on: http://0.0.0.0:8081
2020-03-17 11:42:37,761 INFO  [io.quarkus] (main) Profile test activated. 
2020-03-17 11:42:37,761 INFO  [io.quarkus] (main) Installed features: [cdi, resteasy, resteasy-jackson]
Find class: org.acme.rest.json.FruitResourceTest
Find field: service
Find annotation: @org.acme.rest.json.DockerService(value="test")
RESULT: test
[INFO] Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 8.305 s - in org.acme.rest.json.FruitResourceTest

@geoand
Copy link
Contributor

geoand commented Mar 17, 2020

@andrejpetras excellent, that's what we expected to see :)

@lkrzyzanek
Copy link
Contributor

Tried PR and tests works for me as well now.
Thank you guys!

@geoand
Copy link
Contributor

geoand commented Mar 17, 2020

Thanks for checking @lkrzyzanek!

@geoand geoand merged commit 1a446a8 into quarkusio:master Mar 17, 2020
@gsmet gsmet added this to the 1.3.1.Final milestone Mar 21, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/core area/devtools Issues/PR related to maven, gradle, platform and cli tooling/plugins area/documentation area/kubernetes area/testing
Projects
None yet
Development

Successfully merging this pull request may close these issues.

QuarkusTestResourceLifecycleManager / injecting - getAnnotation stopped working in 1.3.0
5 participants