Question

After creating the ShrinkWrap I am able to see the file structure by using this line of code

System.out.println(webArchive.toString(true));

I wonder if is it possible to see the content of a specific file inside shrinkWrap, for example I want too see the content of my persistence.xml after creating the shrinkWrap.

is there any specific piece of code to print the content of files inside shrinkWrap? or is there any place in file system to look for the temporary shrinkWrap file and explore it's files and contents

Was it helpful?

Solution

Put the part reported below in your arquillian.xml, as described in the guide. This way you will be able to browse deployed test archive. ShrinkWrap on its own does not provide such inspection feature.

This is the XML you should add to your arquillian.xml file:

<engine>
    <property name="deploymentExportPath">target/deployments</property>
</engine>

OTHER TIPS

A quick solution (if you don't want to always copy under target for an Arquillian test or if you use ShrinkWrap independently of Arquillian) is to use the ZipExporter view:

import org.jboss.shrinkwrap.api.exporter.ZipExporter;
...

WebArchive archive = ShrinkWrap.create(WebArchive.class, "foo.war")
    ... // add classes and libraries ...
    .addClass(Foo.class);

archive.as(ZipExporter.class).exportTo(new File("/tmp/foo.war"), true);

See also: http://arquillian.org/guides/shrinkwrap_introduction/#working_with_file_content

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