Skip to content

Instantly share code, notes, and snippets.

@rafaeltuelho
Last active August 29, 2015 14:08
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save rafaeltuelho/599d7778f334a12b5000 to your computer and use it in GitHub Desktop.
Save rafaeltuelho/599d7778f334a12b5000 to your computer and use it in GitHub Desktop.
Shrinkwrap code snippet to generate an Arquillian deployment archive to test inside a JBossAS/EAP
@Deployment
public static Archive<?> createDeployment() {
// You can use war packaging...
@SuppressWarnings("unused")
WebArchive war = ShrinkWrap
.create(WebArchive.class, "test.war")
.addPackage(Bus.class.getPackage())
// .addAsManifestResource(
// new File("src/main/resources/META-INF",
// "persistence.xml"))
// .addAsManifestResource("test-persistence.xml", "persistence.xml")
.addAsResource("test-persistence.xml", "META-INF/persistence.xml")
.addAsWebInfResource("arquillian-ds.xml")
.addAsWebInfResource(EmptyAsset.INSTANCE, "beans.xml");
// or jar packaging...
JavaArchive jar = ShrinkWrap
.create(JavaArchive.class)
.addPackage(Bus.class.getPackage())
.addAsManifestResource("test-persistence.xml", "persistence.xml")
.addAsManifestResource("arquillian-ds.xml")
.addAsManifestResource(EmptyAsset.INSTANCE, "beans.xml");
// choose your packaging here
return war;
}
@rafaeltuelho
Copy link
Author

I had the same problem reported here: https://developer.jboss.org/thread/196728

To add a jboss datasource in your virtual archieve use this:
.addAsResource("test-persistence.xml", "META-INF/persistence.xml")

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment