I\'ve been trying to set my application up so that I can unit test it\'s EJBs all day but I can\'t seem to get past what seems like a really simple problem.
I have a sta
(...) The standard recommended solution is to add the glassfish-embedded-all artifact as the first project dependency with test scope
Indeed, you need an implementation like glassfish-embedded-all
or glassfish-embedded-web
if you're only using the web profile, which seems to be your case (I didn't know that the web profile was providing EJBContainer
by the way).
And to be precise, this artifact doesn't have to be the "first" dependency but it must be declared before the javaee-api
artifact.
So, is there a Maven repository that Nexus will be able to index to give me the glassfish-embedded-all artifact?
I couldn't reproduce the issue with http://download.java.net/maven/glassfish/ but it appears that JBoss Nexus repository does have it (probably because they use it in Arquillian):
<repository>
<id>jboss-public-repository-group</id>
<name>JBoss Public Maven Repository Group</name>
<url>https://repository.jboss.org/nexus/content/groups/public</url>
</repository>
is this even the correct way to go about unit testing EJBs?
Unit tests are typically done outside-container and in isolation (using a Mocking framework) so I wouldn't call that unit testing. But for integration/functional testing (in-container), the EJBContainer
API is really great and perfectly fine.