Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Update blank archetype

  • Loading branch information...
commit 94ca33d915efd4f0a1576636c20b13296e1f39cc 1 parent 1af28ca
@pmuir pmuir authored
Showing with 434 additions and 385 deletions.
  1. +2 −1  jboss-javaee6-webapp-blank-archetype/pom.xml
  2. +4 −4 jboss-javaee6-webapp-blank-archetype/src/main/resources/META-INF/maven/archetype-metadata.xml
  3. +263 −310 jboss-javaee6-webapp-blank-archetype/src/main/resources/archetype-resources/pom.xml
  4. +4 −11 jboss-javaee6-webapp-blank-archetype/src/main/resources/archetype-resources/readme.md
  5. +8 −11 ...sources/archetype-resources/src/main/java/controller/{MemberRegistration.java → MemberController.java}
  6. +32 −0 ...webapp-blank-archetype/src/main/resources/archetype-resources/src/main/java/service/MemberRegistration.java
  7. +9 −0 jboss-javaee6-webapp-blank-archetype/src/main/resources/archetype-resources/src/main/java/util/Resources.java
  8. +2 −2 ...6-webapp-blank-archetype/src/main/resources/archetype-resources/src/main/resources/META-INF/persistence.xml
  9. +21 −0 ...webapp-blank-archetype/src/main/resources/archetype-resources/src/main/webapp/WEB-INF/__artifactId__-ds.xml
  10. +1 −1  ...bapp-blank-archetype/src/main/resources/archetype-resources/src/main/webapp/WEB-INF/templates/default.xhtml
  11. +23 −35 jboss-javaee6-webapp-blank-archetype/src/main/resources/archetype-resources/src/main/webapp/index.xhtml
  12. +14 −2 ...aee6-webapp-blank-archetype/src/main/resources/archetype-resources/src/main/webapp/resources/css/screen.css
  13. +10 −8 ...ebapp-blank-archetype/src/main/resources/archetype-resources/src/test/java/test/MemberRegistrationTest.java
  14. +20 −0 ...app-blank-archetype/src/main/resources/archetype-resources/src/test/resources/META-INF/test-persistence.xml
  15. +21 −0 jboss-javaee6-webapp-blank-archetype/src/main/resources/archetype-resources/src/test/resources/test-ds.xml
View
3  jboss-javaee6-webapp-blank-archetype/pom.xml
@@ -7,11 +7,12 @@
<groupId>org.jboss</groupId>
<artifactId>jboss-parent</artifactId>
<version>6-beta-2</version>
+ <relativePath />
</parent>
<groupId>org.jboss.spec.archetypes</groupId>
<artifactId>jboss-javaee6-webapp-blank-archetype</artifactId>
- <version>7.0.2-SNAPSHOT</version>
+ <version>7.1.1-SNAPSHOT</version>
<packaging>maven-archetype</packaging>
<name>Java EE 6 Webapp</name>
View
8 jboss-javaee6-webapp-blank-archetype/src/main/resources/META-INF/maven/archetype-metadata.xml
@@ -23,13 +23,13 @@
<exclude>**/*</exclude>
</excludes>
</fileSet>
- <fileSet encoding="UTF-8">
+ <fileSet encoding="UTF-8" filtered="true">
<directory>src/test/resources</directory>
<excludes>
- <exclude>**/*</exclude>
+ <include>**/*.xml</include>
</excludes>
</fileSet>
- <fileSet encoding="UTF-8">
+ <fileSet encoding="UTF-8" filtered="true">
<directory>src/main/webapp</directory>
<includes>
<include>**/*.xml</include>
@@ -41,7 +41,7 @@
<exclude>**/*</exclude>
</excludes>
</fileSet>
- <fileSet encoding="UTF-8">
+ <fileSet encoding="UTF-8" filtered="true">
<directory>src/main/resources</directory>
<includes>
<include>**/*.xml</include>
View
573 jboss-javaee6-webapp-blank-archetype/src/main/resources/archetype-resources/pom.xml
@@ -1,337 +1,290 @@
<?xml version="1.0" encoding="UTF-8"?>
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
- <modelVersion>4.0.0</modelVersion>
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+ <modelVersion>4.0.0</modelVersion>
- <groupId>${groupId}</groupId>
- <artifactId>${artifactId}</artifactId>
- <version>${version}</version>
- <packaging>war</packaging>
-#if ($name != "")
- <name>${name}</name>
-#end
- <description>A starter Java EE 6 webapp project for use on JBoss AS 7 / EAP 6, generated from the jboss-javaee6-webapp archetype</description>
+ <groupId>${groupId}</groupId>
+ <artifactId>${artifactId}</artifactId>
+ <version>${version}</version>
+ <packaging>war</packaging>
+ #if ($name != "")
+ <name>${name}</name>
+ #end
+ <description>A starter Java EE 6 webapp project for use on JBoss AS 7 / EAP 6, generated from the jboss-javaee6-webapp archetype</description>
- <properties>
- <!-- Explicitly declaring the source encoding eliminates the following
- message: -->
- <!-- [WARNING] Using platform encoding (UTF-8 actually) to copy filtered
- resources, i.e. build is platform dependent! -->
- <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
- <!-- Define the version of JBoss' Java EE 6 APIs we want to import.
- Any dependencies from org.jboss.spec will have their version defined by this
- BOM -->
-#if ($enterprise == "true" || $enterprise == "y" || $enterprise == "yes" )
- <!-- Certified version of the JBoss EAP components we want to use -->
- <javaee6.web.spec.version>3.0.0.Beta1-redhat-1</javaee6.web.spec.version>
- <!-- Alternatively, comment out the above line, and un-comment the line below to
- use version 2.0.0.Beta1 which is based on community built dependencies.
- You can actually use this stack with any version of JBoss AS that implements
- the Java EE 6 web profile -->
- <!--
- <javaee6.web.spec.version>2.0.0.Final</javaee6.web.spec.version>
- -->
-#else
- <javaee6.web.spec.version>2.0.0.Final</javaee6.web.spec.version>
- <!-- Alternatively, comment out the above line, and un-comment the line below to
- use version 3.0.0.Beta1-redhat-1 which is a release certified
- to work with JBoss EAP 6. It requires you have access to the JBoss EAP 6 maven repository. -->
- <!--
- <javaee6.web.spec.version>3.0.0.Beta1-redhat-1</javaee6.web.spec.version>
- -->
-#end
- </properties>
+ <properties>
+ <!-- Explicitly declaring the source encoding eliminates the following
+ message: -->
+ <!-- [WARNING] Using platform encoding (UTF-8 actually) to copy filtered
+ resources, i.e. build is platform dependent! -->
+ <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
+ <!-- Define the version of JBoss' Java EE 6 APIs and Tools we want
+ to import. -->
+ #if ($enterprise == "true" || $enterprise == "y" || $enterprise
+ == "yes" )
+ <!-- Certified version of the JBoss EAP components we want to use -->
+ <jboss.bom.version>1.0.0.M5-redhat-1</jboss.bom.version>
+ <!-- Alternatively, comment out the above line, and un-comment the
+ line below to use version 1.0.0M5 which is based on community built dependencies. -->
+ <!-- <jboss.bom.version>1.0.0.M5</jboss.bom.version> -->
+ #else
+ <jboss.bom.version>1.0.0.M5</jboss.bom.version>
+ <!-- Alternatively, comment out the above line, and un-comment the
+ line below to use version 1.0.0.M5-redhat-1 which is a release certified
+ to work with JBoss EAP 6. It requires you have access to the JBoss EAP 6
+ maven repository. -->
+ <!-- <jboss.bom.version>1.0.0.M5-redhat-1</jboss.bom.version>> -->
+ #end
+ </properties>
- <dependencyManagement>
- <dependencies>
- <!-- JBoss distributes a complete set of Java EE 6 APIs including
- a Bill of Materials (BOM). A BOM specifies the versions of a "stack" (or
- a collection) of artifacts. We use this here so that we always get the correct
- versions of artifacts. Here we use the jboss-javaee-web-6.0 stack (you can
- read this as the JBoss stack of the Java EE Web Profile 6 APIs) -->
- <dependency>
- <groupId>org.jboss.spec</groupId>
- <artifactId>jboss-javaee-web-6.0</artifactId>
- <version>${javaee6.web.spec.version}</version>
- <type>pom</type>
- <scope>import</scope>
- </dependency>
- </dependencies>
- </dependencyManagement>
- <dependencies>
+ <dependencyManagement>
+ <dependencies>
+ <!-- JBoss distributes a complete set of Java EE 6 APIs including
+ a Bill of Materials (BOM). A BOM specifies the versions of a "stack" (or
+ a collection) of artifacts. We use this here so that we always get the correct
+ versions of artifacts. Here we use the jboss-javaee-6.0-with-tools stack
+ (you can read this as the JBoss stack of the Java EE 6 APIs, with some extras
+ tools for your project, such as Arquillian for testing) and the jboss-javaee-6.0-with-hibernate
+ stack you can read this as the JBoss stack of the Java EE 6 APIs, with extras
+ from the Hibernate family of projects) -->
+ <dependency>
+ <groupId>org.jboss.bom</groupId>
+ <artifactId>jboss-javaee-6.0-with-tools</artifactId>
+ <version>${jboss.bom.version}</version>
+ <type>pom</type>
+ <scope>import</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.jboss.bom</groupId>
+ <artifactId>jboss-javaee-6.0-with-hibernate</artifactId>
+ <version>${jboss.bom.version}</version>
+ <type>pom</type>
+ <scope>import</scope>
+ </dependency>
+ </dependencies>
+ </dependencyManagement>
+
+ <dependencies>
- <!-- First declare the APIs we depend on and need for compilation.
- All of them are provided by JBoss AS 7 -->
+ <!-- First declare the APIs we depend on and need for compilation.
+ All of them are provided by JBoss AS 7 -->
- <!-- Import the CDI API, we use provided scope as the API is included
- in JBoss AS 7 -->
- <dependency>
- <groupId>javax.enterprise</groupId>
- <artifactId>cdi-api</artifactId>
- <scope>provided</scope>
- </dependency>
+ <!-- Import the CDI API, we use provided scope as the API is included
+ in JBoss AS 7 -->
+ <dependency>
+ <groupId>javax.enterprise</groupId>
+ <artifactId>cdi-api</artifactId>
+ <scope>provided</scope>
+ </dependency>
- <!-- Import the Common Annotations API (JSR-250), we use provided scope
- as the API is included in JBoss AS 7 -->
- <dependency>
- <groupId>org.jboss.spec.javax.annotation</groupId>
- <artifactId>jboss-annotations-api_1.1_spec</artifactId>
- <scope>provided</scope>
- </dependency>
+ <!-- Import the Common Annotations API (JSR-250), we use provided
+ scope as the API is included in JBoss AS 7 -->
+ <dependency>
+ <groupId>org.jboss.spec.javax.annotation</groupId>
+ <artifactId>jboss-annotations-api_1.1_spec</artifactId>
+ <scope>provided</scope>
+ </dependency>
- <!-- Import the JAX-RS API, we use provided scope as the API is included
- in JBoss AS 7 -->
- <dependency>
- <groupId>org.jboss.spec.javax.ws.rs</groupId>
- <artifactId>jboss-jaxrs-api_1.1_spec</artifactId>
- <scope>provided</scope>
- </dependency>
+ <!-- Import the JAX-RS API, we use provided scope as the API is included
+ in JBoss AS 7 -->
+ <dependency>
+ <groupId>org.jboss.spec.javax.ws.rs</groupId>
+ <artifactId>jboss-jaxrs-api_1.1_spec</artifactId>
+ <scope>provided</scope>
+ </dependency>
- <!-- Import the JPA API, we use provided scope as the API is included
- in JBoss AS 7 -->
- <dependency>
- <groupId>org.hibernate.javax.persistence</groupId>
- <artifactId>hibernate-jpa-2.0-api</artifactId>
- <scope>provided</scope>
- </dependency>
+ <!-- Import the JPA API, we use provided scope as the API is included
+ in JBoss AS 7 -->
+ <dependency>
+ <groupId>org.hibernate.javax.persistence</groupId>
+ <artifactId>hibernate-jpa-2.0-api</artifactId>
+ <scope>provided</scope>
+ </dependency>
- <!-- Import the EJB API, we use provided scope as the API is included
- in JBoss AS 7 -->
- <dependency>
- <groupId>org.jboss.spec.javax.ejb</groupId>
- <artifactId>jboss-ejb-api_3.1_spec</artifactId>
- <scope>provided</scope>
- </dependency>
+ <!-- Import the EJB API, we use provided scope as the API is included
+ in JBoss AS 7 -->
+ <dependency>
+ <groupId>org.jboss.spec.javax.ejb</groupId>
+ <artifactId>jboss-ejb-api_3.1_spec</artifactId>
+ <scope>provided</scope>
+ </dependency>
- <!-- JSR-303 (Bean Validation) Implementation -->
- <!-- Provides portable constraints such as @Email -->
- <!-- Hibernate Validator is shipped in JBoss AS 7 -->
- <dependency>
- <groupId>org.hibernate</groupId>
- <artifactId>hibernate-validator</artifactId>
- <version>4.2.0.Final</version>
- <scope>provided</scope>
- <exclusions>
- <exclusion>
- <groupId>org.slf4j</groupId>
- <artifactId>slf4j-api</artifactId>
- </exclusion>
- </exclusions>
- </dependency>
+ <!-- JSR-303 (Bean Validation) Implementation -->
+ <!-- Provides portable constraints such as @Email -->
+ <!-- Hibernate Validator is shipped in JBoss AS 7 -->
+ <dependency>
+ <groupId>org.hibernate</groupId>
+ <artifactId>hibernate-validator</artifactId>
+ <scope>provided</scope>
+ <exclusions>
+ <exclusion>
+ <groupId>org.slf4j</groupId>
+ <artifactId>slf4j-api</artifactId>
+ </exclusion>
+ </exclusions>
+ </dependency>
- <!-- Now we declare any tools needed -->
+ <!-- Import the JSF API, we use provided scope as the API is included
+ in JBoss AS 7 -->
+ <dependency>
+ <groupId>org.jboss.spec.javax.faces</groupId>
+ <artifactId>jboss-jsf-api_2.0_spec</artifactId>
+ <scope>provided</scope>
+ </dependency>
- <!-- Annotation processor to generate the JPA 2.0 metamodel classes
- for typesafe criteria queries -->
- <dependency>
- <groupId>org.hibernate</groupId>
- <artifactId>hibernate-jpamodelgen</artifactId>
- <version>1.1.1.Final</version>
- <scope>provided</scope>
- </dependency>
+ <!-- Now we declare any tools needed -->
- <!-- Needed for running tests (you may also use TestNG) -->
- <dependency>
- <groupId>junit</groupId>
- <artifactId>junit</artifactId>
- <version>4.10</version>
- <scope>test</scope>
- </dependency>
+ <!-- Annotation processor to generate the JPA 2.0 metamodel classes
+ for typesafe criteria queries -->
+ <dependency>
+ <groupId>org.hibernate</groupId>
+ <artifactId>hibernate-jpamodelgen</artifactId>
+ <scope>provided</scope>
+ </dependency>
- <!-- Optional, but highly recommended -->
- <!-- Arquillian allows you to test enterprise code such as EJBs and
- Transactional(JTA) JPA from JUnit/TestNG -->
- <dependency>
- <groupId>org.jboss.arquillian.junit</groupId>
- <artifactId>arquillian-junit-container</artifactId>
- <version>1.0.0.CR4</version>
- <scope>test</scope>
- </dependency>
-
- <dependency>
- <groupId>org.jboss.arquillian.protocol</groupId>
- <artifactId>arquillian-protocol-servlet</artifactId>
- <version>1.0.0.CR4</version>
- <scope>test</scope>
- </dependency>
+ <!-- Annotation processor that raising compilation errors whenever
+ constraint annotations are incorrectly used. -->
+ <dependency>
+ <groupId>org.hibernate</groupId>
+ <artifactId>hibernate-validator-annotation-processor</artifactId>
+ <scope>provided</scope>
+ </dependency>
- </dependencies>
+ <!-- Needed for running tests (you may also use TestNG) -->
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ <scope>test</scope>
+ </dependency>
- <build>
- <!-- Maven will append the version to the finalName (which is the name
- given to the generated war, and hence the context root) -->
- <finalName>${project.artifactId}</finalName>
- <plugins>
- <!-- Compiler plugin enforces Java 1.6 compatibility and activates
- annotation processors -->
- <plugin>
- <artifactId>maven-compiler-plugin</artifactId>
- <version>2.3.1</version>
- <configuration>
- <source>1.6</source>
- <target>1.6</target>
- </configuration>
- </plugin>
- <plugin>
- <artifactId>maven-war-plugin</artifactId>
- <version>2.1.1</version>
- <configuration>
- <!-- Java EE 6 doesn't require web.xml, Maven needs to catch
- up! -->
- <failOnMissingWebXml>false</failOnMissingWebXml>
- </configuration>
- </plugin>
- <!-- The JBoss AS plugin deploys your war to a local JBoss AS container -->
- <!-- To use, set the JBOSS_HOME environment variable and run: mvn
- package jboss-as:deploy -->
- <plugin>
- <groupId>org.jboss.as.plugins</groupId>
- <artifactId>jboss-as-maven-plugin</artifactId>
- <version>7.1.0.Beta1b</version>
- </plugin>
- </plugins>
- </build>
+ <!-- Optional, but highly recommended -->
+ <!-- Arquillian allows you to test enterprise code such as EJBs and
+ Transactional(JTA) JPA from JUnit/TestNG -->
+ <dependency>
+ <groupId>org.jboss.arquillian.junit</groupId>
+ <artifactId>arquillian-junit-container</artifactId>
+ <scope>test</scope>
+ </dependency>
- <profiles>
- <profile>
- <!-- The default profile skips all tests, though you can tune it
- to run just unit tests based on a custom pattern -->
- <!-- Seperate profiles are provided for running all tests, including
- Arquillian tests that execute in the specified container -->
- <id>default</id>
- <activation>
- <activeByDefault>true</activeByDefault>
- </activation>
- <build>
- <plugins>
- <plugin>
- <artifactId>maven-surefire-plugin</artifactId>
- <version>2.4.3</version>
- <configuration>
- <skip>true</skip>
- </configuration>
- </plugin>
- </plugins>
- </build>
- </profile>
+ <dependency>
+ <groupId>org.jboss.arquillian.protocol</groupId>
+ <artifactId>arquillian-protocol-servlet</artifactId>
+ <scope>test</scope>
+ </dependency>
- <profile>
- <!-- We add the JBoss repository as we need the JBoss AS connectors
- for Arquillian -->
- <repositories>
- <!-- The JBoss Community public repository is a composite repository
- of several major repositories -->
- <!-- see http://community.jboss.org/wiki/MavenGettingStarted-Users -->
- <repository>
- <id>jboss-public-repository</id>
- <name>JBoss Repository</name>
- <url>http://repository.jboss.org/nexus/content/groups/public</url>
- <!-- These optional flags are designed to speed up your builds
- by reducing remote server calls -->
- <releases>
- </releases>
- <snapshots>
- <enabled>false</enabled>
- </snapshots>
- </repository>
- </repositories>
+ </dependencies>
- <pluginRepositories>
- <pluginRepository>
- <id>jboss-public-repository</id>
- <name>JBoss Repository</name>
- <url>http://repository.jboss.org/nexus/content/groups/public</url>
- <releases>
- </releases>
- <snapshots>
- <enabled>false</enabled>
- </snapshots>
- </pluginRepository>
- </pluginRepositories>
+ <build>
+ <!-- Maven will append the version to the finalName (which is the
+ name given to the generated war, and hence the context root) -->
+ <finalName>${project.artifactId}</finalName>
+ <plugins>
+ <!-- Compiler plugin enforces Java 1.6 compatibility and activates
+ annotation processors -->
+ <plugin>
+ <artifactId>maven-compiler-plugin</artifactId>
+ <version>2.3.1</version>
+ <configuration>
+ <source>1.6</source>
+ <target>1.6</target>
+ </configuration>
+ </plugin>
+ <plugin>
+ <artifactId>maven-war-plugin</artifactId>
+ <version>2.1.1</version>
+ <configuration>
+ <!-- Java EE 6 doesn't require web.xml, Maven needs to
+ catch up! -->
+ <failOnMissingWebXml>false</failOnMissingWebXml>
+ </configuration>
+ </plugin>
+ <!-- The JBoss AS plugin deploys your war to a local JBoss AS
+ container -->
+ <!-- To use, run: mvn package jboss-as:deploy -->
+ <plugin>
+ <groupId>org.jboss.as.plugins</groupId>
+ <artifactId>jboss-as-maven-plugin</artifactId>
+ <version>7.1.1.Final</version>
+ </plugin>
+ </plugins>
+ </build>
- <!-- An optional Arquillian testing profile that executes tests
- in your JBoss AS instance -->
- <!-- This profile will start a new JBoss AS instance, and execute
- the test, shutting it down when done -->
- <!-- Run with: mvn clean test -Parq-jbossas-managed -->
- <id>arq-jbossas-managed</id>
- <dependencies>
- <dependency>
- <groupId>org.jboss.as</groupId>
- <artifactId>jboss-as-arquillian-container-managed</artifactId>
- <version>7.1.0.Beta1b</version>
- <scope>test</scope>
- </dependency>
- </dependencies>
- </profile>
+ <profiles>
+ <profile>
+ <!-- The default profile skips all tests, though you can tune
+ it to run just unit tests based on a custom pattern -->
+ <!-- Seperate profiles are provided for running all tests, including
+ Arquillian tests that execute in the specified container -->
+ <id>default</id>
+ <activation>
+ <activeByDefault>true</activeByDefault>
+ </activation>
+ <build>
+ <plugins>
+ <plugin>
+ <artifactId>maven-surefire-plugin</artifactId>
+ <version>2.4.3</version>
+ <configuration>
+ <skip>true</skip>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
+ </profile>
- <profile>
- <!-- We add the JBoss repository as we need the JBoss AS connectors
- for Arquillian -->
- <repositories>
- <!-- The JBoss Community public repository is a composite repository
- of several major repositories -->
- <!-- see http://community.jboss.org/wiki/MavenGettingStarted-Users -->
- <repository>
- <id>jboss-public-repository</id>
- <name>JBoss Repository</name>
- <url>http://repository.jboss.org/nexus/content/groups/public</url>
- <!-- These optional flags are designed to speed up your builds
- by reducing remote server calls -->
- <releases>
- </releases>
- <snapshots>
- <enabled>false</enabled>
- </snapshots>
- </repository>
- </repositories>
+ <profile>
+ <!-- An optional Arquillian testing profile that executes tests
+ in your JBoss AS instance -->
+ <!-- This profile will start a new JBoss AS instance, and execute
+ the test, shutting it down when done -->
+ <!-- Run with: mvn clean test -Parq-jbossas-managed -->
+ <id>arq-jbossas-managed</id>
+ <dependencies>
+ <dependency>
+ <groupId>org.jboss.as</groupId>
+ <artifactId>jboss-as-arquillian-container-managed</artifactId>
+ <scope>test</scope>
+ </dependency>
+ </dependencies>
+ </profile>
- <pluginRepositories>
- <pluginRepository>
- <id>jboss-public-repository</id>
- <name>JBoss Repository</name>
- <url>http://repository.jboss.org/nexus/content/groups/public</url>
- <releases>
- </releases>
- <snapshots>
- <enabled>false</enabled>
- </snapshots>
- </pluginRepository>
- </pluginRepositories>
+ <profile>
+ <!-- An optional Arquillian testing profile that executes tests
+ in a remote JBoss AS instance -->
+ <!-- Run with: mvn clean test -Parq-jbossas-remote -->
+ <id>arq-jbossas-remote</id>
+ <dependencies>
+ <dependency>
+ <groupId>org.jboss.as</groupId>
+ <artifactId>jboss-as-arquillian-container-remote</artifactId>
+ <scope>test</scope>
+ </dependency>
+ </dependencies>
+ </profile>
- <!-- An optional Arquillian testing profile that executes tests
- in a remote JBoss AS instance -->
- <!-- Run with: mvn clean test -Parq-jbossas-remote -->
- <id>arq-jbossas-remote</id>
- <dependencies>
- <dependency>
- <groupId>org.jboss.as</groupId>
- <artifactId>jboss-as-arquillian-container-remote</artifactId>
- <version>7.1.0.Beta1b</version>
- <scope>test</scope>
- </dependency>
- </dependencies>
- </profile>
-
- <profile>
- <!-- When built in OpenShift the 'openshift' profile will be used when invoking mvn. -->
- <!-- Use this profile for any OpenShift specific customization your app will need. -->
- <!-- By default that is to put the resulting archive into the 'deployments' folder. -->
- <!-- http://maven.apache.org/guides/mini/guide-building-for-different-environments.html -->
- <id>openshift</id>
- <build>
- <plugins>
- <plugin>
- <artifactId>maven-war-plugin</artifactId>
- <version>2.1.1</version>
- <configuration>
- <outputDirectory>deployments</outputDirectory>
- <warName>ROOT</warName>
- </configuration>
- </plugin>
- </plugins>
- </build>
- </profile>
+ <profile>
+ <!-- When built in OpenShift the 'openshift' profile will be
+ used when invoking mvn. -->
+ <!-- Use this profile for any OpenShift specific customization
+ your app will need. -->
+ <!-- By default that is to put the resulting archive into the
+ 'deployments' folder. -->
+ <!-- http://maven.apache.org/guides/mini/guide-building-for-different-environments.html -->
+ <id>openshift</id>
+ <build>
+ <plugins>
+ <plugin>
+ <artifactId>maven-war-plugin</artifactId>
+ <version>2.1.1</version>
+ <configuration>
+ <outputDirectory>deployments</outputDirectory>
+ <warName>ROOT</warName>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
+ </profile>
- </profiles>
+ </profiles>
</project>
View
15 jboss-javaee6-webapp-blank-archetype/src/main/resources/archetype-resources/readme.md
@@ -4,12 +4,7 @@ ${artifactId}
What is it?
-----------
-This is your project! It's a sample, deployable Maven 3 project to help you
-get your foot in the door developing with Java EE 6 on JBoss AS 7 or EAP 6. This
-project is setup to allow you to create a compliant Java EE 6 application
-using JSF 2.0, CDI 1.0, EJB 3.1, JPA 2.0 and Bean Validation 1.0. It includes
-a persistence unit and some sample persistence and transaction code to help
-you get your feet wet with database access in enterprise Java.
+This is your project! It's a sample, deployable Maven 3 project to help you get your foot in the door developing with Java EE 6 on JBoss Enterprise Application Platform 6 or JBoss AS 7. This project is setup to allow you to create a compliant Java EE 6 application using JSF 2.0, CDI 1.0, EJB 3.1, JPA 2.0 and Bean Validation 1.0. It includes a persistence unit and some sample persistence and transaction code to help you get your feet wet with database access in enterprise Java.
System requirements
-------------------
@@ -17,15 +12,14 @@ System requirements
All you need to build this project is Java 6.0 (Java SDK 1.6) or better, Maven
3.0 or better.
-The application this project produces is designed to be run on a JBoss AS 7 or EAP 6.
-The following instructions target JBoss AS 7, but they also apply to JBoss EAP 6.
+The application this project produces is designed to be run on a JBoss Enterprise Application Platform 6 or JBoss AS 7.
With the prerequisites out of the way, you're ready to build and deploy.
Deploying the application
-------------------------
-First you need to start JBoss AS 7 (or EAP 6). To do this, run
+First you need to start JBoss Enterprise Application Platform 6 or JBoss AS 7. To do this, run
$JBOSS_HOME/bin/standalone.sh
@@ -50,8 +44,7 @@ To undeploy from JBoss AS, run this command:
mvn jboss-as:undeploy
-You can also start JBoss AS 7 and deploy the project using Eclipse. See the JBoss AS 7
-Getting Started Guide for Developers for more information.
+You can also start JBoss AS 7 and deploy the project using Eclipse. See the JBoss AS 7 <a href="https://docs.jboss.org/author/display/AS71/Getting+Started+Developing+Applications+Guide" title="Getting Started Developing Applications Guide">Getting Started Developing Applications Guide</a> for more information.
Running the Arquillian tests
============================
View
19 .../src/main/java/controller/MemberRegistration.java → ...es/src/main/java/controller/MemberController.java
@@ -10,29 +10,27 @@
import javax.enterprise.event.Event;
import javax.enterprise.inject.Model;
import javax.enterprise.inject.Produces;
+import javax.faces.application.FacesMessage;
+import javax.faces.context.FacesContext;
import javax.inject.Inject;
import javax.inject.Named;
import javax.persistence.EntityManager;
import ${package}.model.Member;
+import ${package}.service.MemberRegistration;
-// The @Stateful annotation eliminates the need for manual transaction demarcation
-@Stateful
// The @Model stereotype is a convenience mechanism to make this a request-scoped bean that has an
// EL name
// Read more about the @Model stereotype in this FAQ:
// http://sfwk.org/Documentation/WhatIsThePurposeOfTheModelAnnotation
@Model
-public class MemberRegistration {
+public class MemberController {
@Inject
- private Logger log;
+ private FacesContext facesContext;
@Inject
- private EntityManager em;
-
- @Inject
- private Event<Member> memberEventSrc;
+ private MemberRegistration memberRegistration;
private Member newMember;
@@ -43,9 +41,8 @@ public Member getNewMember() {
}
public void register() throws Exception {
- log.info("Registering " + newMember.getName());
- em.persist(newMember);
- memberEventSrc.fire(newMember);
+ memberRegistration.register(newMember);
+ facesContext.addMessage(null, new FacesMessage(FacesMessage.SEVERITY_INFO, "Registered!", "Registration successful"));
initNewMember();
}
View
32 ...app-blank-archetype/src/main/resources/archetype-resources/src/main/java/service/MemberRegistration.java
@@ -0,0 +1,32 @@
+#set( $symbol_pound = '#' )
+#set( $symbol_dollar = '$' )
+#set( $symbol_escape = '\' )
+package ${package}.service;
+
+import ${package}.model.Member;
+
+import javax.ejb.Stateless;
+import javax.enterprise.event.Event;
+import javax.inject.Inject;
+import javax.persistence.EntityManager;
+import java.util.logging.Logger;
+
+// The @Stateless annotation eliminates the need for manual transaction demarcation
+@Stateless
+public class MemberRegistration {
+
+ @Inject
+ private Logger log;
+
+ @Inject
+ private EntityManager em;
+
+ @Inject
+ private Event<Member> memberEventSrc;
+
+ public void register(Member member) throws Exception {
+ log.info("Registering " + member.getName());
+ em.persist(member);
+ memberEventSrc.fire(member);
+ }
+}
View
9 ...-javaee6-webapp-blank-archetype/src/main/resources/archetype-resources/src/main/java/util/Resources.java
@@ -5,8 +5,10 @@
import java.util.logging.Logger;
+import javax.enterprise.context.RequestScoped;
import javax.enterprise.inject.Produces;
import javax.enterprise.inject.spi.InjectionPoint;
+import javax.faces.context.FacesContext;
import javax.persistence.EntityManager;
import javax.persistence.PersistenceContext;
@@ -33,4 +35,11 @@
public Logger produceLog(InjectionPoint injectionPoint) {
return Logger.getLogger(injectionPoint.getMember().getDeclaringClass().getName());
}
+
+ @Produces
+ @RequestScoped
+ public FacesContext produceFacesContext() {
+ return FacesContext.getCurrentInstance();
+ }
+
}
View
4 ...ebapp-blank-archetype/src/main/resources/archetype-resources/src/main/resources/META-INF/persistence.xml
@@ -6,8 +6,8 @@
http://java.sun.com/xml/ns/persistence/persistence_2_0.xsd">
<persistence-unit name="primary">
<!-- If you are running in a production environment, add a managed
- data source, the example data source is just for proofs of concept! -->
- <jta-data-source>java:jboss/datasources/ExampleDS</jta-data-source>
+ data source, the example data source is just for development and testing! -->
+ <jta-data-source>java:jboss/datasources/${artifactId}DS</jta-data-source>
<properties>
<!-- Properties for Hibernate -->
<property name="hibernate.hbm2ddl.auto" value="create-drop" />
View
21 ...app-blank-archetype/src/main/resources/archetype-resources/src/main/webapp/WEB-INF/__artifactId__-ds.xml
@@ -0,0 +1,21 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!-- This is an unmanaged datasource. It should be used for proofs of concept
+ or testing only. It uses H2, an in memory database that ships with JBoss
+ AS. -->
+<datasources xmlns="http://www.jboss.org/ironjacamar/schema"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://www.jboss.org/ironjacamar/schema http://docs.jboss.org/ironjacamar/schema/datasources_1_0.xsd">
+ <!-- The datasource is bound into JNDI at this location. We reference
+ this in META-INF/persistence.xml -->
+ <datasource jndi-name="java:jboss/datasources/${artifactId}DS"
+ pool-name="{artifactId}" enabled="true"
+ use-java-context="true">
+ <connection-url>jdbc:h2:mem:${artifactId};DB_CLOSE_DELAY=-1</connection-url>
+ <driver>h2</driver>
+ <security>
+ <user-name>sa</user-name>
+ <password>sa</password>
+ </security>
+ </datasource>
+</datasources>
+
View
2  ...p-blank-archetype/src/main/resources/archetype-resources/src/main/webapp/WEB-INF/templates/default.xhtml
@@ -18,7 +18,7 @@
<li><a
href="https://docs.jboss.org/author/display/AS7/Getting+Started+Developing+Applications+Guide">JBoss
AS 7 Getting Started Developing Applications Guide</a></li>
- <li><a href="jboss.org/jbossas">JBoss AS 7 project
+ <li><a href="http://www.jboss.org/jbossas">JBoss AS 7 project
site</a></li>
</ul>
<p>Learn about the Java EE 6 platform and the component
View
58 jboss-javaee6-webapp-blank-archetype/src/main/resources/archetype-resources/src/main/webapp/index.xhtml
@@ -7,49 +7,38 @@
<ui:define name="content">
<h1>Welcome to JBoss AS 7!</h1>
- <p>You have successfully deployed a Java EE 6 web application
- on JBoss AS 7.</p>
+ <p>You have successfully deployed a Java EE 6 web application on JBoss AS 7.</p>
<h:form id="reg">
<h2>Register (Bean Validation example)</h2>
- <p>Enforces annotation-based constraints defined on the
- model class.</p>
- <table>
- <tr>
- <th style="text-align: right;"><h:outputLabel
- for="name" value="Name:" /></th>
- <td><h:inputText id="name" value="#{newMember.name}" />
- <h:message for="name" errorClass="invalid" /></td>
- </tr>
- <tr>
- <th style="text-align: right;"><h:outputLabel
- for="email" value="Email:" /></th>
- <td><h:inputText id="email"
- value="#{newMember.email}" /> <h:message
- for="email" errorClass="invalid" /></td>
- </tr>
- <tr>
- <th style="text-align: right;"><h:outputLabel
- for="phoneNumber" value="Phone #:" /></th>
- <td><h:inputText id="phoneNumber"
- value="#{newMember.phoneNumber}" /> <h:message
- for="phoneNumber" errorClass="invalid" /></td>
- </tr>
- </table>
+ <p>Enforces annotation-based constraints defined on the model class.</p>
+ <h:panelGrid columns="3" columnClasses="titleCell">
+ <h:outputLabel for="name" value="Name:"/>
+ <h:inputText id="name" value="#{newMember.name}" />
+ <h:message for="name" errorClass="invalid"/>
+
+ <h:outputLabel for="email" value="Email:"/>
+ <h:inputText id="email" value="#{newMember.email}"/>
+ <h:message for="email" errorClass="invalid"/>
+
+ <h:outputLabel for="phoneNumber" value="Phone #:"/>
+ <h:inputText id="phoneNumber" value="#{newMember.phoneNumber}"/>
+ <h:message for="phoneNumber" errorClass="invalid"/>
+ </h:panelGrid>
+
<p>
- <h:commandButton id="register"
- action="#{memberRegistration.register}" value="Register" />
- <h:outputText value=" Registered!"
- rendered="#{facesContext.postback and empty facesContext.messageList}"
- style="color: green;" />
+ <h:panelGrid columns="2">
+ <h:commandButton id="register" action="#{memberController.register}" value="Register"/>
+ <h:messages styleClass="messages" errorClass="invalid" infoClass="valid" warnClass="warning"
+ globalOnly="true"/>
+ </h:panelGrid>
</p>
</h:form>
<h2>Members</h2>
<h:panelGroup rendered="#{empty members}">
<em>No registered members.</em>
</h:panelGroup>
- <h:dataTable var="_member" value="#{members}"
- rendered="#{not empty members}">
+ <h:dataTable var="_member" value="#{members}" rendered="#{not empty members}">
<h:column>
<f:facet name="header">Id</f:facet>
#{_member.id}
@@ -71,8 +60,7 @@
<a href="#{request.contextPath}/rest/members/#{_member.id}">/rest/members/#{_member.id}</a>
</h:column>
<f:facet name="footer">
- REST URL for all members: <a
- href="#{request.contextPath}/rest/members">/rest/members</a>
+ REST URL for all members: <a href="#{request.contextPath}/rest/members">/rest/members</a>
</f:facet>
</h:dataTable>
</ui:define>
View
16 ...6-webapp-blank-archetype/src/main/resources/archetype-resources/src/main/webapp/resources/css/screen.css
@@ -34,7 +34,19 @@ body {
code {
font-size: 1.1em;
}
-span.invalid {
- padding-left: 3px;
+
+.messages {
+ list-style-type: none;
+}
+
+.invalid {
color: red;
}
+
+.warn {
+ color: orange;
+}
+
+.valid {
+ color: green;
+}
View
18 ...pp-blank-archetype/src/main/resources/archetype-resources/src/test/java/test/MemberRegistrationTest.java
@@ -11,6 +11,10 @@
import org.jboss.arquillian.container.test.api.Deployment;
import org.jboss.arquillian.junit.Arquillian;
+import ${package}.controller.MemberController;
+import ${package}.model.Member;
+import ${package}.service.MemberRegistration;
+import ${package}.util.Resources;
import org.jboss.shrinkwrap.api.Archive;
import org.jboss.shrinkwrap.api.ShrinkWrap;
import org.jboss.shrinkwrap.api.asset.EmptyAsset;
@@ -18,18 +22,16 @@
import org.junit.Test;
import org.junit.runner.RunWith;
-import ${package}.controller.MemberRegistration;
-import ${package}.model.Member;
-import ${package}.util.Resources;
-
@RunWith(Arquillian.class)
public class MemberRegistrationTest {
@Deployment
public static Archive<?> createTestArchive() {
return ShrinkWrap.create(WebArchive.class, "test.war")
.addClasses(Member.class, MemberRegistration.class, Resources.class)
- .addAsResource("META-INF/persistence.xml", "META-INF/persistence.xml")
- .addAsWebInfResource(EmptyAsset.INSTANCE, "beans.xml");
+ .addAsResource("META-INF/test-persistence.xml", "META-INF/persistence.xml")
+ .addAsWebInfResource(EmptyAsset.INSTANCE, "beans.xml")
+ // Deploy our test datasource
+ .addAsWebInfResource("test-ds.xml", "test-ds.xml");
}
@Inject
@@ -40,11 +42,11 @@
@Test
public void testRegister() throws Exception {
- Member newMember = memberRegistration.getNewMember();
+ Member newMember = new Member();
newMember.setName("Jane Doe");
newMember.setEmail("jane@mailinator.com");
newMember.setPhoneNumber("2125551234");
- memberRegistration.register();
+ memberRegistration.register(newMember);
assertNotNull(newMember.getId());
log.info(newMember.getName() + " was persisted with id " + newMember.getId());
}
View
20 ...-blank-archetype/src/main/resources/archetype-resources/src/test/resources/META-INF/test-persistence.xml
@@ -0,0 +1,20 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<persistence version="2.0"
+ xmlns="http://java.sun.com/xml/ns/persistence" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="
+ http://java.sun.com/xml/ns/persistence
+ http://java.sun.com/xml/ns/persistence/persistence_2_0.xsd">
+ <persistence-unit name="primary">
+ <!-- We use a different datasource for tests, so as to not overwrite
+ production data. This is an unmanaged data source, backed by H2, an in memory
+ database. Production applications should use a managed datasource. -->
+ <!-- The datasource is deployed as WEB-INF/test-ds.xml,
+ you can find it in the source at src/test/resources/test-ds.xml -->
+ <jta-data-source>java:jboss/datasources/${artifactId}TestDS</jta-data-source>
+ <properties>
+ <!-- Properties for Hibernate -->
+ <property name="hibernate.hbm2ddl.auto" value="create-drop" />
+ <property name="hibernate.show_sql" value="false" />
+ </properties>
+ </persistence-unit>
+</persistence>
View
21 jboss-javaee6-webapp-blank-archetype/src/main/resources/archetype-resources/src/test/resources/test-ds.xml
@@ -0,0 +1,21 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!-- This is an unmanaged datasource. It should be used for proofs of concept
+ or testing only. It uses H2, an in memory database that ships with JBoss
+ AS. -->
+<datasources xmlns="http://www.jboss.org/ironjacamar/schema"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://www.jboss.org/ironjacamar/schema http://docs.jboss.org/ironjacamar/schema/datasources_1_0.xsd">
+ <!-- The datasource is bound into JNDI at this location. We reference
+ this in META-INF/test-persistence.xml -->
+ <datasource jndi-name="java:jboss/datasources/${artifactId}TestDS"
+ pool-name="${artifactId}-test" enabled="true"
+ use-java-context="true">
+ <connection-url>jdbc:h2:mem:${artifactId}-test;DB_CLOSE_DELAY=-1</connection-url>
+ <driver>h2</driver>
+ <security>
+ <user-name>sa</user-name>
+ <password>sa</password>
+ </security>
+ </datasource>
+</datasources>
+
Please sign in to comment.
Something went wrong with that request. Please try again.