Skip to content
This repository has been archived by the owner on Nov 10, 2017. It is now read-only.

Commit

Permalink
Examples: updated booking, groovybooking, hibernate
Browse files Browse the repository at this point in the history
  • Loading branch information
Ron Smeral authored and mareknovotny committed Jul 4, 2013
1 parent 6e573aa commit fc3e880
Show file tree
Hide file tree
Showing 18 changed files with 601 additions and 242 deletions.
2 changes: 1 addition & 1 deletion examples/blog/README.md
Expand Up @@ -79,6 +79,6 @@ Testing in JBDS

1. Open JBDS and start a configured instance of JBoss AS
2. Import the `ftest` project of the example
2. In the _Project Explorer_, select the ftest project, then
3. In the _Project Explorer_, select the ftest project, then
1. Type `Ctrl+Alt+P` (_Select Maven Profiles_) and activate `arq-remote` profile and deactivate `arq-managed` profile
2. Right-click the module and select _Run As_ - _JUnit Test_
100 changes: 100 additions & 0 deletions examples/booking/README.md
@@ -0,0 +1,100 @@
Seam Booking Example
=================

This example demonstrates the use of Seam in a Java EE 6 environment.
Transaction and persistence context management is handled by the EJB container. This example runs on JBoss AS as an EAR.

Running the example
-------------------

### Using Maven

To deploy the example to a running JBoss AS instance, follow these steps:

1. In the example root directory run:

mvn clean install

2. Set JBOSS_HOME environment property.

3. In the booking-ear directory run:

mvn jboss-as:deploy

4. Open this URL in a web browser: http://localhost:8080/seam-booking

### Using Ant

1. In the example root directory run:

ant clean package

2. Copy seam-booking.ear from directory booking-ear/target to the deployment directory of JBoss AS ($JBOSS_HOME/standalone/deployments by default)

3. Open this URL in a web browser: http://localhost:8080/seam-booking


Testing the example
-------------------

This example is covered by integration and functional tests. All tests use the following technologies:

* __Arquillian__ - as the framework for EE testing, for managing of container lifecycle and deployment of test archive,
* __ShrinkWrap__ - to create the test archive (WAR).


### Integration tests

Integration tests cover core application logic and reside in the EJB module. In addition to Arquillian and ShrinkWrap, the integration tests also use:

* __JUnitSeamTest__ - to hook into the JSF lifecycle and assert server-side state,
* __ShrinkWrap Resolver__ - to resolve dependencies of the project for packaging in the test archive.

The tests are executed in Maven's test phase. By default they are skipped and can be executed on JBoss AS with:

mvn clean test -Darquillian=jbossas-managed-7

The `JBOSS_HOME` environment variable must be set and point to a JBoss AS instance directory.

To test on a running server, use

mvn clean test -Darquillian=jbossas-remote-7

### Functional tests

Functional tests are located in a separate project and are not run during the build of the example. They test the built archive in an application server through browser-testing. They use:

* __Arquillian Graphene Extension__ - an advanced Ajax-capable type-safe Selenium-based browser testing tool,
* __Arquillian Drone Extension__ - to automatically run and stop browser instances.

Run the functional test on JBoss AS instance with

mvn -f booking-ftest/pom.xml clean test

The `JBOSS_HOME` environment variable must be set and point to a JBoss AS instance directory.

To test on a running server, use

mvn -f booking-ftest/pom.xml clean test -Dremote

Testing in JBDS
---------------
### Integration tests

1. Open JBDS and start a configured instance of JBoss AS

2. Import the example project and its submodules

3. In the _Project Explorer_, select the EJB module project, then
1. Type `Ctrl+Alt+P` (_Select Maven Profiles_) and check `integration-tests` and `arq-jbossas-7-remote`
2. Right-click the module and select _Run As_ - _JUnit Test_

### Functional tests

1. Open JBDS and start a configured instance of JBoss AS

2. Import the `ftest` project of the example

3. In the _Project Explorer_, select the ftest project, then
1. Type `Ctrl+Alt+P` (_Select Maven Profiles_) and activate `arq-remote` profile and deactivate `arq-managed` profile
2. Right-click the module and select _Run As_ - _JUnit Test_
9 changes: 9 additions & 0 deletions examples/booking/booking-ear/pom.xml
Expand Up @@ -53,6 +53,15 @@

<build>
<finalName>seam-booking</finalName>
<pluginManagement>
<plugins>
<plugin>
<groupId>org.jboss.as.plugins</groupId>
<artifactId>jboss-as-maven-plugin</artifactId>
<version>${version.jboss.maven.plugin}</version>
</plugin>
</plugins>
</pluginManagement>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
Expand Down
Expand Up @@ -13,7 +13,11 @@ public static WebArchive bookingDeployment() {
// use profiles defined in 'maven.profiles' property in pom.xml
String profilesString = System.getProperty("maven.profiles");
String[] profiles = profilesString != null ? profilesString.split(", ?") : new String[0];
File[] libs = Maven.resolver().loadPomFromFile("pom.xml", profiles).importRuntimeDependencies().asFile();
File[] libs = Maven.resolver().loadPomFromFile("pom.xml", profiles)
.importCompileAndRuntimeDependencies()
// force resolve jboss-seam, because it is provided-scoped in the pom, but we need it bundled in the WAR
.resolve("org.jboss.seam:jboss-seam")
.withTransitivity().asFile();

return ShrinkWrap.create(WebArchive.class, "seam-booking.war")
.addPackage(Booking.class.getPackage())
Expand Down
39 changes: 33 additions & 6 deletions examples/booking/booking-ftest/pom.xml
Expand Up @@ -56,12 +56,6 @@
<artifactId>functional-tests</artifactId>
<scope>test</scope>
</dependency>

<dependency>
<groupId>org.jboss.as</groupId>
<artifactId>jboss-as-arquillian-container-managed</artifactId>
<scope>test</scope>
</dependency>

<dependency>
<groupId>org.jboss.arquillian.protocol</groupId>
Expand All @@ -77,6 +71,39 @@

</dependencies>

<profiles>
<profile>
<id>arq-remote</id>
<activation>
<property>
<name>remote</name>
</property>
</activation>
<dependencies>
<dependency>
<groupId>org.jboss.as</groupId>
<artifactId>jboss-as-arquillian-container-remote</artifactId>
<scope>test</scope>
</dependency>
</dependencies>
</profile>
<profile>
<id>arq-managed</id>
<activation>
<property>
<name>!remote</name>
</property>
</activation>
<dependencies>
<dependency>
<groupId>org.jboss.as</groupId>
<artifactId>jboss-as-arquillian-container-managed</artifactId>
<scope>test</scope>
</dependency>
</dependencies>
</profile>
</profiles>

<build>
<testResources>
<testResource>
Expand Down
7 changes: 6 additions & 1 deletion examples/booking/pom.xml
Expand Up @@ -13,14 +13,18 @@
<maven.compiler.target>1.6</maven.compiler.target>
<maven.compiler.source>1.6</maven.compiler.source>

<!-- To use jacoco, set jacoco.agent system property to something like
-javaagent:/path/to/jacocoagent.jar=append=true,destfile=/path/to/output/jacoco.exec -->
<jacoco.agent />

<!-- To use custom Maven settings and profiles, uncomment and customize
the following properties. This is necessary for the ShrinkWrap
resolver to function properly. -->
<!--<maven.user.settings>/path/to/custom/settings.xml</maven.user.settings>-->
<!--<maven.profiles>custom,profile</maven.profiles>-->

<version.commons.logging>1.1.1</version.commons.logging>
<version.shrinkwrap.resolver>2.0.0-beta-3</version.shrinkwrap.resolver>
<version.shrinkwrap.resolver>2.0.0-beta-4-SNAPSHOT</version.shrinkwrap.resolver>

<!-- Plugin versions -->
<version.dependency.plugin>2.5.1</version.dependency.plugin>
Expand All @@ -30,6 +34,7 @@
<version.ear.plugin>2.6</version.ear.plugin>
<version.war.plugin>2.1.1</version.war.plugin>
<version.ejb.plugin>2.3</version.ejb.plugin>
<version.jboss.maven.plugin>7.4.Final</version.jboss.maven.plugin>
</properties>

<modules>
Expand Down
31 changes: 0 additions & 31 deletions examples/booking/readme.txt

This file was deleted.

60 changes: 60 additions & 0 deletions examples/groovybooking/README.md
@@ -0,0 +1,60 @@
Seam GroovyBooking Example
=================

This is the Hotel Booking example implemented in Groovy Beans and Hibernate JPA.
The application is deployed as a WAR rather than an EAR.

Running the example
-------------------

To deploy the example to a running JBoss AS instance, follow these steps:

1. In the example root directory run:

mvn clean install

2. Set JBOSS_HOME environment property.

3. In the groovybooking-web directory run:

mvn jboss-as:deploy

4. Open this URL in a web browser: http://localhost:8080/groovybooking-web


Testing the example
-------------------

This example is covered by functional tests. All tests use the following technologies:

* __Arquillian__ - as the framework for EE testing, for managing of container lifecycle and deployment of test archive,
* __ShrinkWrap__ - to create the test archive (WAR).


### Functional tests

Functional tests are located in a separate project and are not run during the build of the example. They test the built archive in an application server through browser-testing. They use:

* __Arquillian Graphene Extension__ - an advanced Ajax-capable type-safe Selenium-based browser testing tool,
* __Arquillian Drone Extension__ - to automatically run and stop browser instances.

Run the functional test on JBoss AS instance with

mvn -f groovybooking-ftest/pom.xml clean test

The `JBOSS_HOME` environment variable must be set and point to a JBoss AS instance directory.

To test on a running server, use

mvn -f groovybooking-ftest/pom.xml clean test -Dremote

Testing in JBDS
---------------
### Functional tests

1. Open JBDS and start a configured instance of JBoss AS
2. Import the `ftest` project of the example
3. In the _Project Explorer_, select the ftest project, then
1. Type `Ctrl+Alt+P` (_Select Maven Profiles_) and activate `arq-remote` profile and deactivate `arq-managed` profile
2. Right-click the module and select _Run As_ - _JUnit Test_

39 changes: 33 additions & 6 deletions examples/groovybooking/groovybooking-ftest/pom.xml
Expand Up @@ -56,12 +56,6 @@
<artifactId>functional-tests</artifactId>
<scope>test</scope>
</dependency>

<dependency>
<groupId>org.jboss.as</groupId>
<artifactId>jboss-as-arquillian-container-managed</artifactId>
<scope>test</scope>
</dependency>

<dependency>
<groupId>org.jboss.arquillian.protocol</groupId>
Expand All @@ -77,6 +71,39 @@

</dependencies>

<profiles>
<profile>
<id>arq-remote</id>
<activation>
<property>
<name>remote</name>
</property>
</activation>
<dependencies>
<dependency>
<groupId>org.jboss.as</groupId>
<artifactId>jboss-as-arquillian-container-remote</artifactId>
<scope>test</scope>
</dependency>
</dependencies>
</profile>
<profile>
<id>arq-managed</id>
<activation>
<property>
<name>!remote</name>
</property>
</activation>
<dependencies>
<dependency>
<groupId>org.jboss.as</groupId>
<artifactId>jboss-as-arquillian-container-managed</artifactId>
<scope>test</scope>
</dependency>
</dependencies>
</profile>
</profiles>

<build>
<testResources>
<testResource>
Expand Down

0 comments on commit fc3e880

Please sign in to comment.