7

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

4

2 回答 2

12

将下面报告的部分放入您的 arquillian.xml,如指南中所述。这样,您将能够浏览已部署的测试存档。ShrinkWrap 本身不提供此类检查功能。

这是您应该添加到 arquillian.xml 文件中的 XML:

<engine>
    <property name="deploymentExportPath">target/deployments</property>
</engine>
于 2013-05-23T07:14:35.533 回答
2

一个快速的解决方案(如果您不想总是在targetArquillian 测试下复制,或者如果您独立于 Arquillian 使用 ShrinkWrap)是使用ZipExporter视图:

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);

另见: http ://arquillian.org/guides/shrinkwrap_introduction/#working_with_file_content

于 2020-05-17T18:01:40.183 回答