-
1. Re: Guidance in using Arquillian with Wildfly9
jvskriubakken Feb 20, 2017 3:54 PM (in response to jvskriubakken)So, here is an update on my current approach
1. I've minimised the @Deployment method with the use of the MavenImporter:
@Deployment
public static Archive createDeployment() {return ShrinkWrap
.create(MavenImporter.class)
.loadPomFromFile("pom.xml")
.importBuildOutput()
.as(WebArchive.class)
.addAsWebInfResource("test-ds.xml", "test-ds.xml");
}I'm pretty happy with firing up the whole application with such few lines. However, one obstacle is left: I would really like to avoid duplicating my persistence.xml which resides in my dao module (containing JPA entities and daos) as my persistence.xml list each entity. However I soon see this at the only solution as I do not figure out how to override the jpa property javax.persistence.schema-generation.database.action which in production i set to "none" and in test must be "drop-and-create". Is there any elegant solution to doing this without duplicating my persistence.xml?
I've attached my pom and test-ds.xml.
Am I on the right track here, when using MavenImporter instead of the Persistence Extension?
Cheers,
Jøund
-
test-ds.xml.zip 573 bytes
-
pom.xml.zip 1.8 KB
-
-
2. Re: Guidance in using Arquillian with Wildfly9
mjobanek Feb 24, 2017 2:21 AM (in response to jvskriubakken)Hi,
if you need somehow hack you persistence.xml, you can try using ShrinkWrap Descriptors project - an article about it:How do I create or copy and modify persistence.xml, beans.xml, etc?
As for your question: "Am I on the right track here, when using MavenImporter instead of the Persistence Extension?"
MavenImporter (provided by ShrinkWrap Resolver) solves a different problem than the Persistence Extension. ShrinkWrap Resolver is a tool for managing maven dependencies (it doesn't test anything), but Persistence Extension is a tool that helps you writing tests for persistence layer (focused on the tests). So you can use both tools in one tests, but for different purposes.