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

From: Craig S.
Sent on: Thursday, January 3, 2013 1:01 PM
Lots of interesting replies.

I've decided to go with arquillian as it looks like the best thing around at the moment for this type of job.

Thanks


On Mon, Dec 24, 2012 at 3:40 PM, James Green <[address removed]> wrote:
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





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

Our Sponsors

  • Our Blog

    Read the latest news from the LJC

  • RecWorks Ltd

    Fixing Tech Recruitment using the Power of Community

  • jClarity

    Java/JVM Performance Analysis Tools & mentoring for Java related matters

  • LJC Aggrity

    Our LJC Aggrity site contains blog posts from our members

  • LJC Book Club

    Our Book club with book reviews from our members

  • Devoxx UK

    Java Community Conference, in collaboration with the LJC 12/13 Jun 14

  • SkillsMatter

    "Host, help organise, promote, film many of our meetings."

  • New Relic

    New Relic makes sense of billions of metrics a day in real time.

  • Hazelcast

    Hazelcast is the leader in operating in-memory computing.

  • Packt Publishing

    A publishing company specializing on specific technologies and solutions

  • Java.Net

    We are an official Java User Group recognised by Oracle's JUG program

  • JRebel

    Free 3 month J-Rebel license.

  • O'Reilly

    40% discount on printed books and 50% on e-books.

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