{"id":119,"date":"2019-05-21T19:24:54","date_gmt":"2019-05-21T19:24:54","guid":{"rendered":"http:\/\/buki.io\/?p=119"},"modified":"2021-05-11T10:57:37","modified_gmt":"2021-05-11T09:57:37","slug":"set-up-a-embedded-payara-5-for-arquillian-tests-with-db2-z-os-drivers","status":"publish","type":"post","link":"http:\/\/buki.io\/?p=119","title":{"rendered":"Set up a embedded Payara 5 for Arquillian tests with DB2 z\/OS drivers"},"content":{"rendered":"<p>Despite a lot of tutorials on using embedded Payara with Arquillian, I struggled a while to get the container running. Here are the steps<\/p>\n<p><br \/>Code for configuring and deploying the embedded container<\/p>\n<pre>@Deployment public static Archive createDeployment() throws IOException {<br \/>File[] files = Maven.configureResolver().withMavenCentralRepo(false).loadPomFromFile(\"pom.xml\").resolve(\"com.ibm:db2jcc4:version1234\", \"com.ibm:db2jcc_license_cisuz:version1234\").withTransitivity().asFile();<br \/>final WebArchive war = ShrinkWrap.create(WebArchive.class, \"test.war\").addPackages(true, \"my.org.backend\").addPackages(true, \"my.org.exceptions\").addAsResource(\"persistence.xml\", \"META-INF\/persistence.xml\").addAsLibraries(files); \/\/ add all xml required for the queries <br \/>Files.walk(Paths.get(\"src\/main\/resources\/META-INF\")).forEach(file - &gt;{<br \/>if (file.toFile().isFile() &amp;&amp; !file.getFileName().toString().equalsIgnoreCase(\"MANIFEST.MF\") &amp;&amp; !file.getFileName().toString().equalsIgnoreCase(\"persistence.xml\")) {<br \/>final String fileName = file.toAbsolutePath().toString();<br \/>final int start = fileName.indexOf(\"META-INF\");<br \/>final String resource = fileName.substring(start - 1);<br \/>war.addAsResource(file.toFile(), resource);<br \/>}<br \/>});<br \/>return war;<br \/>}<\/pre>\n\n\n<p><br>Mind to put the arquillian.xml under &#8222;src\/test\/resources&#8220;<br><\/p>\n\n\n\n<p>Maven dependencies:<br>org.jboss.arquillian.junit arquillian-junit-container 1.4.1.Final test<br>org.jboss.shrinkwrap.resolver shrinkwrap-resolver-impl-maven 2.2.6 test<br>junit junit 4.12 test<br>fish.payara.arquillian arquillian-payara-server-4-embedded 1.0.Beta3 test<br>fish.payara.extraspayara-embedded-all5.181test<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Despite a lot of tutorials on using embedded Payara with Arquillian, I struggled a while to get the container running. Here are the steps Code for configuring and deploying the embedded container @Deployment public static Archive createDeployment() throws IOException {File[] files = Maven.configureResolver().withMavenCentralRepo(false).loadPomFromFile(&#8222;pom.xml&#8220;).resolve(&#8222;com.ibm:db2jcc4:version1234&#8220;, &#8222;com.ibm:db2jcc_license_cisuz:version1234&#8220;).withTransitivity().asFile();final WebArchive war = ShrinkWrap.create(WebArchive.class, &#8222;test.war&#8220;).addPackages(true, &#8222;my.org.backend&#8220;).addPackages(true, &#8222;my.org.exceptions&#8220;).addAsResource(&#8222;persistence.xml&#8220;, &#8222;META-INF\/persistence.xml&#8220;).addAsLibraries(files); \/\/ add all &hellip; <\/p>\n<p class=\"link-more\"><a href=\"http:\/\/buki.io\/?p=119\" class=\"more-link\">Continue reading<span class=\"screen-reader-text\"> &#8222;Set up a embedded Payara 5 for Arquillian tests with DB2 z\/OS drivers&#8220;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"jetpack_post_was_ever_published":false,"jetpack_publicize_message":"","jetpack_is_tweetstorm":false,"jetpack_publicize_feature_enabled":true},"categories":[3],"tags":[],"jetpack_publicize_connections":[],"jetpack_featured_media_url":"","jetpack_sharing_enabled":true,"jetpack_shortlink":"https:\/\/wp.me\/p7N2pi-1V","_links":{"self":[{"href":"http:\/\/buki.io\/index.php?rest_route=\/wp\/v2\/posts\/119"}],"collection":[{"href":"http:\/\/buki.io\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/buki.io\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/buki.io\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/buki.io\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=119"}],"version-history":[{"count":3,"href":"http:\/\/buki.io\/index.php?rest_route=\/wp\/v2\/posts\/119\/revisions"}],"predecessor-version":[{"id":151,"href":"http:\/\/buki.io\/index.php?rest_route=\/wp\/v2\/posts\/119\/revisions\/151"}],"wp:attachment":[{"href":"http:\/\/buki.io\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=119"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/buki.io\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=119"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/buki.io\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=119"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}