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 2012/11/24 23:18:16 UTC

svn commit: r1413278 [4/4] - in /openejb/trunk/openejb/examples: ./ moviefun/ moviefun/src/ moviefun/src/main/ moviefun/src/main/java/ moviefun/src/main/java/org/ moviefun/src/main/java/org/superbiz/ moviefun/src/main/java/org/superbiz/moviefun/ movief...

Added: openejb/trunk/openejb/examples/moviefun/src/main/webapp/default.css
URL: http://svn.apache.org/viewvc/openejb/trunk/openejb/examples/moviefun/src/main/webapp/default.css?rev=1413278&view=auto
==============================================================================
--- openejb/trunk/openejb/examples/moviefun/src/main/webapp/default.css (added)
+++ openejb/trunk/openejb/examples/moviefun/src/main/webapp/default.css Sat Nov 24 22:18:13 2012
@@ -0,0 +1,207 @@
+/*
+ *  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.
+ *
+ */
+body, p, td, table, tr, .bodytext, .stepfield {
+  font-family: Verdana, arial, sans-serif;
+  font-size: 11px;
+  line-height: 16px;
+  color: #000000;
+  font-weight: normal;
+}
+
+body {
+  margin: 0px;
+  padding: 0px;
+  text-align: center;
+  background-color: #f0f0f0;
+}
+
+#Content {
+  text-align: left;
+  background-color: #fff;
+  padding: 0px;
+  margin: 0px;
+}
+
+HR {
+  color: 3 c78b5;
+  height: 1;
+}
+
+A:link, A:visited, A:active, A:hover {
+  color: #003366;
+}
+
+h1 A:link, h1 A:visited, h1 A:active {
+  text-decoration: none;
+}
+
+h1 A:hover {
+  border-bottom: 1px dotted #003366;
+}
+
+input {
+  font-family: verdana, geneva, arial, sans-serif;
+  font-size: 11px;
+  color: #000000;
+}
+
+h1 {
+  font-size: 24px;
+  line-height: normal;
+  font-weight: bold;
+  background-color: #f0f0f0;
+  color: #003366;
+  border-bottom: 1px solid #3c78b5;
+  padding: 2px;
+  margin: 36px 0px 4px 0px;
+}
+
+h2 {
+  font-size: 18px;
+  line-height: normal;
+  font-weight: bold;
+  background-color: #f0f0f0;
+  border-bottom: 1px solid #3c78b5;
+  padding: 2px;
+  margin: 27px 0px 4px 0px;
+}
+
+h3 {
+  font-size: 14px;
+  line-height: normal;
+  font-weight: bold;
+  background-color: #f0f0f0;
+  padding: 2px;
+  margin: 21px 0px 4px 0px;
+}
+
+h4 {
+  font-size: 12px;
+  line-height: normal;
+  font-weight: bold;
+  background-color: #f0f0f0;
+  padding: 2px;
+  margin: 18px 0px 4px 0px;
+}
+
+h4.search {
+  font-size: 12px;
+  line-height: normal;
+  font-weight: normal;
+  background-color: #f0f0f0;
+  padding: 4px;
+  margin: 18px 0px 4px 0px;
+}
+
+h5 {
+  font-size: 10px;
+  line-height: normal;
+  font-weight: bold;
+  background-color: #f0f0f0;
+  padding: 2px;
+  margin: 14px 0px 4px 0px;
+}
+
+h6 {
+  font-size: 8px;
+  line-height: normal;
+  font-weight: bold;
+  background-color: #f0f0f0;
+  padding: 2px;
+  margin: 14px 0px 4px 0px;
+}
+
+.smalltext {
+  color: #666666;
+  font-size: 10px;
+}
+
+.smalltext a {
+  color: #666666;
+}
+
+.tableview table {
+  margin: 0;
+}
+
+.tableview th {
+  text-align: left;
+  color: #003366;
+  font-size: 12px;
+  padding: 5px 0px 0px 5px;
+  border-bottom: 2px solid #3c78b5;
+}
+
+.tableview td {
+  text-align: left;
+  border-color: #ccc;
+  border-width: 0px 0px 1px 0px;
+  border-style: solid;
+  margin: 0;
+  padding: 4px 10px 4px 5px;
+}
+
+.bottomshadow {
+  height: 12px;
+  background-image: url("/images/border/border_bottom.gif");
+  background-repeat: repeat-x;
+}
+
+.topBarDiv a:link {
+  color: white;
+}
+
+.topBarDiv a:visited {
+  color: white;
+}
+
+.topBarDiv a:active {
+  color: white;
+}
+
+.topBarDiv a:hover {
+  color: white;
+}
+
+.topBarDiv {
+  color: white;
+}
+
+.topBar td {
+  background-color: #003366;
+}
+
+.basicPanelContainer {
+  border: 1px solid #3c78b5;
+  margin-top: 2px;
+  margin-bottom: 8px;
+  width: 100%
+}
+
+.basicPanelTitle {
+  padding: 5px;
+  margin: 0px;
+  background-color: #f0f0f0;
+  color: black;
+  font-weight: bold;
+}
+
+.basicPanelBody {
+  padding: 5px;
+  margin: 0px
+}

Added: openejb/trunk/openejb/examples/moviefun/src/main/webapp/index.jsp
URL: http://svn.apache.org/viewvc/openejb/trunk/openejb/examples/moviefun/src/main/webapp/index.jsp?rev=1413278&view=auto
==============================================================================
--- openejb/trunk/openejb/examples/moviefun/src/main/webapp/index.jsp (added)
+++ openejb/trunk/openejb/examples/moviefun/src/main/webapp/index.jsp Sat Nov 24 22:18:13 2012
@@ -0,0 +1,75 @@
+<%--
+    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.
+--%>
+
+<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
+<%@ taglib uri="http://java.sun.com/jsp/jstl/fmt" prefix="fmt" %>
+<%@ taglib uri="http://java.sun.com/jsp/jstl/functions" prefix="fn" %>
+<c:set var="language" value="${pageContext.request.locale}" />
+<fmt:setLocale value="${language}" />
+
+<!DOCTYPE html>
+<html lang="${language}">
+<head>
+<meta charset="utf-8">
+<title>Moviefun</title>
+<meta name="viewport" content="width=device-width, initial-scale=1.0">
+<meta name="description" content="">
+<meta name="author" content="">
+
+<!-- Le styles -->
+<link href="assets/css/bootstrap.css" rel="stylesheet">
+<link href="assets/css/movie.css" rel="stylesheet">
+<style>
+body {
+	padding-top: 60px;
+	/* 60px to make the container go all the way to the bottom of the topbar */
+}
+</style>
+<link href="assets/css/bootstrap-responsive.css" rel="stylesheet">
+
+<!-- Le HTML5 shim, for IE6-8 support of HTML5 elements -->
+<!--[if lt IE 9]>
+      <script src="http://html5shim.googlecode.com/svn/trunk/html5.js"></script>
+    <![endif]-->
+</head>
+
+<body>
+
+	<div class="navbar navbar-inverse navbar-fixed-top">
+		<div class="navbar-inner">
+			<div class="container">
+				<a class="btn btn-navbar" data-toggle="collapse"
+					data-target=".nav-collapse"> <span class="icon-bar"></span> <span
+					class="icon-bar"></span> <span class="icon-bar"></span>
+				</a> <a class="brand" href="#">Moviefun</a>
+				<!--/.nav-collapse -->
+			</div>
+		</div>
+	</div>
+
+	<div class="container">
+
+		<h1>Moviefun</h1>
+		
+		<p>Please select one of the following links:</p>
+		<a href="setup.jsp">Setup</a> - Sets up the application with some sample data<br />
+		<a href="moviefun">Index</a> - Start the application<br />
+
+	</div>
+	<!-- /container -->
+</body>
+</html>

Added: openejb/trunk/openejb/examples/moviefun/src/main/webapp/setup.jsp
URL: http://svn.apache.org/viewvc/openejb/trunk/openejb/examples/moviefun/src/main/webapp/setup.jsp?rev=1413278&view=auto
==============================================================================
--- openejb/trunk/openejb/examples/moviefun/src/main/webapp/setup.jsp (added)
+++ openejb/trunk/openejb/examples/moviefun/src/main/webapp/setup.jsp Sat Nov 24 22:18:13 2012
@@ -0,0 +1,115 @@
+<%--
+    Licensed to the Apache Software Foundation (ASF) under one or more
+    contributor license agreements.  See the NOTICE file distributed with
+    this work for additional information regarding copyright ownership.
+    The ASF licenses this file to You under the Apache License, Version 2.0
+    (the "License"); you may not use this file except in compliance with
+    the License.  You may obtain a copy of the License at
+
+       http://www.apache.org/licenses/LICENSE-2.0
+
+    Unless required by applicable law or agreed to in writing, software
+    distributed under the License is distributed on an "AS IS" BASIS,
+    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+    See the License for the specific language governing permissions and
+    limitations under the License.
+--%>
+<%@ page import=" org.superbiz.moviefun.Movie" %>
+<%@ page import="org.superbiz.moviefun.MoviesBean" %>
+<%@ page import="javax.naming.InitialContext" %>
+<%@ page import="java.util.List" %>
+<%@ page import="java.util.Iterator" %>
+<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
+<%@ taglib uri="http://java.sun.com/jsp/jstl/fmt" prefix="fmt" %>
+<%@ taglib uri="http://java.sun.com/jsp/jstl/functions" prefix="fn" %>
+<%
+	InitialContext initialContext = new InitialContext();
+    MoviesBean moviesBean = (MoviesBean) initialContext.lookup("java:comp/env/org.superbiz.moviefun.ActionServlet/moviesBean");
+
+    moviesBean.addMovie(new Movie("Wedding Crashers", "David Dobkin", "Comedy", 7, 2005));
+    moviesBean.addMovie(new Movie("Starsky & Hutch", "Todd Phillips", "Action", 6, 2004));
+    moviesBean.addMovie(new Movie("Shanghai Knights", "David Dobkin", "Action", 6, 2003));
+    moviesBean.addMovie(new Movie("I-Spy", "Betty Thomas", "Adventure", 5, 2002));
+    moviesBean.addMovie(new Movie("The Royal Tenenbaums", "Wes Anderson", "Comedy", 8, 2001));
+    moviesBean.addMovie(new Movie("Zoolander", "Ben Stiller", "Comedy", 6, 2001));
+    moviesBean.addMovie(new Movie("Shanghai Noon", "Tom Dey", "Comedy", 7, 2000));
+%>
+<c:set var="language" value="${pageContext.request.locale}" />
+<fmt:setLocale value="${language}" />
+
+<!DOCTYPE html>
+<html lang="${language}">
+<head>
+<meta charset="utf-8">
+<title>Moviefun</title>
+<meta name="viewport" content="width=device-width, initial-scale=1.0">
+<meta name="description" content="">
+<meta name="author" content="">
+
+<!-- Le styles -->
+<link href="assets/css/bootstrap.css" rel="stylesheet">
+<link href="assets/css/movie.css" rel="stylesheet">
+<style>
+body {
+	padding-top: 60px;
+	/* 60px to make the container go all the way to the bottom of the topbar */
+}
+</style>
+<link href="assets/css/bootstrap-responsive.css" rel="stylesheet">
+
+<!-- Le HTML5 shim, for IE6-8 support of HTML5 elements -->
+<!--[if lt IE 9]>
+      <script src="http://html5shim.googlecode.com/svn/trunk/html5.js"></script>
+    <![endif]-->
+</head>
+
+<body>
+
+	<div class="navbar navbar-inverse navbar-fixed-top">
+		<div class="navbar-inner">
+			<div class="container">
+				<a class="btn btn-navbar" data-toggle="collapse"
+					data-target=".nav-collapse"> <span class="icon-bar"></span> <span
+					class="icon-bar"></span> <span class="icon-bar"></span>
+				</a> <a class="brand" href="#">Moviefun</a>
+				<!--/.nav-collapse -->
+			</div>
+		</div>
+	</div>
+
+	<div class="container">
+
+		<h1>Moviefun</h1>
+		
+<h2>Seeded Database with the Following movies</h2>
+<table width="500">
+    <tr>
+        <td><b>Title</b></td>
+        <td><b>Director</b></td>
+        <td><b>Genre</b></td>
+    </tr>
+    <%
+        List<Movie> movies = moviesBean.getMovies();
+        for (Iterator<Movie> iterator = movies.iterator(); iterator.hasNext();) {
+            Movie movie = (Movie) iterator.next();
+    %>
+    <tr>
+        <td><%=movie.getTitle()%>
+        </td>
+        <td><%=movie.getDirector()%>
+        </td>
+        <td><%=movie.getGenre()%>
+        </td>
+    </tr>
+
+    <%
+        }
+    %>
+</table>
+
+<h2>Continue</h2>
+<a href="moviefun">Go to main app</a>
+	</div>
+	<!-- /container -->
+</body>
+</html>

Added: openejb/trunk/openejb/examples/moviefun/src/test/java/org/superbiz/moviefun/MoviesArquillianHtmlUnitTest.java
URL: http://svn.apache.org/viewvc/openejb/trunk/openejb/examples/moviefun/src/test/java/org/superbiz/moviefun/MoviesArquillianHtmlUnitTest.java?rev=1413278&view=auto
==============================================================================
--- openejb/trunk/openejb/examples/moviefun/src/test/java/org/superbiz/moviefun/MoviesArquillianHtmlUnitTest.java (added)
+++ openejb/trunk/openejb/examples/moviefun/src/test/java/org/superbiz/moviefun/MoviesArquillianHtmlUnitTest.java Sat Nov 24 22:18:13 2012
@@ -0,0 +1,106 @@
+/**
+ * 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.io.File;
+import java.net.URL;
+import java.util.Arrays;
+import java.util.Collection;
+
+import javax.ejb.EJB;
+
+import org.jboss.arquillian.container.test.api.Deployment;
+import org.jboss.arquillian.junit.Arquillian;
+import org.jboss.arquillian.test.api.ArquillianResource;
+import org.jboss.shrinkwrap.api.Filters;
+import org.jboss.shrinkwrap.api.GenericArchive;
+import org.jboss.shrinkwrap.api.ShrinkWrap;
+import org.jboss.shrinkwrap.api.asset.ClassLoaderAsset;
+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.After;
+import org.junit.Before;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+
+import com.gargoylesoftware.htmlunit.WebClient;
+import com.gargoylesoftware.htmlunit.html.HtmlPage;
+
+@RunWith(Arquillian.class)
+public class MoviesArquillianHtmlUnitTest {
+	private static final String WEBAPP_SRC = "src/main/webapp";
+
+	@Deployment public static WebArchive createDeployment() {
+		
+		Collection<String> dependencies = Arrays.asList(new String[] {
+				"javax.servlet:jstl",
+				"taglibs:standard",
+				"commons-lang:commons-lang"
+		});
+		
+		File[] libs = Maven.resolver()
+                .loadPomFromFile("pom.xml").resolve(dependencies)
+                .withTransitivity().asFile(); 
+		
+		WebArchive war = ShrinkWrap.create(WebArchive.class, "test.war")
+                .addClasses(Movie.class, MoviesBean.class, MoviesArquillianHtmlUnitTest.class, ActionServlet.class)
+                .addAsResource(new ClassLoaderAsset("META-INF/ejb-jar.xml"), "META-INF/ejb-jar.xml")
+                .addAsResource(new ClassLoaderAsset("META-INF/persistence.xml"), "META-INF/persistence.xml")
+				.addAsLibraries(libs);
+		
+		war.merge(ShrinkWrap.create(GenericArchive.class).as(ExplodedImporter.class)
+			    .importDirectory(WEBAPP_SRC).as(GenericArchive.class),
+			    "/", Filters.includeAll());
+		
+		return war;
+	}
+
+	@EJB private MoviesBean movies;
+	
+	@ArquillianResource
+	private URL deploymentUrl;
+
+    @Before @After public void clean() {
+        movies.clean();
+    }
+
+    @Test
+	public void testShouldMakeSureWebappIsWorking() throws Exception {
+		WebClient webClient = new WebClient();
+		HtmlPage page = webClient.getPage(deploymentUrl + "/setup.jsp");
+
+		assertMoviesPresent(page);
+
+		page = webClient.getPage(deploymentUrl + "/moviefun");
+
+		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"));
+	}
+
+}

Added: openejb/trunk/openejb/examples/moviefun/src/test/java/org/superbiz/moviefun/MoviesEJBTest.java
URL: http://svn.apache.org/viewvc/openejb/trunk/openejb/examples/moviefun/src/test/java/org/superbiz/moviefun/MoviesEJBTest.java?rev=1413278&view=auto
==============================================================================
--- openejb/trunk/openejb/examples/moviefun/src/test/java/org/superbiz/moviefun/MoviesEJBTest.java (added)
+++ openejb/trunk/openejb/examples/moviefun/src/test/java/org/superbiz/moviefun/MoviesEJBTest.java Sat Nov 24 22:18:13 2012
@@ -0,0 +1,73 @@
+/**
+ * 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.assertEquals;
+import static org.junit.Assert.assertNotNull;
+
+import java.util.List;
+
+import javax.ejb.EJB;
+
+import org.jboss.arquillian.container.test.api.Deployment;
+import org.jboss.arquillian.junit.Arquillian;
+import org.jboss.shrinkwrap.api.ShrinkWrap;
+import org.jboss.shrinkwrap.api.asset.ClassLoaderAsset;
+import org.jboss.shrinkwrap.api.spec.WebArchive;
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+
+@RunWith(Arquillian.class)
+public class MoviesEJBTest {
+	@Deployment public static WebArchive createDeployment() {
+		return ShrinkWrap.create(WebArchive.class, "test.war")
+                .addClasses(Movie.class, MoviesBean.class, MoviesEJBTest.class)
+                .addAsResource(new ClassLoaderAsset("META-INF/ejb-jar.xml"), "META-INF/ejb-jar.xml")
+                .addAsResource(new ClassLoaderAsset("META-INF/persistence.xml"), "META-INF/persistence.xml");
+	}
+
+	@EJB private MoviesBean movies;
+
+    @Before @After public void clean() {
+        movies.clean();
+    }
+
+	@Test public void shouldBeAbleToAddAMovie() throws Exception {
+		assertNotNull("Verify that the ejb was injected", movies);
+
+		Movie movie = new Movie();
+		movie.setDirector("Michael Bay");
+		movie.setGenre("Action");
+		movie.setRating(9);
+		movie.setTitle("Bad Boys");
+		movie.setYear(1995);
+		movies.addMovie(movie);
+		
+		assertEquals(1, movies.countAll());
+		List<Movie> moviesFound = movies.findRange("title", "Bad Boys", 0, 5);
+		
+		assertEquals(1, moviesFound.size());
+		assertEquals("Michael Bay", moviesFound.get(0).getDirector());
+		assertEquals("Action", moviesFound.get(0).getGenre());
+		assertEquals(9, moviesFound.get(0).getRating());
+		assertEquals("Bad Boys", moviesFound.get(0).getTitle());
+		assertEquals(1995, moviesFound.get(0).getYear());
+	}
+
+}

Added: openejb/trunk/openejb/examples/moviefun/src/test/java/org/superbiz/moviefun/MoviesEmbeddedEJBTest.java
URL: http://svn.apache.org/viewvc/openejb/trunk/openejb/examples/moviefun/src/test/java/org/superbiz/moviefun/MoviesEmbeddedEJBTest.java?rev=1413278&view=auto
==============================================================================
--- openejb/trunk/openejb/examples/moviefun/src/test/java/org/superbiz/moviefun/MoviesEmbeddedEJBTest.java (added)
+++ openejb/trunk/openejb/examples/moviefun/src/test/java/org/superbiz/moviefun/MoviesEmbeddedEJBTest.java Sat Nov 24 22:18:13 2012
@@ -0,0 +1,76 @@
+/**
+ * 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 java.util.List;
+
+import javax.ejb.embeddable.EJBContainer;
+
+import org.junit.After;
+import org.junit.AfterClass;
+import org.junit.Assert;
+import org.junit.Before;
+import org.junit.BeforeClass;
+import org.junit.Test;
+
+public class MoviesEmbeddedEJBTest {
+
+	private static EJBContainer ejbContainer;
+
+	@BeforeClass
+	public static void setUp() throws Exception {
+		ejbContainer = EJBContainer.createEJBContainer();
+	}
+
+	@AfterClass
+	public static void tearDown() {
+		if (ejbContainer != null) {
+			ejbContainer.close();
+		}
+	}
+
+	@Before
+	@After
+	public void clean() throws Exception {
+		MoviesBean movies = (MoviesBean) ejbContainer.getContext().lookup("java:global/moviefun/MoviesBean!org.superbiz.moviefun.MoviesBean");
+		movies.clean();
+	}
+
+	@Test
+	public void testShouldAddAMovie() throws Exception {
+		MoviesBean movies = (MoviesBean) ejbContainer.getContext().lookup("java:global/moviefun/MoviesBean!org.superbiz.moviefun.MoviesBean");
+		
+		Movie movie = new Movie();
+		movie.setDirector("Michael Bay");
+		movie.setGenre("Action");
+		movie.setRating(9);
+		movie.setTitle("Bad Boys");
+		movie.setYear(1995);
+		movies.addMovie(movie);
+
+		Assert.assertEquals(1, movies.countAll());
+		List<Movie> moviesFound = movies.findRange("title", "Bad Boys", 0, 10);
+
+		Assert.assertEquals(1, moviesFound.size());
+		Assert.assertEquals("Michael Bay", moviesFound.get(0).getDirector());
+		Assert.assertEquals("Action", moviesFound.get(0).getGenre());
+		Assert.assertEquals(9, moviesFound.get(0).getRating());
+		Assert.assertEquals("Bad Boys", moviesFound.get(0).getTitle());
+		Assert.assertEquals(1995, moviesFound.get(0).getYear());
+	}
+
+}
\ No newline at end of file

Added: openejb/trunk/openejb/examples/moviefun/src/test/java/org/superbiz/moviefun/MoviesHtmlUnitTest.java
URL: http://svn.apache.org/viewvc/openejb/trunk/openejb/examples/moviefun/src/test/java/org/superbiz/moviefun/MoviesHtmlUnitTest.java?rev=1413278&view=auto
==============================================================================
--- openejb/trunk/openejb/examples/moviefun/src/test/java/org/superbiz/moviefun/MoviesHtmlUnitTest.java (added)
+++ openejb/trunk/openejb/examples/moviefun/src/test/java/org/superbiz/moviefun/MoviesHtmlUnitTest.java Sat Nov 24 22:18:13 2012
@@ -0,0 +1,108 @@
+/**
+ * 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.io.File;
+import java.io.IOException;
+import java.net.ServerSocket;
+import java.util.Properties;
+
+import javax.ejb.embeddable.EJBContainer;
+
+import org.apache.commons.io.FileUtils;
+import org.apache.tomee.embedded.EmbeddedTomEEContainer;
+import org.junit.AfterClass;
+import org.junit.BeforeClass;
+import org.junit.Test;
+
+import com.gargoylesoftware.htmlunit.WebClient;
+import com.gargoylesoftware.htmlunit.html.HtmlPage;
+
+public class MoviesHtmlUnitTest {
+
+	private static EJBContainer container;
+	private static File webApp;
+	private static int port;
+
+	@BeforeClass
+	public static void start() throws IOException {
+		
+		// get a random unused port to use for http requests
+		ServerSocket server = new ServerSocket(0);
+		port = server.getLocalPort();
+		server.close();
+		
+		webApp = createWebApp();
+		Properties p = new Properties();
+		p.setProperty(EJBContainer.APP_NAME, "moviefun");
+		p.setProperty(EJBContainer.PROVIDER, "tomee-embedded"); // need web feature
+		p.setProperty(EJBContainer.MODULES, webApp.getAbsolutePath());
+		p.setProperty(EmbeddedTomEEContainer.TOMEE_EJBCONTAINER_HTTP_PORT, String.valueOf(port));
+		container = EJBContainer.createEJBContainer(p);
+	}
+
+	@AfterClass
+	public static void stop() {
+		if (container != null) {
+			container.close();
+		}
+		if (webApp != null) {
+			try {
+				FileUtils.forceDelete(webApp);
+			} catch (IOException e) {
+				FileUtils.deleteQuietly(webApp);
+			}
+		}
+	}
+
+	private static File createWebApp() throws IOException {
+		File file = new File(System.getProperty("java.io.tmpdir") + "/tomee-" + Math.random());
+		if (!file.mkdirs() && !file.exists()) {
+			throw new RuntimeException("can't create " + file.getAbsolutePath());
+		}
+
+		FileUtils.copyDirectory(new File("target/classes"), new File(file, "WEB-INF/classes"));
+	    FileUtils.copyDirectory(new File("target/test-libs"), new File(file, "WEB-INF/lib"));
+		FileUtils.copyDirectory(new File("src/main/webapp"), file);
+
+		return file;
+	}
+
+	@Test
+	public void testShouldMakeSureWebappIsWorking() throws Exception {
+		WebClient webClient = new WebClient();
+		HtmlPage page = webClient.getPage("http://localhost:" + port + "/moviefun/setup.jsp");
+
+		assertMoviesPresent(page);
+
+		page = webClient.getPage("http://localhost:" + port + "/moviefun/moviefun");
+
+		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"));
+	}
+}

Added: openejb/trunk/openejb/examples/moviefun/src/test/java/org/superbiz/moviefun/MoviesTest.java
URL: http://svn.apache.org/viewvc/openejb/trunk/openejb/examples/moviefun/src/test/java/org/superbiz/moviefun/MoviesTest.java?rev=1413278&view=auto
==============================================================================
--- openejb/trunk/openejb/examples/moviefun/src/test/java/org/superbiz/moviefun/MoviesTest.java (added)
+++ openejb/trunk/openejb/examples/moviefun/src/test/java/org/superbiz/moviefun/MoviesTest.java Sat Nov 24 22:18:13 2012
@@ -0,0 +1,76 @@
+/**
+ * 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 java.util.List;
+
+import javax.ejb.embeddable.EJBContainer;
+
+import org.junit.After;
+import org.junit.AfterClass;
+import org.junit.Assert;
+import org.junit.Before;
+import org.junit.BeforeClass;
+import org.junit.Test;
+
+public class MoviesTest {
+
+	private static EJBContainer ejbContainer;
+
+	@BeforeClass
+	public static void setUp() throws Exception {
+		ejbContainer = EJBContainer.createEJBContainer();
+	}
+
+	@AfterClass
+	public static void tearDown() {
+		if (ejbContainer != null) {
+			ejbContainer.close();
+		}
+	}
+
+	@Before
+	@After
+	public void clean() throws Exception {
+		MoviesBean movies = (MoviesBean) ejbContainer.getContext().lookup("java:global/moviefun/MoviesBean!org.superbiz.moviefun.MoviesBean");
+		movies.clean();
+	}
+
+	@Test
+	public void testShouldAddAMovie() throws Exception {
+		MoviesBean movies = (MoviesBean) ejbContainer.getContext().lookup("java:global/moviefun/MoviesBean!org.superbiz.moviefun.MoviesBean");
+		
+		Movie movie = new Movie();
+		movie.setDirector("Michael Bay");
+		movie.setGenre("Action");
+		movie.setRating(9);
+		movie.setTitle("Bad Boys");
+		movie.setYear(1995);
+		movies.addMovie(movie);
+
+		Assert.assertEquals(1, movies.countAll());
+		List<Movie> moviesFound = movies.findRange("title", "Bad Boys", 0, 10);
+
+		Assert.assertEquals(1, moviesFound.size());
+		Assert.assertEquals("Michael Bay", moviesFound.get(0).getDirector());
+		Assert.assertEquals("Action", moviesFound.get(0).getGenre());
+		Assert.assertEquals(9, moviesFound.get(0).getRating());
+		Assert.assertEquals("Bad Boys", moviesFound.get(0).getTitle());
+		Assert.assertEquals(1995, moviesFound.get(0).getYear());
+	}
+
+}
\ No newline at end of file

Added: openejb/trunk/openejb/examples/moviefun/src/test/resources/META-INF/application-client.xml
URL: http://svn.apache.org/viewvc/openejb/trunk/openejb/examples/moviefun/src/test/resources/META-INF/application-client.xml?rev=1413278&view=auto
==============================================================================
--- openejb/trunk/openejb/examples/moviefun/src/test/resources/META-INF/application-client.xml (added)
+++ openejb/trunk/openejb/examples/moviefun/src/test/resources/META-INF/application-client.xml Sat Nov 24 22:18:13 2012
@@ -0,0 +1 @@
+<application-client/>
\ No newline at end of file

Added: openejb/trunk/openejb/examples/moviefun/src/test/resources/arquillian.xml
URL: http://svn.apache.org/viewvc/openejb/trunk/openejb/examples/moviefun/src/test/resources/arquillian.xml?rev=1413278&view=auto
==============================================================================
--- openejb/trunk/openejb/examples/moviefun/src/test/resources/arquillian.xml (added)
+++ openejb/trunk/openejb/examples/moviefun/src/test/resources/arquillian.xml Sat Nov 24 22:18:13 2012
@@ -0,0 +1,33 @@
+<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
+<!--
+
+    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:xsi="http://www.w3.org/2001/XMLSchema-instance" 
+	xsi:schemaLocation="http://jboss.org/schema/arquillian http://jboss.org/schema/arquillian/arquillian_1_0.xsd">
+	
+       <container qualifier="tomee" default="true">
+           <configuration>
+               <property name="httpPort">9080</property>
+               <property name="stopPort">9005</property>
+               <property name="tomcatVersion"></property>
+               <property name="openejbVersion">${tomee.version}</property>
+               <property name="dir">target/apache-tomee-remote</property>
+               <property name="appWorkingDir">target/arquillian-test-working-dir</property>
+           </configuration>
+       </container>
+</arquillian>
\ No newline at end of file

Modified: openejb/trunk/openejb/examples/pom.xml
URL: http://svn.apache.org/viewvc/openejb/trunk/openejb/examples/pom.xml?rev=1413278&r1=1413277&r2=1413278&view=diff
==============================================================================
--- openejb/trunk/openejb/examples/pom.xml (original)
+++ openejb/trunk/openejb/examples/pom.xml Sat Nov 24 22:18:13 2012
@@ -147,6 +147,7 @@
     <module>webservice-ws-with-resources-config</module>
     <module>webservice-handlerchain</module>
     <module>webservice-holder</module>
+    <module>moviefun</module>
   </modules>
   <profiles>
     <profile>