tomee-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jgallim...@apache.org
Subject svn commit: r1195726 - in /openejb/trunk/openejb/arquillian-tomee/arquillian-tomee-moviefun-example: ./ src/main/java/org/superbiz/moviefun/ src/main/java/org/superbiz/moviefun/setup/ src/main/webapp/ src/main/webapp/WEB-INF/ src/test/java/org/superbiz...
Date Tue, 01 Nov 2011 00:04:49 GMT
Author: jgallimore
Date: Tue Nov  1 00:00:25 2011
New Revision: 1195726

URL: http://svn.apache.org/viewvc?rev=1195726&view=rev
Log:
Adding some CDI functionality to the example

Added:
    openejb/trunk/openejb/arquillian-tomee/arquillian-tomee-moviefun-example/src/main/java/org/superbiz/moviefun/SetupServlet.java
    openejb/trunk/openejb/arquillian-tomee/arquillian-tomee-moviefun-example/src/main/java/org/superbiz/moviefun/setup/
    openejb/trunk/openejb/arquillian-tomee/arquillian-tomee-moviefun-example/src/main/java/org/superbiz/moviefun/setup/ExampleDataProducer.java
    openejb/trunk/openejb/arquillian-tomee/arquillian-tomee-moviefun-example/src/main/java/org/superbiz/moviefun/setup/Examples.java
    openejb/trunk/openejb/arquillian-tomee/arquillian-tomee-moviefun-example/src/main/java/org/superbiz/moviefun/setup/Setup.java
    openejb/trunk/openejb/arquillian-tomee/arquillian-tomee-moviefun-example/src/main/webapp/WEB-INF/beans.xml
    openejb/trunk/openejb/arquillian-tomee/arquillian-tomee-moviefun-example/src/main/webapp/WEB-INF/setup.jsp
    openejb/trunk/openejb/arquillian-tomee/arquillian-tomee-moviefun-example/src/test/java/org/superbiz/moviefun/EJBClient.java
Modified:
    openejb/trunk/openejb/arquillian-tomee/arquillian-tomee-moviefun-example/pom.xml
    openejb/trunk/openejb/arquillian-tomee/arquillian-tomee-moviefun-example/src/main/webapp/WEB-INF/web.xml
    openejb/trunk/openejb/arquillian-tomee/arquillian-tomee-moviefun-example/src/main/webapp/index.jsp
    openejb/trunk/openejb/arquillian-tomee/arquillian-tomee-moviefun-example/src/main/webapp/setup.jsp
    openejb/trunk/openejb/arquillian-tomee/arquillian-tomee-moviefun-example/src/test/java/org/superbiz/moviefun/MoviesEJBTest.java
    openejb/trunk/openejb/arquillian-tomee/arquillian-tomee-moviefun-example/src/test/java/org/superbiz/moviefun/MoviesHtmlUnitTest.java
    openejb/trunk/openejb/arquillian-tomee/arquillian-tomee-moviefun-example/src/test/java/org/superbiz/moviefun/MoviesSeleniumTest.java
    openejb/trunk/openejb/arquillian-tomee/arquillian-tomee-moviefun-example/src/test/java/org/superbiz/moviefun/MoviesTest.java
    openejb/trunk/openejb/arquillian-tomee/arquillian-tomee-moviefun-example/src/test/resources/arquillian.xml

Modified: openejb/trunk/openejb/arquillian-tomee/arquillian-tomee-moviefun-example/pom.xml
URL: http://svn.apache.org/viewvc/openejb/trunk/openejb/arquillian-tomee/arquillian-tomee-moviefun-example/pom.xml?rev=1195726&r1=1195725&r2=1195726&view=diff
==============================================================================
--- openejb/trunk/openejb/arquillian-tomee/arquillian-tomee-moviefun-example/pom.xml (original)
+++ openejb/trunk/openejb/arquillian-tomee/arquillian-tomee-moviefun-example/pom.xml Tue Nov
 1 00:00:25 2011
@@ -200,7 +200,7 @@
     	<artifactId>tomee-embedded</artifactId>
     	<version>1.0.0-beta-2-SNAPSHOT</version>
     	<type>jar</type>
-      <classifier>uber</classifier>
+      <!--<classifier>uber</classifier>-->
     	<scope>test</scope>
     </dependency>
     <dependency>

Added: openejb/trunk/openejb/arquillian-tomee/arquillian-tomee-moviefun-example/src/main/java/org/superbiz/moviefun/SetupServlet.java
URL: http://svn.apache.org/viewvc/openejb/trunk/openejb/arquillian-tomee/arquillian-tomee-moviefun-example/src/main/java/org/superbiz/moviefun/SetupServlet.java?rev=1195726&view=auto
==============================================================================
--- openejb/trunk/openejb/arquillian-tomee/arquillian-tomee-moviefun-example/src/main/java/org/superbiz/moviefun/SetupServlet.java
(added)
+++ openejb/trunk/openejb/arquillian-tomee/arquillian-tomee-moviefun-example/src/main/java/org/superbiz/moviefun/SetupServlet.java
Tue Nov  1 00:00:25 2011
@@ -0,0 +1,56 @@
+/**
+ * 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.io.IOException;
+import java.util.List;
+
+import javax.inject.Inject;
+import javax.servlet.ServletException;
+import javax.servlet.http.HttpServlet;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+
+import org.superbiz.moviefun.setup.Setup;
+
+/**
+ * Servlet implementation class SetupServlet
+ */
+public class SetupServlet extends HttpServlet {
+	
+	@Inject private Setup setup;
+	
+	private static final long serialVersionUID = 1L;
+       
+    /**
+     * @see HttpServlet#HttpServlet()
+     */
+    public SetupServlet() {
+        super();
+        // TODO Auto-generated constructor stub
+    }
+
+	/**
+	 * @see HttpServlet#doGet(HttpServletRequest request, HttpServletResponse response)
+	 */
+	protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException,
IOException {
+		List<Movie> addedMovies = setup.setup();
+		request.setAttribute("movies", addedMovies);
+		request.getRequestDispatcher("WEB-INF/setup.jsp").forward(request, response);
+	}
+
+}

Added: openejb/trunk/openejb/arquillian-tomee/arquillian-tomee-moviefun-example/src/main/java/org/superbiz/moviefun/setup/ExampleDataProducer.java
URL: http://svn.apache.org/viewvc/openejb/trunk/openejb/arquillian-tomee/arquillian-tomee-moviefun-example/src/main/java/org/superbiz/moviefun/setup/ExampleDataProducer.java?rev=1195726&view=auto
==============================================================================
--- openejb/trunk/openejb/arquillian-tomee/arquillian-tomee-moviefun-example/src/main/java/org/superbiz/moviefun/setup/ExampleDataProducer.java
(added)
+++ openejb/trunk/openejb/arquillian-tomee/arquillian-tomee-moviefun-example/src/main/java/org/superbiz/moviefun/setup/ExampleDataProducer.java
Tue Nov  1 00:00:25 2011
@@ -0,0 +1,42 @@
+/**
+ * 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.setup;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import javax.enterprise.context.ApplicationScoped;
+import javax.enterprise.inject.Produces;
+
+import org.superbiz.moviefun.Movie;
+
+@ApplicationScoped
+public class ExampleDataProducer {
+	@Produces
+	@Examples 
+	public List<Movie> createSampleMovies() {
+		List<Movie> sampleMovies = new ArrayList<Movie>();
+		sampleMovies.add(new Movie("Wedding Crashers", "David Dobkin", "Comedy", 7, 2005));
+		sampleMovies.add(new Movie("Starsky & Hutch", "Todd Phillips", "Action", 6, 2004));
+		sampleMovies.add(new Movie("Shanghai Knights", "David Dobkin", "Action", 6, 2003));
+		sampleMovies.add(new Movie("I-Spy", "Betty Thomas", "Adventure", 5, 2002));
+		sampleMovies.add(new Movie("The Royal Tenenbaums", "Wes Anderson", "Comedy", 8, 2001));
+		sampleMovies.add(new Movie("Zoolander", "Ben Stiller", "Comedy", 6, 2001));
+		sampleMovies.add(new Movie("Shanghai Noon", "Tom Dey", "Comedy", 7, 2000));
+		return sampleMovies;
+	}
+}

Added: openejb/trunk/openejb/arquillian-tomee/arquillian-tomee-moviefun-example/src/main/java/org/superbiz/moviefun/setup/Examples.java
URL: http://svn.apache.org/viewvc/openejb/trunk/openejb/arquillian-tomee/arquillian-tomee-moviefun-example/src/main/java/org/superbiz/moviefun/setup/Examples.java?rev=1195726&view=auto
==============================================================================
--- openejb/trunk/openejb/arquillian-tomee/arquillian-tomee-moviefun-example/src/main/java/org/superbiz/moviefun/setup/Examples.java
(added)
+++ openejb/trunk/openejb/arquillian-tomee/arquillian-tomee-moviefun-example/src/main/java/org/superbiz/moviefun/setup/Examples.java
Tue Nov  1 00:00:25 2011
@@ -0,0 +1,30 @@
+/**
+ * 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.setup;
+
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+
+import javax.inject.Qualifier;
+
+@Qualifier
+@Retention(RetentionPolicy.RUNTIME)
+@Target({ ElementType.TYPE, ElementType.METHOD, ElementType.PARAMETER, ElementType.FIELD
})
+public @interface Examples {
+}

Added: openejb/trunk/openejb/arquillian-tomee/arquillian-tomee-moviefun-example/src/main/java/org/superbiz/moviefun/setup/Setup.java
URL: http://svn.apache.org/viewvc/openejb/trunk/openejb/arquillian-tomee/arquillian-tomee-moviefun-example/src/main/java/org/superbiz/moviefun/setup/Setup.java?rev=1195726&view=auto
==============================================================================
--- openejb/trunk/openejb/arquillian-tomee/arquillian-tomee-moviefun-example/src/main/java/org/superbiz/moviefun/setup/Setup.java
(added)
+++ openejb/trunk/openejb/arquillian-tomee/arquillian-tomee-moviefun-example/src/main/java/org/superbiz/moviefun/setup/Setup.java
Tue Nov  1 00:00:25 2011
@@ -0,0 +1,39 @@
+/**
+ * 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.setup;
+
+import java.util.List;
+
+import javax.ejb.EJB;
+import javax.inject.Inject;
+
+import org.superbiz.moviefun.Movie;
+import org.superbiz.moviefun.Movies;
+
+public class Setup {
+	
+	@Inject @Examples private List<Movie> exampleMovies;
+	@EJB private Movies moviesBean;
+	
+	public List<Movie> setup() {
+		for (Movie movie : exampleMovies) {
+			moviesBean.addMovie(movie);
+		}
+		
+		return exampleMovies;
+	}
+}

Added: openejb/trunk/openejb/arquillian-tomee/arquillian-tomee-moviefun-example/src/main/webapp/WEB-INF/beans.xml
URL: http://svn.apache.org/viewvc/openejb/trunk/openejb/arquillian-tomee/arquillian-tomee-moviefun-example/src/main/webapp/WEB-INF/beans.xml?rev=1195726&view=auto
==============================================================================
    (empty)

Added: openejb/trunk/openejb/arquillian-tomee/arquillian-tomee-moviefun-example/src/main/webapp/WEB-INF/setup.jsp
URL: http://svn.apache.org/viewvc/openejb/trunk/openejb/arquillian-tomee/arquillian-tomee-moviefun-example/src/main/webapp/WEB-INF/setup.jsp?rev=1195726&view=auto
==============================================================================
--- openejb/trunk/openejb/arquillian-tomee/arquillian-tomee-moviefun-example/src/main/webapp/WEB-INF/setup.jsp
(added)
+++ openejb/trunk/openejb/arquillian-tomee/arquillian-tomee-moviefun-example/src/main/webapp/WEB-INF/setup.jsp
Tue Nov  1 00:00:25 2011
@@ -0,0 +1,43 @@
+<%--
+    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/functions" prefix="fn" %>
+<%@ taglib uri='http://java.sun.com/jsp/jstl/core' prefix='c' %>
+
+<h2>Setup</h2>
+Done!
+
+<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>
+	<c:forEach var="movie" items="${movies}">    
+	<tr>
+        <td><c:out value="${movie.title}" />
+        </td>
+        <td><c:out value="${movie.director}" />
+        </td>
+        <td><c:out value="${movie.genre}" />
+        </td>
+    </tr>
+    </c:forEach>
+</table>
+
+<h2>Continue</h2>
+<a href="moviefun">Go to main app</a>
\ No newline at end of file

Modified: openejb/trunk/openejb/arquillian-tomee/arquillian-tomee-moviefun-example/src/main/webapp/WEB-INF/web.xml
URL: http://svn.apache.org/viewvc/openejb/trunk/openejb/arquillian-tomee/arquillian-tomee-moviefun-example/src/main/webapp/WEB-INF/web.xml?rev=1195726&r1=1195725&r2=1195726&view=diff
==============================================================================
--- openejb/trunk/openejb/arquillian-tomee/arquillian-tomee-moviefun-example/src/main/webapp/WEB-INF/web.xml
(original)
+++ openejb/trunk/openejb/arquillian-tomee/arquillian-tomee-moviefun-example/src/main/webapp/WEB-INF/web.xml
Tue Nov  1 00:00:25 2011
@@ -16,32 +16,40 @@
     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">
-    <listener>
-        <listener-class>org.apache.myfaces.webapp.StartupServletContextListener</listener-class>
-    </listener>
-    <context-param>
-        <param-name>javax.faces.PROJECT_STAGE</param-name>
-        <param-value>Development</param-value>
-    </context-param>
-    <servlet>
-        <servlet-name>ActionServlet</servlet-name>
-        <servlet-class>org.superbiz.moviefun.ActionServlet</servlet-class>
-    </servlet>
-    <servlet>
-        <servlet-name>Faces Servlet</servlet-name>
-        <servlet-class>javax.faces.webapp.FacesServlet</servlet-class>
-        <load-on-startup>1</load-on-startup>
-    </servlet>
-    <servlet-mapping>
-        <servlet-name>Faces Servlet</servlet-name>
-        <url-pattern>/faces/*</url-pattern>
-    </servlet-mapping>
-    <servlet-mapping>
-        <servlet-name>ActionServlet</servlet-name>
-        <url-pattern>/moviefun/*</url-pattern>
-    </servlet-mapping>
-    <welcome-file-list>
-        <welcome-file>index.jsp</welcome-file>
-    </welcome-file-list>
-</web-app>
+<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://java.sun.com/xml/ns/javaee"
xmlns:web="http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee
http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd" version="3.0">
+  <listener>
+    <listener-class>org.apache.myfaces.webapp.StartupServletContextListener</listener-class>
+  </listener>
+  <context-param>
+    <param-name>javax.faces.PROJECT_STAGE</param-name>
+    <param-value>Development</param-value>
+  </context-param>
+  <servlet>
+    <servlet-name>ActionServlet</servlet-name>
+    <servlet-class>org.superbiz.moviefun.ActionServlet</servlet-class>
+  </servlet>
+   <servlet>
+    <servlet-name>SetupServlet</servlet-name>
+    <servlet-class>org.superbiz.moviefun.SetupServlet</servlet-class>
+  </servlet>
+  <servlet>
+    <servlet-name>Faces Servlet</servlet-name>
+    <servlet-class>javax.faces.webapp.FacesServlet</servlet-class>
+    <load-on-startup>1</load-on-startup>
+  </servlet>
+  <servlet-mapping>
+    <servlet-name>Faces Servlet</servlet-name>
+    <url-pattern>/faces/*</url-pattern>
+  </servlet-mapping>
+  <servlet-mapping>
+    <servlet-name>ActionServlet</servlet-name>
+    <url-pattern>/moviefun/*</url-pattern>
+  </servlet-mapping>
+  <servlet-mapping>
+    <servlet-name>SetupServlet</servlet-name>
+    <url-pattern>/setup</url-pattern>
+  </servlet-mapping>
+  <welcome-file-list>
+    <welcome-file>index.jsp</welcome-file>
+  </welcome-file-list>
+</web-app>
\ No newline at end of file

Modified: openejb/trunk/openejb/arquillian-tomee/arquillian-tomee-moviefun-example/src/main/webapp/index.jsp
URL: http://svn.apache.org/viewvc/openejb/trunk/openejb/arquillian-tomee/arquillian-tomee-moviefun-example/src/main/webapp/index.jsp?rev=1195726&r1=1195725&r2=1195726&view=diff
==============================================================================
--- openejb/trunk/openejb/arquillian-tomee/arquillian-tomee-moviefun-example/src/main/webapp/index.jsp
(original)
+++ openejb/trunk/openejb/arquillian-tomee/arquillian-tomee-moviefun-example/src/main/webapp/index.jsp
Tue Nov  1 00:00:25 2011
@@ -24,7 +24,7 @@
 
 <div id="Content">
 	<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="setup">Setup</a> - Sets up the application with some sample data<br
/>
 	<a href="moviefun">JSP</a> - Use the JSP version of the application<br />
 	<a href="faces/index.xhtml">JSF</a> - Use the JSF 2 version of the application<br
/>
 

Modified: openejb/trunk/openejb/arquillian-tomee/arquillian-tomee-moviefun-example/src/main/webapp/setup.jsp
URL: http://svn.apache.org/viewvc/openejb/trunk/openejb/arquillian-tomee/arquillian-tomee-moviefun-example/src/main/webapp/setup.jsp?rev=1195726&r1=1195725&r2=1195726&view=diff
==============================================================================
--- openejb/trunk/openejb/arquillian-tomee/arquillian-tomee-moviefun-example/src/main/webapp/setup.jsp
(original)
+++ openejb/trunk/openejb/arquillian-tomee/arquillian-tomee-moviefun-example/src/main/webapp/setup.jsp
Tue Nov  1 00:00:25 2011
@@ -1,65 +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.
---%>
-<%@ page import="org.superbiz.moviefun.Movie" %>
-<%@ page import="org.superbiz.moviefun.Movies" %>
-<%@ page import="javax.naming.InitialContext" %>
-<%@ page import="java.util.Iterator" %>
-<%@ page import="java.util.List" %>
-
-<h2>Setup</h2>
-<%
-    InitialContext initialContext = new InitialContext();
-    Movies moviesBean = (Movies) initialContext.lookup("java:global/moviefun/Movies");
-
-    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));
-%>
-Done!
-
-<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 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>
\ No newline at end of file

Added: openejb/trunk/openejb/arquillian-tomee/arquillian-tomee-moviefun-example/src/test/java/org/superbiz/moviefun/EJBClient.java
URL: http://svn.apache.org/viewvc/openejb/trunk/openejb/arquillian-tomee/arquillian-tomee-moviefun-example/src/test/java/org/superbiz/moviefun/EJBClient.java?rev=1195726&view=auto
==============================================================================
--- openejb/trunk/openejb/arquillian-tomee/arquillian-tomee-moviefun-example/src/test/java/org/superbiz/moviefun/EJBClient.java
(added)
+++ openejb/trunk/openejb/arquillian-tomee/arquillian-tomee-moviefun-example/src/test/java/org/superbiz/moviefun/EJBClient.java
Tue Nov  1 00:00:25 2011
@@ -0,0 +1,49 @@
+/**
+ * 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 java.util.Properties;
+
+import javax.naming.Context;
+import javax.naming.InitialContext;
+import javax.naming.NamingException;
+
+import org.apache.openejb.client.RemoteInitialContextFactory;
+
+public class EJBClient {
+
+	public static void main(String[] args) {
+		try {
+			Properties p = new Properties();
+			p.setProperty(Context.INITIAL_CONTEXT_FACTORY, RemoteInitialContextFactory.class.getName());
+			p.setProperty(Context.PROVIDER_URL, "http://localhost:8080/openejb/ejb");
+			
+			InitialContext context = new InitialContext(p);
+			MoviesRemote movies = (MoviesRemote) context.lookup("MoviesRemote");
+			List<Movie> allMovies = movies.getMovies();
+			for (Movie movie : allMovies) {
+				System.out.println(movie.getId() + ": " + movie.getTitle() + ", directed by: " + movie.getDirector()
+ ", year: " + movie.getYear() + ", genre: " + movie.getGenre() + ", rating: " + movie.getRating());
+			}
+		} catch (NamingException e) {
+			e.printStackTrace();
+		}
+		
+		
+	}
+
+}

Modified: openejb/trunk/openejb/arquillian-tomee/arquillian-tomee-moviefun-example/src/test/java/org/superbiz/moviefun/MoviesEJBTest.java
URL: http://svn.apache.org/viewvc/openejb/trunk/openejb/arquillian-tomee/arquillian-tomee-moviefun-example/src/test/java/org/superbiz/moviefun/MoviesEJBTest.java?rev=1195726&r1=1195725&r2=1195726&view=diff
==============================================================================
--- openejb/trunk/openejb/arquillian-tomee/arquillian-tomee-moviefun-example/src/test/java/org/superbiz/moviefun/MoviesEJBTest.java
(original)
+++ openejb/trunk/openejb/arquillian-tomee/arquillian-tomee-moviefun-example/src/test/java/org/superbiz/moviefun/MoviesEJBTest.java
Tue Nov  1 00:00:25 2011
@@ -1,3 +1,19 @@
+/**
+ * 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;
@@ -10,24 +26,31 @@ 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.spec.JavaArchive;
+import org.jboss.shrinkwrap.api.asset.EmptyAsset;
+import org.jboss.shrinkwrap.api.spec.WebArchive;
 import org.jboss.shrinkwrap.impl.base.asset.ClassLoaderAsset;
 import org.junit.After;
 import org.junit.Before;
 import org.junit.Test;
 import org.junit.runner.RunWith;
+import org.superbiz.moviefun.setup.ExampleDataProducer;
+import org.superbiz.moviefun.setup.Examples;
+import org.superbiz.moviefun.setup.Setup;
+
+import javax.inject.Inject;
 
 
 @RunWith(Arquillian.class)
 public class MoviesEJBTest {
-	@Deployment public static JavaArchive createDeployment() {
-		// explicit archive name required until ARQ-77 is resolved
-		return ShrinkWrap.create(JavaArchive.class, "test.jar").addClasses(Movie.class, MoviesImpl.class,
Movies.class, MoviesRemote.class, MoviesEJBTest.class)
+	@Deployment public static WebArchive createDeployment() {
+		return ShrinkWrap.create(WebArchive.class, "test.war").addClasses(Movie.class, MoviesImpl.class,
Movies.class, MoviesRemote.class, MoviesEJBTest.class, Setup.class, Examples.class, ExampleDataProducer.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");
+        		.addAsResource(new ClassLoaderAsset("META-INF/persistence.xml") , "META-INF/persistence.xml")
+        		.addAsWebInfResource(EmptyAsset.INSTANCE, "beans.xml");
 	}
 
 	@EJB private Movies movies;
+	@Inject private Setup setup;
 
     @Before @After public void clean() {
         movies.clean();
@@ -35,6 +58,11 @@ public class MoviesEJBTest {
 
 	@Test public void shouldBeAbleToAddAMovie() throws Exception {
 		assertNotNull("Verify that the ejb was injected", movies);
+		assertNotNull("Verify that the setup CDI bean was injected", setup);
+		
+		setup.setup();
+		
+		assertEquals(7, movies.getMovies().size());
 
 		Movie movie = new Movie();
 		movie.setDirector("Michael Bay");
@@ -44,7 +72,7 @@ public class MoviesEJBTest {
 		movie.setYear(1995);
 		movies.addMovie(movie);
 		
-		assertEquals(1, movies.count());
+		assertEquals(8, movies.count());
 		List<Movie> moviesFound = movies.findByTitle("Bad Boys");
 		
 		assertEquals(1, moviesFound.size());

Modified: openejb/trunk/openejb/arquillian-tomee/arquillian-tomee-moviefun-example/src/test/java/org/superbiz/moviefun/MoviesHtmlUnitTest.java
URL: http://svn.apache.org/viewvc/openejb/trunk/openejb/arquillian-tomee/arquillian-tomee-moviefun-example/src/test/java/org/superbiz/moviefun/MoviesHtmlUnitTest.java?rev=1195726&r1=1195725&r2=1195726&view=diff
==============================================================================
--- openejb/trunk/openejb/arquillian-tomee/arquillian-tomee-moviefun-example/src/test/java/org/superbiz/moviefun/MoviesHtmlUnitTest.java
(original)
+++ openejb/trunk/openejb/arquillian-tomee/arquillian-tomee-moviefun-example/src/test/java/org/superbiz/moviefun/MoviesHtmlUnitTest.java
Tue Nov  1 00:00:25 2011
@@ -1,3 +1,19 @@
+/**
+ * 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;
@@ -52,6 +68,7 @@ public class MoviesHtmlUnitTest {
         }
 
         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;
@@ -60,7 +77,7 @@ public class MoviesHtmlUnitTest {
 	@Test
     public void testShouldMakeSureWebappIsWorking() throws Exception {
         WebClient webClient = new WebClient();
-        HtmlPage page = webClient.getPage("http://localhost:9999/moviefun/setup.jsp");
+        HtmlPage page = webClient.getPage("http://localhost:9999/moviefun/setup");
 
         assertMoviesPresent(page);
 

Modified: openejb/trunk/openejb/arquillian-tomee/arquillian-tomee-moviefun-example/src/test/java/org/superbiz/moviefun/MoviesSeleniumTest.java
URL: http://svn.apache.org/viewvc/openejb/trunk/openejb/arquillian-tomee/arquillian-tomee-moviefun-example/src/test/java/org/superbiz/moviefun/MoviesSeleniumTest.java?rev=1195726&r1=1195725&r2=1195726&view=diff
==============================================================================
--- openejb/trunk/openejb/arquillian-tomee/arquillian-tomee-moviefun-example/src/test/java/org/superbiz/moviefun/MoviesSeleniumTest.java
(original)
+++ openejb/trunk/openejb/arquillian-tomee/arquillian-tomee-moviefun-example/src/test/java/org/superbiz/moviefun/MoviesSeleniumTest.java
Tue Nov  1 00:00:25 2011
@@ -31,6 +31,9 @@ import org.jboss.shrinkwrap.api.spec.Web
 import org.jboss.shrinkwrap.impl.base.asset.ClassLoaderAsset;
 import org.junit.Test;
 import org.junit.runner.RunWith;
+import org.superbiz.moviefun.setup.ExampleDataProducer;
+import org.superbiz.moviefun.setup.Examples;
+import org.superbiz.moviefun.setup.Setup;
 import org.superbiz.moviefun.util.JsfUtil;
 import org.superbiz.moviefun.util.PaginationHelper;
 
@@ -48,7 +51,7 @@ public class MoviesSeleniumTest {
 	@Deployment(testable = false)
     public static WebArchive createDeployment() {
         WebArchive archive = ShrinkWrap.create(WebArchive.class, "moviefun.war")
-        		.addClasses(ActionServlet.class, Movie.class, MovieController.class, Movies.class,
MoviesImpl.class, MoviesRemote.class, JsfUtil.class, PaginationHelper.class)
+        		.addClasses(ActionServlet.class, SetupServlet.class, Movie.class, MovieController.class,
Movies.class, MoviesImpl.class, MoviesRemote.class, JsfUtil.class, PaginationHelper.class,
ExampleDataProducer.class, Examples.class, Setup.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(new File("target/test-libs/commons-beanutils.jar"),

Modified: openejb/trunk/openejb/arquillian-tomee/arquillian-tomee-moviefun-example/src/test/java/org/superbiz/moviefun/MoviesTest.java
URL: http://svn.apache.org/viewvc/openejb/trunk/openejb/arquillian-tomee/arquillian-tomee-moviefun-example/src/test/java/org/superbiz/moviefun/MoviesTest.java?rev=1195726&r1=1195725&r2=1195726&view=diff
==============================================================================
--- openejb/trunk/openejb/arquillian-tomee/arquillian-tomee-moviefun-example/src/test/java/org/superbiz/moviefun/MoviesTest.java
(original)
+++ openejb/trunk/openejb/arquillian-tomee/arquillian-tomee-moviefun-example/src/test/java/org/superbiz/moviefun/MoviesTest.java
Tue Nov  1 00:00:25 2011
@@ -1,3 +1,19 @@
+/**
+ * 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 org.junit.After;

Modified: openejb/trunk/openejb/arquillian-tomee/arquillian-tomee-moviefun-example/src/test/resources/arquillian.xml
URL: http://svn.apache.org/viewvc/openejb/trunk/openejb/arquillian-tomee/arquillian-tomee-moviefun-example/src/test/resources/arquillian.xml?rev=1195726&r1=1195725&r2=1195726&view=diff
==============================================================================
--- openejb/trunk/openejb/arquillian-tomee/arquillian-tomee-moviefun-example/src/test/resources/arquillian.xml
(original)
+++ openejb/trunk/openejb/arquillian-tomee/arquillian-tomee-moviefun-example/src/test/resources/arquillian.xml
Tue Nov  1 00:00:25 2011
@@ -23,8 +23,10 @@
        <container qualifier="tomee" default="true">
            <configuration>
            	   <property name="dir">/tmp/arquillian-apache-tomee</property>
-               <property name="httpPort">8080</property>
+               <property name="httpPort">9080</property>
                <property name="stopPort">9005</property>
+               <property name="tomcatVersion"></property>
+               <property name="openejbVersion">1.0.0-beta-2-SNAPSHOT</property>
            </configuration>
        </container>
        



Mime
View raw message