Hi Guys,
I'm using Arquillian to test my JSF beans in an embedded Tomcat 7.0.27 container. Problem is, I'm getting this exception when I run maven test: see
http://pastebin.com/Ewiwe2CQHere's my Unit Test Class:
@RunWith(Arquillian.class)
public class UserBeanTest {
@Deployment
public static WebArchive createDeployment() {
MavenDependencyResolver resolver = DependencyResolvers.use(MavenDependencyResolver.class).loadMetadataFromPom("pom.xml");
WebArchive war = ShrinkWrap.create(WebArchive.class)
.setWebXML(new File("src/main/webapp/WEB-INF/web.xml"))
.addAsWebResource(new File("src/main/webapp/WEB-INF/faces-config.xml"), "/WEB-INF/faces-config.xml")
.addClass(UserBean.class);
war.addAsWebResource(new File("src/main/webapp", "user.xhtml"));
//add these libraries only for non JEE containers (e.g. tomcat)
war.addAsLibraries(resolver.artifact("org.apache.myfaces.core:myfaces-api:2.1.5").resolveAsFiles());
war.addAsLibraries(resolver.artifact("org.apache.myfaces.core:myfaces-impl:2.1.5").resolveAsFiles());
return war;
}
@Test
@InitialPage("/user.jsf")
public void should_create_greeting(JSFServerSession server, JSFClientSession client) {
//some tests here
}
}
The problem seems to occur during deployment of the WebArchive when the Arquillian tests run, and not when my @Test methods run. I was able to make things work by using managed tomcat. But I'd prefer an embedded tomcat though. Has anyone had better luck with this?
Best Regards,
Paul