Changes required to merge.
Tests are now organized and added one more as an functional example.
Added the patch on BaseWicketTester and WicketTester.

Signed-off-by: Felipe C. <[email protected]>

Project: http://git-wip-us.apache.org/repos/asf/wicket/repo
Commit: http://git-wip-us.apache.org/repos/asf/wicket/commit/af093ab1
Tree: http://git-wip-us.apache.org/repos/asf/wicket/tree/af093ab1
Diff: http://git-wip-us.apache.org/repos/asf/wicket/diff/af093ab1

Branch: refs/heads/master
Commit: af093ab1db443077c38fe316903e5b00b9cc9384
Parents: 1fd7934
Author: Felipe C. <[email protected]>
Authored: Tue Jun 23 15:08:57 2015 -0300
Committer: Felipe C. <[email protected]>
Committed: Tue Jun 23 15:08:57 2015 -0300

----------------------------------------------------------------------
 testing/wicket-arquillian/README.md             |   4 +-
 testing/wicket-arquillian/pom.xml               | 169 +++++++--------
 .../testing/WicketJavaEEApplication.java        |  77 +++++++
 .../arquillian/testing/dao/ContactDao.java      |  61 ++++++
 .../arquillian/testing/dao/ContactDaoBean.java  |  69 +++++++
 .../arquillian/testing/model/Contact.java       | 109 ++++++++++
 .../arquillian/testing/pages/InsertContact.java |  82 ++++++++
 .../arquillian/testing/pages/ListContacts.java  |  70 +++++++
 .../util/ResourceWebApplicationPath.java        |  92 +++++++++
 .../wicketWar/WicketJavaEEApplication.java      |  70 -------
 .../quickstarts/wicketWar/dao/ContactDao.java   |  61 ------
 .../wicketWar/dao/ContactDaoBean.java           |  69 -------
 .../as/quickstarts/wicketWar/model/Contact.java | 104 ----------
 .../wicketWar/pages/InsertContact.java          |  82 --------
 .../wicketWar/pages/ListContacts.java           |  70 -------
 .../util/ResourceWebApplicationPath.java        |  98 ---------
 .../src/main/resources/META-INF/persistence.xml |   7 +-
 .../src/main/webapp/WEB-INF/faces-config.xml    |   9 -
 .../src/main/webapp/WEB-INF/web.xml             |  10 +-
 .../WEB-INF/wicket-arquillian-testing-ds.xml    |  37 ++++
 .../webapp/WEB-INF/wicket-quickstart-ds.xml     |  37 ----
 .../testing/TestWicketJavaEEApplication.java    |  35 ++++
 .../deployment/AbstractDeploymentTest.java      | 145 +++++++++++++
 .../testing/pages/InsertContactTest.java        | 115 +++++++++++
 .../ArquillianContainerProvidedTest.java        | 149 +++++++++++++
 .../wicketWar/TestWicketJavaEEApplication.java  |  36 ----
 .../wicketWar/pages/InsertContactTest.java      | 207 -------------------
 .../src/test/resources/arquillian.xml           |   4 +-
 .../src/test/webapp/WEB-INF/web.xml             |   4 +-
 .../wicket/util/tester/BaseWicketTester.java    |  84 ++++++--
 .../apache/wicket/util/tester/WicketTester.java |  30 ++-
 31 files changed, 1219 insertions(+), 977 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/wicket/blob/af093ab1/testing/wicket-arquillian/README.md
----------------------------------------------------------------------
diff --git a/testing/wicket-arquillian/README.md 
b/testing/wicket-arquillian/README.md
index 6e17c0b..b3ca219 100644
--- a/testing/wicket-arquillian/README.md
+++ b/testing/wicket-arquillian/README.md
@@ -3,14 +3,14 @@ wicket-war: Wicket Framework used in a WAR.
 Author: Ondrej Zizka <[email protected]>
 Level: Intermediate
 Technologies: Apache Wicket, JPA
-Summary: Demonstrates how to use the Wicket Framework 1.5 with the JBoss 
server using the Wicket-Stuff Java EE integration packaged as a WAR
+Summary: Demonstrates how to use the Wicket Framework 7.x with the JBoss 
server using the Wicket-Stuff Java EE integration packaged as a WAR
 Target Project: WildFly
 Source: <https://github.com/wildfly/quickstart/>
 
 What is it?
 -----------
 
-This is an example of how to use Wicket Framework 1.5 with WildFly, leveraging 
features of Java EE 7, using the Wicket-Stuff Java EE integration.
+This is an example of how to use Wicket Framework 7.x with WildFly, leveraging 
features of Java EE 6, using the CDI Java EE integration.
 
 Features used:
 

http://git-wip-us.apache.org/repos/asf/wicket/blob/af093ab1/testing/wicket-arquillian/pom.xml
----------------------------------------------------------------------
diff --git a/testing/wicket-arquillian/pom.xml 
b/testing/wicket-arquillian/pom.xml
index 0c8d4fc..91b5f23 100644
--- a/testing/wicket-arquillian/pom.xml
+++ b/testing/wicket-arquillian/pom.xml
@@ -1,24 +1,35 @@
 <?xml version="1.0"?>
-<!-- JBoss, Home of Professional Open Source Copyright 2013, Red Hat, Inc. 
-       and/or its affiliates, and individual contributors by the @authors tag. 
See 
-       the copyright.txt in the distribution for a full listing of individual 
contributors. 
-       Licensed under the Apache License, Version 2.0 (the "License"); you may 
not 
-       use this file except in compliance with the License. You may obtain a 
copy 
-       of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless 
required 
-       by applicable law or agreed to in writing, software distributed under 
the 
-       License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR 
CONDITIONS 
-       OF ANY KIND, either express or implied. See the License for the 
specific 
-       language governing permissions and limitations under the License. -->
+<!--
+   Licensed to the Apache Software Foundation (ASF) under one or more
+   contributor license agreements.  See the NOTICE file distributed with
+   this work for additional information regarding copyright ownership.
+   The ASF licenses this file to You under the Apache License, Version 2.0
+   (the "License"); you may not use this file except in compliance with
+   the License.  You may obtain a copy of the License at
+
+        http://www.apache.org/licenses/LICENSE-2.0
+
+   Unless required by applicable law or agreed to in writing, software
+   distributed under the License is distributed on an "AS IS" BASIS,
+   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+   See the License for the specific language governing permissions and
+   limitations under the License.
+-->
 <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>org.wildfly.quickstarts</groupId>
-       <artifactId>wildfly-arquillian-wicket-war</artifactId>
-       <version>8.0.0-SNAPSHOT</version>
+       
+       <parent>
+               <groupId>org.apache.wicket</groupId>
+               <artifactId>wicket-parent</artifactId>
+               <version>7.0.0-SNAPSHOT</version>
+               <relativePath>../../pom.xml</relativePath>
+       </parent>
+       
+       <artifactId>wicket-arquillian-testing</artifactId>
        <packaging>war</packaging>
 
-       <name>WildFly Quickstarts: Wicket: WAR</name>
+       <name>Wicket Arquillian Testing with Wildfly Java EE 6 Managed and 
Unpacked :: WAR</name>
        <licenses>
                <license>
                        <name>Apache License, Version 2.0</name>
@@ -28,57 +39,40 @@
        </licenses>
 
        <description>
-        A sample JAVA EE 6 project demonstrating how to use Wicket Framework 
with JBoss WildFly.
+        A sample JAVA EE 6 project demonstrating how to use Arquillian with 
Wicket Framework deployed on JBoss WildFly managed downloaded from maven 
repository (NEXUS for example) and unpacked with dependency plugin.
         WAR version (everything in a single .war file).
     </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>
-
-               <!-- JBoss dependency versions -->
-
+               <!-- Wildfly dependency versions -->
                
<version.wildfly.maven.plugin>1.0.2.Final</version.wildfly.maven.plugin>
+               <version.wildfly_8>8.1.0.Final</version.wildfly_8>
+               
+               <!-- Java EE 6 SPEC JBoss -->
+               
<version.jboss.spec.javaee.6.0>3.0.3.Final</version.jboss.spec.javaee.6.0>
 
-               
<version.jboss.spec.javaee.7.0>3.0.2.Final</version.jboss.spec.javaee.7.0>
-
-
-               <!-- Other dependency versions -->
-               <version.org.apache.wicket>1.5.5</version.org.apache.wicket>
-               
<version.net.ftlines.wicket-cdi>1.2</version.net.ftlines.wicket-cdi>
-
-               <!-- other plugin versions -->
-               <version.compiler.plugin>3.1</version.compiler.plugin>
-               <version.war.plugin>2.1.1</version.war.plugin>
-
-               <!-- maven-compiler-plugin -->
-               <maven.compiler.target>1.7</maven.compiler.target>
-               <maven.compiler.source>1.7</maven.compiler.source>
-
+               <!-- ShrinkWrap Resolvers Maven -->
                
<version.shrinkwrap.resolvers>2.1.1</version.shrinkwrap.resolvers>
+               
+               <!-- Arquillian -->
                <version.arquillian_core>1.0.3.Final</version.arquillian_core>
-               <version.jbossas_7>8.1.0.Final</version.jbossas_7>
-               <version.junit>4.8.1</version.junit>
        </properties>
 
        <dependencyManagement>
                <dependencies>
-                       <!-- JBoss distributes a complete set of Java EE 7 APIs 
including a Bill 
+                       <!-- 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-7.0-with-tools stack (you can 
-                               read this as the JBoss stack of the Java EE 7 
APIs, with some extras tools 
-                               for your project, such as Arquillian for 
testing) and the jboss-javaee-7.0-with-hibernate 
-                               stack you can read this as the JBoss stack of 
the Java EE 7 APIs, with extras 
+                               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.spec</groupId>
                                <artifactId>jboss-javaee-6.0</artifactId>
-                               
<version>${version.jboss.spec.javaee.7.0}</version>
+                               
<version>${version.jboss.spec.javaee.6.0}</version>
                                <type>pom</type>
                                <scope>import</scope>
                        </dependency>
@@ -87,14 +81,14 @@
                        <dependency>
                                <groupId>org.apache.wicket</groupId>
                                <artifactId>wicket-core</artifactId>
-                               <version>${version.org.apache.wicket}</version>
+                               <version>${project.version}</version>
                        </dependency>
 
                        <!-- Wicket Java EE integration. -->
                        <dependency>
-                               <groupId>net.ftlines.wicket-cdi</groupId>
+                               <groupId>org.apache.wicket</groupId>
                                <artifactId>wicket-cdi</artifactId>
-                               
<version>${version.net.ftlines.wicket-cdi}</version>
+                               <version>${project.version}</version>
                        </dependency>
 
                        <!-- Arquillian -->
@@ -126,6 +120,11 @@
                                <version>${version.arquillian_core}</version>
                                <classifier>tests</classifier>
                        </dependency>
+                       <dependency>
+                               <groupId>org.wildfly</groupId>
+                               
<artifactId>wildfly-arquillian-container-managed</artifactId>
+                               <version>${version.wildfly_8}</version>
+                       </dependency>
                </dependencies>
        </dependencyManagement>
 
@@ -176,7 +175,7 @@
 
                <!-- Wicket CDI integration. -->
                <dependency>
-                       <groupId>net.ftlines.wicket-cdi</groupId>
+                       <groupId>org.apache.wicket</groupId>
                        <artifactId>wicket-cdi</artifactId>
                </dependency>
 
@@ -184,22 +183,11 @@
                <dependency>
                        <groupId>org.jboss.shrinkwrap.resolver</groupId>
                        <artifactId>shrinkwrap-resolver-depchain</artifactId>
-                       <!-- <version>${version.shrinkwrap.resolvers}</version> 
-->
                        <scope>test</scope>
                        <type>pom</type>
                </dependency>
-               <!-- <dependency> <groupId>org.jboss.shrinkwrap</groupId> 
<artifactId>shrinkwrap-api</artifactId> 
-                       <scope>test</scope> </dependency> <dependency> 
<groupId>org.jboss.shrinkwrap</groupId> 
-                       <artifactId>shrinkwrap-spi</artifactId> 
<scope>test</scope> </dependency> 
-                       <dependency> <groupId>org.jboss.shrinkwrap</groupId> 
<artifactId>shrinkwrap-impl-base</artifactId> 
-                       <scope>test</scope> </dependency> <dependency> 
<groupId>org.jboss.shrinkwrap.resolver</groupId> 
-                       <artifactId>shrinkwrap-resolver-api</artifactId> 
<scope>test</scope> </dependency> 
-                       <dependency> 
<groupId>org.jboss.shrinkwrap.resolver</groupId> 
<artifactId>shrinkwrap-resolver-api-maven</artifactId> 
-                       <scope>test</scope> </dependency> <dependency> 
<groupId>org.jboss.shrinkwrap.resolver</groupId> 
-                       <artifactId>shrinkwrap-resolver-impl-maven</artifactId> 
<scope>test</scope> 
-                       </dependency> -->
 
-               <!-- Arquillian Test Harness -->
+               <!-- Arquillian -->
                <dependency>
                        <groupId>org.jboss.arquillian.core</groupId>
                        <artifactId>arquillian-core-api</artifactId>
@@ -225,7 +213,6 @@
                        <artifactId>arquillian-container-test-spi</artifactId>
                        <scope>test</scope>
                </dependency>
-
                <dependency>
                        <groupId>org.jboss.arquillian.junit</groupId>
                        <artifactId>arquillian-junit-container</artifactId>
@@ -243,41 +230,36 @@
                        <classifier>tests</classifier>
                        <scope>test</scope>
                </dependency>
-
                <dependency>
-                       <groupId>junit</groupId>
-                       <artifactId>junit</artifactId>
-                       <version>${version.junit}</version>
+                       <groupId>org.jboss.arquillian.protocol</groupId>
+                       <artifactId>arquillian-protocol-servlet</artifactId>
                        <scope>test</scope>
                </dependency>
+               
+               <!-- JUnit -->
                <dependency>
-                       <groupId>org.jboss.arquillian.protocol</groupId>
-                       <artifactId>arquillian-protocol-servlet</artifactId>
+                       <groupId>junit</groupId>
+                       <artifactId>junit</artifactId>
                        <scope>test</scope>
                </dependency>
+               
+               <!-- Wildfly managed. -->
                <dependency>
                        <groupId>org.wildfly</groupId>
                        
<artifactId>wildfly-arquillian-container-managed</artifactId>
-                       <version>${version.jbossas_7}</version>
                        <scope>test</scope>
                </dependency>
        </dependencies>
 
        <build>
-               <!-- Set the name of the war, used as the context root when the 
app is 
-                       deployed. -->
+               <testResources>
+                       <testResource>
+                               <directory>src/test/resources</directory>
+                               <filtering>true</filtering>
+                       </testResource>
+               </testResources>
+               <!-- Set the name of the war, used as the context root when the 
app is deployed. -->
                <finalName>${project.artifactId}</finalName>
-
-               <!-- Allow packaging the html files alongside the java sources 
-->
-               <!-- <resources> <resource> 
<directory>src/main/resources</directory> <filtering>true</filtering> 
-                       </resource> <resource> 
<directory>src/main/java</directory> <filtering>true</filtering> 
-                       <includes> <include>**</include> </includes> <excludes> 
<exclude>**/*.java</exclude> 
-                       </excludes> </resource> </resources> -->
-               <!-- <testResources> <testResource> 
<directory>src/test/resources</directory> 
-                       <filtering>true</filtering> </testResource> 
<testResource> <directory>src/test/java</directory> 
-                       <filtering>true</filtering> <includes> 
<include>**</include> </includes> 
-                       <excludes> <exclude>**/*.java</exclude> </excludes> 
</testResource> </testResources> -->
-
                <plugins>
                        <!-- WildFly plugin to deploy the war -->
                        <plugin>
@@ -290,32 +272,21 @@
                                        </fileNames>
                                </configuration>
                        </plugin>
-                       <!-- Compiler plugin enforces Java 1.6 compatibility 
and activates annotation 
-                               processors -->
-                       <plugin>
-                               <artifactId>maven-compiler-plugin</artifactId>
-                               <version>${version.compiler.plugin}</version>
-                               <configuration>
-                                       
<source>${maven.compiler.source}</source>
-                                       
<target>${maven.compiler.target}</target>
-                               </configuration>
-                       </plugin>
-
                        <plugin>
                                <artifactId>maven-surefire-plugin</artifactId>
-                               <version>2.12.4</version>
                                <configuration>
                                        <environmentVariables>
-                                               
<JBOSS_HOME>${project.build.directory}/wildfly-${version.jbossas_7}</JBOSS_HOME>
+                                               
<JBOSS_HOME>${project.build.directory}/wildfly-${version.wildfly_8}</JBOSS_HOME>
                                        </environmentVariables>
                                        <systemProperties>
-                                               
<jboss.version>${version.jbossas_7}</jboss.version>
+                                               
<jboss.version>${version.wildfly_8}</jboss.version>
                                        </systemProperties>
                                </configuration>
                        </plugin>
                        <plugin>
                                <groupId>org.apache.maven.plugins</groupId>
                                <artifactId>maven-dependency-plugin</artifactId>
+                               <version>2.10</version>
                                <executions>
                                        <execution>
                                                <id>unpack</id>
@@ -328,7 +299,7 @@
                                                                <artifactItem>
                                                                        
<groupId>org.wildfly</groupId>
                                                                        
<artifactId>wildfly-dist</artifactId>
-                                                                       
<version>${version.jbossas_7}</version>
+                                                                       
<version>${version.wildfly_8}</version>
                                                                        
<type>zip</type>
                                                                        
<overWrite>true</overWrite>
                                                                        
<outputDirectory>${project.build.directory}</outputDirectory>

http://git-wip-us.apache.org/repos/asf/wicket/blob/af093ab1/testing/wicket-arquillian/src/main/java/org/apache/wicket/arquillian/testing/WicketJavaEEApplication.java
----------------------------------------------------------------------
diff --git 
a/testing/wicket-arquillian/src/main/java/org/apache/wicket/arquillian/testing/WicketJavaEEApplication.java
 
b/testing/wicket-arquillian/src/main/java/org/apache/wicket/arquillian/testing/WicketJavaEEApplication.java
new file mode 100644
index 0000000..cd86e75
--- /dev/null
+++ 
b/testing/wicket-arquillian/src/main/java/org/apache/wicket/arquillian/testing/WicketJavaEEApplication.java
@@ -0,0 +1,77 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.wicket.arquillian.testing;
+
+import javax.enterprise.inject.spi.BeanManager;
+import javax.naming.InitialContext;
+import javax.naming.NamingException;
+
+import org.apache.wicket.Page;
+import org.apache.wicket.arquillian.testing.pages.InsertContact;
+import org.apache.wicket.arquillian.testing.pages.ListContacts;
+import org.apache.wicket.arquillian.testing.util.ResourceWebApplicationPath;
+import org.apache.wicket.cdi.CdiConfiguration;
+import org.apache.wicket.cdi.ConversationPropagation;
+import org.apache.wicket.protocol.http.WebApplication;
+
+
+/**
+ * Modified to create test with Arquillian looking for resources in an 
ServletContext.
+ * 
+ * @author Ondrej Zizka
+ * @author felipecalmeida
+ *                     Modified to create test with Arquillian looking for 
resources in an ServletContext.
+ * @since 06/23/2015
+ * 
+ */
+public class WicketJavaEEApplication extends WebApplication {
+
+    @Override
+    public Class<? extends Page> getHomePage() {
+        return ListContacts.class;
+    }
+
+    @Override
+    protected void init() {
+        super.init();
+
+        // Enable CDI
+        BeanManager bm;
+        try {
+            bm = (BeanManager) new 
InitialContext().lookup("java:comp/BeanManager");
+        } catch (NamingException e) {
+            throw new IllegalStateException("Unable to obtain CDI 
BeanManager", e);
+        }
+
+        initResourceFinder();
+        
+        // Configure CDI, disabling Conversations as we aren't using them
+        new 
CdiConfiguration(bm).setPropagation(ConversationPropagation.NONE).configure(this);
+        
+        // Mount the InsertContact page at /insert
+        mountPage("/insert", InsertContact.class);
+    }
+    
+    /**
+     * Adding resource finder as we need (container web or during the phase 
test that reuses the container web).
+     */
+    protected void initResourceFinder() {
+       getResourceSettings().getResourceFinders().add(new 
ResourceWebApplicationPath(WicketJavaEEApplication.class.getPackage().getName(),
 getServletContext()));
+       }
+
+    
+}

http://git-wip-us.apache.org/repos/asf/wicket/blob/af093ab1/testing/wicket-arquillian/src/main/java/org/apache/wicket/arquillian/testing/dao/ContactDao.java
----------------------------------------------------------------------
diff --git 
a/testing/wicket-arquillian/src/main/java/org/apache/wicket/arquillian/testing/dao/ContactDao.java
 
b/testing/wicket-arquillian/src/main/java/org/apache/wicket/arquillian/testing/dao/ContactDao.java
new file mode 100644
index 0000000..3615244
--- /dev/null
+++ 
b/testing/wicket-arquillian/src/main/java/org/apache/wicket/arquillian/testing/dao/ContactDao.java
@@ -0,0 +1,61 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2013, Red Hat, Inc. and/or its affiliates, and individual
+ * contributors by the @authors tag. See the copyright.txt in the
+ * distribution for a full listing of individual contributors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.wicket.arquillian.testing.dao;
+
+import java.util.List;
+
+import javax.ejb.Local;
+
+import org.apache.wicket.arquillian.testing.model.Contact;
+
+/**
+ *
+ * @author Filippo Diotalevi
+ */
+@Local
+public interface ContactDao {
+
+    /**
+     * Returns the currently available contacts.
+     *
+     * @return every contact in the database
+     */
+    public List<Contact> getContacts();
+
+    /**
+     * Returns a specific Contact from DB.
+     *
+     * @param id The Id for the Contact
+     * @return The specified Contact object
+     */
+    public Contact getContact(Long id);
+
+    /**
+     * Persist a new Contact in the DB.
+     *
+     * @param name The name of the new Contact
+     * @param email The e-mail address of the new Contact
+     */
+    public void addContact(String name, String email);
+
+    /**
+     * Removes a specific item from the DB.
+     *
+     * @param modelObject The specific Contact object, which we wants to remove
+     */
+    public void remove(Contact modelObject);
+}

http://git-wip-us.apache.org/repos/asf/wicket/blob/af093ab1/testing/wicket-arquillian/src/main/java/org/apache/wicket/arquillian/testing/dao/ContactDaoBean.java
----------------------------------------------------------------------
diff --git 
a/testing/wicket-arquillian/src/main/java/org/apache/wicket/arquillian/testing/dao/ContactDaoBean.java
 
b/testing/wicket-arquillian/src/main/java/org/apache/wicket/arquillian/testing/dao/ContactDaoBean.java
new file mode 100644
index 0000000..fb1cb08
--- /dev/null
+++ 
b/testing/wicket-arquillian/src/main/java/org/apache/wicket/arquillian/testing/dao/ContactDaoBean.java
@@ -0,0 +1,69 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2013, Red Hat, Inc. and/or its affiliates, and individual
+ * contributors by the @authors tag. See the copyright.txt in the
+ * distribution for a full listing of individual contributors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.wicket.arquillian.testing.dao;
+
+import java.util.List;
+
+import javax.ejb.Stateless;
+import javax.persistence.EntityManager;
+import javax.persistence.PersistenceContext;
+
+import org.apache.wicket.arquillian.testing.model.Contact;
+
+/**
+ * A bean which manages Contact entities.
+ */
+@Stateless
+public class ContactDaoBean implements ContactDao {
+
+    @PersistenceContext
+    private EntityManager em;
+
+
+    @Override
+    @SuppressWarnings("unchecked")
+    public List<Contact> getContacts() {
+        return em.createQuery("SELECT c FROM Contact c").getResultList();
+    }
+
+    /**
+     * Get Contact by ID.
+     */
+    @Override
+    public Contact getContact(Long id) {
+        return em.find(Contact.class, id);
+    }
+
+    /**
+     * Add a new Contact.
+     */
+    @Override
+    public void addContact(String name, String email) {
+        em.merge(new Contact(null, name, email));
+    }
+
+    /**
+     * Remove a Contact.
+     */
+    @Override
+    public void remove(Contact modelObject) {
+        Contact managed = em.merge(modelObject);
+        em.remove(managed);
+        em.flush();
+    }
+    
+}

http://git-wip-us.apache.org/repos/asf/wicket/blob/af093ab1/testing/wicket-arquillian/src/main/java/org/apache/wicket/arquillian/testing/model/Contact.java
----------------------------------------------------------------------
diff --git 
a/testing/wicket-arquillian/src/main/java/org/apache/wicket/arquillian/testing/model/Contact.java
 
b/testing/wicket-arquillian/src/main/java/org/apache/wicket/arquillian/testing/model/Contact.java
new file mode 100644
index 0000000..947333b
--- /dev/null
+++ 
b/testing/wicket-arquillian/src/main/java/org/apache/wicket/arquillian/testing/model/Contact.java
@@ -0,0 +1,109 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2013, Red Hat, Inc. and/or its affiliates, and individual
+ * contributors by the @authors tag. See the copyright.txt in the
+ * distribution for a full listing of individual contributors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.wicket.arquillian.testing.model;
+
+import static javax.persistence.GenerationType.IDENTITY;
+
+import java.io.Serializable;
+
+import javax.persistence.Column;
+import javax.persistence.Entity;
+import javax.persistence.GeneratedValue;
+import javax.persistence.Id;
+
+
+/**
+ *
+ * @author Filippo Diotalevi
+ */
+@SuppressWarnings("serial")
+@Entity
+public class Contact implements Serializable {
+
+    @Id
+    @GeneratedValue(strategy = IDENTITY)
+    private Long id;
+    private String name;
+    
+    @Column(unique=true)
+    private String email;
+
+    public Contact() {
+    }
+
+    public Contact(Long id, String name, String email) {
+        this.id = id;
+        this.name = name;
+        this.email = email;
+    }
+
+    public String getEmail() {
+        return email;
+    }
+
+    public void setEmail(String email) {
+        this.email = email;
+    }
+
+    public String getName() {
+        return name;
+    }
+
+    public void setName(String name) {
+        this.name = name;
+    }
+
+    
+    public Long getId() {
+        return id;
+    }
+
+    public void setId(Long id) {
+        this.id = id;
+    }
+
+    @Override
+    public int hashCode() {
+        final int prime = 31;
+        int result = 1;
+        result = prime * result + ((email == null) ? 0 : email.hashCode());
+        return result;
+    }
+
+    @Override
+    public boolean equals(Object obj) {
+        if (this == obj)
+            return true;
+        if (obj == null)
+            return false;
+        if (getClass() != obj.getClass())
+            return false;
+        Contact other = (Contact) obj;
+        if (email == null) {
+            if (other.email != null)
+                return false;
+        } else if (!email.equals(other.email))
+            return false;
+        return true;
+    }
+    
+    @Override
+    public String toString() {
+       return "Name: " + name + " / E-mail: " + email;
+    }
+    
+}

http://git-wip-us.apache.org/repos/asf/wicket/blob/af093ab1/testing/wicket-arquillian/src/main/java/org/apache/wicket/arquillian/testing/pages/InsertContact.java
----------------------------------------------------------------------
diff --git 
a/testing/wicket-arquillian/src/main/java/org/apache/wicket/arquillian/testing/pages/InsertContact.java
 
b/testing/wicket-arquillian/src/main/java/org/apache/wicket/arquillian/testing/pages/InsertContact.java
new file mode 100644
index 0000000..902b6d6
--- /dev/null
+++ 
b/testing/wicket-arquillian/src/main/java/org/apache/wicket/arquillian/testing/pages/InsertContact.java
@@ -0,0 +1,82 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2013, Red Hat, Inc. and/or its affiliates, and individual
+ * contributors by the @authors tag. See the copyright.txt in the
+ * distribution for a full listing of individual contributors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.wicket.arquillian.testing.pages;
+
+import javax.inject.Inject;
+
+import org.apache.wicket.arquillian.testing.dao.ContactDao;
+import org.apache.wicket.arquillian.testing.model.Contact;
+import org.apache.wicket.markup.html.WebPage;
+import org.apache.wicket.markup.html.form.Form;
+import org.apache.wicket.markup.html.form.RequiredTextField;
+import org.apache.wicket.markup.html.panel.FeedbackPanel;
+import org.apache.wicket.model.PropertyModel;
+
+/**
+ *
+ * @author Filippo Diotalevi
+ */
+@SuppressWarnings("serial")
+public class InsertContact extends WebPage {
+    
+    private Form<Contact> insertForm;
+    
+    private String name;
+    
+    private String email;
+    
+    @Inject
+    private ContactDao contactDao;
+
+    
+    public InsertContact() {
+        add(new FeedbackPanel("feedback"));
+
+        insertForm = new Form<Contact>("insertForm") {
+
+            @Override
+            protected void onSubmit() {
+                contactDao.addContact(name, email);
+                setResponsePage(ListContacts.class);
+            }
+        };
+
+        insertForm.add(new RequiredTextField<String>("name",
+                new PropertyModel<String>(this, "name")));
+        insertForm.add(new RequiredTextField<String>("email", new 
PropertyModel<String>(this,
+                "email")));
+        add(insertForm);
+    }
+
+    
+    public String getEmail() {
+        return email;
+    }
+
+    public void setEmail(String email) {
+        this.email = email;
+    }
+
+    public String getName() {
+        return name;
+    }
+
+    public void setName(String name) {
+        this.name = name;
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/wicket/blob/af093ab1/testing/wicket-arquillian/src/main/java/org/apache/wicket/arquillian/testing/pages/ListContacts.java
----------------------------------------------------------------------
diff --git 
a/testing/wicket-arquillian/src/main/java/org/apache/wicket/arquillian/testing/pages/ListContacts.java
 
b/testing/wicket-arquillian/src/main/java/org/apache/wicket/arquillian/testing/pages/ListContacts.java
new file mode 100644
index 0000000..4694438
--- /dev/null
+++ 
b/testing/wicket-arquillian/src/main/java/org/apache/wicket/arquillian/testing/pages/ListContacts.java
@@ -0,0 +1,70 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2013, Red Hat, Inc. and/or its affiliates, and individual
+ * contributors by the @authors tag. See the copyright.txt in the
+ * distribution for a full listing of individual contributors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.wicket.arquillian.testing.pages;
+
+import javax.annotation.Resource;
+import javax.inject.Inject;
+
+import org.apache.wicket.arquillian.testing.dao.ContactDao;
+import org.apache.wicket.arquillian.testing.model.Contact;
+import org.apache.wicket.markup.html.WebPage;
+import org.apache.wicket.markup.html.basic.Label;
+import org.apache.wicket.markup.html.link.Link;
+import org.apache.wicket.markup.html.list.ListItem;
+import org.apache.wicket.markup.html.list.ListView;
+
+/**
+ * Dynamic behavior for the ListContact page
+ * 
+ * @author Filippo Diotalevi
+ */
+@SuppressWarnings("serial")
+public class ListContacts extends WebPage {
+
+    // Inject the ContactDao using @Inject
+    @Inject
+    private ContactDao contactDao;
+
+    @Resource(name = "welcomeMessage")
+    private String welcome;
+
+    // Set up the dynamic behavior for the page, widgets bound by id
+    public ListContacts() {
+
+        // Add the dynamic welcome message, specified in web.xml
+        add(new Label("welcomeMessage", welcome));
+        add(new ListView<Contact>("contacts", contactDao.getContacts()) {
+
+            // Populate the table of contacts
+            @Override
+            protected void populateItem(final ListItem<Contact> item) {
+                Contact contact = item.getModelObject();
+                item.add(new Label("name", contact.getName()));
+                item.add(new Label("email", contact.getEmail()));
+                item.add(new Link<Contact>("delete", item.getModel()) {
+
+                    @Override
+                    public void onClick() {
+                        contactDao.remove(item.getModelObject());
+                        setResponsePage(ListContacts.class);
+                    }
+                });
+            }
+        });
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/wicket/blob/af093ab1/testing/wicket-arquillian/src/main/java/org/apache/wicket/arquillian/testing/util/ResourceWebApplicationPath.java
----------------------------------------------------------------------
diff --git 
a/testing/wicket-arquillian/src/main/java/org/apache/wicket/arquillian/testing/util/ResourceWebApplicationPath.java
 
b/testing/wicket-arquillian/src/main/java/org/apache/wicket/arquillian/testing/util/ResourceWebApplicationPath.java
new file mode 100644
index 0000000..e936f79
--- /dev/null
+++ 
b/testing/wicket-arquillian/src/main/java/org/apache/wicket/arquillian/testing/util/ResourceWebApplicationPath.java
@@ -0,0 +1,92 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.wicket.arquillian.testing.util;
+
+import java.net.URL;
+
+import javax.servlet.ServletContext;
+
+import org.apache.wicket.core.util.resource.UrlResourceStream;
+import org.apache.wicket.util.file.IResourceFinder;
+import org.apache.wicket.util.resource.IResourceStream;
+
+
+/**
+ * Maintain a list of paths which might either be ordinary folders of the 
filesystem or relative
+ * paths to the web application's servlet context.
+ * 
+ * @author Johan Compagner
+ * 
+ * @author felipecalmeida
+ *             Modified to look inside servletContext and same package as 
Application.
+ */
+public final class ResourceWebApplicationPath implements IResourceFinder
+{
+       private static final String WEB_INF = "WEB-INF/";
+
+       /** The web apps servlet context */
+       private final ServletContext servletContext;
+
+       private String basePath;
+
+       /**
+        * Constructor
+        * 
+        * @param servletContext
+        *            The webapplication context where the resources must be 
loaded from
+        */
+       public ResourceWebApplicationPath(String basePath,final ServletContext 
servletContext)
+       {
+               this.basePath = basePath.replaceAll("\\.", "\\/");
+               this.servletContext = servletContext;
+       }
+
+       /**
+        * 
+        * @see org.apache.wicket.util.file.IResourceFinder#find(Class, String)
+        */
+       public IResourceStream find(final Class<?> clazz, final String pathname)
+       {
+
+               if (pathname.startsWith(WEB_INF) == false)
+               {
+                       try
+                       {
+                               final URL url = 
servletContext.getResource(pathname.replaceFirst(basePath, ""));
+                               if (url != null)
+                               {
+                                       return new UrlResourceStream(url);
+                               }
+                       }
+                       catch (Exception ex)
+                       {
+                               // ignore, file couldn't be found
+                       }
+               }
+
+               return null;
+       }
+
+       /**
+        * @see java.lang.Object#toString()
+        */
+       @Override
+       public String toString()
+       {
+               return "[webapppath: " + basePath + "]";
+       }
+}

http://git-wip-us.apache.org/repos/asf/wicket/blob/af093ab1/testing/wicket-arquillian/src/main/java/org/jboss/as/quickstarts/wicketWar/WicketJavaEEApplication.java
----------------------------------------------------------------------
diff --git 
a/testing/wicket-arquillian/src/main/java/org/jboss/as/quickstarts/wicketWar/WicketJavaEEApplication.java
 
b/testing/wicket-arquillian/src/main/java/org/jboss/as/quickstarts/wicketWar/WicketJavaEEApplication.java
deleted file mode 100644
index a91c104..0000000
--- 
a/testing/wicket-arquillian/src/main/java/org/jboss/as/quickstarts/wicketWar/WicketJavaEEApplication.java
+++ /dev/null
@@ -1,70 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2013, Red Hat, Inc. and/or its affiliates, and individual
- * contributors by the @authors tag. See the copyright.txt in the
- * distribution for a full listing of individual contributors.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- * http://www.apache.org/licenses/LICENSE-2.0
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.jboss.as.quickstarts.wicketWar;
-
-import static net.ftlines.wicket.cdi.ConversationPropagation.NONE;
-
-import javax.enterprise.inject.spi.BeanManager;
-import javax.naming.InitialContext;
-import javax.naming.NamingException;
-
-import net.ftlines.wicket.cdi.CdiConfiguration;
-
-import org.apache.wicket.Page;
-import org.apache.wicket.protocol.http.WebApplication;
-import org.apache.wicket.util.file.IResourceFinder;
-import org.jboss.as.quickstarts.wicketWar.pages.InsertContact;
-import org.jboss.as.quickstarts.wicketWar.pages.ListContacts;
-import org.jboss.as.quickstarts.wicketWar.util.ResourceWebApplicationPath;
-
-
-/**
- *
- * @author Ondrej Zizka
- */
-public class WicketJavaEEApplication extends WebApplication {
-
-    @Override
-    public Class<? extends Page> getHomePage() {
-        return ListContacts.class;
-    }
-
-    @Override
-    protected void init() {
-        super.init();
-
-        // Enable CDI
-        BeanManager bm;
-        try {
-            bm = (BeanManager) new 
InitialContext().lookup("java:comp/BeanManager");
-        } catch (NamingException e) {
-            throw new IllegalStateException("Unable to obtain CDI 
BeanManager", e);
-        }
-
-        // Configure CDI, disabling Conversations as we aren't using them
-        new CdiConfiguration(bm).setPropagation(NONE).configure(this);
-        
-        // Mount the InsertContact page at /insert
-        mountPage("/insert", InsertContact.class);
-    }
-    
-    @Override
-    protected IResourceFinder getResourceFinder() {
-       return new 
ResourceWebApplicationPath(WicketJavaEEApplication.class.getPackage().getName(),
 getServletContext());
-    }
-    
-}

http://git-wip-us.apache.org/repos/asf/wicket/blob/af093ab1/testing/wicket-arquillian/src/main/java/org/jboss/as/quickstarts/wicketWar/dao/ContactDao.java
----------------------------------------------------------------------
diff --git 
a/testing/wicket-arquillian/src/main/java/org/jboss/as/quickstarts/wicketWar/dao/ContactDao.java
 
b/testing/wicket-arquillian/src/main/java/org/jboss/as/quickstarts/wicketWar/dao/ContactDao.java
deleted file mode 100644
index 78d7003..0000000
--- 
a/testing/wicket-arquillian/src/main/java/org/jboss/as/quickstarts/wicketWar/dao/ContactDao.java
+++ /dev/null
@@ -1,61 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2013, Red Hat, Inc. and/or its affiliates, and individual
- * contributors by the @authors tag. See the copyright.txt in the
- * distribution for a full listing of individual contributors.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- * http://www.apache.org/licenses/LICENSE-2.0
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.jboss.as.quickstarts.wicketWar.dao;
-
-import java.util.List;
-
-import javax.ejb.Local;
-
-import org.jboss.as.quickstarts.wicketWar.model.Contact;
-
-/**
- *
- * @author Filippo Diotalevi
- */
-@Local
-public interface ContactDao {
-
-    /**
-     * Returns the currently available contacts.
-     *
-     * @return every contact in the database
-     */
-    public List<Contact> getContacts();
-
-    /**
-     * Returns a specific Contact from DB.
-     *
-     * @param id The Id for the Contact
-     * @return The specified Contact object
-     */
-    public Contact getContact(Long id);
-
-    /**
-     * Persist a new Contact in the DB.
-     *
-     * @param name The name of the new Contact
-     * @param email The e-mail address of the new Contact
-     */
-    public void addContact(String name, String email);
-
-    /**
-     * Removes a specific item from the DB.
-     *
-     * @param modelObject The specific Contact object, which we wants to remove
-     */
-    public void remove(Contact modelObject);
-}

http://git-wip-us.apache.org/repos/asf/wicket/blob/af093ab1/testing/wicket-arquillian/src/main/java/org/jboss/as/quickstarts/wicketWar/dao/ContactDaoBean.java
----------------------------------------------------------------------
diff --git 
a/testing/wicket-arquillian/src/main/java/org/jboss/as/quickstarts/wicketWar/dao/ContactDaoBean.java
 
b/testing/wicket-arquillian/src/main/java/org/jboss/as/quickstarts/wicketWar/dao/ContactDaoBean.java
deleted file mode 100644
index 25fb2d1..0000000
--- 
a/testing/wicket-arquillian/src/main/java/org/jboss/as/quickstarts/wicketWar/dao/ContactDaoBean.java
+++ /dev/null
@@ -1,69 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2013, Red Hat, Inc. and/or its affiliates, and individual
- * contributors by the @authors tag. See the copyright.txt in the
- * distribution for a full listing of individual contributors.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- * http://www.apache.org/licenses/LICENSE-2.0
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.jboss.as.quickstarts.wicketWar.dao;
-
-import java.util.List;
-
-import javax.ejb.Stateless;
-import javax.persistence.EntityManager;
-import javax.persistence.PersistenceContext;
-
-import org.jboss.as.quickstarts.wicketWar.model.Contact;
-
-/**
- * A bean which manages Contact entities.
- */
-@Stateless
-public class ContactDaoBean implements ContactDao {
-
-    @PersistenceContext
-    private EntityManager em;
-
-
-    @Override
-    @SuppressWarnings("unchecked")
-    public List<Contact> getContacts() {
-        return em.createQuery("SELECT c FROM Contact c").getResultList();
-    }
-
-    /**
-     * Get Contact by ID.
-     */
-    @Override
-    public Contact getContact(Long id) {
-        return em.find(Contact.class, id);
-    }
-
-    /**
-     * Add a new Contact.
-     */
-    @Override
-    public void addContact(String name, String email) {
-        em.merge(new Contact(null, name, email));
-    }
-
-    /**
-     * Remove a Contact.
-     */
-    @Override
-    public void remove(Contact modelObject) {
-        Contact managed = em.merge(modelObject);
-        em.remove(managed);
-        em.flush();
-    }
-    
-}

http://git-wip-us.apache.org/repos/asf/wicket/blob/af093ab1/testing/wicket-arquillian/src/main/java/org/jboss/as/quickstarts/wicketWar/model/Contact.java
----------------------------------------------------------------------
diff --git 
a/testing/wicket-arquillian/src/main/java/org/jboss/as/quickstarts/wicketWar/model/Contact.java
 
b/testing/wicket-arquillian/src/main/java/org/jboss/as/quickstarts/wicketWar/model/Contact.java
deleted file mode 100644
index 152b777..0000000
--- 
a/testing/wicket-arquillian/src/main/java/org/jboss/as/quickstarts/wicketWar/model/Contact.java
+++ /dev/null
@@ -1,104 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2013, Red Hat, Inc. and/or its affiliates, and individual
- * contributors by the @authors tag. See the copyright.txt in the
- * distribution for a full listing of individual contributors.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- * http://www.apache.org/licenses/LICENSE-2.0
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.jboss.as.quickstarts.wicketWar.model;
-
-import static javax.persistence.GenerationType.IDENTITY;
-
-import java.io.Serializable;
-
-import javax.persistence.Column;
-import javax.persistence.Entity;
-import javax.persistence.GeneratedValue;
-import javax.persistence.Id;
-
-
-/**
- *
- * @author Filippo Diotalevi
- */
-@SuppressWarnings("serial")
-@Entity
-public class Contact implements Serializable {
-
-    @Id
-    @GeneratedValue(strategy = IDENTITY)
-    private Long id;
-    private String name;
-    
-    @Column(unique=true)
-    private String email;
-
-    public Contact() {
-    }
-
-    public Contact(Long id, String name, String email) {
-        this.id = id;
-        this.name = name;
-        this.email = email;
-    }
-
-    public String getEmail() {
-        return email;
-    }
-
-    public void setEmail(String email) {
-        this.email = email;
-    }
-
-    public String getName() {
-        return name;
-    }
-
-    public void setName(String name) {
-        this.name = name;
-    }
-
-    
-    public Long getId() {
-        return id;
-    }
-
-    public void setId(Long id) {
-        this.id = id;
-    }
-
-    @Override
-    public int hashCode() {
-        final int prime = 31;
-        int result = 1;
-        result = prime * result + ((email == null) ? 0 : email.hashCode());
-        return result;
-    }
-
-    @Override
-    public boolean equals(Object obj) {
-        if (this == obj)
-            return true;
-        if (obj == null)
-            return false;
-        if (getClass() != obj.getClass())
-            return false;
-        Contact other = (Contact) obj;
-        if (email == null) {
-            if (other.email != null)
-                return false;
-        } else if (!email.equals(other.email))
-            return false;
-        return true;
-    }
-    
-}

http://git-wip-us.apache.org/repos/asf/wicket/blob/af093ab1/testing/wicket-arquillian/src/main/java/org/jboss/as/quickstarts/wicketWar/pages/InsertContact.java
----------------------------------------------------------------------
diff --git 
a/testing/wicket-arquillian/src/main/java/org/jboss/as/quickstarts/wicketWar/pages/InsertContact.java
 
b/testing/wicket-arquillian/src/main/java/org/jboss/as/quickstarts/wicketWar/pages/InsertContact.java
deleted file mode 100644
index ce7c692..0000000
--- 
a/testing/wicket-arquillian/src/main/java/org/jboss/as/quickstarts/wicketWar/pages/InsertContact.java
+++ /dev/null
@@ -1,82 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2013, Red Hat, Inc. and/or its affiliates, and individual
- * contributors by the @authors tag. See the copyright.txt in the
- * distribution for a full listing of individual contributors.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- * http://www.apache.org/licenses/LICENSE-2.0
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.jboss.as.quickstarts.wicketWar.pages;
-
-import javax.inject.Inject;
-
-import org.apache.wicket.markup.html.WebPage;
-import org.apache.wicket.markup.html.form.Form;
-import org.apache.wicket.markup.html.form.RequiredTextField;
-import org.apache.wicket.markup.html.panel.FeedbackPanel;
-import org.apache.wicket.model.PropertyModel;
-import org.jboss.as.quickstarts.wicketWar.dao.ContactDao;
-import org.jboss.as.quickstarts.wicketWar.model.Contact;
-
-/**
- *
- * @author Filippo Diotalevi
- */
-@SuppressWarnings("serial")
-public class InsertContact extends WebPage {
-    
-    private Form<Contact> insertForm;
-    
-    private String name;
-    
-    private String email;
-    
-    @Inject
-    private ContactDao contactDao;
-
-    
-    public InsertContact() {
-        add(new FeedbackPanel("feedback"));
-
-        insertForm = new Form<Contact>("insertForm") {
-
-            @Override
-            protected void onSubmit() {
-                contactDao.addContact(name, email);
-                setResponsePage(ListContacts.class);
-            }
-        };
-
-        insertForm.add(new RequiredTextField<String>("name",
-                new PropertyModel<String>(this, "name")));
-        insertForm.add(new RequiredTextField<String>("email", new 
PropertyModel<String>(this,
-                "email")));
-        add(insertForm);
-    }
-
-    
-    public String getEmail() {
-        return email;
-    }
-
-    public void setEmail(String email) {
-        this.email = email;
-    }
-
-    public String getName() {
-        return name;
-    }
-
-    public void setName(String name) {
-        this.name = name;
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/wicket/blob/af093ab1/testing/wicket-arquillian/src/main/java/org/jboss/as/quickstarts/wicketWar/pages/ListContacts.java
----------------------------------------------------------------------
diff --git 
a/testing/wicket-arquillian/src/main/java/org/jboss/as/quickstarts/wicketWar/pages/ListContacts.java
 
b/testing/wicket-arquillian/src/main/java/org/jboss/as/quickstarts/wicketWar/pages/ListContacts.java
deleted file mode 100644
index fe86ce1..0000000
--- 
a/testing/wicket-arquillian/src/main/java/org/jboss/as/quickstarts/wicketWar/pages/ListContacts.java
+++ /dev/null
@@ -1,70 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2013, Red Hat, Inc. and/or its affiliates, and individual
- * contributors by the @authors tag. See the copyright.txt in the
- * distribution for a full listing of individual contributors.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- * http://www.apache.org/licenses/LICENSE-2.0
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.jboss.as.quickstarts.wicketWar.pages;
-
-import javax.annotation.Resource;
-import javax.inject.Inject;
-
-import org.apache.wicket.markup.html.WebPage;
-import org.apache.wicket.markup.html.basic.Label;
-import org.apache.wicket.markup.html.link.Link;
-import org.apache.wicket.markup.html.list.ListItem;
-import org.apache.wicket.markup.html.list.ListView;
-import org.jboss.as.quickstarts.wicketWar.dao.ContactDao;
-import org.jboss.as.quickstarts.wicketWar.model.Contact;
-
-/**
- * Dynamic behavior for the ListContact page
- * 
- * @author Filippo Diotalevi
- */
-@SuppressWarnings("serial")
-public class ListContacts extends WebPage {
-
-    // Inject the ContactDao using @Inject
-    @Inject
-    private ContactDao contactDao;
-
-    @Resource(name = "welcomeMessage")
-    private String welcome;
-
-    // Set up the dynamic behavior for the page, widgets bound by id
-    public ListContacts() {
-
-        // Add the dynamic welcome message, specified in web.xml
-        add(new Label("welcomeMessage", welcome));
-        add(new ListView<Contact>("contacts", contactDao.getContacts()) {
-
-            // Populate the table of contacts
-            @Override
-            protected void populateItem(final ListItem<Contact> item) {
-                Contact contact = item.getModelObject();
-                item.add(new Label("name", contact.getName()));
-                item.add(new Label("email", contact.getEmail()));
-                item.add(new Link<Contact>("delete", item.getModel()) {
-
-                    @Override
-                    public void onClick() {
-                        contactDao.remove(item.getModelObject());
-                        setResponsePage(ListContacts.class);
-                    }
-                });
-            }
-        });
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/wicket/blob/af093ab1/testing/wicket-arquillian/src/main/java/org/jboss/as/quickstarts/wicketWar/util/ResourceWebApplicationPath.java
----------------------------------------------------------------------
diff --git 
a/testing/wicket-arquillian/src/main/java/org/jboss/as/quickstarts/wicketWar/util/ResourceWebApplicationPath.java
 
b/testing/wicket-arquillian/src/main/java/org/jboss/as/quickstarts/wicketWar/util/ResourceWebApplicationPath.java
deleted file mode 100644
index 6aea12e..0000000
--- 
a/testing/wicket-arquillian/src/main/java/org/jboss/as/quickstarts/wicketWar/util/ResourceWebApplicationPath.java
+++ /dev/null
@@ -1,98 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.jboss.as.quickstarts.wicketWar.util;
-
-import java.net.URL;
-
-import javax.servlet.ServletContext;
-
-import org.apache.wicket.util.file.IResourcePath;
-import org.apache.wicket.util.resource.IResourceStream;
-import org.apache.wicket.util.resource.UrlResourceStream;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-
-/**
- * Maintain a list of paths which might either be ordinary folders of the 
filesystem or relative
- * paths to the web application's servlet context.
- * 
- * @author Johan Compagner
- */
-public final class ResourceWebApplicationPath implements IResourcePath
-{
-       private final static Logger log = 
LoggerFactory.getLogger(ResourceWebApplicationPath.class);
-
-       private static final String WEB_INF = "WEB-INF/";
-
-       /** The web apps servlet context */
-       private final ServletContext servletContext;
-
-       private String basePath;
-
-       /**
-        * Constructor
-        * 
-        * @param servletContext
-        *            The webapplication context where the resources must be 
loaded from
-        */
-       public ResourceWebApplicationPath(String basePath,final ServletContext 
servletContext)
-       {
-               this.basePath = basePath.replaceAll("\\.", "\\/");
-               this.servletContext = servletContext;
-       }
-
-       /**
-        * 
-        * @see org.apache.wicket.util.file.IResourceFinder#find(Class, String)
-        */
-       public IResourceStream find(final Class<?> clazz, final String pathname)
-       {
-
-               if (pathname.startsWith(WEB_INF) == false)
-               {
-                       try
-                       {
-                               final URL url = 
servletContext.getResource(pathname.replaceFirst(basePath, ""));
-                               if (url != null)
-                               {
-                                       return new UrlResourceStream(url);
-                               }
-                       }
-                       catch (Exception ex)
-                       {
-                               // ignore, file couldn't be found
-                       }
-               }
-
-               return null;
-       }
-
-       /**
-        * @see java.lang.Object#toString()
-        */
-       @Override
-       public String toString()
-       {
-               return "[webapppath: " + basePath + "]";
-       }
-
-       @Override
-       public void add(String folder) {
-               // DO NOTHING.
-       }
-}

http://git-wip-us.apache.org/repos/asf/wicket/blob/af093ab1/testing/wicket-arquillian/src/main/resources/META-INF/persistence.xml
----------------------------------------------------------------------
diff --git 
a/testing/wicket-arquillian/src/main/resources/META-INF/persistence.xml 
b/testing/wicket-arquillian/src/main/resources/META-INF/persistence.xml
index 0c3470d..e42cebe 100644
--- a/testing/wicket-arquillian/src/main/resources/META-INF/persistence.xml
+++ b/testing/wicket-arquillian/src/main/resources/META-INF/persistence.xml
@@ -20,12 +20,11 @@
     xsi:schemaLocation="
         http://java.sun.com/xml/ns/persistence
         http://java.sun.com/xml/ns/persistence/persistence_2_0.xsd";>
-    <persistence-unit name="primary">
+    <persistence-unit name="wicketArquillianTesting">
         <!-- If you are running in a production environment, add a managed 
             data source, this example data source is just for development and 
testing! -->
-        <!-- The datasource is deployed as 
<EAR>/META-INF/wicket-quickstart-ds.xml, 
-            you can find it in the source at 
ear/src/main/application/META-INF/wicket-quickstart-ds.xml -->
-        
<jta-data-source>java:jboss/datasources/WicketQuickstartDS</jta-data-source>
+        <!-- You can find it in the source at 
src/main/webapp/WEB-INF/wicket-arquillian-testing-ds.xml -->
+        
<jta-data-source>java:jboss/datasources/WicketArquillianTestingDS</jta-data-source>
         <properties>
             <!-- Properties for Hibernate -->
             <property name="hibernate.hbm2ddl.auto" value="create-drop" />

http://git-wip-us.apache.org/repos/asf/wicket/blob/af093ab1/testing/wicket-arquillian/src/main/webapp/WEB-INF/faces-config.xml
----------------------------------------------------------------------
diff --git a/testing/wicket-arquillian/src/main/webapp/WEB-INF/faces-config.xml 
b/testing/wicket-arquillian/src/main/webapp/WEB-INF/faces-config.xml
deleted file mode 100644
index ddd61c7..0000000
--- a/testing/wicket-arquillian/src/main/webapp/WEB-INF/faces-config.xml
+++ /dev/null
@@ -1,9 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-
-<faces-config
-    xmlns="http://java.sun.com/xml/ns/javaee";
-    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
-    xsi:schemaLocation="http://java.sun.com/xml/ns/javaee 
http://java.sun.com/xml/ns/javaee/web-facesconfig_1_2.xsd";
-    version="1.2">
-
-</faces-config>

http://git-wip-us.apache.org/repos/asf/wicket/blob/af093ab1/testing/wicket-arquillian/src/main/webapp/WEB-INF/web.xml
----------------------------------------------------------------------
diff --git a/testing/wicket-arquillian/src/main/webapp/WEB-INF/web.xml 
b/testing/wicket-arquillian/src/main/webapp/WEB-INF/web.xml
index 040099d..cafe4bd 100644
--- a/testing/wicket-arquillian/src/main/webapp/WEB-INF/web.xml
+++ b/testing/wicket-arquillian/src/main/webapp/WEB-INF/web.xml
@@ -15,11 +15,11 @@
     See the License for the specific language governing permissions and
     limitations under the License.
 -->
-<web-app xmlns="http://java.sun.com/xml/ns/javaee"; 
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
-    xsi:schemaLocation="http://java.sun.com/xml/ns/javaee 
http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd";
-    version="2.5">
+<web-app version="3.0" xmlns="http://java.sun.com/xml/ns/javaee";
+       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
+       xsi:schemaLocation="http://java.sun.com/xml/ns/javaee 
http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd";>
 
-    <display-name>WildFly Quickstart: Wicket WAR</display-name>
+    <display-name>Wicket Arquillian WildFly Quickstart: Wicket 
WAR</display-name>
 
     <!-- Enable Wicket -->
     <filter>
@@ -29,7 +29,7 @@
             <!-- Specify the "entry point" for Wicket to configure itself 
                 from -->
             <param-name>applicationClassName</param-name>
-            
<param-value>org.jboss.as.quickstarts.wicketWar.WicketJavaEEApplication</param-value>
+            
<param-value>org.apache.wicket.arquillian.testing.WicketJavaEEApplication</param-value>
         </init-param>
     </filter>
 

http://git-wip-us.apache.org/repos/asf/wicket/blob/af093ab1/testing/wicket-arquillian/src/main/webapp/WEB-INF/wicket-arquillian-testing-ds.xml
----------------------------------------------------------------------
diff --git 
a/testing/wicket-arquillian/src/main/webapp/WEB-INF/wicket-arquillian-testing-ds.xml
 
b/testing/wicket-arquillian/src/main/webapp/WEB-INF/wicket-arquillian-testing-ds.xml
new file mode 100644
index 0000000..af137fe
--- /dev/null
+++ 
b/testing/wicket-arquillian/src/main/webapp/WEB-INF/wicket-arquillian-testing-ds.xml
@@ -0,0 +1,37 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+    JBoss, Home of Professional Open Source
+    Copyright 2013, Red Hat, Inc. and/or its affiliates, and individual
+    contributors by the @authors tag. See the copyright.txt in the
+    distribution for a full listing of individual contributors.
+
+    Licensed under the Apache License, Version 2.0 (the "License");
+    you may not use this file except in compliance with the License.
+    You may obtain a copy of the License at
+    http://www.apache.org/licenses/LICENSE-2.0
+    Unless required by applicable law or agreed to in writing, software
+    distributed under the License is distributed on an "AS IS" BASIS,
+    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+    See the License for the specific language governing permissions and
+    limitations under the License.
+-->
+<!-- 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/WicketArquillianTestingDS"
+        pool-name="wicket-arquillian-testing" enabled="true"
+        use-java-context="true">
+        
<connection-url>jdbc:h2:mem:wicket-arquillian-testing;DB_CLOSE_ON_EXIT=FALSE;DB_CLOSE_DELAY=-1</connection-url>
+        <driver>h2</driver>
+        <security>
+            <user-name>sa</user-name>
+            <password>sa</password>
+        </security>
+    </datasource>
+</datasources>
+ 

http://git-wip-us.apache.org/repos/asf/wicket/blob/af093ab1/testing/wicket-arquillian/src/main/webapp/WEB-INF/wicket-quickstart-ds.xml
----------------------------------------------------------------------
diff --git 
a/testing/wicket-arquillian/src/main/webapp/WEB-INF/wicket-quickstart-ds.xml 
b/testing/wicket-arquillian/src/main/webapp/WEB-INF/wicket-quickstart-ds.xml
deleted file mode 100644
index 92fa71a..0000000
--- a/testing/wicket-arquillian/src/main/webapp/WEB-INF/wicket-quickstart-ds.xml
+++ /dev/null
@@ -1,37 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
-    JBoss, Home of Professional Open Source
-    Copyright 2013, Red Hat, Inc. and/or its affiliates, and individual
-    contributors by the @authors tag. See the copyright.txt in the
-    distribution for a full listing of individual contributors.
-
-    Licensed under the Apache License, Version 2.0 (the "License");
-    you may not use this file except in compliance with the License.
-    You may obtain a copy of the License at
-    http://www.apache.org/licenses/LICENSE-2.0
-    Unless required by applicable law or agreed to in writing, software
-    distributed under the License is distributed on an "AS IS" BASIS,
-    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-    See the License for the specific language governing permissions and
-    limitations under the License.
--->
-<!-- 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/WicketQuickstartDS"
-        pool-name="wicket-quickstart" enabled="true"
-        use-java-context="true">
-        
<connection-url>jdbc:h2:mem:wicket-quickstart;DB_CLOSE_ON_EXIT=FALSE;DB_CLOSE_DELAY=-1</connection-url>
-        <driver>h2</driver>
-        <security>
-            <user-name>sa</user-name>
-            <password>sa</password>
-        </security>
-    </datasource>
-</datasources>
- 

http://git-wip-us.apache.org/repos/asf/wicket/blob/af093ab1/testing/wicket-arquillian/src/test/java/org/apache/wicket/arquillian/testing/TestWicketJavaEEApplication.java
----------------------------------------------------------------------
diff --git 
a/testing/wicket-arquillian/src/test/java/org/apache/wicket/arquillian/testing/TestWicketJavaEEApplication.java
 
b/testing/wicket-arquillian/src/test/java/org/apache/wicket/arquillian/testing/TestWicketJavaEEApplication.java
new file mode 100644
index 0000000..cb2cdf8
--- /dev/null
+++ 
b/testing/wicket-arquillian/src/test/java/org/apache/wicket/arquillian/testing/TestWicketJavaEEApplication.java
@@ -0,0 +1,35 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.wicket.arquillian.testing;
+
+import org.apache.wicket.arquillian.testing.util.ResourceWebApplicationPath;
+
+/**
+ * Just extends the Application to add some needs.
+ * 
+ * @author felipecalmeida
+ * @since 06/20/2015
+ */
+public class TestWicketJavaEEApplication extends WicketJavaEEApplication {
+  
+       // Has some security ignores during the test (example: accept all 
roles).
+       
+       @Override
+       protected void initResourceFinder() {
+       getResourceSettings().getResourceFinders().add(new 
ResourceWebApplicationPath(TestWicketJavaEEApplication.class.getPackage().getName(),
 getServletContext()));
+       }
+}

http://git-wip-us.apache.org/repos/asf/wicket/blob/af093ab1/testing/wicket-arquillian/src/test/java/org/apache/wicket/arquillian/testing/deployment/AbstractDeploymentTest.java
----------------------------------------------------------------------
diff --git 
a/testing/wicket-arquillian/src/test/java/org/apache/wicket/arquillian/testing/deployment/AbstractDeploymentTest.java
 
b/testing/wicket-arquillian/src/test/java/org/apache/wicket/arquillian/testing/deployment/AbstractDeploymentTest.java
new file mode 100644
index 0000000..268d098
--- /dev/null
+++ 
b/testing/wicket-arquillian/src/test/java/org/apache/wicket/arquillian/testing/deployment/AbstractDeploymentTest.java
@@ -0,0 +1,145 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.wicket.arquillian.testing.deployment;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+
+import java.io.File;
+
+import javax.servlet.ServletContext;
+
+import org.apache.wicket.arquillian.testing.TestWicketJavaEEApplication;
+import org.apache.wicket.protocol.http.WebApplication;
+import org.apache.wicket.util.tester.WicketTester;
+import org.jboss.arquillian.container.test.api.Deployment;
+import org.jboss.shrinkwrap.api.Filters;
+import org.jboss.shrinkwrap.api.GenericArchive;
+import org.jboss.shrinkwrap.api.ShrinkWrap;
+import org.jboss.shrinkwrap.api.asset.ByteArrayAsset;
+import org.jboss.shrinkwrap.api.importer.ExplodedImporter;
+import org.jboss.shrinkwrap.api.spec.WebArchive;
+import org.jboss.shrinkwrap.resolver.api.maven.Maven;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+/**
+ * <b>WARNING: If this error occurs - 
org.jboss.arquillian.container.spi.client.container.LifecycleException: The 
server is already running! Managed containers do not support connecting to 
running server instances due to the possible harmful effect of connecting to 
the wrong server. Please stop server before running or change to another type 
of container.
+ *     To disable this check and allow Arquillian to connect to a running 
server, set allowConnectingToRunningServer to true in the container 
configuration.</b>
+ *     
+ *     <b>SOLUTION: Search and kill wildfly or jboss proccess instance that 
are using port 8080.</b>
+ * 
+ * <b> If you can't run inside eclipse, add as source the folder 
src/test/resources and try again. </b>
+ * 
+ * @author felipecalmeida
+ * @since 06/23/2015
+ *
+ */
+public abstract class AbstractDeploymentTest {
+       
+       private static final Logger log = 
LoggerFactory.getLogger(AbstractDeploymentTest.class);
+       
+       private static final String WEBAPP_SRC = "src/main/webapp";
+       private static final String WEBAPP_TEST_SRC = "src/test/webapp";
+
+       @Deployment
+       public static WebArchive deployment() {
+               // Create webapp files from src/main/webapp. (WEB AS NORMAL)
+               GenericArchive webapp = 
ShrinkWrap.create(GenericArchive.class).as(ExplodedImporter.class).importDirectory(WEBAPP_SRC).as(GenericArchive.class);
+               
+               // Create webapptest files from src/test/webapp. (TEST)
+               GenericArchive webappTest = 
ShrinkWrap.create(GenericArchive.class).as(ExplodedImporter.class).importDirectory(WEBAPP_TEST_SRC).as(GenericArchive.class);
+               
+               // Some configurations to create a manifest.mf.
+               ByteArrayAsset resource = new ByteArrayAsset("Dependencies: 
org.jboss.msc".getBytes());
+               
+               // Create libs from POM.XML.
+               File[] asFile = Maven.configureResolver()
+                               // I'm not using internet directly, I have a 
Nexus Repository that handles the libs for me.
+                               .workOffline().withMavenCentralRepo(false)
+                               // Load everything from pom, that is compile 
and runtime, as a file and transitivity to don't loose anything and cause 
exceptions.
+                               
.loadPomFromFile("./pom.xml").importCompileAndRuntimeDependencies()
+                               .resolve().withTransitivity().asFile();
+               
+               // Create the WAR.
+               return ShrinkWrap.create(WebArchive.class, 
"wicket-servletContext.war")
+                                                // Add packages and/or classes.
+                                                .addPackages(true, 
TestWicketJavaEEApplication.class.getPackage())
+                                                // Add the persistence.xml
+                                                
.addAsResource("META-INF/persistence.xml")
+                                                // Add a manifest.
+                                                
.addAsManifestResource(resource, "MANIFEST.MF")
+                                                // Add WEBAPP files.
+                                                
.merge(webapp,"/",Filters.exclude(".*\\web.xml"))
+                                                // Add WEBAPP TEST files.
+                                                
.merge(webappTest,"/",Filters.includeAll())
+                                                // Add LIBS from POM.XML.
+                                                .addAsLibraries(asFile);
+       }
+       
+       protected WicketTester wicketTester;
+       
+       /**
+        * Set a new instance of wicketTester.
+        *
+        * @param wicketTester
+        */
+       public void setWicketTester(WicketTester wicketTester) {
+               this.wicketTester = wicketTester;
+       }
+       
+       /**
+        * Get an instance of wicketTester. The first time verify and create a 
new one.
+        *
+        * @return
+        */
+       public WicketTester getWicketTester() {
+               if(wicketTester == null) {
+                       wicketTester = new 
WicketTester(useServletContextContainer(),false);
+               }
+               return wicketTester;
+       }
+       
+       /**
+        * Loading the TestWicketJavaEEApplication from 
src/test/webapp/WEB-INF/web.xml.
+        * 
+        * @return
+        */
+       protected WebApplication useServletContextContainer() {
+               WebApplication webApplication = null;
+               try {
+                       webApplication = TestWicketJavaEEApplication.get();
+               } catch (Exception e) {
+                       log.error("If not using arquillian, maybe 
org.apache.wicket.Application has a message for you " + e.getMessage());
+                       // I didn't test it, just supposing that i'm not using 
arquillian, so should show this message.
+                       assertEquals("There is no application attached to 
current thread " + Thread.currentThread().getName(), e.getMessage());
+               }
+               
+               assertNotNull(webApplication);
+               
+               log.info("WebApplication Name: " + webApplication.getName());
+               
+               ServletContext servletContext = 
webApplication.getServletContext();
+               assertNotNull(servletContext);
+               log.info("ServletContext Name: " + 
servletContext.getServletContextName());
+               assertEquals("Wicket Arquillian WildFly Quickstart: Wicket TEST 
WAR",servletContext.getServletContextName());
+               
+               log.info("Server info: " + servletContext.getServerInfo());
+               return webApplication;
+       }
+
+}

http://git-wip-us.apache.org/repos/asf/wicket/blob/af093ab1/testing/wicket-arquillian/src/test/java/org/apache/wicket/arquillian/testing/pages/InsertContactTest.java
----------------------------------------------------------------------
diff --git 
a/testing/wicket-arquillian/src/test/java/org/apache/wicket/arquillian/testing/pages/InsertContactTest.java
 
b/testing/wicket-arquillian/src/test/java/org/apache/wicket/arquillian/testing/pages/InsertContactTest.java
new file mode 100644
index 0000000..b3c9230
--- /dev/null
+++ 
b/testing/wicket-arquillian/src/test/java/org/apache/wicket/arquillian/testing/pages/InsertContactTest.java
@@ -0,0 +1,115 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.wicket.arquillian.testing.pages;
+
+import static org.junit.Assert.*;
+
+import java.util.List;
+
+import javax.inject.Inject;
+
+import org.apache.wicket.arquillian.testing.dao.ContactDao;
+import org.apache.wicket.arquillian.testing.deployment.AbstractDeploymentTest;
+import org.apache.wicket.arquillian.testing.model.Contact;
+import org.apache.wicket.util.tester.FormTester;
+import org.jboss.arquillian.junit.Arquillian;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+/**
+ * <b>WARNING: If this error occurs - 
org.jboss.arquillian.container.spi.client.container.LifecycleException: The 
server is already running! Managed containers do not support connecting to 
running server instances due to the possible harmful effect of connecting to 
the wrong server. Please stop server before running or change to another type 
of container.
+ *     To disable this check and allow Arquillian to connect to a running 
server, set allowConnectingToRunningServer to true in the container 
configuration.</b>
+ *     
+ *     <b>SOLUTION: Search and kill wildfly or jboss proccess instance that 
are using port 8080.</b>
+ * 
+ * <b> If you can't run inside eclipse, add as source the folder 
src/test/resources and try again. </b>
+ * 
+ * Just a class test to show that everything is working.
+ * 
+ * @author felipecalmeida
+ * @since 06/21/2015
+ *
+ */
+@RunWith(Arquillian.class)
+public class InsertContactTest extends AbstractDeploymentTest {
+       
+       private static final String EMAIL_IS_REQUIRED = "'email' is required.";
+
+       private static final String NAME_IS_REQUIRED = "'name' is required.";
+
+       private static final String INSERT_FORM = "insertForm";
+
+       private static final String EMAIL = "email";
+
+       private static final String NAME = "name";
+
+       private static final String WICKET_ARQUILLIAN_TEST_APACHE_ORG = 
"[email protected]";
+
+       private static final String WICKET_ARQUILLIAN_TEST = "Wicket Arquillian 
Test";
+
+       private static final Logger log = 
LoggerFactory.getLogger(InsertContactTest.class);
+
+       @Inject
+    private ContactDao contactDao;
+       
+       @Test
+       public void testErrorMessagesInsertContact() {
+               Class<InsertContact> pageClass = InsertContact.class;
+               getWicketTester().startPage(pageClass);
+               getWicketTester().assertRenderedPage(pageClass);
+               
+               FormTester formTester = 
getWicketTester().newFormTester(INSERT_FORM);
+               formTester.submit();
+               getWicketTester().assertErrorMessages(NAME_IS_REQUIRED, 
EMAIL_IS_REQUIRED);
+               log.info("Required Messages: " + NAME_IS_REQUIRED + " and " + 
EMAIL_IS_REQUIRED);
+               
+               getWicketTester().assertRenderedPage(pageClass);
+       }
+       
+       @Test
+       public void testInsertContact() {
+               Class<InsertContact> pageClass = InsertContact.class;
+               getWicketTester().startPage(pageClass);
+               getWicketTester().assertRenderedPage(pageClass);
+               
+               FormTester formTester = 
getWicketTester().newFormTester(INSERT_FORM);
+               formTester.setValue(NAME, WICKET_ARQUILLIAN_TEST);
+               formTester.setValue(EMAIL, WICKET_ARQUILLIAN_TEST_APACHE_ORG);
+               formTester.submit();
+               
+               getWicketTester().assertNoErrorMessage();
+               getWicketTester().assertRenderedPage(ListContacts.class);
+               
+               log.info("Retrieving contacts to assert:");
+               List<Contact> contacts = contactDao.getContacts();
+               int contactsSize = contacts.size();
+               assertEquals(1, contactsSize);
+               
+               Contact contact = contacts.get(0);
+               assertNotNull(contact.getId());
+               assertEquals(WICKET_ARQUILLIAN_TEST,contact.getName());
+               
assertEquals(WICKET_ARQUILLIAN_TEST_APACHE_ORG,contact.getEmail());
+               
+               log.info("Contacts size: " + contactsSize);
+               for (Contact infoContact : contacts) {
+                       log.info("Contacts info: " + infoContact);
+               }
+       }
+
+}

http://git-wip-us.apache.org/repos/asf/wicket/blob/af093ab1/testing/wicket-arquillian/src/test/java/org/apache/wicket/arquillian/testing/servletcontext/ArquillianContainerProvidedTest.java
----------------------------------------------------------------------
diff --git 
a/testing/wicket-arquillian/src/test/java/org/apache/wicket/arquillian/testing/servletcontext/ArquillianContainerProvidedTest.java
 
b/testing/wicket-arquillian/src/test/java/org/apache/wicket/arquillian/testing/servletcontext/ArquillianContainerProvidedTest.java
new file mode 100644
index 0000000..e459348
--- /dev/null
+++ 
b/testing/wicket-arquillian/src/test/java/org/apache/wicket/arquillian/testing/servletcontext/ArquillianContainerProvidedTest.java
@@ -0,0 +1,149 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.wicket.arquillian.testing.servletcontext;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertNull;
+import static org.junit.Assert.assertTrue;
+import static org.junit.Assert.fail;
+
+import java.net.MalformedURLException;
+import java.net.URL;
+
+import org.apache.wicket.arquillian.testing.TestWicketJavaEEApplication;
+import org.apache.wicket.arquillian.testing.deployment.AbstractDeploymentTest;
+import org.apache.wicket.protocol.http.WebApplication;
+import org.apache.wicket.util.tester.WicketTester;
+import org.jboss.arquillian.junit.Arquillian;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+/**
+ * <b>WARNING: If this error occurs - 
org.jboss.arquillian.container.spi.client.container.LifecycleException: The 
server is already running! Managed containers do not support connecting to 
running server instances due to the possible harmful effect of connecting to 
the wrong server. Please stop server before running or change to another type 
of container.
+ *     To disable this check and allow Arquillian to connect to a running 
server, set allowConnectingToRunningServer to true in the container 
configuration.</b>
+ *     
+ *     <b>SOLUTION: Search and kill wildfly or jboss proccess instance that 
are using port 8080.</b>
+ * 
+ * <b> If you can't run inside eclipse, add as source the folder 
src/test/resources and try again. </b>
+ * 
+ * @author felipecalmeida
+ * @since 06/23/2015
+ *
+ */
+@RunWith(Arquillian.class)
+public class ArquillianContainerProvidedTest extends AbstractDeploymentTest {
+       
+       private static final Logger log = 
LoggerFactory.getLogger(ArquillianContainerProvidedTest.class);
+
+       /**
+        * Using container's servlet context and/or filter provided configured 
in web.xml and using Arquillian.
+        */
+       @Test
+       public void testFindResourcesServletContextFromContainer() {
+               WebApplication webApplication =  useServletContextContainer();
+               setWicketTester(new WicketTester(webApplication, 
webApplication.getServletContext(), false));
+               findResourcesServletContext();
+       }
+       
+       /**
+        * Using container's servlet context and/or filter provided configured 
in web.xml and using Arquillian.
+        */
+       @Test
+       public void testFindResourcesWebApplicationFromContainer() {
+               WebApplication webApplication = useServletContextContainer();
+               setWicketTester(new WicketTester(webApplication, false));
+               findResourcesServletContext();
+       }
+       
+       /**
+        * Creating another application and trying to reuse the 
ServletContext/Filter.
+        */
+       @Test
+       public void testNewApplicationTryReuseServletContextFilter() {
+               try {
+                       log.info("Trying to reuse container's 
ServletContext/Filter.");
+                       setWicketTester(new WicketTester(new 
TestWicketJavaEEApplication(),false));
+               } catch (IllegalStateException e) {
+                       assertEquals("servletContext is not set yet. Any code 
in your Application object that uses the wicket filter instance should be put 
in the init() method instead of your constructor",e.getMessage());
+                       log.error("Cannot use container's ServletContext.\n", 
e);
+               }
+               
+               assertNull(wicketTester);
+       }
+       
+       /**
+        * Null application to test error.
+        */
+       @Test
+       public void testNullApplication() {
+               try {
+                       log.info("Trying to use a null application.");
+                       setWicketTester(new WicketTester(null,false));
+               } catch (AssertionError e) {
+                       assertEquals("WebApplication cannot be 
null",e.getMessage());
+                       log.error("WebApplication cannot be null\n", e);
+                       assertNull(wicketTester);
+               }
+               
+       }
+       
+       /**
+        * Test with new application.
+        */
+       @Test
+       public void testNewApplication() {
+               try {
+                       setWicketTester(new WicketTester(new 
TestWicketJavaEEApplication()));
+                       assertNotNull(getWicketTester().getApplication());
+                       log.info("Using mock servletcontext.");
+                       log.info("WebApplication MOCK after wicketTester Name: 
" + getWicketTester().getApplication().getName());
+                       log.info("ServletContext MOCK after wicketTester Name: 
" + getWicketTester().getServletContext().getServletContextName());
+                       log.info("Server info: " + 
getWicketTester().getServletContext().getServerInfo());
+                       assertEquals("Wicket Mock Test Environment v1.0", 
getWicketTester().getServletContext().getServerInfo());
+               } catch (IllegalStateException e) {
+                       // I don't know what or if could cause this.
+                       fail("Cannot use a mock ServletContext.");
+               }
+               
+               // USING MOCK.
+               findResourcesServletContext();
+       }
+
+       /**
+        * Look for resources (like html, js, css, img, etc).
+        * 
+        * @param servletContext
+        */
+       private void findResourcesServletContext() {
+               try {
+                       // Doing the same thing that ResourceWebApplicationPath 
does.
+                       URL resource = 
getWicketTester().getServletContext().getResource("/pages/InsertContact.html");
+                       if(resource == null) {
+                               throw new MalformedURLException("Resource 
/pages/InsertContact.html not found.");
+                       }
+                       log.info("Resource found " + resource.getFile());
+                       
assertTrue(resource.getFile().contains("/pages/InsertContact.html"));
+               } catch (Exception e) {
+                       assertEquals("Resource /pages/InsertContact.html not 
found.", e.getMessage());
+                       log.error("Resource cannot be found.", e);
+               }
+       }
+
+}

Reply via email to