You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomee.apache.org by Chris Owens <ct...@chris-owens.com> on 2016/04/06 17:19:03 UTC

AppContext for Aquillian tests

I believe I have Arquillian set up according to the openEJB guidelines.
Everything works as expected, but I get warnings about a missing AppContext,
as follows:



I can't figure out where I'm supposed to initialize the application context
for Arquillian.



--
View this message in context: http://tomee-openejb.979440.n4.nabble.com/AppContext-for-Aquillian-tests-tp4678096.html
Sent from the TomEE Users mailing list archive at Nabble.com.

Re: AppContext for Aquillian tests

Posted by Romain Manni-Bucau <rm...@gmail.com>.
Le 19 août 2016 02:29, "ChrisOwens" <ch...@chris-owens.com> a écrit :
>
> Thank you for your help!
>
> I am afraid I don't really understand the answer very well.
>
> Do I need to create a separate Java class containing the rule and then
> manually deploy it as an EJB?
>

Yes

That said the impl warns setup was not the expected one but it works so you
can ignore it too until 7.0.2 is released

> And, how do I get deployment_name? Isn't that something that Arquillian
> creates differently each run?
>

You can force it through @Deployment(name)

> An example would help me a lot.
>
>
>
>
>
> --
> View this message in context:
http://tomee-openejb.979440.n4.nabble.com/AppContext-for-Aquillian-tests-tp4678096p4679800.html
> Sent from the TomEE Users mailing list archive at Nabble.com.

Re: AppContext for Aquillian tests

Posted by ChrisOwens <ch...@chris-owens.com>.
Thank you for your help!

I am afraid I don't really understand the answer very well. 

Do I need to create a separate Java class containing the rule and then
manually deploy it as an EJB? 

And, how do I get deployment_name? Isn't that something that Arquillian
creates differently each run?

An example would help me a lot. 





--
View this message in context: http://tomee-openejb.979440.n4.nabble.com/AppContext-for-Aquillian-tests-tp4678096p4679800.html
Sent from the TomEE Users mailing list archive at Nabble.com.

Re: AppContext for Aquillian tests

Posted by Romain Manni-Bucau <rm...@gmail.com>.
Hello Chris,

this is due to the rules which are not by default enrichable - so the
warning is accurate. To make it enrichable you need to deploy them as an
EJB with the name <deployment name>_<fully qualified name of the class> and
add them in the deployment.

Will check if we can enhance it and probably just skip junit built-in rules.



Romain Manni-Bucau
@rmannibucau <https://twitter.com/rmannibucau> |  Blog
<https://blog-rmannibucau.rhcloud.com> | Old Wordpress Blog
<http://rmannibucau.wordpress.com> | Github <https://github.com/rmannibucau> |
LinkedIn <https://www.linkedin.com/in/rmannibucau> | Tomitriber
<http://www.tomitribe.com> | JavaEE Factory
<https://javaeefactory-rmannibucau.rhcloud.com>

2016-08-16 17:44 GMT+02:00 ChrisOwens <ch...@chris-owens.com>:

> Thanks for the offer!  I pruned it down as small as I could; just one test
> class.
>
> https://github.com/chrisowensboston/scratch.git
>
>
>
>
> --
> View this message in context: http://tomee-openejb.979440.
> n4.nabble.com/AppContext-for-Aquillian-tests-tp4678096p4679766.html
> Sent from the TomEE Users mailing list archive at Nabble.com.
>

Re: AppContext for Aquillian tests

Posted by ChrisOwens <ch...@chris-owens.com>.
Thanks for the offer!  I pruned it down as small as I could; just one test
class. 

https://github.com/chrisowensboston/scratch.git




--
View this message in context: http://tomee-openejb.979440.n4.nabble.com/AppContext-for-Aquillian-tests-tp4678096p4679766.html
Sent from the TomEE Users mailing list archive at Nabble.com.

Re: AppContext for Aquillian tests

Posted by Romain Manni-Bucau <rm...@gmail.com>.
Le 16 août 2016 02:40, "ChrisOwens" <ch...@chris-owens.com> a écrit :
>
> I hate to resurrect this thread, but the warning messages really clutter
up
> the console and make it harder to see what's going on in test runs. How
can
> I suppress them? Or, ideally, how can I remedy the problem that is
> triggering them?
>

Suppress: logger level = off but wouldnt do it since it means something is
wrong in your setup

Fix: check why it is not found. Happy to help you if you push a github
sample

>
>
>
> --
> View this message in context:
http://tomee-openejb.979440.n4.nabble.com/AppContext-for-Aquillian-tests-tp4678096p4679752.html
> Sent from the TomEE Users mailing list archive at Nabble.com.

Re: AppContext for Aquillian tests

Posted by ChrisOwens <ch...@chris-owens.com>.
I hate to resurrect this thread, but the warning messages really clutter up
the console and make it harder to see what's going on in test runs. How can
I suppress them? Or, ideally, how can I remedy the problem that is
triggering them?




--
View this message in context: http://tomee-openejb.979440.n4.nabble.com/AppContext-for-Aquillian-tests-tp4678096p4679752.html
Sent from the TomEE Users mailing list archive at Nabble.com.

Re: AppContext for Aquillian tests

Posted by Romain Manni-Bucau <rm...@gmail.com>.
2016-04-08 17:46 GMT+02:00 Chris Owens <ct...@chris-owens.com>:
> Romain Manni-Bucau wrote
>> AppContext is the tomee representation of the app in the server. Not
>> having
>> it means the app is not deployed.
>
> What is the technical meaning of "deployed" with regard to the embedded
> Arquillian server?

For arquillian nothing, for tomee it means "running". This is probably
an issue in the finder logic due to a wrong classloader at that moment
or another side effect of your setup.

>
> The test case is annotated with
> @RunWith(Arquillian.class)
>
> It has a method CreateDeployment, annotated with @Deployment, that invokes
> Shrinkwrap.create(WebArchive.class)  containing the application classes,
> persistence.xml, openejb-jar.xml, and an empty beans.xml
>
> The tests run successfully.
>
> Thanks for your ongoing patience here.
>
>
>
>
>
> --
> View this message in context: http://tomee-openejb.979440.n4.nabble.com/AppContext-for-Aquillian-tests-tp4678096p4678111.html
> Sent from the TomEE Users mailing list archive at Nabble.com.

Re: AppContext for Aquillian tests

Posted by Chris Owens <ct...@chris-owens.com>.
Romain Manni-Bucau wrote
> AppContext is the tomee representation of the app in the server. Not
> having
> it means the app is not deployed.

What is the technical meaning of "deployed" with regard to the embedded
Arquillian server? 

The test case is annotated with
@RunWith(Arquillian.class)

It has a method CreateDeployment, annotated with @Deployment, that invokes
Shrinkwrap.create(WebArchive.class)  containing the application classes,
persistence.xml, openejb-jar.xml, and an empty beans.xml

The tests run successfully. 

Thanks for your ongoing patience here.





--
View this message in context: http://tomee-openejb.979440.n4.nabble.com/AppContext-for-Aquillian-tests-tp4678096p4678111.html
Sent from the TomEE Users mailing list archive at Nabble.com.

Re: AppContext for Aquillian tests

Posted by Romain Manni-Bucau <rm...@gmail.com>.
AppContext is the tomee representation of the app in the server. Not having
it means the app is not deployed.
Le 8 avr. 2016 00:40, "Chris Owens" <ct...@chris-owens.com> a écrit :

> Romain Manni-Bucau wrote
> > I guess it is due to rule integration 1nd the fact this rule can be in a
> > higher classloader than the app. Maybe force junit classes to be loaded
> > (openejb.classloader.forced-load=org.junit in properties in
> > arquillian.xml)
>
> Thank you Romain, but forcing the junit classes to load did not solve the
> problem.
>
> What controls the creation of an appContext in an Arquillian / embedded
> TomEE run?  I can't find relevant sources because I don't really know where
> to look.
>
> /c
>
>
>
> --
> View this message in context:
> http://tomee-openejb.979440.n4.nabble.com/AppContext-for-Aquillian-tests-tp4678096p4678108.html
> Sent from the TomEE Users mailing list archive at Nabble.com.
>

Re: AppContext for Aquillian tests

Posted by Chris Owens <ct...@chris-owens.com>.
Romain Manni-Bucau wrote
> I guess it is due to rule integration 1nd the fact this rule can be in a
> higher classloader than the app. Maybe force junit classes to be loaded
> (openejb.classloader.forced-load=org.junit in properties in
> arquillian.xml)

Thank you Romain, but forcing the junit classes to load did not solve the
problem. 

What controls the creation of an appContext in an Arquillian / embedded
TomEE run?  I can't find relevant sources because I don't really know where
to look.

/c



--
View this message in context: http://tomee-openejb.979440.n4.nabble.com/AppContext-for-Aquillian-tests-tp4678096p4678108.html
Sent from the TomEE Users mailing list archive at Nabble.com.

Re: AppContext for Aquillian tests

Posted by Romain Manni-Bucau <rm...@gmail.com>.
I guess it is due to rule integration 1nd the fact this rule can be in a
higher classloader than the app. Maybe force junit classes to be loaded
(openejb.classloader.forced-load=org.junit in properties in arquillian.xml)
Le 6 avr. 2016 23:23, "Chris Owens" <ct...@chris-owens.com> a écrit :

> I believe I have Arquillian set up according to the openEJB guidelines.
> Everything works as expected, but I get warnings about a missing
> AppContext,
> as follows:
>
>
>
> I can't figure out where I'm supposed to initialize the application context
> for Arquillian.
>
>
>
> --
> View this message in context:
> http://tomee-openejb.979440.n4.nabble.com/AppContext-for-Aquillian-tests-tp4678096.html
> Sent from the TomEE Users mailing list archive at Nabble.com.
>