i currently I am developing a test and I want to use Arquillian Warp.
Currently I am using Arquillian 1.1.7, latest Warp and Managed Apache TomEE
1.7.1. The test is as simple as:
@RunWith(Arquillian.class)@WarpTestpublic class RestUploadTest {
@Deployment
public static final WebArchive deployment() {
return ShrinkWrap
.create(WebArchive.class)
.addClasses(BoundedInputStream.class, IOUtil.class,
P12Resource.class, TemporaryFolder.class)
.addAsWebInfResource(EmptyAsset.INSTANCE, "beans.xml")
.addAsLibraries(
Maven.resolver().loadPomFromFile("pom.xml")
.resolve("org.glassfish:javax.json")
.withTransitivity().as(JavaArchive.class));
}
@ArquillianResource
URL baseUrl;
@Test
@RunAsClient
public void shouldUploadContent() {
Warp.initiate(() -> {
URI endpoint = UriBuilder.fromPath(baseUrl.toExternalForm())
.path(P12Resource.class).path("chunkedUpload").build();
given().request().body("This is a test file.".getBytes())
.post(endpoint).then().assertThat()
.body("uploadId", notNullValue()).and()
.body("offset", notNullValue());
}).inspect(new Inspection() {
private static final long serialVersionUID = 1L;
@Inject
TemporaryFolder temporaryFolder;
@AfterServlet
public void assertCreatedFile() {
System.out.println(temporaryFolder.getRoot());
}
});
}
}
The problem is that temporaryFolder is not injected and its value is null.
Note that TemporaryFolder is a class that I have developed and injected
correctly on my business class (EJB).
Talking with Aslak noticed me that it can be something related with how
TomEE enrichment API but of course he is not 100% sure (
http://discuss.arquillian.org/t/arquillian-warp-and-cdi-in-inspection/170)
Also I can share code without any problem.
Thank you so much.
Alex.