Removed wicket-cdi-1.1 and Arquillian testing
Project: http://git-wip-us.apache.org/repos/asf/wicket/repo Commit: http://git-wip-us.apache.org/repos/asf/wicket/commit/9578a8a1 Tree: http://git-wip-us.apache.org/repos/asf/wicket/tree/9578a8a1 Diff: http://git-wip-us.apache.org/repos/asf/wicket/diff/9578a8a1 Branch: refs/heads/wicket9 Commit: 9578a8a1554ea47045063aa383ea664f49f50852 Parents: ed5cc82 Author: Andrea Del Bene <[email protected]> Authored: Mon Apr 16 11:12:04 2018 +0200 Committer: Andrea Del Bene <[email protected]> Committed: Mon Apr 16 11:12:04 2018 +0200 ---------------------------------------------------------------------- pom.xml | 10 +- testing/wicket-arquillian/README.md | 89 ------ testing/wicket-arquillian/pom.xml | 197 ------------- .../testing/WicketJavaEEApplication.java | 77 ----- .../arquillian/testing/dao/ContactDao.java | 77 ----- .../arquillian/testing/dao/ContactDaoBean.java | 88 ------ .../arquillian/testing/model/Contact.java | 125 -------- .../arquillian/testing/pages/InsertContact.java | 101 ------- .../arquillian/testing/pages/ListContacts.java | 85 ------ .../util/ResourceWebApplicationPath.java | 84 ------ .../src/main/resources/META-INF/MANIFEST.MF | 1 - .../src/main/resources/META-INF/persistence.xml | 50 ---- .../src/main/resources/arquillian.xml | 35 --- .../src/main/webapp/WEB-INF/beans.xml | 41 --- .../src/main/webapp/WEB-INF/web.xml | 65 ----- .../WEB-INF/wicket-arquillian-testing-ds.xml | 53 ---- .../src/main/webapp/pages/InsertContact.html | 58 ---- .../src/main/webapp/pages/ListContacts.html | 60 ---- .../testing/ApacheLicenceHeaderTest.java | 42 --- .../testing/TestWicketJavaEEApplication.java | 35 --- .../deployment/AbstractDeploymentTest.java | 154 ---------- .../testing/pages/InsertContactTest.java | 123 -------- .../ArquillianContainerProvidedTest.java | 150 ---------- .../src/test/webapp/WEB-INF/web.xml | 58 ---- wicket-cdi-1.1/pom.xml | 64 ---- .../org/apache/wicket/cdi/AbstractInjector.java | 39 --- .../org/apache/wicket/cdi/AutoConversation.java | 50 ---- .../wicket/cdi/AutoConversationManager.java | 121 -------- .../apache/wicket/cdi/BeanManagerLookup.java | 128 -------- .../org/apache/wicket/cdi/BehaviorInjector.java | 42 --- .../org/apache/wicket/cdi/CdiConfiguration.java | 126 -------- .../apache/wicket/cdi/CdiShutdownCleaner.java | 39 --- .../apache/wicket/cdi/ComponentInjector.java | 43 --- .../cdi/ConversationExpiredException.java | 52 ---- .../wicket/cdi/ConversationExpiryChecker.java | 70 ----- .../wicket/cdi/ConversationPropagation.java | 62 ---- .../wicket/cdi/ConversationPropagator.java | 291 ------------------- .../wicket/cdi/ConversationalComponent.java | 30 -- .../java/org/apache/wicket/cdi/DetachEvent.java | 28 -- .../apache/wicket/cdi/DetachEventEmitter.java | 75 ----- .../cdi/ICdiAwareRequestCycleListener.java | 41 --- .../wicket/cdi/IConversationPropagation.java | 47 --- .../org/apache/wicket/cdi/NonContextual.java | 164 ----------- .../org/apache/wicket/cdi/SessionInjector.java | 42 --- .../src/main/resources/META-INF/beans.xml | 4 - .../wicket/cdi/ApacheLicenceHeaderTest.java | 42 --- .../apache/wicket/cdi/CdiConfigurationTest.java | 68 ----- .../org/apache/wicket/cdi/CdiWicketTester.java | 128 -------- .../org/apache/wicket/cdi/ContextManager.java | 105 ------- .../wicket/cdi/ConversationPropagatorTest.java | 202 ------------- .../apache/wicket/cdi/WicketCdiTestCase.java | 185 ------------ .../apache/wicket/cdi/testapp/TestAppScope.java | 40 --- .../wicket/cdi/testapp/TestApplication.java | 39 --- .../wicket/cdi/testapp/TestCdiApplication.java | 54 ---- .../cdi/testapp/TestConversationBean.java | 56 ---- .../cdi/testapp/TestConversationPage.html | 12 - .../cdi/testapp/TestConversationPage.java | 84 ------ .../cdi/testapp/TestConversationalPage.html | 12 - .../cdi/testapp/TestConversationalPage.java | 78 ----- .../cdi/testapp/TestNonConversationalPage.html | 11 - .../cdi/testapp/TestNonConversationalPage.java | 55 ---- .../org/apache/wicket/cdi/testapp/TestPage.html | 10 - .../org/apache/wicket/cdi/testapp/TestPage.java | 40 --- .../wicket/cdi/testapp/TestQualifier.java | 35 --- .../src/test/java/simplelogger.properties | 1 - wicket-examples/pom.xml | 4 - .../wicket/examples/cdi/ApplicationCounter.java | 36 --- .../examples/cdi/AutoConversationPage1.html | 19 -- .../examples/cdi/AutoConversationPage1.java | 53 ---- .../examples/cdi/AutoConversationPage2.html | 17 -- .../examples/cdi/AutoConversationPage2.java | 42 --- .../wicket/examples/cdi/CdiApplication.java | 45 --- .../wicket/examples/cdi/CdiExamplePage.html | 18 -- .../wicket/examples/cdi/CdiExamplePage.java | 24 -- .../apache/wicket/examples/cdi/CdiHomePage.html | 19 -- .../apache/wicket/examples/cdi/CdiHomePage.java | 25 -- .../examples/cdi/ConversationCounter.java | 36 --- .../wicket/examples/cdi/ConversationPage1.html | 20 -- .../wicket/examples/cdi/ConversationPage1.java | 55 ---- .../wicket/examples/cdi/ConversationPage2.html | 22 -- .../wicket/examples/cdi/ConversationPage2.java | 43 --- .../wicket/examples/cdi/ConversationPage3.html | 13 - .../wicket/examples/cdi/ConversationPage3.java | 33 --- .../org/apache/wicket/examples/cdi/Counter.java | 35 --- .../wicket/examples/cdi/InjectionPage.html | 16 - .../wicket/examples/cdi/InjectionPage.java | 40 --- 86 files changed, 1 insertion(+), 5287 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/wicket/blob/9578a8a1/pom.xml ---------------------------------------------------------------------- diff --git a/pom.xml b/pom.xml index fbecbb9..39cfb47 100644 --- a/pom.xml +++ b/pom.xml @@ -105,10 +105,8 @@ <module>archetypes/quickstart</module> <module>testing/wicket-common-tests</module> <module>testing/wicket-js-tests</module> - <module>testing/wicket-arquillian</module> <module>wicket-native-websocket</module> <module>wicket-bean-validation</module> - <module>wicket-cdi-1.1</module> <module>wicket-user-guide</module> </modules> <properties> @@ -296,12 +294,6 @@ </dependency> <dependency> <groupId>org.apache.wicket</groupId> - <artifactId>wicket-cdi-1.1</artifactId> - <version>8.0.0-SNAPSHOT</version> - <type>jar</type> - </dependency> - <dependency> - <groupId>org.apache.wicket</groupId> <artifactId>wicket-core</artifactId> <version>8.0.0-SNAPSHOT</version> <type>jar</type> @@ -544,7 +536,7 @@ <dependency> <groupId>org.jglue.cdi-unit</groupId> <artifactId>cdi-unit</artifactId> - <version>2.2.1</version> + <version>4.0.2</version> <scope>test</scope> </dependency> <dependency> http://git-wip-us.apache.org/repos/asf/wicket/blob/9578a8a1/testing/wicket-arquillian/README.md ---------------------------------------------------------------------- diff --git a/testing/wicket-arquillian/README.md b/testing/wicket-arquillian/README.md deleted file mode 100644 index b3ca219..0000000 --- a/testing/wicket-arquillian/README.md +++ /dev/null @@ -1,89 +0,0 @@ -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 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 7.x with WildFly, leveraging features of Java EE 6, using the CDI Java EE integration. - -Features used: - - * Injection of `@PersistenceContext` - * Injection of a value from `web.xml` using `@Resource` - * Injection of a stateless session bean using `@EJB` - -This is a WAR version. - - -System requirements -------------------- - -All you need to build this project is Java 7.0 (Java SDK 1.7) or better, Maven 3.1 or better. - -The application this project produces is designed to be run on JBoss WildFly. - - -Configure Maven ---------------- - -If you have not yet done so, you must [Configure Maven](../README.md#mavenconfiguration) before testing the quickstarts. - - -Start JBoss WildFly with the Web Profile -------------------------- - -1. Open a command line and navigate to the root of the JBoss server directory. -2. The following shows the command line to start the server with the web profile: - - For Linux: JBOSS_HOME/bin/standalone.sh - For Windows: JBOSS_HOME\bin\standalone.bat - - - -Build and Deploy the Quickstart -------------------------- - -_NOTE: The following build command assumes you have configured your Maven user settings. If you have not, you must include Maven setting arguments on the command line. See [Build and Deploy the Quickstarts](../README.md#buildanddeploy) for complete instructions and additional options._ - -1. Make sure you have started the JBoss Server as described above. -2. Open a command line and navigate to the root directory of this quickstart. -3. Type this command to build and deploy the archive: - - mvn clean package wildfly:deploy - -4. This will deploy `target/wildfly-wicket-war.war` to the running instance of the server. - - - -Access the application ----------------------- - -Access the running application in a browser at the following URL: <http://localhost:8080/wildfly-wicket-war> - -You will see a page with a table listing user entities. Initially, this table is empty. By clicking a link, you can add more users. - - -Undeploy the Archive --------------------- - -1. Make sure you have started the JBoss Server as described above. -2. Open a command line and navigate to the root directory of this quickstart. -3. When you are finished testing, type this command to undeploy the archive: - - mvn wildfly:undeploy - - -Debug the Application ------------------------------------- - -If you want to debug the source code or look at the Javadocs of any library in the project, -run either of the following commands to pull them into your local repository. The IDE should then detect them. - - mvn dependency:sources - mvn dependency:resolve -Dclassifier=javadoc http://git-wip-us.apache.org/repos/asf/wicket/blob/9578a8a1/testing/wicket-arquillian/pom.xml ---------------------------------------------------------------------- diff --git a/testing/wicket-arquillian/pom.xml b/testing/wicket-arquillian/pom.xml deleted file mode 100644 index 94613da..0000000 --- a/testing/wicket-arquillian/pom.xml +++ /dev/null @@ -1,197 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<!-- - 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> - - <parent> - <groupId>org.apache.wicket</groupId> - <artifactId>wicket-parent</artifactId> - <version>8.0.0-SNAPSHOT</version> - <relativePath>../../pom.xml</relativePath> - </parent> - - <artifactId>wicket-arquillian-testing</artifactId> - <packaging>war</packaging> - - <name>Wicket Arquillian Testing</name> - - <description> - 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> - <!-- port configuration --> - <wicket.arquillian.server.port>18787</wicket.arquillian.server.port> - <java.debug.wire.protocol.port>48787</java.debug.wire.protocol.port> - <wicket.arquillian.management.port>11091</wicket.arquillian.management.port> - <!-- end port configuration --> - - <arquillian.version>1.1.13.Final</arquillian.version> - <maven.dependency.plugin.version>2.10</maven.dependency.plugin.version> - <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> - <wildfly.version>8.2.1.Final</wildfly.version> - <version.wildfly.maven.plugin>1.0.2.Final</version.wildfly.maven.plugin> - <jee.spec.version>1.1.0.Final</jee.spec.version> - </properties> - - <dependencyManagement> - <dependencies> - <dependency> - <groupId>org.jboss.arquillian</groupId> - <artifactId>arquillian-bom</artifactId> - <version>${arquillian.version}</version> - <scope>import</scope> - <type>pom</type> - </dependency> - </dependencies> - </dependencyManagement> - - <dependencies> - <dependency> - <groupId>org.jboss.spec</groupId> - <artifactId>jboss-javaee-7.0</artifactId> - <version>${jee.spec.version}</version> - <type>pom</type> - <scope>provided</scope> - </dependency> - <dependency> - <groupId>junit</groupId> - <artifactId>junit</artifactId> - <scope>test</scope> - </dependency> - <dependency> - <groupId>org.wildfly</groupId> - <artifactId>wildfly-arquillian-container-embedded</artifactId> - <version>${wildfly.version}</version> - </dependency> - <dependency> - <groupId>org.wildfly</groupId> - <artifactId>wildfly-embedded</artifactId> - <version>${wildfly.version}</version> - </dependency> - <dependency> - <groupId>org.jboss.arquillian.junit</groupId> - <artifactId>arquillian-junit-container</artifactId> - <scope>test</scope> - </dependency> - <!-- Wicket CDI integration. --> - <dependency> - <groupId>org.apache.wicket</groupId> - <artifactId>wicket-cdi</artifactId> - </dependency> - - <!-- Wicket --> - <dependency> - <groupId>org.apache.wicket</groupId> - <artifactId>wicket-core</artifactId> - </dependency> - - <dependency> - <groupId>org.jboss.shrinkwrap.resolver</groupId> - <artifactId>shrinkwrap-resolver-impl-maven</artifactId> - </dependency> - <dependency> - <groupId>org.jboss.shrinkwrap.resolver</groupId> - <artifactId>shrinkwrap-resolver-spi</artifactId> - </dependency> - - </dependencies> - - <build> - <resources> - <resource> - <directory>src/main/resources</directory> - <filtering>true</filtering> - </resource> - </resources> - <pluginManagement> - <plugins> - <plugin> - <groupId>org.apache.maven.plugins</groupId> - <artifactId>maven-dependency-plugin</artifactId> - <version>${maven.dependency.plugin.version}</version> - <executions> - <execution> - <id>unpack</id> - <phase>process-test-classes</phase> - <goals> - <goal>unpack</goal> - </goals> - <configuration> - <artifactItems> - <artifactItem> - <groupId>org.wildfly</groupId> - <artifactId>wildfly-dist</artifactId> - <version>${wildfly.version}</version> - <type>zip</type> - <overWrite>false</overWrite> - <outputDirectory>${project.build.directory}</outputDirectory> - </artifactItem> - </artifactItems> - </configuration> - </execution> - </executions> - </plugin> - - <plugin> - <groupId>org.apache.maven.plugins</groupId> - <artifactId>maven-surefire-plugin</artifactId> - <version>${maven.surefire.version}</version> - <configuration> - <systemPropertyVariables> - <!-- <jboss.socket.binding.port-offset>1100</jboss.socket.binding.port-offset> --> - <jboss.management.http.port>${wicket.arquillian.management.port}</jboss.management.http.port> - <jboss.http.port>${wicket.arquillian.server.port}</jboss.http.port> - <java.util.logging.manager>org.jboss.logmanager.LogManager</java.util.logging.manager> - <jboss.home>${project.build.directory}/wildfly-${wildfly.version}</jboss.home> - <module.path>${project.build.directory}/wildfly-${wildfly.version}/modules</module.path> - </systemPropertyVariables> - <redirectTestOutputToFile>false</redirectTestOutputToFile> - </configuration> - </plugin> - <plugin> - <groupId>org.wildfly.plugins</groupId> - <artifactId>wildfly-maven-plugin</artifactId> - <version>${version.wildfly.maven.plugin}</version> - <configuration> - <port>${wicket.arquillian.management.port}</port> - <filename>target/${project.build.finalName}.war</filename> - </configuration> - </plugin> - - </plugins> - </pluginManagement> - <plugins> - <plugin> - <groupId>org.apache.maven.plugins</groupId> - <artifactId>maven-dependency-plugin</artifactId> - </plugin> - <plugin> - <groupId>org.apache.maven.plugins</groupId> - <artifactId>maven-surefire-plugin</artifactId> - </plugin> - <plugin> - <groupId>org.wildfly.plugins</groupId> - <artifactId>wildfly-maven-plugin</artifactId> - </plugin> - </plugins> - </build> - -</project> - http://git-wip-us.apache.org/repos/asf/wicket/blob/9578a8a1/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 deleted file mode 100644 index 6dc0c93..0000000 --- a/testing/wicket-arquillian/src/main/java/org/apache/wicket/arquillian/testing/WicketJavaEEApplication.java +++ /dev/null @@ -1,77 +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.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/9578a8a1/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 deleted file mode 100644 index e2cd94c..0000000 --- a/testing/wicket-arquillian/src/main/java/org/apache/wicket/arquillian/testing/dao/ContactDao.java +++ /dev/null @@ -1,77 +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. - */ -/* - * 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 - */ - List<Contact> getContacts(); - - /** - * Returns a specific Contact from DB. - * - * @param id The Id for the Contact - * @return The specified Contact object - */ - 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 - */ - void addContact(String name, String email); - - /** - * Removes a specific item from the DB. - * - * @param modelObject The specific Contact object, which we wants to remove - */ - void remove(Contact modelObject); -} http://git-wip-us.apache.org/repos/asf/wicket/blob/9578a8a1/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 deleted file mode 100644 index a7982c1..0000000 --- a/testing/wicket-arquillian/src/main/java/org/apache/wicket/arquillian/testing/dao/ContactDaoBean.java +++ /dev/null @@ -1,88 +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. - */ -/* - * 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/9578a8a1/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 deleted file mode 100644 index e5a2bcc..0000000 --- a/testing/wicket-arquillian/src/main/java/org/apache/wicket/arquillian/testing/model/Contact.java +++ /dev/null @@ -1,125 +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. - */ -/* - * 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/9578a8a1/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 deleted file mode 100644 index e78831a..0000000 --- a/testing/wicket-arquillian/src/main/java/org/apache/wicket/arquillian/testing/pages/InsertContact.java +++ /dev/null @@ -1,101 +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. - */ -/* - * 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<>("name", - new PropertyModel<String>(this, "name"))); - insertForm.add(new RequiredTextField<>("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/9578a8a1/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 deleted file mode 100644 index f08ff55..0000000 --- a/testing/wicket-arquillian/src/main/java/org/apache/wicket/arquillian/testing/pages/ListContacts.java +++ /dev/null @@ -1,85 +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. - */ -/* - * 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/9578a8a1/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 deleted file mode 100644 index d647626..0000000 --- a/testing/wicket-arquillian/src/main/java/org/apache/wicket/arquillian/testing/util/ResourceWebApplicationPath.java +++ /dev/null @@ -1,84 +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.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 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; - - /** basePath of the project org/apache/wicket/arquillian/testing **/ - 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; - } - - @Override - public IResourceStream find(final Class<?> clazz, final String pathname) - { - if (pathname != null && 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; - } - - @Override - public String toString() - { - return "[webapppath: " + basePath + "]"; - } -} http://git-wip-us.apache.org/repos/asf/wicket/blob/9578a8a1/testing/wicket-arquillian/src/main/resources/META-INF/MANIFEST.MF ---------------------------------------------------------------------- diff --git a/testing/wicket-arquillian/src/main/resources/META-INF/MANIFEST.MF b/testing/wicket-arquillian/src/main/resources/META-INF/MANIFEST.MF deleted file mode 100644 index aff5ee3..0000000 --- a/testing/wicket-arquillian/src/main/resources/META-INF/MANIFEST.MF +++ /dev/null @@ -1 +0,0 @@ -Dependencies: org.jboss.msc http://git-wip-us.apache.org/repos/asf/wicket/blob/9578a8a1/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 deleted file mode 100644 index 49b98fb..0000000 --- a/testing/wicket-arquillian/src/main/resources/META-INF/persistence.xml +++ /dev/null @@ -1,50 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<!-- - 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. ---> -<!-- - 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. ---> -<persistence version="2.0" - xmlns="http://java.sun.com/xml/ns/persistence" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xsi:schemaLocation=" - http://java.sun.com/xml/ns/persistence - http://java.sun.com/xml/ns/persistence/persistence_2_0.xsd"> - <persistence-unit name="wicketArquillianTesting"> - <!-- If you are running in a production environment, add a managed - data source, this example data source is just for development and testing! --> - <!-- 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" /> - <property name="hibernate.show_sql" value="false" /> - </properties> - </persistence-unit> -</persistence> http://git-wip-us.apache.org/repos/asf/wicket/blob/9578a8a1/testing/wicket-arquillian/src/main/resources/arquillian.xml ---------------------------------------------------------------------- diff --git a/testing/wicket-arquillian/src/main/resources/arquillian.xml b/testing/wicket-arquillian/src/main/resources/arquillian.xml deleted file mode 100644 index d6bda74..0000000 --- a/testing/wicket-arquillian/src/main/resources/arquillian.xml +++ /dev/null @@ -1,35 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<!-- - 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. ---> -<arquillian xmlns="http://jboss.org/schema/arquillian" - xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xsi:schemaLocation="http://jboss.org/schema/arquillian http://jboss.org/schema/arquillian/arquillian_1_0.xsd"> - - <defaultProtocol type="Servlet 3.0" /> - <engine> - <property name="deploymentExportPath">target</property> - </engine> - - <container qualifier="wildfly" default="true"> - <configuration> - <property name="managementPort">${wicket.arquillian.management.port}</property> - <property name="jbossHome">target/wildfly-${wildfly.version}</property> - <property name="javaVmArguments">-Xrunjdwp:transport=dt_socket,address=${java.debug.wire.protocol.port},server=y,suspend=n</property> - </configuration> - </container> - -</arquillian> http://git-wip-us.apache.org/repos/asf/wicket/blob/9578a8a1/testing/wicket-arquillian/src/main/webapp/WEB-INF/beans.xml ---------------------------------------------------------------------- diff --git a/testing/wicket-arquillian/src/main/webapp/WEB-INF/beans.xml b/testing/wicket-arquillian/src/main/webapp/WEB-INF/beans.xml deleted file mode 100644 index 8c6322f..0000000 --- a/testing/wicket-arquillian/src/main/webapp/WEB-INF/beans.xml +++ /dev/null @@ -1,41 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<!-- - 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. ---> -<!-- - 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 file can be an empty text file (0 bytes) --> -<!-- We're declaring the schema to save you time if you do have to configure - this in the future --> -<beans 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/beans_1_0.xsd"> -</beans> http://git-wip-us.apache.org/repos/asf/wicket/blob/9578a8a1/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 deleted file mode 100644 index 1118849..0000000 --- a/testing/wicket-arquillian/src/main/webapp/WEB-INF/web.xml +++ /dev/null @@ -1,65 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<!-- - 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. ---> -<!-- - 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. ---> -<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>Wicket Arquillian WildFly Quickstart: Wicket WAR</display-name> - - <!-- Enable Wicket --> - <filter> - <filter-name>Wicket</filter-name> - <filter-class>org.apache.wicket.protocol.http.WicketFilter</filter-class> - <init-param> - <!-- Specify the "entry point" for Wicket to configure itself - from --> - <param-name>applicationClassName</param-name> - <param-value>org.apache.wicket.arquillian.testing.WicketJavaEEApplication</param-value> - </init-param> - </filter> - - <!-- Have wicket manage the context root --> - <filter-mapping> - <filter-name>Wicket</filter-name> - <url-pattern>/*</url-pattern> - </filter-mapping> - - <!-- A message displayed on the page, externalized into web.xml --> - <env-entry> - <env-entry-name>welcomeMessage</env-entry-name> - <env-entry-type>java.lang.String</env-entry-type> - <env-entry-value>Welcome to the WildFly Quickstart showing the use of Wicket, packaged in an WAR</env-entry-value> - </env-entry> - -</web-app> http://git-wip-us.apache.org/repos/asf/wicket/blob/9578a8a1/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 deleted file mode 100644 index cc13b92..0000000 --- a/testing/wicket-arquillian/src/main/webapp/WEB-INF/wicket-arquillian-testing-ds.xml +++ /dev/null @@ -1,53 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<!-- - 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. ---> -<!-- - 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/9578a8a1/testing/wicket-arquillian/src/main/webapp/pages/InsertContact.html ---------------------------------------------------------------------- diff --git a/testing/wicket-arquillian/src/main/webapp/pages/InsertContact.html b/testing/wicket-arquillian/src/main/webapp/pages/InsertContact.html deleted file mode 100644 index a9636b2..0000000 --- a/testing/wicket-arquillian/src/main/webapp/pages/InsertContact.html +++ /dev/null @@ -1,58 +0,0 @@ -<?xml version="1.0" encoding="UTF-8" ?> -<!-- - 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. ---> -<!-- - 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. ---> -<html xmlns:wicket="http://wicket.sourceforge.net/"> - <head> - <title>wicket-war</title> - </head> - - <body> - <span wicket:id="feedback"></span> - <form method="post" action="#" wicket:id="insertForm"> - <table border="0" cellpadding="5"> - <tr> - <td width="200">Name</td> - <td><input type="text" wicket:id="name" size="20"/></td> - </tr> - <tr> - <td width="200">Email</td> - <td><input type="text" wicket:id="email" size="20"/></td> - </tr> - <tr> - <td width="200"> </td> - <td><input type="submit" value="Insert"/></td> - </tr> - </table> - </form> - </body> -</html> http://git-wip-us.apache.org/repos/asf/wicket/blob/9578a8a1/testing/wicket-arquillian/src/main/webapp/pages/ListContacts.html ---------------------------------------------------------------------- diff --git a/testing/wicket-arquillian/src/main/webapp/pages/ListContacts.html b/testing/wicket-arquillian/src/main/webapp/pages/ListContacts.html deleted file mode 100644 index b2bb4ca..0000000 --- a/testing/wicket-arquillian/src/main/webapp/pages/ListContacts.html +++ /dev/null @@ -1,60 +0,0 @@ -<?xml version="1.0" encoding="UTF-8" ?> -<!-- - 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. ---> -<!-- - 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. ---> -<html xmlns:wicket="http://wicket.sourceforge.net/"> - <head> - <title>wicket-war</title> - </head> - - <body> - - <h1> - <span wicket:id="welcomeMessage"></span> - </h1> - - <table border="1" cellpadding="8"> - <tr> - <td width="200">Name</td> - <td width="200">Email</td> - <td width="200"> </td> - </tr> - <tr wicket:id="contacts"> - <td><span wicket:id="name">[name]</span></td> - <td><span wicket:id="email">[email]</span></td> - <td><a href="#" wicket:id="delete">[delete]</a></td> - </tr> - </table> - - <wicket:link><a href="InsertContact.html">Insert a new Contact</a></wicket:link> - </body> -</html> http://git-wip-us.apache.org/repos/asf/wicket/blob/9578a8a1/testing/wicket-arquillian/src/test/java/org/apache/wicket/arquillian/testing/ApacheLicenceHeaderTest.java ---------------------------------------------------------------------- diff --git a/testing/wicket-arquillian/src/test/java/org/apache/wicket/arquillian/testing/ApacheLicenceHeaderTest.java b/testing/wicket-arquillian/src/test/java/org/apache/wicket/arquillian/testing/ApacheLicenceHeaderTest.java deleted file mode 100644 index ac5aa02..0000000 --- a/testing/wicket-arquillian/src/test/java/org/apache/wicket/arquillian/testing/ApacheLicenceHeaderTest.java +++ /dev/null @@ -1,42 +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.apache.wicket.arquillian.testing; - -import java.util.Arrays; - -import org.apache.wicket.util.license.ApacheLicenseHeaderTestCase; - -/** - * Test that the license headers are in place in this project. The tests are run - * from {@link ApacheLicenseHeaderTestCase}, but you can add project specific - * tests here if needed. - * - * @author Frank Bille Jensen (frankbille) - */ -public class ApacheLicenceHeaderTest extends ApacheLicenseHeaderTestCase -{ - /** - * Construct. - */ - public ApacheLicenceHeaderTest() - { -// xmlIgnore.add(".settings"); -// xmlIgnore.add("src/main/resources/META-INF/beans.xml"); -// xmlIgnore.add("src/test/java/simplelogger.properties"); -// xmlPrologIgnore = Arrays.asList("src"); - } -} http://git-wip-us.apache.org/repos/asf/wicket/blob/9578a8a1/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 deleted file mode 100644 index 9f2d146..0000000 --- a/testing/wicket-arquillian/src/test/java/org/apache/wicket/arquillian/testing/TestWicketJavaEEApplication.java +++ /dev/null @@ -1,35 +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.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/9578a8a1/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 deleted file mode 100644 index 7a3e1a2..0000000 --- a/testing/wicket-arquillian/src/test/java/org/apache/wicket/arquillian/testing/deployment/AbstractDeploymentTest.java +++ /dev/null @@ -1,154 +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.apache.wicket.arquillian.testing.deployment; - -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertNotNull; - -import java.io.File; -import java.util.Locale; - -import javax.servlet.ServletContext; - -import org.apache.wicket.arquillian.testing.TestWicketJavaEEApplication; -import org.apache.wicket.protocol.http.WebApplication; -import org.apache.wicket.util.SlowTests; -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.junit.experimental.categories.Category; -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 - * - */ -@Category(SlowTests.class) -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-servletContext8.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) { - @Override - protected Locale servletRequestLocale() { - return Locale.US; - } - }; - } - 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/9578a8a1/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 deleted file mode 100644 index 38df500..0000000 --- a/testing/wicket-arquillian/src/test/java/org/apache/wicket/arquillian/testing/pages/InsertContactTest.java +++ /dev/null @@ -1,123 +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.apache.wicket.arquillian.testing.pages; - -import static org.junit.Assert.*; - -import java.util.List; -import java.util.Locale; - -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.Before; -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; - - @Before - public void before() - { - getWicketTester().getSession().setLocale(Locale.ENGLISH); - } - - @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/9578a8a1/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 deleted file mode 100644 index a3ec33c..0000000 --- a/testing/wicket-arquillian/src/test/java/org/apache/wicket/arquillian/testing/servletcontext/ArquillianContainerProvidedTest.java +++ /dev/null @@ -1,150 +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.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); - - private static final String RESOURCE_PAGES_INSERT_CONTACT_HTML_NOT_FOUND = "Resource /pages/InsertContact.html not found."; - - /** - * Using container's servlet context and/or filter provided configured in web.xml and using Arquillian. - */ - @Test - public void testFindResourcesServletContextFromContainer() throws MalformedURLException - { - 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() throws MalformedURLException - { - 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)); - fail("Should not be able to reuse the servlet context"); - } 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()); - } - - 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)); - fail("WebApplication cannot be null"); - } catch (IllegalArgumentException iax) { - assertEquals("Argument 'application' may not be null.", iax.getMessage()); - } - assertNull(wicketTester); - } - - /** - * Test with new application. - */ - @Test - public void testNewApplication() throws MalformedURLException - { - 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()); - - // USING MOCK. - try - { - findResourcesServletContext(); - fail("Should not be able to find '/pages/InsertContact.html' in the mocked servlet context"); - } - catch (IllegalStateException isx) - { - assertEquals(RESOURCE_PAGES_INSERT_CONTACT_HTML_NOT_FOUND, isx.getMessage()); - } - } - - /** - * Look for resources (like html, js, css, img, etc). - */ - private void findResourcesServletContext() throws MalformedURLException - { - // Doing the same thing that ResourceWebApplicationPath does. - URL resource = getWicketTester().getServletContext().getResource("/pages/InsertContact.html"); - if (resource == null) { - throw new IllegalStateException(RESOURCE_PAGES_INSERT_CONTACT_HTML_NOT_FOUND); - } - log.info("Resource found " + resource.getFile()); - assertTrue(resource.getFile().contains("/pages/InsertContact.html")); - } - -}
