Arquillian, ShrinkWrap and archive filename

When you create a deployment using Arquillian (great test runner for testing your Java EE code in the container of your choice: jBoss, Glassfish, OpenEJB, … either in embedded, managed or remote mode) remember that the name of the deployment archive file is the exact filename that will be executed in the container. It does make a difference if you use *.war or *.jar for your deployment, so beware the following construct if it’s not exactly what you intended to do:...

June 13, 2011 · 1 min

ShrinkWrap -- adding classes to non-root location

If you want to add your classes (or any other resources) to your ShrinkWrap archive to a non-root location, you can use the following: @Deployment public static JavaArchive deploy() { // This is the classes and resources archive JavaArchive ar; ar = ShrinkWrap.create(JavaArchive.class, "resources.jar") .addPackage(TestClass.class.getPackage()); /* * The 'ar' archive will be added to the 'yourDir', so you'll * end with test.jar#/yourDir/TestClassPackage/TestClass.class */ JavaArchive endArch; endArch = ShrinkWrap.create(JavaArchive.class, "test.jar") .merge(ar, "yourDir"); endArch....

June 13, 2011 · 1 min