1

I'm trying to test with Arquillian a Java RESTful API (JAX-RS) in a war package. The API in the war calls a method of an EJB that's located in a jar.

To test this, I created an Arquillian test that calls the war method. The test is located in a test folder inside the war. The problem is that Arquillian complains that it doesn't find a library that's called internally in the jar (note that this library is not in the pom.xml). I prefer not to add an EJB dependency in the war, how to add this library to Arquillian's deployment?

@Deployment
public static WebArchive createDeployment() {
    return ShrinkWrap.create(WebArchive.class, "test.war")
        .addClass(DAOException.class)
        .addClass(BeanException.class)
        .addPackages(true, "org.jooq") // <-- I had to copy this library to the war
        .setWebXML("WEB-INF/web.xml")
        .addAsDirectories("/myfolder/mypackage")  // <-- this doesn't work
        .addPackages(true, "ejb.package");
}

UPDATE

I found this here and it would work for me if the importFrom gets a directory of files instead of a jar file.

JavaArchive roundtrip = ShrinkWrap
  .create(ZipImporter.class, "myPackageRoundtrip.jar")
  .importFrom(new File("/home/alr/Desktop/myPackage.jar"))
  .as(JavaArchive.class);
ps0604
  • 1,227
  • 23
  • 133
  • 330

0 Answers0