This tutorial familiarquillian plug-in for JBoss Forge. After reading this tutorial, you can master:
- Install the Arquillian plug-in the Forge Environment
- Use this plug-in to add the Arquillian infrastructure to a Maven-based Java project.
- Generate components and corresponding Arquillian tests
- You do not need to manually modify to run the Arquillian test in different containers
You will complete many steps that are the same as those described in the Quick Start tutorial. The difference is that some trivial things are left to Forge for processing. This tutorial is intended for quick reading, which is to help you get started faster.
Prerequisites
This tutorial assumes that you have installed JBoss Forge. It is not difficult to install Forge. Please refer to the "quick start tutorial" or the official Forge document to download and install it. You also need to install JDK on your machine.1.6 or later.
Create a project
Before using Arquillian, we need to create a project. If you have not created a project, use the following Forge command to create a simple Java EE 6 project, including support for JPA.
$ new-project --named arquillian-demo --topLevelPackage demo
? Use [/Users/paul/arquillian-demo] as project directory? [Y/n]***SUCCESS*** Created project [arquillian-demo] in new working directory [/Users/paul/arquillian-demo]Wrote /Users/paul/arquillian-demoWrote /Users/paul/arquillian-demo/pom.xmlWrote /Users/paul/arquillian-demo/src/main/javaWrote /Users/paul/arquillian-demo/src/test/javaWrote /Users/paul/arquillian-demo/src/main/resourcesWrote /Users/paul/arquillian-demo/src/test/resourcesWrote /Users/paul/arquillian-demo/src/main/resources/META-INF/forge.xml
The new project has been created. Next, we need to add some code for testing. The following uses Forge to create a CDI Bean.
First, we use the "beans" plug-in to install CDI into the project.
$ beans setup
***SUCCESS*** Installed [forge.spec.cdi] successfully. ? Do you want to install CDI APIs? [y/N]Wrote /Users/paul/arquillian-demo/src/main/resources/META-INF/beans.xml
Then create a Bean.
$ beans new-bean --type demo.MySimpleBean --scoped DEPENDENT
Picked up type <JavaResource>: demo.MySimpleBeanWrote /Users/paul/arquillian-demo/src/main/java/demo/MySimpleBean.java
The project is ready. perform the test below.