Any suggestion for unit testing of cross-depended EJB projects
schua Jun 16, 2013 11:39 PMHi all,
I am a newbie to arquillian and find it is interesting.
I follow the tutorial of Getting Start to create a simple junit test with Glassfish 3.1 embedded container.
I also tried to introduce more complexities by adding session bean, entity bean, DAO classes and connection pool.
I can get the EJB and data source injected and all test cases are successful.
It is awesome and exciting.
However, when I back to real world, the story is a bit frustrating.
We have tens of EJB projects and they have cross dependencies.
I do some configuration for one EJB project as tutorial and set the deployment method as following. (Please refer to atteched test case for more details)
@Deployment
public static JavaArchive createDeployment() {
return ShrinkWrap.create(JavaArchive.class)
.addPackages(true, "com.aa.bb.stockmgmt.cashlevelservice", "com.aa.bb.stockmgmt.common", "com.aa.bb.stockmgmt.stockservice")
.addAsManifestResource("ejbModule/META-INF/ejb-jar.xml", "ejb-jar.xml")
.addAsManifestResource("ejbModule/META-INF/MANIFEST.MF", "MANIFEST.MF")
.addAsManifestResource("ejbModule/META-INF/persistence.xml", "persistence.xml");
}
I get errors when start testing. (Please refer attached startup failure log file for complete errors)
Jun 17, 2013 11:18:01 AM org.apache.catalina.core.StandardContext callServletContainerInitializers
SEVERE: PWC1420: Error invoking ServletContainerInitializer com.sun.jersey.server.impl.container.servlet.JerseyServletContainerInitializer
Throwable occurred: java.lang.NoSuchMethodError: javax/servlet/ServletContext.getServletRegistrations()Ljava/util/Map;
Is there anything do with the dependences of other projects?
If I package all EJB projects (JAR) into an EAR file in deployment method, test cases could start without problem.
But it is more like a integration testing not a unit test.
Is there any suggestion for unit testing with arquillian for my scenarios?
Thanks a lot.
Flik