Author: dblevins
Date: Mon Apr 11 11:05:46 2011
New Revision: 1091024
URL: http://svn.apache.org/viewvc?rev=1091024&view=rev
Log:
OPENEJB-1519: Update existing examples to EJB 3.1
Added:
openejb/trunk/openejb3/examples/troubleshooting/src/main/java/org/superbiz/troubleshooting/Movies.java
- copied, changed from r1090810,
openejb/trunk/openejb3/examples/troubleshooting/src/main/java/org/superbiz/troubleshooting/MoviesImpl.java
Removed:
openejb/trunk/openejb3/examples/troubleshooting/src/main/java/org/superbiz/troubleshooting/MoviesImpl.java
openejb/trunk/openejb3/examples/troubleshooting/src/main/resources/META-INF/ejb-jar.xml
openejb/trunk/openejb3/examples/troubleshooting/src/test/resources/
Modified:
openejb/trunk/openejb3/examples/troubleshooting/src/test/java/org/superbiz/troubleshooting/MoviesTest.java
Copied:
openejb/trunk/openejb3/examples/troubleshooting/src/main/java/org/superbiz/troubleshooting/Movies.java
(from r1090810,
openejb/trunk/openejb3/examples/troubleshooting/src/main/java/org/superbiz/troubleshooting/MoviesImpl.java)
URL:
http://svn.apache.org/viewvc/openejb/trunk/openejb3/examples/troubleshooting/src/main/java/org/superbiz/troubleshooting/Movies.java?p2=openejb/trunk/openejb3/examples/troubleshooting/src/main/java/org/superbiz/troubleshooting/Movies.java&p1=openejb/trunk/openejb3/examples/troubleshooting/src/main/java/org/superbiz/troubleshooting/MoviesImpl.java&r1=1090810&r2=1091024&rev=1091024&view=diff
==============================================================================
---
openejb/trunk/openejb3/examples/troubleshooting/src/main/java/org/superbiz/troubleshooting/MoviesImpl.java
(original)
+++
openejb/trunk/openejb3/examples/troubleshooting/src/main/java/org/superbiz/troubleshooting/Movies.java
Mon Apr 11 11:05:46 2011
@@ -24,8 +24,8 @@ import javax.persistence.Query;
import java.util.List;
//START SNIPPET: code
-@Stateless(name = "Movies")
-public class MoviesImpl implements Movies {
+@Stateless
+public class Movies {
@PersistenceContext(unitName = "movie-unit", type =
PersistenceContextType.TRANSACTION)
private EntityManager entityManager;
Modified:
openejb/trunk/openejb3/examples/troubleshooting/src/test/java/org/superbiz/troubleshooting/MoviesTest.java
URL:
http://svn.apache.org/viewvc/openejb/trunk/openejb3/examples/troubleshooting/src/test/java/org/superbiz/troubleshooting/MoviesTest.java?rev=1091024&r1=1091023&r2=1091024&view=diff
==============================================================================
---
openejb/trunk/openejb3/examples/troubleshooting/src/test/java/org/superbiz/troubleshooting/MoviesTest.java
(original)
+++
openejb/trunk/openejb3/examples/troubleshooting/src/test/java/org/superbiz/troubleshooting/MoviesTest.java
Mon Apr 11 11:05:46 2011
@@ -17,12 +17,10 @@
package org.superbiz.troubleshooting;
import junit.framework.TestCase;
-import org.apache.openejb.api.LocalClient;
import javax.annotation.Resource;
import javax.ejb.EJB;
-import javax.naming.Context;
-import javax.naming.InitialContext;
+import javax.ejb.embeddable.EJBContainer;
import javax.persistence.EntityManager;
import javax.persistence.PersistenceContext;
import javax.transaction.UserTransaction;
@@ -30,7 +28,6 @@ import java.util.List;
import java.util.Properties;
//START SNIPPET: code
-@LocalClient
public class MoviesTest extends TestCase {
@EJB
@@ -42,11 +39,8 @@ public class MoviesTest extends TestCase
@PersistenceContext
private EntityManager entityManager;
- private InitialContext initialContext;
-
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");
@@ -82,9 +76,7 @@ public class MoviesTest extends TestCase
// A great tool for those learning EJB.
p.put("openejb.validation.output.level", "verbose");
- initialContext = new InitialContext(p);
-
- initialContext.bind("inject", this);
+ EJBContainer.createEJBContainer(p).getContext().bind("inject", this);
}
public void test() throws Exception {