Quick Start: use Forge

Source: Internet
Author: User

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.

  • 1
  • 2
  • 3
  • Next Page

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.