I'm trying to implement an integration test for a non-trivial maven-built JEE5 EAR with Arquillian and embedded OpenEJB.
This EAR uses "META-INF/application.xml" to define the list of EJB moduls and the library directory (here WebLogics "APP-INF/lib/" is used). Due to the missing support of Arquillians embedded OpenEJB container adapter for the "application.xml" DD I have to convert the EAR into a WAR (libraries / EJB modules in "WEB-INF/lib/" and resources in "Web-INF/classes").
Now I'm wondering how to implement this conversion effectively?
Especially I'm interested in a solution for dealing with the ZipFileEntryAsset instances which are used for the content of the EnterpriseArchive returned by the following statement:
EnterpriseArchive ear = Maven.resolver().loadPomFromFile("pom.xml").resolve("com.acme:product:ear:?").withoutTransitivity().asSingle(EnterpriseArchive.class);
My current approach is as follows:
To convert a single ZipFileEntryAsset into an ArchiveAsset I'm using the following workaround (here the variable "libNode" holds the content node with the ZipFileEntryAsset retrieved from the EARs library directory "/APP-INF/lib/"):
JavaArchive libJar = ShrinkWrap.create(ZipImporter.class, libNode.getPath().get().substring("/APP-INF/lib/".length())) .importFrom(libNode.getAsset().openStream()).as(JavaArchive.class);
Is there a better solution for this?