Chapter 5. Try It Out

5.1. Run the Quickstarts

5.1.1. Run the Quickstarts in Red Hat JBoss Developer Studio

This section describes how to use Red Hat JBoss Developer Studio to deploy the quickstarts and run the Arquillian tests.

Procedure 5.1. Import the quickstarts into Red Hat JBoss Developer Studio

Each quickstart ships with a POM (Project Object Model) file that contains project and configuration information for the quickstart. Using this POM file, you can easily import the quickstart into Red Hat JBoss Developer Studio.

Important

If your quickstart project folder is located within the IDE workspace when you import it into Red Hat JBoss Developer Studio, the IDE generates an invalid project name and WAR archive name. Be sure your quickstart project folder is located outside the IDE workspace before you begin!
  1. Start Red Hat JBoss Developer Studio.
  2. From the menu, select FileImport.
  3. In the selection list, choose MavenExisting Maven Projects, then click Next.
    Import Existing Maven Projects

    Figure 5.1. Import Existing Maven Projects

  4. Browse to the directory of the quickstart you plan to test, for example the helloworld quickstart, and click OK. The Projects list box is populated with the pom.xml file of the selected quickstart project.
    Select Maven Projects

    Figure 5.2. Select Maven Projects

  5. Click Finish.

Procedure 5.2. Build and Deploy the helloworld quickstart

The helloworld quickstart is one of the simplest quickstarts and is a good way to verify that the JBoss server is configured and running correctly.
  1. If you do not see a Servers tab or have not yet defined a server, follow the instructions here: Section 4.1.5, “Add the JBoss EAP Server Using Define New Server”. If you plan to deploy a quickstart that requires the full profile or additional startup arguments, be sure to create the server runtime environment as noted in the quickstart instructions.
  2. Right-click on the jboss-helloworld project in the Project Explorer tab and select Run As. You are provided with a list of choices. Select Run on Server.
    Run As - Run on Server

    Figure 5.3. Run As - Run on Server

  3. Select JBoss EAP 6.1+ Runtime Server from the server list and click Next.
    Run on Server

    Figure 5.4. Run on Server

  4. The next screen displays the resources that are configured on the server. The jboss-helloworld quickstart is configured for you. Click Finish to deploy the quickstart.
    Modify Resources Configured on the Server

    Figure 5.5. Modify Resources Configured on the Server

  5. Review the results.
    • In the Server tab, the JBoss EAP 6.x Runtime Server status changes to [Started, Republish] .
    • The server Console tab shows messages detailing the JBoss EAP 6.x server start and the helloworld quickstart deployment.
    • A helloworld tab appears displaying the URL http://localhost:8080/jboss-helloworld/HelloWorld and the text "Hello World!".
    • The following messages in the Console confirm deployment of the jboss-helloworld.war file:
      JBAS018210: Register web context: /jboss-helloworld
      JBAS018559: Deployed "jboss-helloworld.war" (runtime-name : "jboss-helloworld.war")
      
      The registered web context is appended to http://localhost:8080 to provide the URL used to access the deployed application.
  6. To verify the helloworld quickstart deployed successfully to the JBoss server, open a web browser and access the application at this URL: http://localhost:8080/jboss-helloworld

Procedure 5.3. Run the bean-validation quickstart Arquillian tests

Some quickstarts do not provide a user interface layer and instead provide Arquillian tests to demonstrate the code examples. The bean-validation quickstart is an example of a quickstart that provides Arquillian tests.
  1. Follow the procedure above to import the bean-validation quickstart into Red Hat JBoss Developer Studio.
  2. In the Servers tab, right-click on the server and choose Start to start the JBoss EAP server. If you do not see a Servers tab or have not yet defined a server, follow the instructions here: Section 4.1.5, “Add the JBoss EAP Server Using Define New Server”.
  3. Right-click on the jboss-bean-validation project in the Project Explorer tab and select Run As. You are provided with a list of choices. Select Maven Build.
  4. In the Goals input field of the Edit Configuration dialog, type: clean test -Parq-jbossas-remote
    Then click Run.
    Edit Configuration

    Figure 5.6. Edit Configuration

  5. Review the results.
    The server Console tab shows messages detailing the JBoss EAP server start and the output of the bean-validation quickstart Arquillian tests.
    -------------------------------------------------------
     T E S T S
    -------------------------------------------------------
    Running org.jboss.as.quickstarts.bean_validation.test.MemberValidationTest
    Tests run: 5, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 2.189 sec
    
    Results :
    
    Tests run: 5, Failures: 0, Errors: 0, Skipped: 0
    
    [INFO] ------------------------------------------------------------------------
    [INFO] BUILD SUCCESS
    [INFO] ------------------------------------------------------------------------
    

5.1.2. Run the Quickstarts Using a Command Line

Procedure 5.4. Build and Deploy the Quickstarts Using a Command Line

You can easily build and deploy the quickstarts using a command line. Be aware that, when using a command line, you are responsible for starting the JBoss server if it is required.
  1. Review the README.html file in the root directory of the quickstarts.
    This file contains general information about system requirements, how to configure Maven, how to add users, and how to run the Quickstarts. Be sure to read through it before you get started.
    It also contains a table listing the available quickstarts. The table lists each quickstart name and the technologies it demonstrates. It gives a brief description of each quickstart and the level of experience required to set it up. For more detailed information about a quickstart, click on the quickstart name.
    Some quickstarts are designed to enhance or extend other quickstarts. These are noted in the Prerequisites column. If a quickstart lists prerequisites, you must install them first before working with the quickstart.
    Some quickstarts require the installation and configuration of optional components. Do not install these components unless the quickstart requires them.
  2. Run the helloworld quickstart.
    The helloworld quickstart is one of the simplest quickstarts and is a good way to verify that the JBoss server is configured and running correctly. Open the README.html file in the root of the helloworld quickstart. It contains detailed instructions on how to build and deploy the quickstart and access the running application
  3. Run the other quickstarts.
    Follow the instructions in the README.html file located in the root folder of each quickstart to run the example.