java ee - WildFly: How to test EJB using embedded container? -


i'm doing first java ee project , want preform test. searched , found since ejb 3.1, there's possibility of using embedded ejb container test business layer. i'm using wildfly haven't found how configure embedded container.

so, how configure embedded container , test ejbs 3.1+ wildfly?

i appreciate help!

you must use framework arquillian jboss http://www.mastertheboss.com/jboss-frameworks/arquillian/arquillian-tutorial.

what framework this: in background instance of jboss created. deployed there can run ejb's or servlets on "background" container.

it not easy configure it, recommend start jboss tools eclipse. code looks this:

@deployment public static archive<?> createtestarchive() {      return shrinkwrap.create(webarchive.class, "test-demo.war")             .addasresource("meta-inf/persistence.xml")             .addaswebinfresource(emptyasset.instance, "beans.xml"); } 

i not favor approach, it's separate deployment, need understand structure of war , ejb packages , other details.

it's better, ejb's , jpas , servlet beans light wrappers around normal java classes (pojo's), real logic resides. can use plain unit tests test those.


Comments

Popular posts from this blog

IF statement in MySQL trigger -

c++ - What does MSC in "// appease MSC" comments mean? -

javascript - Blogger related post gadget image Resize s72-c [ Need Expert Help ] -