Last active
August 29, 2015 14:08
-
-
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
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@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; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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")