addressalign-toparrow-leftarrow-rightbackbellblockcalendarcameraccwcheckchevron-downchevron-leftchevron-rightchevron-small-downchevron-small-leftchevron-small-rightchevron-small-upchevron-upcircle-with-checkcircle-with-crosscircle-with-pluscontroller-playcredit-cardcrossdots-three-verticaleditemptyheartexporteye-with-lineeyefacebookfolderfullheartglobe--smallglobegmailgooglegroupshelp-with-circleimageimagesinstagramFill 1launch-new-window--smalllight-bulblinklocation-pinm-swarmSearchmailmessagesminusmoremuplabelShape 3 + Rectangle 1ShapeoutlookpersonJoin Group on CardStartprice-ribbonprintShapeShapeShapeShapeImported LayersImported LayersImported Layersshieldstartickettrashtriangle-downtriangle-uptwitteruserwarningyahoo

Re: [ljc] Testing code that should be in a container, but isn't.

From: James G.
Sent on: Monday, December 24, 2012 12:29 PM
You add your classes into a Shrinkwrap archive instance, and return that instance in a test annotated @Deployment. That archive is then deployed into a Arquillian container adapter (via some Maven magic). Those container adapters are embedded/managed/remote Glassfish, TomEE, etc.

One of the problems I've had is repeatedly running integration tests within a remote glassfish instance - within a couple of runs you end up having to restart GF due to permgen issues. I've switched to using a managed instance instead and made this work inside a Jenkins computer.

Works well but could always be faster :) Shrinkwrap is itself seeing some API changes particularly for resolving maven dependencies so be careful with the documentation out there

James



On 23 December[masked]:41, Craig Silk <[address removed]> wrote:
JPA, EJB and CDI are the main reasons.

I'm looking into Arquillian but will also check out embedded glassfish.

Thanks.


On Fri, Dec 21, 2012 at 7:57 AM, Stephen Souness <[address removed]> wrote:
Have you considered using embeddable Glassfish for these unit tests?

http://embedded-glassfish.java.net

I would again query why you're using GlassFish, as it shouldn't be required for the JAX-RS functionality.


--
Stephen


From: [address removed]
To: [address removed]
Subject: [ljc] Testing code that should be in a container, but isn't.
Date: Wed, 19 Dec[masked]:36:40 -0500

Hi all,

I've run into an issue which some of you must have come across before. I'd love to hear a few suggestions as to what to do next if possible.

I'm using JPA inside of GlassFish. I've got some JUnit tests that I want to run against the JPA POJO's that I've created. I'm trying to run the tests from Eclipse but I'm being told (by way of an Exception) that my datasource cannot be found. I'm pointing my persistence.xml to a JNDI resource inside of GlassFish (a connection pool).

I'm sure that I'm getting the error because at the time of the test execution the code isn't in the GlassFish container.

What methods have people used to overcome this issue?

Stackoverflow seems to suggest that I should be mocking my database locally or using some sort of integration tool.

Any thoughts?


Thanks
Craig




--
Please Note: If you hit "REPLY", your message will be sent to everyone on this mailing list ([address removed])
This message was sent by Craig Silk ([address removed]) from LJC - London Java Community.
To learn more about Craig Silk, visit his/her member profile




--
Please Note: If you hit "REPLY", your message will be sent to everyone on this mailing list ([address removed])
This message was sent by Stephen Souness ([address removed]) from LJC - London Java Community.
To learn more about Stephen Souness, visit his/her member profile





--
Please Note: If you hit "REPLY", your message will be sent to everyone on this mailing list ([address removed])
This message was sent by Craig Silk ([address removed]) from LJC - London Java Community.
To learn more about Craig Silk, visit his/her member profile

People in this
Meetup are also in:

Sign up

Meetup members, Log in

By clicking "Sign up" or "Sign up using Facebook", you confirm that you accept our Terms of Service & Privacy Policy