Enable Arquillian on an existing Java EE project, using Forge Addon (Tech Tip #54)

Tech Tip #34 explained how to create a testable Java EE 7 application. This is useful if you are starting a new application. But what if you already have an application and Arquillian-enable it ?

That’s where Forge and Forge-Arquillian add-on comes in handy. That’s how I added support for Arquillian in javaee7-simple-sample. The updated source code is at github.com/arun-gupta/javaee7-continuous-delivery.

Lets see what was done!

  1. Download and install Forge. You can download ZIP and unzip in your favorite location, or just use the following command that does it for you:
  2. Clone the simple-javaee7-sample repo
  3. Change the directory to javaee7-simple-sample and start Forge:
  4. Install the Forge-Arquillian add-on:
  5. Configure Arquillian add-on and install WildFly adapter:
    The list of adapters is diverse as shown:
    This allows you to configure the container of your choice. This will add the following profile to your “pom.xml”:
    The profile includes the “wildfly-arquillian-container-remote” dependency which allows Arquillian to connect with a WildFly running in remote “mode”. The default host is “localhost” and port is “8080”. The “maven-surefire-plugin” is passed a “arquillian.launch” configuration property with the value “arquillian-wildfly-remote”. This is matched with a “container” qualifier in the generated “arquillian.xml”.

    “arquillian.xml” is used to define configuration settings to locate or communicate with the container. In our case, WildFly is running on default host and port and so there is no need to update this file. The important part to note is that the “container” qualifier matches with the “arquillian.launch” qualifier value.

    This file. More details about this configuration file are available here.

  6. Until FORGE-2148 is fixed, you also need to add a JAX-RS implementation as well, and the corresponding JAXB provider. This test is using RESTEasy and so the following needs to be added:

    This can be added either in the profile or project-wide dependencies.

And now you are ready to test!

Download WildFly 8.1 and unzip. Start the server as:

Run the tests:

And now you’ve Arquillian-enabled your existing project!

Once again, the complete source code is available at github.com/arun-gupta/javaee7-continuous-delivery.

File any issues here.

Enjoy!

Be Sociable, Share!
  • Tweet

6 thoughts on “Enable Arquillian on an existing Java EE project, using Forge Addon (Tech Tip #54)

  1. Hi Arun,
    just a question: the cloned repo (simple-javaee7-sample repo) has no test in it… how is it possible than that running mvn test executes 2 tests?

    Thanks in advance,
    Pietro

  2. The PersonTest.java class can be found in the finished example: https://github.com/arun-gupta/javaee7-continuous-delivery

    Another issue I found was that when I ran ‘mvn test’ I got this error:

    org.jboss.arquillian.container.test.impl.client.deployment.ValidationException: DeploymentScenario contains a target (_DEFAULT_) not matching any defined Container in the registry.
    Please include at least 1 Deployable Container on your Classpath.

    That was just because I failed to specify the ‘arquillian-wildfly-remote’ profile when running the test, eg:

    mvn test -Parquillian-wildfly-remote

  3. Now it has became easier to clarify your all hurdles regarding windows 10 sync settings also you can move to windows 10 update settings which will meet the requirement you are are looking for. Also all information available here will be displayed you in the form of images.

  4. Arquillian venture for JavaMagazin article. Arquillian empowers you to test your business rationale in a remote or installed holder. On the other hand, it can convey a file to the compartment so the test can interface as a remote customer. http://www.domyassignmentforme.com

Leave a Reply

Your email address will not be published. Required fields are marked *