Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<blockquote> <p>(...) The standard recommended solution is to add the glassfish-embedded-all artifact as the first project dependency with test scope</p> </blockquote> <p>Indeed, you need an implementation like <code>glassfish-embedded-all</code> or <code>glassfish-embedded-web</code> if you're only using the web profile, which seems to be your case (I didn't know that the web profile was providing <code>EJBContainer</code> by the way).</p> <p>And to be precise, this artifact doesn't have to be the "first" dependency but it <strong>must</strong> be declared <strong>before</strong> the <code>javaee-api</code> artifact.</p> <blockquote> <p>So, is there a Maven repository that Nexus will be able to index to give me the glassfish-embedded-all artifact? </p> </blockquote> <p>I couldn't reproduce the issue with <a href="http://download.java.net/maven/glassfish/" rel="noreferrer">http://download.java.net/maven/glassfish/</a> but it appears that JBoss Nexus repository does have it (probably because they use it in <a href="http://jboss.org/arquillian" rel="noreferrer">Arquillian</a>):</p> <pre><code>&lt;repository&gt; &lt;id&gt;jboss-public-repository-group&lt;/id&gt; &lt;name&gt;JBoss Public Maven Repository Group&lt;/name&gt; &lt;url&gt;https://repository.jboss.org/nexus/content/groups/public&lt;/url&gt; &lt;/repository&gt; </code></pre> <blockquote> <p>is this even the correct way to go about unit testing EJBs?</p> </blockquote> <p>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 <code>EJBContainer</code> API is really great and perfectly fine.</p> <h3>See also</h3> <ul> <li><a href="http://blogs.oracle.com/arungupta/entry/totd_128_ejbcontainer_createejbcontainer_embedded" rel="noreferrer">TOTD #128: EJBContainer.createEJBContainer: Embedded EJB using GlassFish v3</a></li> <li><a href="http://ctpjava.blogspot.com/2009/10/unit-testing-ejbs-and-jpa-with.html" rel="noreferrer">Unit Testing EJBs and JPA with Embeddable GlassFish</a></li> <li><a href="http://blogs.oracle.com/alexismp/entry/testing_ejb_3_1_s" rel="noreferrer">Using the EJBContainer API with or without Maven (but with GlassFish v3)</a></li> <li><a href="http://www.adam-bien.com/roller/abien/entry/embedding_ejb_3_1_container" rel="noreferrer">Embedding EJB 3.1 Container Into Your Unit Tests - Boot Time: 5 Seconds</a></li> <li><a href="http://www.adam-bien.com/roller/abien/entry/unit_testing_ejb_3_1" rel="noreferrer">Unit Testing EJB 3.1 ...When 0.8 Seconds Are Too Long</a> for a unit test example</li> <li>The <a href="http://jboss.org/arquillian" rel="noreferrer">Arquillian</a> project</li> </ul>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload