Tech Tip #54 explained how to enable Arquillian for an existing Java EE project. In that tip, the tests were run against a locally installed WildFly server. Would the same adapter work if this WildFly instance was running on OpenShift ? No!
Because the security constraints and requirement of a PaaS, as opposed to a localhost, are different. Lets take a look at what’s required to run our tests in javaee7-continuous-delivery on a WildFly instance hosted on OpenShift.
Lets get started!
- As explained in Tech Tip #52, create a WildFly application on OpenShift as shown:
123456789101112131415161718192021222324252627282930313233workspaces> rhc app-create mywildfly jboss-wildfly-8Application Options-------------------Domain: milestogoCartridges: jboss-wildfly-8Gear Size: defaultScaling: noCreating application 'mywildfly' ... Artifacts deployed: ./ROOT.wardoneWildFly 8 administrator added. Please make note of these credentials:Username: adminMYtMTDbPassword: tq1K-QYLFgBDrun 'rhc port-forward mywildfly' to access the web admin area on port 9990.Waiting for your DNS name to be available ... doneCloning into 'mywildfly'...Warning: Permanently added the RSA host key for IP address '54.163.64.193' to the list of known hosts.Your application 'mywildfly' is now available.URL: http://mywildfly-milestogo.rhcloud.com/SSH to: 54699516ecb8d41cb8000016@mywildfly-milestogo.rhcloud.comGit remote: ssh://54699516ecb8d41cb8000016@mywildfly-milestogo.rhcloud.com/~/git/mywildfly.git/Cloned to: /Users/arungupta/workspaces/mywildflyRun 'rhc show-app mywildfly' for more details about your app.@
in the value corresponding toSSH to
. - Until FORGEPLUGINS-177 is resolved, we need to manually add maven profile and provide container configuration information in “arquillian.xml”. Add the following
<profile>
to “pom.xml”:
1234567891011121314151617181920212223242526<profile><id>arquillian-wildfly-openshift</id><build><plugins><plugin><artifactId>maven-surefire-plugin</artifactId><version>2.14.1</version><configuration><systemPropertyVariables><arquillian.launch>arquillian-wildfly-openshift</arquillian.launch></systemPropertyVariables></configuration></plugin></plugins></build><dependencies><dependency><groupId>org.jboss.arquillian.container</groupId><artifactId>arquillian-openshift</artifactId><version>1.0.0.Final-SNAPSHOT</version><scope>test</scope></dependency></dependencies></profile>arquillian-openshift
container and referring toarquillian-wildfly-openshift
configuration that will be matched with the appropriate container in “arquillian.xml”.So this is how the updated “arquillian.xml” look:
1234567891011121314151617<?xml version="1.0" encoding="UTF-8" standalone="no"?><arquillian xmlns="http://jboss.org/schema/arquillian" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://jboss.org/schema/arquillian http://jboss.org/schema/arquillian/arquillian_1_0.xsd"><container qualifier="arquillian-wildfly-remote"/><container qualifier="arquillian-wildfly-openshift"><configuration><property name="namespace">milestogo</property><property name="application">mywildfly</property><property name="libraDomain">rhcloud.com</property><property name="sshUserName">54699516ecb8d41cb8000016</property><property name="login">arungupta@redhat.com</property><property name="deploymentTimeoutInSeconds">300</property><property name="disableStrictHostChecking">true</property></configuration></container></arquillian>Note the new
<container>
with the qualifierarquillian-wildfly-openshift
. It provides information about where the server is located and some other configuration properties. ThesshUserName
property value should be the same from the WildFly instance created earlier. - That’s it, now you can run the test against the WildFly instance on OpenShift:
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051javaee7-simple-sample> mvn test -Parquillian-wildfly-openshift[INFO] Scanning for projects...[INFO][INFO] ------------------------------------------------------------------------[INFO] Building helloworld 1.0-SNAPSHOT[INFO] ------------------------------------------------------------------------[INFO][INFO] --- maven-resources-plugin:2.6:resources (default-resources) @ helloworld ---[INFO] Using 'UTF-8' encoding to copy filtered resources.[INFO] Copying 0 resource[INFO][INFO] --- maven-compiler-plugin:3.1:compile (default-compile) @ helloworld ---[INFO] Nothing to compile - all classes are up to date[INFO][INFO] --- maven-resources-plugin:2.6:testResources (default-testResources) @ helloworld ---[INFO] Using 'UTF-8' encoding to copy filtered resources.[INFO] Copying 1 resource[INFO][INFO] --- maven-compiler-plugin:3.1:testCompile (default-testCompile) @ helloworld ---[INFO] Nothing to compile - all classes are up to date[INFO][INFO] --- maven-surefire-plugin:2.14.1:test (default-test) @ helloworld ---[INFO] Surefire report directory: /Users/arungupta/workspaces/javaee7-simple-sample/target/surefire-reports-------------------------------------------------------T E S T S-------------------------------------------------------Running org.javaee7.sample.PersonTestNov 17, 2014 11:18:24 AM org.jboss.arquillian.container.openshift.OpenShiftContainer startINFO: Preparing Arquillian OpenShift container at http://mywildfly-milestogo.rhcloud.comNov 17, 2014 11:19:19 AM org.jboss.arquillian.container.openshift.OpenShiftRepository pushINFO: Pushed to the remote repository ssh://54699516ecb8d41cb8000016@mywildfly-milestogo.rhcloud.com/~/git/mywildfly.git/Nov 17, 2014 11:20:56 AM org.jboss.arquillian.container.openshift.OpenShiftRepository pushINFO: Pushed to the remote repository ssh://54699516ecb8d41cb8000016@mywildfly-milestogo.rhcloud.com/~/git/mywildfly.git/Tests run: 2, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 152.653 secNov 17, 2014 11:20:56 AM org.jboss.arquillian.container.openshift.OpenShiftContainer stopINFO: Shutting down Arquillian OpenShift container at http://mywildfly-milestogo.rhcloud.comResults :Tests run: 2, Failures: 0, Errors: 0, Skipped: 0[INFO] ------------------------------------------------------------------------[INFO] BUILD SUCCESS[INFO] ------------------------------------------------------------------------[INFO] Total time: 05:46 min[INFO] Finished at: 2014-11-17T11:24:09+02:00[INFO] Final Memory: 12M/309M[INFO] ------------------------------------------------------------------------
The complete source code is available at github.com/arun-gupta/javaee7-continuous-delivery.
Enjoy!
After a long search I have found out one of the prime text file which will help you to map drive windows 7 as this feature of windows is an prime feature so if you are facing somehow any problem so you may have help of this portal.
I found your website perfect for my needs. It contains wonderful and helpful posts. Keep up the good work! run 3 cool math