Question

I want to use Arquillian + Selenium for testing my JSF Pages. My Project structure is as follows:

/src/main/java - my java classes
/src/main/resources
/src/main/resources/META-INF - all imgs, css, js and custom composite JSF components
/src/main/webapp/pages - my xhtml pages
/src/main/webapp/WEB-INF - descriptors, JSF template

I want to build a test deployment archive with all my needed stuff, i.e. all resources, the particular xhtml page I want to test, WEB-INF directory. I've managed to copy all of them except of the META-INF resources. Is there any method how to tell shrinkwrap to take the whole META-INF directory into the deployment? Thank you.

No correct solution

OTHER TIPS

Another solution (which can be found at http://arquillian.org/guides/functional_testing_using_graphene/)

archive.merge(ShrinkWrap.create(GenericArchive.class)
   .as(ExplodedImporter.class)
   .importDirectory(WEBAPP_SRC).as(GenericArchive.class),
   "/", Filters.include("META-INF\\.*\\.xml"));

You could do something like:

File[] files = new File("src/main/resources/META-INF").listFiles();
WebArchive war = ShrinkWrap.create(WebArchive.class, "test.war");
for (File file : files) {
    war.addAsManifestResource(file);
}
war.writeTo(System.out, Formatters.VERBOSE);

Assuming you have the following files in src/main/resources/META-INF:

beans.xml
configuration1.xml
configuration2.xml

... it would output:

test.war:
/META-INF/
/META-INF/beans.xml
/META-INF/configuration2.xml
/META-INF/configuration1.xml

The path passed to the File constructor might need to be adjusted if you have a nested multi-module project.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top