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, ie 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.
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.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.