You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tomee.apache.org by db...@apache.org on 2009/06/02 11:36:42 UTC

svn commit: r780982 - in /openejb/trunk/openejb3/examples/webapps/moviefun: ./ src/main/java/org/superbiz/moviefun/ src/main/java/org/superbiz/ws/ src/main/resources/META-INF/ src/main/webapp/ src/main/webapp/WEB-INF/ src/test/ src/test/java/ src/test/...

Author: dblevins
Date: Tue Jun  2 09:36:41 2009
New Revision: 780982

URL: http://svn.apache.org/viewvc?rev=780982&view=rev
Log:
Revived the moviefun application

Added:
    openejb/trunk/openejb3/examples/webapps/moviefun/
      - copied from r780161, openejb/trunk/openejb3/examples/webapps/ejb-webservice/
    openejb/trunk/openejb3/examples/webapps/moviefun/delete-movie.pl
    openejb/trunk/openejb3/examples/webapps/moviefun/get-movies.pl
    openejb/trunk/openejb3/examples/webapps/moviefun/pom.xml
      - copied, changed from r780182, openejb/trunk/openejb3/examples/webapps/ejb-webservice/pom.xml
    openejb/trunk/openejb3/examples/webapps/moviefun/src/main/java/org/superbiz/moviefun/
    openejb/trunk/openejb3/examples/webapps/moviefun/src/main/java/org/superbiz/moviefun/ActionServlet.java
    openejb/trunk/openejb3/examples/webapps/moviefun/src/main/java/org/superbiz/moviefun/Movie.java
    openejb/trunk/openejb3/examples/webapps/moviefun/src/main/java/org/superbiz/moviefun/Movies.java
    openejb/trunk/openejb3/examples/webapps/moviefun/src/main/java/org/superbiz/moviefun/MoviesImpl.java
    openejb/trunk/openejb3/examples/webapps/moviefun/src/main/resources/META-INF/
    openejb/trunk/openejb3/examples/webapps/moviefun/src/main/resources/META-INF/ejb-jar.xml
    openejb/trunk/openejb3/examples/webapps/moviefun/src/main/resources/META-INF/persistence.xml
    openejb/trunk/openejb3/examples/webapps/moviefun/src/main/webapp/default.css
    openejb/trunk/openejb3/examples/webapps/moviefun/src/main/webapp/index.jsp
    openejb/trunk/openejb3/examples/webapps/moviefun/src/main/webapp/setup.jsp
    openejb/trunk/openejb3/examples/webapps/moviefun/src/test/
    openejb/trunk/openejb3/examples/webapps/moviefun/src/test/java/
    openejb/trunk/openejb3/examples/webapps/moviefun/src/test/java/org/
    openejb/trunk/openejb3/examples/webapps/moviefun/src/test/java/org/superbiz/
    openejb/trunk/openejb3/examples/webapps/moviefun/src/test/java/org/superbiz/moviefun/
    openejb/trunk/openejb3/examples/webapps/moviefun/src/test/java/org/superbiz/moviefun/MoviesTest.java
    openejb/trunk/openejb3/examples/webapps/moviefun/src/test/resources/
    openejb/trunk/openejb3/examples/webapps/moviefun/src/test/resources/META-INF/
    openejb/trunk/openejb3/examples/webapps/moviefun/src/test/resources/META-INF/application-client.xml
Removed:
    openejb/trunk/openejb3/examples/webapps/moviefun/client.pl
    openejb/trunk/openejb3/examples/webapps/moviefun/src/main/java/org/superbiz/ws/
Modified:
    openejb/trunk/openejb3/examples/webapps/moviefun/src/main/webapp/WEB-INF/web.xml

Added: openejb/trunk/openejb3/examples/webapps/moviefun/delete-movie.pl
URL: http://svn.apache.org/viewvc/openejb/trunk/openejb3/examples/webapps/moviefun/delete-movie.pl?rev=780982&view=auto
==============================================================================
--- openejb/trunk/openejb3/examples/webapps/moviefun/delete-movie.pl (added)
+++ openejb/trunk/openejb3/examples/webapps/moviefun/delete-movie.pl Tue Jun  2 09:36:41 2009
@@ -0,0 +1,21 @@
+#!/usr/bin/perl -w
+
+#use SOAP::Lite 'trace', 'debug';
+use SOAP::Lite;
+
+my $ID = $ARGV[0];
+
+my $namespace = 'http://superbiz.org/wsdl';
+
+my $service = SOAP::Lite-> uri($namespace) 
+    ->proxy('http://localhost:8080/Movies') 
+    ->on_action (sub { return '' } ); 
+
+my $method = SOAP::Data->name("ns1:deleteMovieId") 
+    ->attr({'xmlns:ns1' => $namespace}); 
+
+my @params = (SOAP::Data->name('arg0'=> $ID));
+
+
+my $response =  $service->call($method=>@params);
+

Added: openejb/trunk/openejb3/examples/webapps/moviefun/get-movies.pl
URL: http://svn.apache.org/viewvc/openejb/trunk/openejb3/examples/webapps/moviefun/get-movies.pl?rev=780982&view=auto
==============================================================================
--- openejb/trunk/openejb3/examples/webapps/moviefun/get-movies.pl (added)
+++ openejb/trunk/openejb3/examples/webapps/moviefun/get-movies.pl Tue Jun  2 09:36:41 2009
@@ -0,0 +1,31 @@
+#!/usr/bin/perl -w
+
+#use SOAP::Lite 'trace', 'debug';
+use SOAP::Lite;
+
+my $namespace = 'http://superbiz.org/wsdl';
+
+my $service = SOAP::Lite-> uri($namespace) 
+    ->proxy('http://localhost:8080/Movies') 
+    ->on_action (sub { return '' } ); 
+
+my $method = SOAP::Data->name("ns1:getMovies") 
+    ->attr({'xmlns:ns1' => $namespace}); 
+
+#my @params = (
+#    SOAP::Data->name('arg0'=>3), 
+#    SOAP::Data->name('arg1'=>4)); 
+
+my $response =  $service->call($method=>@params);
+
+for my $movie ($response->valueof('//return')) {
+    while ( my ($key, $value) = each(%$movie) ) {
+	print "$key => $value\n";
+    }
+    print "\n";
+}
+
+
+
+
+

Copied: openejb/trunk/openejb3/examples/webapps/moviefun/pom.xml (from r780182, openejb/trunk/openejb3/examples/webapps/ejb-webservice/pom.xml)
URL: http://svn.apache.org/viewvc/openejb/trunk/openejb3/examples/webapps/moviefun/pom.xml?p2=openejb/trunk/openejb3/examples/webapps/moviefun/pom.xml&p1=openejb/trunk/openejb3/examples/webapps/ejb-webservice/pom.xml&r1=780182&r2=780982&rev=780982&view=diff
==============================================================================
--- openejb/trunk/openejb3/examples/webapps/ejb-webservice/pom.xml (original)
+++ openejb/trunk/openejb3/examples/webapps/moviefun/pom.xml Tue Jun  2 09:36:41 2009
@@ -23,7 +23,7 @@
          xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
   <modelVersion>4.0.0</modelVersion>
   <groupId>org.superbiz</groupId>
-  <artifactId>ejb-webservice</artifactId>
+  <artifactId>moviefun</artifactId>
   <packaging>war</packaging>
   <version>1.1-SNAPSHOT</version>
   <name>OpenEJB :: Web Examples :: EJB WebService</name>
@@ -40,6 +40,12 @@
       <version>4.4</version>
       <scope>test</scope>
     </dependency>
+    <dependency>
+      <groupId>org.apache.openejb</groupId>
+      <artifactId>openejb-core</artifactId>
+      <version>3.1.1</version>
+      <scope>test</scope>
+    </dependency>
   </dependencies>
   <build>
     <defaultGoal>install</defaultGoal>

Added: openejb/trunk/openejb3/examples/webapps/moviefun/src/main/java/org/superbiz/moviefun/ActionServlet.java
URL: http://svn.apache.org/viewvc/openejb/trunk/openejb3/examples/webapps/moviefun/src/main/java/org/superbiz/moviefun/ActionServlet.java?rev=780982&view=auto
==============================================================================
--- openejb/trunk/openejb3/examples/webapps/moviefun/src/main/java/org/superbiz/moviefun/ActionServlet.java (added)
+++ openejb/trunk/openejb3/examples/webapps/moviefun/src/main/java/org/superbiz/moviefun/ActionServlet.java Tue Jun  2 09:36:41 2009
@@ -0,0 +1,32 @@
+/**
+ * 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 javax.servlet.http.HttpServlet;
+import javax.ejb.EJB;
+
+/**
+ * @version $Revision$ $Date$
+ */
+public class ActionServlet extends HttpServlet {
+
+    @EJB(name = "movies")
+    private Movies movies;
+
+    
+
+}

Added: openejb/trunk/openejb3/examples/webapps/moviefun/src/main/java/org/superbiz/moviefun/Movie.java
URL: http://svn.apache.org/viewvc/openejb/trunk/openejb3/examples/webapps/moviefun/src/main/java/org/superbiz/moviefun/Movie.java?rev=780982&view=auto
==============================================================================
--- openejb/trunk/openejb3/examples/webapps/moviefun/src/main/java/org/superbiz/moviefun/Movie.java (added)
+++ openejb/trunk/openejb3/examples/webapps/moviefun/src/main/java/org/superbiz/moviefun/Movie.java Tue Jun  2 09:36:41 2009
@@ -0,0 +1,102 @@
+/**
+ * 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 javax.persistence.Entity;
+import javax.persistence.Id;
+import javax.persistence.GeneratedValue;
+import javax.persistence.GenerationType;
+
+@Entity
+public class Movie {
+
+    @Id
+    @GeneratedValue(strategy = GenerationType.AUTO)
+    private long id;
+
+    private String director;
+    private String title;
+    private int year;
+    private String genre;
+    private int rating;
+
+
+    public Movie() {
+    }
+
+    public Movie(String title, String director, String genre, int rating, int year) {
+        this.director = director;
+        this.title = title;
+        this.year = year;
+        this.genre = genre;
+        this.rating = rating;
+    }
+
+    public Movie(String director, String title, int year) {
+        this.director = director;
+        this.title = title;
+        this.year = year;
+    }
+
+    public long getId() {
+        return id;
+    }
+
+    public void setId(long id) {
+        this.id = id;
+    }
+
+    public String getDirector() {
+        return director;
+    }
+
+    public void setDirector(String director) {
+        this.director = director;
+    }
+
+    public String getTitle() {
+        return title;
+    }
+
+    public void setTitle(String title) {
+        this.title = title;
+    }
+
+    public int getYear() {
+        return year;
+    }
+
+    public void setYear(int year) {
+        this.year = year;
+    }
+
+    public String getGenre() {
+        return genre;
+    }
+
+    public void setGenre(String genre) {
+        this.genre = genre;
+    }
+
+    public int getRating() {
+        return rating;
+    }
+
+    public void setRating(int rating) {
+        this.rating = rating;
+    }
+}
\ No newline at end of file

Added: openejb/trunk/openejb3/examples/webapps/moviefun/src/main/java/org/superbiz/moviefun/Movies.java
URL: http://svn.apache.org/viewvc/openejb/trunk/openejb3/examples/webapps/moviefun/src/main/java/org/superbiz/moviefun/Movies.java?rev=780982&view=auto
==============================================================================
--- openejb/trunk/openejb3/examples/webapps/moviefun/src/main/java/org/superbiz/moviefun/Movies.java (added)
+++ openejb/trunk/openejb3/examples/webapps/moviefun/src/main/java/org/superbiz/moviefun/Movies.java Tue Jun  2 09:36:41 2009
@@ -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;
+
+import javax.ejb.Local;
+import java.util.List;
+
+@Local
+public interface Movies {
+
+    void addMovie(Movie movie) throws Exception;
+
+    void deleteMovie(Movie movie) throws Exception;
+
+    void deleteMovieId(long id) throws Exception;
+
+    List<Movie> getMovies() throws Exception;
+
+    List<Movie> findByTitle(String title) throws Exception;
+
+    List<Movie> findByGenre(String genre) throws Exception;
+
+    List<Movie> findByDirector(String director) throws Exception;
+
+}
\ No newline at end of file

Added: openejb/trunk/openejb3/examples/webapps/moviefun/src/main/java/org/superbiz/moviefun/MoviesImpl.java
URL: http://svn.apache.org/viewvc/openejb/trunk/openejb3/examples/webapps/moviefun/src/main/java/org/superbiz/moviefun/MoviesImpl.java?rev=780982&view=auto
==============================================================================
--- openejb/trunk/openejb3/examples/webapps/moviefun/src/main/java/org/superbiz/moviefun/MoviesImpl.java (added)
+++ openejb/trunk/openejb3/examples/webapps/moviefun/src/main/java/org/superbiz/moviefun/MoviesImpl.java Tue Jun  2 09:36:41 2009
@@ -0,0 +1,72 @@
+/**
+ * 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 javax.ejb.Stateless;
+import javax.persistence.EntityManager;
+import javax.persistence.PersistenceContext;
+import javax.persistence.Query;
+import javax.jws.WebService;
+import javax.annotation.Resource;
+import java.util.List;
+
+@Stateless(name = "Movies")
+@WebService(portName = "MoviesPort",
+        serviceName = "MoviesWebService",
+        targetNamespace = "http://superbiz.org/wsdl")
+public class MoviesImpl implements Movies {
+
+    @PersistenceContext(unitName = "movie-unit")
+    private EntityManager entityManager;
+
+    public void addMovie(Movie movie) throws Exception {
+        entityManager.persist(movie);
+    }
+
+    public void deleteMovie(Movie movie) throws Exception {
+        entityManager.remove(movie);
+    }
+
+    public void deleteMovieId(long id) throws Exception {
+        Movie movie = entityManager.find(Movie.class, id);
+        entityManager.remove(movie);
+    }
+
+    public List<Movie> getMovies() throws Exception {
+        Query query = entityManager.createQuery("SELECT m from Movie as m");
+        return query.getResultList();
+    }
+
+    public List<Movie> findByTitle(String title) throws Exception {
+        Query query = entityManager.createQuery("SELECT m from Movie as m where m.title = ?1");
+        query.setParameter(1, title);
+        return query.getResultList();
+    }
+
+    public List<Movie> findByGenre(String genre) throws Exception {
+        Query query = entityManager.createQuery("SELECT m from Movie as m where m.genre = ?1");
+        query.setParameter(1, genre);
+        return query.getResultList();
+    }
+
+    public List<Movie> findByDirector(String director) throws Exception {
+        Query query = entityManager.createQuery("SELECT m from Movie as m where m.director = ?1");
+        query.setParameter(1, director);
+        return query.getResultList();
+    }
+
+}
\ No newline at end of file

Added: openejb/trunk/openejb3/examples/webapps/moviefun/src/main/resources/META-INF/ejb-jar.xml
URL: http://svn.apache.org/viewvc/openejb/trunk/openejb3/examples/webapps/moviefun/src/main/resources/META-INF/ejb-jar.xml?rev=780982&view=auto
==============================================================================
--- openejb/trunk/openejb3/examples/webapps/moviefun/src/main/resources/META-INF/ejb-jar.xml (added)
+++ openejb/trunk/openejb3/examples/webapps/moviefun/src/main/resources/META-INF/ejb-jar.xml Tue Jun  2 09:36:41 2009
@@ -0,0 +1 @@
+<ejb-jar/>
\ No newline at end of file

Added: openejb/trunk/openejb3/examples/webapps/moviefun/src/main/resources/META-INF/persistence.xml
URL: http://svn.apache.org/viewvc/openejb/trunk/openejb3/examples/webapps/moviefun/src/main/resources/META-INF/persistence.xml?rev=780982&view=auto
==============================================================================
--- openejb/trunk/openejb3/examples/webapps/moviefun/src/main/resources/META-INF/persistence.xml (added)
+++ openejb/trunk/openejb3/examples/webapps/moviefun/src/main/resources/META-INF/persistence.xml Tue Jun  2 09:36:41 2009
@@ -0,0 +1,30 @@
+<?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.
+-->
+<persistence xmlns="http://java.sun.com/xml/ns/persistence" version="1.0">
+
+  <persistence-unit name="movie-unit">
+    <jta-data-source>movieDatabase</jta-data-source>
+    <non-jta-data-source>movieDatabaseUnmanaged</non-jta-data-source>
+    <class>org.superbiz.moviefun.Movie</class>
+
+    <properties>
+      <property name="openjpa.jdbc.SynchronizeMappings" value="buildSchema(ForeignKeys=true)"/>
+    </properties>
+  </persistence-unit>
+</persistence>
\ No newline at end of file

Modified: openejb/trunk/openejb3/examples/webapps/moviefun/src/main/webapp/WEB-INF/web.xml
URL: http://svn.apache.org/viewvc/openejb/trunk/openejb3/examples/webapps/moviefun/src/main/webapp/WEB-INF/web.xml?rev=780982&r1=780161&r2=780982&view=diff
==============================================================================
--- openejb/trunk/openejb3/examples/webapps/moviefun/src/main/webapp/WEB-INF/web.xml (original)
+++ openejb/trunk/openejb3/examples/webapps/moviefun/src/main/webapp/WEB-INF/web.xml Tue Jun  2 09:36:41 2009
@@ -25,4 +25,66 @@
          metadata-complete="false"
          version="2.5">
 
+  <servlet>
+    <servlet-name>ActionServlet</servlet-name>
+    <servlet-class>org.superbiz.moviefun.ActionServlet</servlet-class>
+  </servlet>
+
+
+  <soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
+    <soap:Body>
+      <ns1:getMoviesResponse xmlns:ns1="http://superbiz.org/wsdl">
+        <return>
+          <director>David Dobkin</director>
+          <genre>Comedy</genre>
+          <id>101</id>
+          <rating>7</rating>
+          <title>Wedding Crashers</title>
+          <year>2005</year>
+        </return>
+        <return>
+          <director>Todd Phillips</director>
+          <genre>Action</genre>
+          <id>102</id>
+          <rating>6</rating>
+          <title>Starsky &amp; Hutch</title>
+          <year>2004</year>
+        </return>
+        <return>
+          <director>David Dobkin</director>
+          <genre>Action</genre>
+          <id>103</id>
+          <rating>6</rating>
+          <title>Shanghai Knights</title>
+          <year>2003</year>
+        </return>
+        <return>
+          <director>Wes Anderson</director>
+          <genre>Comedy</genre>
+          <id>105</id>
+          <rating>8</rating>
+          <title>The Royal Tenenbaums</title>
+          <year>2001</year>
+        </return>
+        <return>
+          <director>Ben Stiller</director>
+          <genre>Comedy</genre>
+          <id>106</id>
+          <rating>6</rating>
+          <title>Zoolander</title>
+          <year>2001</year>
+        </return>
+        <return>
+          <director>Tom Dey</director>
+          <genre>Comedy</genre>
+          <id>107</id>
+          <rating>7</rating>
+          <title>Shanghai Noon</title>
+          <year>2000</year>
+        </return>
+      </ns1:getMoviesResponse>
+    </soap:Body>
+  </soap:Envelope>
+
+
 </web-app>

Added: openejb/trunk/openejb3/examples/webapps/moviefun/src/main/webapp/default.css
URL: http://svn.apache.org/viewvc/openejb/trunk/openejb3/examples/webapps/moviefun/src/main/webapp/default.css?rev=780982&view=auto
==============================================================================
--- openejb/trunk/openejb3/examples/webapps/moviefun/src/main/webapp/default.css (added)
+++ openejb/trunk/openejb3/examples/webapps/moviefun/src/main/webapp/default.css Tue Jun  2 09:36:41 2009
@@ -0,0 +1,159 @@
+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: 3c78b5;
+	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/openejb3/examples/webapps/moviefun/src/main/webapp/index.jsp
URL: http://svn.apache.org/viewvc/openejb/trunk/openejb3/examples/webapps/moviefun/src/main/webapp/index.jsp?rev=780982&view=auto
==============================================================================
--- openejb/trunk/openejb3/examples/webapps/moviefun/src/main/webapp/index.jsp (added)
+++ openejb/trunk/openejb3/examples/webapps/moviefun/src/main/webapp/index.jsp Tue Jun  2 09:36:41 2009
@@ -0,0 +1,200 @@
+<%@ page import="org.superbiz.moviefun.Movie,
+                 org.superbiz.moviefun.Movies,
+                 javax.naming.InitialContext,
+                 java.util.List,
+                 java.util.ListIterator" %>
+<%@ page contentType="text/html;charset=UTF-8" language="java" %>
+<%
+
+    InitialContext initialContext = new InitialContext();
+    Movies moviesBean = (Movies) initialContext.lookup("java:comp/env/movies");
+
+    List movies = null;
+    ListIterator listIterator = null;
+    int display = 5;
+    String action = request.getParameter("action");
+
+    if ("Add".equals(action)) {
+
+        String title = request.getParameter("title");
+        String director = request.getParameter("director");
+        String genre = request.getParameter("genre");
+        int rating = Integer.parseInt(request.getParameter("rating"));
+        int year = Integer.parseInt(request.getParameter("year"));
+
+        Movie movie = new Movie(title, director, genre, rating, year);
+
+        moviesBean.addMovie(movie);
+
+    } else if ("Remove".equals(action)) {
+
+        String[] ids = request.getParameterValues("id");
+        for (String id : ids) {
+            moviesBean.deleteMovieId(new Long(id));
+        }
+
+    } else if (">>".equals(action)) {
+
+        movies = (List) session.getAttribute("movies.collection");
+        listIterator = (ListIterator) session.getAttribute("movies.iterator");
+
+    } else if ("<<".equals(action)) {
+
+        movies = (List) session.getAttribute("movies.collection");
+        listIterator = (ListIterator) session.getAttribute("movies.iterator");
+        for (int i = display * 2; i > 0 && listIterator.hasPrevious(); i--) {
+            listIterator.previous(); // backup
+        }
+
+    } else if ("findByTitle".equals(action)) {
+
+        movies = moviesBean.findByTitle(request.getParameter("key"));
+
+    } else if ("findByDirector".equals(action)) {
+
+        movies = moviesBean.findByDirector(request.getParameter("key"));
+
+    } else if ("findByGenre".equals(action)) {
+
+        movies = moviesBean.findByGenre(request.getParameter("key"));
+    }
+
+    if (movies == null) {
+        try {
+            movies = moviesBean.getMovies();
+        } catch (Throwable e) {
+            // We must not have run setup yet
+            response.sendRedirect("setup.jsp");
+            return;
+        }
+    }
+
+    if (listIterator == null) {
+        listIterator = movies.listIterator();
+    }
+
+    session.setAttribute("movies.collection", movies);
+    session.setAttribute("movies.iterator", listIterator);
+%>
+<html>
+<head><title>Moviefun :: Index</title>
+<link rel="stylesheet" href="default.css" type="text/css" />
+
+</head>
+<body>
+<p/>
+<div id="Content">
+<table>
+<tr>
+<td>
+    <table border="0" cellpadding="0" cellspacing="0" width="100%">
+    <tr class="topBar">
+        <td align="left" width="85%">&nbsp;
+            <span class="topBarDiv">Mini-Movie Application</span>
+        </td>
+        <td align="right" valign="middle" width="1%" nowrap>
+            <form method="POST" action="index.jsp" name="findMovie" style="padding: 1px; margin: 1px">
+            <select name="action">
+                <option value="findByTitle">Title</option>
+                <option value="findByDirector">Director</option>
+                <option value="findByGenre">Genre</option>
+            </select>
+            <input type="text" name="key" size="20"/>
+            <input type="submit" value="Search"/>
+            </form>
+        </td>
+    </tr>
+    </table>
+
+</td>
+</tr>
+<tr>
+<td>
+    <div class="basicPanelContainer" style="width: 100%">
+
+        <div class="basicPanelTitle">Movies</div>
+
+        <div class="basicPanelBody">
+            <form method="POST" action="index.jsp" name="listMovies" style="padding: 1px; margin: 1px">
+            <table class="tableview" width="100%" cellspacing="0" cellpadding="0" style="padding: 5px">
+            <tr>
+            <th>Title</th>
+            <th>Director</th>
+            <th>Genre</th>
+            <th>Rating</th>
+            <th>Year</th>
+            <th>&nbsp;</th>
+            </tr>
+            <%
+            int start = listIterator.nextIndex();
+            for (int i=display; i > 0 && listIterator.hasNext(); i-- ) {
+                Movie movie = (Movie) listIterator.next();
+            %>
+            <tr>
+            <td width="200"><%=movie.getTitle()%></td>
+            <td width="120"><%=movie.getDirector()%></td>
+            <td width="90"><%=movie.getGenre()%></td>
+            <td width="50"><%=movie.getRating()%></td>
+            <td width="50"><%=movie.getYear()%></td>
+            <td><input type="checkbox" name="id" value="<%=movie.getId()%>"></td>
+            </tr>
+
+            <% } %>
+            </table>
+            <table width="100%" cellspacing="0" cellpadding="0" style="padding: 5px">
+            <tr>
+            <td>
+            <% if (start!=0&&listIterator.hasPrevious()){%><input type="submit" name="action" value="<<"/><%}%>
+
+            <%=start+1%> - <%=listIterator.nextIndex()%> of <%=movies.size()%>
+
+            <% if (listIterator.hasNext()){%><input type="submit" name="action" value=">>"/><%}%>
+            </td>
+            <td align="right">
+                <input type="submit" name="action" value="Remove"/>
+            </td>
+            </tr>
+            </table>
+            </form>
+        </div>
+    </div>
+</td>
+</tr>
+<tr>
+<td>
+    <div class="basicPanelContainer" style="width: 100%">
+        <div class="basicPanelTitle">Add</div>
+        <div class="basicPanelBody">
+            <form method="POST" action="index.jsp" name="addMovie" style="padding: 1px; margin: 1px">
+            <table width="100%" cellspacing="0" cellpadding="0" style="padding: 0px">
+            <tr>
+            <td width="200"><input type="text" name="title" size="29"/></td>
+            <td width="120"><input type="text" name="director" size="17"/></td>
+            <td width="90"><input type="text" name="genre" size="14"/></td>
+            <td width="50"><input type="text" name="rating" size="7"/></td>
+            <td width="50"><input type="text" name="year" size="4"/></td>
+            <td><input type="submit" name="action" value="Add"/></td>
+            </tr>
+            </table>
+            </form>
+
+        </div>
+    </div>
+</td>
+</tr>
+</table>
+
+
+    <div class="bottomshadow"></div>
+
+    <div id="poweredby" class="smalltext">
+        Powered by
+        <a href="http://tomcat.apache.org" class="smalltext">Apache Tomcat</a> and
+        <a href="http://openejb.apache.org" class="smalltext">Apache OpenEJB</a>.
+        <br/>
+    </div>
+
+
+</div>
+</body>
+</html>
\ No newline at end of file

Added: openejb/trunk/openejb3/examples/webapps/moviefun/src/main/webapp/setup.jsp
URL: http://svn.apache.org/viewvc/openejb/trunk/openejb3/examples/webapps/moviefun/src/main/webapp/setup.jsp?rev=780982&view=auto
==============================================================================
--- openejb/trunk/openejb3/examples/webapps/moviefun/src/main/webapp/setup.jsp (added)
+++ openejb/trunk/openejb3/examples/webapps/moviefun/src/main/webapp/setup.jsp Tue Jun  2 09:36:41 2009
@@ -0,0 +1,46 @@
+<%@ page import=" java.util.Iterator"%>
+<%@ page import="org.superbiz.moviefun.Movies" %>
+<%@ page import="javax.naming.InitialContext" %>
+<%@ page import="org.superbiz.moviefun.Movie" %>
+<%@ page import="java.util.List" %>
+
+<h2>Setup</h2>
+<%
+    InitialContext initialContext = new InitialContext();
+    Movies moviesBean = (Movies) initialContext.lookup("java:comp/env/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="index.jsp">Go to main app</a>
\ No newline at end of file

Added: openejb/trunk/openejb3/examples/webapps/moviefun/src/test/java/org/superbiz/moviefun/MoviesTest.java
URL: http://svn.apache.org/viewvc/openejb/trunk/openejb3/examples/webapps/moviefun/src/test/java/org/superbiz/moviefun/MoviesTest.java?rev=780982&view=auto
==============================================================================
--- openejb/trunk/openejb3/examples/webapps/moviefun/src/test/java/org/superbiz/moviefun/MoviesTest.java (added)
+++ openejb/trunk/openejb3/examples/webapps/moviefun/src/test/java/org/superbiz/moviefun/MoviesTest.java Tue Jun  2 09:36:41 2009
@@ -0,0 +1,80 @@
+/**
+ * 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 junit.framework.TestCase;
+
+import javax.naming.Context;
+import javax.naming.InitialContext;
+import javax.ejb.EJB;
+import javax.transaction.UserTransaction;
+import javax.annotation.Resource;
+import javax.persistence.PersistenceContext;
+import javax.persistence.EntityManager;
+import java.util.Properties;
+import java.util.List;
+
+import org.apache.openejb.api.LocalClient;
+
+@LocalClient
+public class MoviesTest extends TestCase {
+
+    @EJB
+    private Movies movies;
+
+    @Resource
+    private UserTransaction userTransaction;
+
+    @PersistenceContext
+    private EntityManager entityManager;
+
+    public void setUp() throws Exception {
+        Properties p = new Properties();
+        p.put(Context.INITIAL_CONTEXT_FACTORY, "org.apache.openejb.client.LocalInitialContextFactory");
+        p.put("movieDatabase", "new://Resource?type=DataSource");
+        p.put("movieDatabase.JdbcDriver", "org.hsqldb.jdbcDriver");
+        p.put("movieDatabase.JdbcUrl", "jdbc:hsqldb:mem:moviedb");
+
+        InitialContext initialContext = new InitialContext(p);
+
+        // Here's the fun part
+        initialContext.bind("inject", this);
+    }
+
+    public void test() throws Exception {
+
+        userTransaction.begin();
+
+        try {
+            entityManager.persist(new Movie("Quentin Tarantino", "Reservoir Dogs", 1992));
+            entityManager.persist(new Movie("Joel Coen", "Fargo", 1996));
+            entityManager.persist(new Movie("Joel Coen", "The Big Lebowski", 1998));
+
+            List<Movie> list = movies.getMovies();
+            assertEquals("List.size()", 3, list.size());
+
+            for (Movie movie : list) {
+                movies.deleteMovie(movie);
+            }
+
+            assertEquals("Movies.getMovies()", 0, movies.getMovies().size());
+
+        } finally {
+            userTransaction.commit();
+        }
+    }
+}
\ No newline at end of file

Added: openejb/trunk/openejb3/examples/webapps/moviefun/src/test/resources/META-INF/application-client.xml
URL: http://svn.apache.org/viewvc/openejb/trunk/openejb3/examples/webapps/moviefun/src/test/resources/META-INF/application-client.xml?rev=780982&view=auto
==============================================================================
--- openejb/trunk/openejb3/examples/webapps/moviefun/src/test/resources/META-INF/application-client.xml (added)
+++ openejb/trunk/openejb3/examples/webapps/moviefun/src/test/resources/META-INF/application-client.xml Tue Jun  2 09:36:41 2009
@@ -0,0 +1 @@
+<application-client/>
\ No newline at end of file