You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tomee.apache.org by jg...@apache.org on 2011/03/27 22:07:33 UTC
svn commit: r1086013 - in /openejb/trunk/openejb3/examples/webapps/moviefun:
app/ app/src/main/java/org/superbiz/moviefun/
app/src/test/java/org/superbiz/moviefun/ monitor/ monitor/src/main/resources/
Author: jgallimore
Date: Sun Mar 27 20:07:33 2011
New Revision: 1086013
URL: http://svn.apache.org/viewvc?rev=1086013&view=rev
Log:
Added integration test using t7mp and htmlunit for moviefun application
Added:
openejb/trunk/openejb3/examples/webapps/moviefun/app/src/test/java/org/superbiz/moviefun/MoviesIT.java
openejb/trunk/openejb3/examples/webapps/moviefun/monitor/src/main/resources/movie.png (with props)
Modified:
openejb/trunk/openejb3/examples/webapps/moviefun/app/pom.xml
openejb/trunk/openejb3/examples/webapps/moviefun/app/src/main/java/org/superbiz/moviefun/MovieController.java
openejb/trunk/openejb3/examples/webapps/moviefun/app/src/main/java/org/superbiz/moviefun/MoviesImpl.java
openejb/trunk/openejb3/examples/webapps/moviefun/monitor/pom.xml
Modified: openejb/trunk/openejb3/examples/webapps/moviefun/app/pom.xml
URL: http://svn.apache.org/viewvc/openejb/trunk/openejb3/examples/webapps/moviefun/app/pom.xml?rev=1086013&r1=1086012&r2=1086013&view=diff
==============================================================================
--- openejb/trunk/openejb3/examples/webapps/moviefun/app/pom.xml (original)
+++ openejb/trunk/openejb3/examples/webapps/moviefun/app/pom.xml Sun Mar 27 20:07:33 2011
@@ -1,26 +1,19 @@
<?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.
--->
+<!-- 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. -->
<!-- $Rev: 684173 $ $Date: 2008-08-08 20:13:24 -0700 (Fri, 08 Aug 2008) $ -->
<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">
+ 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.superbiz</groupId>
@@ -43,6 +36,7 @@
</repository>
</repositories>
<build>
+ <finalName>moviefun</finalName>
<defaultGoal>install</defaultGoal>
<plugins>
<plugin>
@@ -59,6 +53,15 @@
<target>1.6</target>
</configuration>
</plugin>
+ <plugin>
+ <artifactId>maven-eclipse-plugin</artifactId>
+ <configuration>
+ <configuration>
+ <wtpapplicationxml>true</wtpapplicationxml>
+ <wtpversion>2.0</wtpversion>
+ </configuration>
+ </configuration>
+ </plugin>
</plugins>
</build>
<dependencies>
@@ -101,18 +104,23 @@
<version>1.1.2</version>
</dependency>
<dependency>
- <groupId>org.superbiz</groupId>
- <artifactId>moviefun-iface</artifactId>
- <version>1.1-SNAPSHOT</version>
- <type>jar</type>
- <scope>compile</scope>
+ <groupId>org.superbiz</groupId>
+ <artifactId>moviefun-iface</artifactId>
+ <version>1.1-SNAPSHOT</version>
+ <type>jar</type>
+ <scope>compile</scope>
+ </dependency>
+ <dependency>
+ <groupId>net.sourceforge.htmlunit</groupId>
+ <artifactId>htmlunit</artifactId>
+ <version>2.8</version>
+ <type>jar</type>
+ <scope>test</scope>
</dependency>
</dependencies>
- <!--
- This section allows you to configure where to publish libraries for sharing.
- It is not required and may be deleted. For more information see:
- http://maven.apache.org/plugins/maven-deploy-plugin/
- -->
+ <!-- This section allows you to configure where to publish libraries for
+ sharing. It is not required and may be deleted. For more information see:
+ http://maven.apache.org/plugins/maven-deploy-plugin/ -->
<distributionManagement>
<repository>
<id>localhost</id>
@@ -123,4 +131,57 @@
<url>file://${basedir}/target/snapshot-repo/</url>
</snapshotRepository>
</distributionManagement>
+
+ <profiles>
+ <profile>
+ <id>itest</id>
+ <build>
+ <defaultGoal>install</defaultGoal>
+ <plugins>
+ <plugin>
+ <groupId>com.googlecode.t7mp</groupId>
+ <artifactId>maven-t7-plugin</artifactId>
+ <version>0.9.6</version>
+ <configuration>
+ <tomcatHttpPort>9999</tomcatHttpPort>
+ <tomcatShutdownPort>9998</tomcatShutdownPort>
+ <tomcatVersion>7.0.11</tomcatVersion>
+ <webapps>
+ <webappArtifact>
+ <groupId>org.apache.openejb</groupId>
+ <artifactId>openejb-tomcat-webapp</artifactId>
+ <version>3.2-SNAPSHOT</version>
+ <contextPath>openejb</contextPath>
+ </webappArtifact>
+ </webapps>
+ </configuration>
+ <executions>
+ <execution>
+ <id>start-tomcat</id>
+ <goals>
+ <goal>run</goal>
+ </goals>
+ <phase>pre-integration-test</phase>
+ <configuration>
+ <tomcatSetAwait>false</tomcatSetAwait>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin>
+ <plugin>
+ <artifactId>maven-failsafe-plugin</artifactId>
+ <version>2.6</version>
+ <executions>
+ <execution>
+ <goals>
+ <goal>integration-test</goal>
+ <goal>verify</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+ </build>
+ </profile>
+ </profiles>
</project>
\ No newline at end of file
Modified: openejb/trunk/openejb3/examples/webapps/moviefun/app/src/main/java/org/superbiz/moviefun/MovieController.java
URL: http://svn.apache.org/viewvc/openejb/trunk/openejb3/examples/webapps/moviefun/app/src/main/java/org/superbiz/moviefun/MovieController.java?rev=1086013&r1=1086012&r2=1086013&view=diff
==============================================================================
--- openejb/trunk/openejb3/examples/webapps/moviefun/app/src/main/java/org/superbiz/moviefun/MovieController.java (original)
+++ openejb/trunk/openejb3/examples/webapps/moviefun/app/src/main/java/org/superbiz/moviefun/MovieController.java Sun Mar 27 20:07:33 2011
@@ -144,7 +144,7 @@ public class MovieController implements
private void performDestroy() {
try {
- getFacade().deleteMovie(current);
+ getFacade().deleteMovieId(current.getId());
JsfUtil.addSuccessMessage(ResourceBundle.getBundle("/Bundle").getString("MovieDeleted"));
} catch (Exception e) {
JsfUtil.addErrorMessage(e, ResourceBundle.getBundle("/Bundle").getString("PersistenceErrorOccured"));
Modified: openejb/trunk/openejb3/examples/webapps/moviefun/app/src/main/java/org/superbiz/moviefun/MoviesImpl.java
URL: http://svn.apache.org/viewvc/openejb/trunk/openejb3/examples/webapps/moviefun/app/src/main/java/org/superbiz/moviefun/MoviesImpl.java?rev=1086013&r1=1086012&r2=1086013&view=diff
==============================================================================
--- openejb/trunk/openejb3/examples/webapps/moviefun/app/src/main/java/org/superbiz/moviefun/MoviesImpl.java (original)
+++ openejb/trunk/openejb3/examples/webapps/moviefun/app/src/main/java/org/superbiz/moviefun/MoviesImpl.java Sun Mar 27 20:07:33 2011
@@ -63,14 +63,13 @@ public class MoviesImpl implements Movie
@Override
public void deleteMovie(Movie movie) {
entityManager.remove(movie);
+ notifier.notify("Deleted Movie \"" + movie.getTitle() + "\" (" + movie.getYear() + ")");
}
@Override
public void deleteMovieId(long id) {
Movie movie = entityManager.find(Movie.class, id);
entityManager.remove(movie);
-
- notifier.notify("Deleted Movie \"" + movie.getTitle() + "\" (" + movie.getYear() + ")");
}
@Override
Added: openejb/trunk/openejb3/examples/webapps/moviefun/app/src/test/java/org/superbiz/moviefun/MoviesIT.java
URL: http://svn.apache.org/viewvc/openejb/trunk/openejb3/examples/webapps/moviefun/app/src/test/java/org/superbiz/moviefun/MoviesIT.java?rev=1086013&view=auto
==============================================================================
--- openejb/trunk/openejb3/examples/webapps/moviefun/app/src/test/java/org/superbiz/moviefun/MoviesIT.java (added)
+++ openejb/trunk/openejb3/examples/webapps/moviefun/app/src/test/java/org/superbiz/moviefun/MoviesIT.java Sun Mar 27 20:07:33 2011
@@ -0,0 +1,70 @@
+/**
+ * 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.superbiz.moviefun;
+
+import static org.junit.Assert.assertTrue;
+
+import java.util.Iterator;
+
+import org.junit.Test;
+
+import com.gargoylesoftware.htmlunit.WebClient;
+import com.gargoylesoftware.htmlunit.html.DomNodeList;
+import com.gargoylesoftware.htmlunit.html.HtmlAnchor;
+import com.gargoylesoftware.htmlunit.html.HtmlElement;
+import com.gargoylesoftware.htmlunit.html.HtmlPage;
+
+public class MoviesIT {
+
+ @Test
+ public void testShouldMakeSureWebappIsWorking() throws Exception {
+ WebClient webClient = new WebClient();
+ HtmlPage page = webClient.getPage("http://localhost:9999/moviefun/setup.jsp");
+
+ assertMoviesPresent(page);
+
+ page = webClient.getPage("http://localhost:9999/moviefun/faces/movie/List.xhtml");
+
+ assertMoviesPresent(page);
+ webClient.closeAllWindows();
+ }
+
+ private void assertMoviesPresent(HtmlPage page) {
+ String pageAsText = page.asText();
+ assertTrue(pageAsText.contains("Wedding Crashers"));
+ assertTrue(pageAsText.contains("Starsky & Hutch"));
+ assertTrue(pageAsText.contains("Shanghai Knights"));
+ assertTrue(pageAsText.contains("I-Spy"));
+ assertTrue(pageAsText.contains("The Royal Tenenbaums"));
+ assertTrue(pageAsText.contains("Zoolander"));
+ assertTrue(pageAsText.contains("Shanghai Noon"));
+ }
+
+ private void clickOnLink(HtmlPage page, String lookFor) throws Exception {
+ DomNodeList<HtmlElement> links = page.getElementsByTagName("a");
+ Iterator<HtmlElement> iterator = links.iterator();
+ while (iterator.hasNext()) {
+ HtmlAnchor anchor = (HtmlAnchor) iterator.next();
+
+ if (lookFor.equals(anchor.getTextContent())) {
+ anchor.click();
+ break;
+ }
+ }
+ }
+
+}
Modified: openejb/trunk/openejb3/examples/webapps/moviefun/monitor/pom.xml
URL: http://svn.apache.org/viewvc/openejb/trunk/openejb3/examples/webapps/moviefun/monitor/pom.xml?rev=1086013&r1=1086012&r2=1086013&view=diff
==============================================================================
--- openejb/trunk/openejb3/examples/webapps/moviefun/monitor/pom.xml (original)
+++ openejb/trunk/openejb3/examples/webapps/moviefun/monitor/pom.xml Sun Mar 27 20:07:33 2011
@@ -27,6 +27,12 @@
<name>OpenEJB :: Web Examples :: Moviefun :: Monitor</name>
<dependencies>
<dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ <version>4.8.1</version>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
<groupId>org.apache.openejb</groupId>
<artifactId>javaee-api</artifactId>
<version>6.0-SNAPSHOT</version>
@@ -242,18 +248,13 @@
<build>
<defaultGoal>install</defaultGoal>
- <pluginManagement>
- <plugins>
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-surefire-plugin</artifactId>
- <version>2.2</version>
- </plugin>
- </plugins>
- </pluginManagement>
-
<plugins>
<plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-surefire-plugin</artifactId>
+ <version>2.6</version>
+ </plugin>
+ <plugin>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<source>1.6</source>
Added: openejb/trunk/openejb3/examples/webapps/moviefun/monitor/src/main/resources/movie.png
URL: http://svn.apache.org/viewvc/openejb/trunk/openejb3/examples/webapps/moviefun/monitor/src/main/resources/movie.png?rev=1086013&view=auto
==============================================================================
Binary file - no diff available.
Propchange: openejb/trunk/openejb3/examples/webapps/moviefun/monitor/src/main/resources/movie.png
------------------------------------------------------------------------------
svn:mime-type = application/octet-stream