Skip to content

Commit

Permalink
refs: eclipse#42 add Arquillian integration for CDI support
Browse files Browse the repository at this point in the history
places resources at correct location in the ShrinkWrap archive
We cannot keep them 1:1 in the same location as they would otherwise
get picked up twice in locale Arquillian containers (getResources).

Signed-off-by: Mark Struberg <[email protected]>
  • Loading branch information
struberg committed Mar 11, 2017
1 parent c390f91 commit acf73b9
Showing 1 changed file with 13 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
import org.jboss.arquillian.testng.Arquillian;
import org.jboss.shrinkwrap.api.ShrinkWrap;
import org.jboss.shrinkwrap.api.asset.EmptyAsset;
import org.jboss.shrinkwrap.api.asset.UrlAsset;
import org.jboss.shrinkwrap.api.spec.JavaArchive;


Expand All @@ -34,9 +35,20 @@ protected static JavaArchive allIn(String testName) {
.create(JavaArchive.class, testName)
.addPackage(CustomDbConfigSource.class.getPackage())
.addPackage(DuckConverter.class.getPackage())
.addAsManifestResource(EmptyAsset.INSTANCE, "beans.xml");
.addAsManifestResource(EmptyAsset.INSTANCE, "beans.xml")
.as(JavaArchive.class);

addFile(testJar, "META-INF/services/org.eclipse.microprofile.config.spi.ConfigSource");
addFile(testJar, "META-INF/services/org.eclipse.microprofile.config.spi.ConfigSourceProvider");
addFile(testJar, "META-INF/microprofile-config.properties");
addFile(testJar, "sampleconfig.yaml");

return testJar;
}

private static void addFile(JavaArchive archive, String originalPath) {
archive.addAsResource(new UrlAsset(Thread.currentThread().getContextClassLoader().getResource("internal/" + originalPath)),
originalPath);
}

}

0 comments on commit acf73b9

Please sign in to comment.