Skip to content

Commit

Permalink
Examples made more up to date
Browse files Browse the repository at this point in the history
* replaced references to JBoss AS/EAP with WildFly 8
* removed references to Tomcat 6
* arquillian.xml cleaned up, removed old containers
* removed randomly occurring vim modelines
* jsf/numberguess
  * renamed webapp-jboss5* configs to webapp-wildfly
  * removed jsf12 config; the 1.2 slot is no longer present in WF
  * removed servlet config; context.xml no longer applicable
* s/Web Beans/Weld/
* examples/se: Markdownified READMEs, removed licences from READMEs (like in other examples)
  • Loading branch information
Ron Smeral authored and jharting committed Apr 1, 2014
1 parent abc3bfb commit 303045a
Show file tree
Hide file tree
Showing 26 changed files with 210 additions and 617 deletions.
34 changes: 17 additions & 17 deletions examples/README.md
Expand Up @@ -11,56 +11,56 @@ Weld currently comes with a number of examples:
* `se/numberguess` (the numberguess example for Java SE using Swing)
* `se/helloworld` (a simple example for Java SE)

Before running the examples, you'll need to ensure your server supports CDI (JBoss AS 7 and
GlassFish v3 both have built in support, and Weld provides support for Tomcat, Jetty and
Before running the examples, you'll need to ensure your server supports CDI (WildFly 8 and
GlassFish v4 both have built in support, and Weld provides support for Tomcat, Jetty and
Google App Engine). Weld also supports Java SE.

The examples and Weld are explained in detail in the reference guide, including
how to deploy the examples to JBoss AS 7, and how to deploy the examples to Tomcat. Most
how to deploy the examples to WildFly, and how to deploy the examples to Tomcat. Most
examples also have a README which explains how to run the example on all servers it supports.


Running the functional tests for the JSF examples
------------------------------------------------

Weld's JSF examples come with functional tests, which use Selenium to each flow a user can take
through the GUI of the example.
Weld's JSF examples come with functional tests, which use Selenium to test each flow a user can
take through the GUI of the example.

The functional tests can be run on an individual JSF examples or on all examples. WildFly 8
must to be installed to run the functional tests.
must be installed to run the functional tests.

Make sure you have set the `JBOSS_HOME` environment property to point to your WildFly distribution.

To run the functional tests:

mvn -Darquillian=wildfly-managed-8 clean verify

You can run the functional tests against all examples (from the `examples` directory`) or against
an individual example (from it's sub-directory).
You can run the functional tests against all examples (from the `examples` directory) or against
an individual example (from its sub-directory).

The jsf/numberguess example can be also tested in a cluster. Follow these steps for a default configuration:
The` jsf/numberguess` example can also be tested in a cluster. Follow these steps for a default configuration:

1. Create two JBoss AS 7 distributions, so you have, e.g.
1. Create two WildFly 8 distributions, so you have, e.g.

/home/foo/testing/node1/jboss-as-7.1.0.Final/
/home/foo/testing/node1/wildfly-8.0.0.Final/

and
and

/home/foo/testing/node2/jboss-as-7.1.0.Final/
/home/foo/testing/node2/wildfly-8.0.0.Final/

2. Configure each of the installations standalone/configuration/standalone/standalone-ha.xml files
2. Configure each of the installations' `standalone/configuration/standalone-ha.xml` files

Edit the <interfaces/> element to bind each instance to a different loopback IP address, e.g.
Edit the `<interfaces/>` element to bind each instance to a different loopback IP address, e.g.

<loopback-address value="127.0.1.1"/>

and

<loopback-address value="127.0.2.1"/>
3. Run the test suite, modify the node{1,2}.jbossHome properties to match your configuration
3. Run the test suite, modify the `node{1,2}.jbossHome` properties to match your configuration

mvn clean verify -Pjboss6cluster -Darquillian=jbossas-cluster-7 -Dnode1.jbossHome=/home/foo/testing/node1/jboss-as-7.1.0.Final/ -Dnode2.jbossHome=/home/foo/testing/node2/jboss-as-7.1.0.Final/
mvn clean verify -Pwildfly-cluster -Darquillian=wildfly-cluster-8 -Dnode1.jbossHome=/home/foo/testing/node1/wildfly-8.0.0.Final/ -Dnode2.jbossHome=/home/foo/testing/node2/wildfly-8.0.0.Final/

If you have set up a different addresses in the previous step, you also need to add the following system properties:

Expand Down
17 changes: 10 additions & 7 deletions examples/jsf/login/README.md
@@ -1,20 +1,23 @@
Weld Login Example
========================
==================

Deploying to JBoss AS, JBoss EAP, WildFly
Deploying to WildFly
---------------------

Make sure you have assigned the absolute path of your installation to the
JBOSS_HOME environment variable.
`JBOSS_HOME` environment variable.

1. Open terminal and start the server by running script:
$JBOSS_HOME/bin/standalone.sh

2. Deploy example on the server you have run in the step 1 using command
mvn jboss-as:deploy
$JBOSS_HOME/bin/standalone.sh

2. Deploy example to the server you have started in step 1 using command

mvn wildfly:deploy

3. Now you can view the application at <http://localhost:8080/weld-login>.


To run functional tests execute:
mvn verify -Darquillian=wildfly-managed-8

mvn verify -Darquillian=wildfly-managed-8
16 changes: 1 addition & 15 deletions examples/jsf/login/src/ftest/resources/arquillian.xml
@@ -1,15 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<arquillian xmlns="http://www.jboss.org/arquillian-1.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.jboss.org/arquillian-1.0 http://jboss.org/schema/arquillian/arquillian-1.0.xsd">

<container qualifier="jbossas-managed-6">
</container>

<container qualifier="jbossas-managed-7">
<configuration>
<property name="javaVmArguments">-Xms128m -Xmx768m -XX:MaxPermSize=256m ${jacoco.agent}</property>
</configuration>
</container>

<container qualifier="wildfly-managed-8">
<configuration>
Expand All @@ -19,10 +10,5 @@

<container qualifier="wildfly-remote-8">
</container>

<container qualifier="jbossas-remote-6">
</container>

<container qualifier="jbossas-remote-7">
</container>

</arquillian>
65 changes: 21 additions & 44 deletions examples/jsf/numberguess/README.md
Expand Up @@ -2,58 +2,57 @@ Weld Numberguess Example
========================

This example demonstrates the use of Weld in a Servlet container (Tomcat or
Jetty) or as a non-EJB application for a Java EE server (JBoss AS or GlassFish). No alterations are expected
Jetty) or as a non-EJB application for a Java EE server (WildFly or GlassFish). No alterations are expected
to be made to the container. All services are self-contained within the
deployment.

Deploying to JBoss AS, JBoss EAP, WildFly
---------------------
Deploying to WildFly
--------------------

Make sure you have assigned the absolute path of your installation to the
JBOSS_HOME environment variable.
`JBOSS_HOME` environment variable.

1. Open terminal and start the server by running script:
$JBOSS_HOME/bin/standalone.sh
1. Open terminal and start the server by running

2. Deploy example on the server you have run in step the 1 using command
mvn jboss-as:deploy
$JBOSS_HOME/bin/standalone.sh

2. Deploy example to the server you have started in step 1 using command

mvn wildfly:deploy

3. Now you can view the application at <http://localhost:8080/weld-numberguess>.


To run functional tests execute:
mvn verify -Darquillian=wildfly-managed-8
To run the functional tests, execute:

mvn verify -Darquillian=wildfly-managed-8

Deploying to GlassFish
----------------------

Firstly, verify that the GLASSFISH_HOME environment variable points to your
Firstly, verify that the `GLASSFISH_HOME` environment variable points to your
GlassFish installation.

Then, create a new domain for the application:

mvn glassfish:create-domain
mvn glassfish:create-domain

Finally, deploy the application using:

mvn package glassfish:deploy
mvn package glassfish:deploy

The application becomes available at <http://localhost:7070/weld-numberguess>


Deploying to standalone Tomcat
------------------------------
Deploying to standalone Tomcat 7
--------------------------------

If you want to run the application on a standalone Tomcat, first download and
extract Tomcat. This build assumes you will be running Tomcat in its default
configuration, with a hostname of localhost and port 8080. Before starting
Tomcat, add the following line to `conf/tomcat-users.xml` to allow the Maven
Tomcat plugin to access the manager application, then start Tomcat:

Tomcat 6:
<user username="admin" password="" roles="manager"/>

Tomcat 7:
<user username="admin" password="" roles="standard,manager-script"/>

To override this username and password, add a `<server>` with id `tomcat` in your
Expand All @@ -64,28 +63,14 @@ tomcat-maven-plugin configuration in the `pom.xml`.
You can deploy it as an exploded archive immediately after the war goal is
finished assembling the exploded structure:

Tomcat 6:
mvn clean compile war:exploded tomcat6:deploy -Ptomcat

Tomcat 7:
mvn clean compile war:exploded tomcat7:deploy -Ptomcat

Once the application is deployed, you can redeploy it using this command:

Tomcat 6:
mvn tomcat6:redeploy -Ptomcat

Tomcat 7:
mvn tomcat7:redeploy -Ptomcat

But likely you want to run one or more build goals first before you redeploy:

Tomcat 6:
mvn compile tomcat6:redeploy -Ptomcat
mvn war:exploded tomcat6:redeploy -Ptomcat
mvn compile war:exploded tomcat6:redeploy -Ptomcat

Tomcat 7:
mvn compile tomcat7:redeploy -Ptomcat
mvn war:exploded tomcat7:redeploy -Ptomcat
mvn compile war:exploded tomcat7:redeploy -Ptomcat
Expand All @@ -94,22 +79,16 @@ Now you can view the application at <http://localhost:8080/weld-numberguess>.

To undeploy, use:

Tomcat 6:
mvn tomcat6:undeploy -Ptomcat

Tomcat 7:
mvn tomcat7:undeploy -Ptomcat

Deploying to embedded Jetty
------------------------------
---------------------------

Simply run:

mvn war:inplace jetty:run -Pjetty

The application will be running at the following local URL:

http://localhost:9090/weld-numberguess
The application will be running at <http://localhost:9090/weld-numberguess>

NOTE: This configuration currently does not work on Maven 3.1.x due to class loading conflicts regarding JSR-330

Expand All @@ -122,10 +101,8 @@ First, set up the Eclipse environment:

Make sure you have the Google App Engine Eclipse plugin installed.

Next, put all the needed resources into the src/main/webapp
Next, put all the needed resources into the `src/main/webapp`

mvn war:inplace -Pgae

Now, in Eclipse, you can either run the app locally, or deploy it to Google App Engine.

vim:tw=80
23 changes: 3 additions & 20 deletions examples/jsf/numberguess/pom.xml
Expand Up @@ -66,7 +66,7 @@

<profiles>
<profile>
<id>jboss6cluster</id>
<id>wildfly-cluster</id>
<build>
<plugins>
<plugin>
Expand All @@ -75,7 +75,7 @@
<configuration>
<webResources>
<resource>
<directory>src/main/webapp-jboss5-cluster</directory>
<directory>src/main/webapp-wildfly-cluster</directory>
<filtering>true</filtering>
</resource>
</webResources>
Expand Down Expand Up @@ -280,10 +280,6 @@
</build>
</profile>

<profile>
<id>arquillian-tomcat-embdedded-6</id>
</profile>

<profile>
<id>arquillian-jetty-embedded-7</id>
</profile>
Expand Down Expand Up @@ -333,26 +329,13 @@
</filesets>
<webResources>
<resource>
<directory>src/main/webapp-jboss5</directory>
<directory>src/main/webapp-wildfly</directory>
<filtering>true</filtering>
</resource>
</webResources>
</configuration>
</plugin>

<plugin>
<groupId>org.apache.tomcat.maven</groupId>
<artifactId>tomcat6-maven-plugin</artifactId>
<configuration>
<path>/${project.build.finalName}</path>
<!--
uncomment to use server configuration override; see
readme.txt for details
-->
<!--<server>tomcat</server>-->
<url>http://localhost:${tomcat.http.port}/manager</url>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.tomcat.maven</groupId>
<artifactId>tomcat7-maven-plugin</artifactId>
Expand Down

0 comments on commit 303045a

Please sign in to comment.