I'm trying to set up integrated testing for my simple Java EE app that uses JAX-RS to expose a REST service (it's also an EJB) and JPA to store the underlying data, and I continue to struggle finding a solution that doesn't require manually setting up an external container/application server. I've done a lot of searching here and on the web for solutions, and ended up burning far too many weeks to get GlassFish 3.1.2 Embedded working, which I succeed doing until the final straw a week ago: conflicting documentation and bugs trying to create users to test security. Drat! I looked at JBoss AS 7, but the embedded product looks unsupported. I then tried rolling my own using a servlet container (Jetty, Grizzly, and Simple) to directly run Jersey. (I was eventually planning on adding in EclipseLink and Derby embedded.) All of these presented unexpected and blocking challenges in setting up and running the most basic JUnit tests; I couldn't get Jetty to run JAX-RS, and Grizzly didn't have HTTP Basic authentication, for example. Double drat! I then looked at Arquillian, but couldn't find JBoss AS 7 listed in their container adapters.
I have two questions: 1) This seems to be far, far harder to get working than I expected. If I assume it's not just me (please, it's not just me!), then why is it so hard? I'm wondering if the entire Java EE stack with its 30+ APIs is a house of cards that's very difficult to get stacked up right and doesn't lend itself to being shoved into a single jar. Or maybe people prefer to do integration testing on an external ("local"?) container that they start before running the tests.
Question 2): What is the standard terminology for the different kinds of test-container configurations? It seems inconsistent. For example, http://mvnrepository.com/artifact/org.jboss.arquillian.container lists "remote", "embedded", "managed", and "local", but yet I found "in-container" and "out-of-container" testing mentioned elsewhere.
Rather than use space on details on what failed above, I'm ready to listen to what this experience is trying to tell me, so I would really appreciate hearing what worked for you. Thanks in advance!