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 2011/10/29 06:54:42 UTC

svn commit: r1190757 [1/15] - in /openejb/trunk/openejb/examples: access-timeout-meta/src/main/java/org/superbiz/accesstimeout/ alternate-descriptors/ application-composer/ applicationexception/ applicationexception/src/test/java/org/superbiz/appexcept...

Author: dblevins
Date: Sat Oct 29 04:54:40 2011
New Revision: 1190757

URL: http://svn.apache.org/viewvc?rev=1190757&view=rev
Log:
Unfinished README.md files for the remaining examples

Added:
    openejb/trunk/openejb/examples/alternate-descriptors/README.md
    openejb/trunk/openejb/examples/application-composer/README.md
    openejb/trunk/openejb/examples/applicationexception/README.md
    openejb/trunk/openejb/examples/cdi-interceptors/README.md
    openejb/trunk/openejb/examples/cdi-produces-disposes/README.md
    openejb/trunk/openejb/examples/component-interfaces/README.md
    openejb/trunk/openejb/examples/custom-injection/README.md
    openejb/trunk/openejb/examples/decorators/README.md
    openejb/trunk/openejb/examples/dynamic-implementation/README.md
    openejb/trunk/openejb/examples/ear-testing/README.md
    openejb/trunk/openejb/examples/helloworld-weblogic/README.md
    openejb/trunk/openejb/examples/injection-of-connectionfactory/README.md
    openejb/trunk/openejb/examples/injection-of-datasource/README.md
    openejb/trunk/openejb/examples/injection-of-ejbs/README.md
    openejb/trunk/openejb/examples/injection-of-entitymanager/README.md
    openejb/trunk/openejb/examples/injection-of-env-entry/README.md
    openejb/trunk/openejb/examples/interceptors/README.md
    openejb/trunk/openejb/examples/jpa-eclipselink/README.md
    openejb/trunk/openejb/examples/jpa-hibernate/README.md
    openejb/trunk/openejb/examples/lookup-of-ejbs-with-descriptor/README.md
    openejb/trunk/openejb/examples/lookup-of-ejbs/README.md
    openejb/trunk/openejb/examples/movies-complete-meta/README.md
    openejb/trunk/openejb/examples/movies-complete/README.md
    openejb/trunk/openejb/examples/quartz-app/README.md
    openejb/trunk/openejb/examples/rest-on-ejb/README.md
    openejb/trunk/openejb/examples/schedule-expression/README.md
    openejb/trunk/openejb/examples/schedule-methods-meta/README.md
    openejb/trunk/openejb/examples/schedule-methods/README.md
    openejb/trunk/openejb/examples/simple-cmp2/README.md
    openejb/trunk/openejb/examples/simple-mdb-with-descriptor/README.md
    openejb/trunk/openejb/examples/simple-singleton/README.md
    openejb/trunk/openejb/examples/simple-stateless-with-descriptor/README.md
    openejb/trunk/openejb/examples/simple-webservice/README.md
    openejb/trunk/openejb/examples/spring-integration/README.md
    openejb/trunk/openejb/examples/telephone-stateful/README.md
    openejb/trunk/openejb/examples/testcase-injection/README.md
    openejb/trunk/openejb/examples/testing-security-2/README.md
    openejb/trunk/openejb/examples/testing-security-meta/README.md
    openejb/trunk/openejb/examples/testing-security/README.md
    openejb/trunk/openejb/examples/testing-transactions/README.md
    openejb/trunk/openejb/examples/transaction-rollback/README.md
    openejb/trunk/openejb/examples/troubleshooting/README.md
    openejb/trunk/openejb/examples/webapps/applet/README.md
    openejb/trunk/openejb/examples/webapps/ejb-examples/README.md
    openejb/trunk/openejb/examples/webapps/ejb-webservice/README.md
    openejb/trunk/openejb/examples/webapps/jsf/README.md
    openejb/trunk/openejb/examples/webapps/moviefun/README.md
    openejb/trunk/openejb/examples/webapps/rest-example-with-application/README.md
    openejb/trunk/openejb/examples/webapps/rest-example/README.md
    openejb/trunk/openejb/examples/webapps/struts/README.md
    openejb/trunk/openejb/examples/webservice-attachments/README.md
    openejb/trunk/openejb/examples/webservice-inheritance/README.md
    openejb/trunk/openejb/examples/webservice-security/README.md
    openejb/trunk/openejb/examples/webservice-ws-security/README.md
Modified:
    openejb/trunk/openejb/examples/access-timeout-meta/src/main/java/org/superbiz/accesstimeout/BusyBee.java
    openejb/trunk/openejb/examples/applicationexception/src/test/java/org/superbiz/appexception/ThrowBusinessExceptionImplTest.java
    openejb/trunk/openejb/examples/async-methods/README.md
    openejb/trunk/openejb/examples/cdi-basic/README.md

Modified: openejb/trunk/openejb/examples/access-timeout-meta/src/main/java/org/superbiz/accesstimeout/BusyBee.java
URL: http://svn.apache.org/viewvc/openejb/trunk/openejb/examples/access-timeout-meta/src/main/java/org/superbiz/accesstimeout/BusyBee.java?rev=1190757&r1=1190756&r2=1190757&view=diff
==============================================================================
--- openejb/trunk/openejb/examples/access-timeout-meta/src/main/java/org/superbiz/accesstimeout/BusyBee.java (original)
+++ openejb/trunk/openejb/examples/access-timeout-meta/src/main/java/org/superbiz/accesstimeout/BusyBee.java Sat Oct 29 04:54:40 2011
@@ -20,13 +20,11 @@ import org.superbiz.accesstimeout.api.Aw
 import org.superbiz.accesstimeout.api.AwaitForever;
 import org.superbiz.accesstimeout.api.AwaitNever;
 
-import javax.ejb.AccessTimeout;
 import javax.ejb.Asynchronous;
 import javax.ejb.Lock;
 import javax.ejb.Singleton;
 import java.util.concurrent.CountDownLatch;
 import java.util.concurrent.Future;
-import java.util.concurrent.TimeUnit;
 
 import static javax.ejb.LockType.WRITE;
 

Added: openejb/trunk/openejb/examples/alternate-descriptors/README.md
URL: http://svn.apache.org/viewvc/openejb/trunk/openejb/examples/alternate-descriptors/README.md?rev=1190757&view=auto
==============================================================================
--- openejb/trunk/openejb/examples/alternate-descriptors/README.md (added)
+++ openejb/trunk/openejb/examples/alternate-descriptors/README.md Sat Oct 29 04:54:40 2011
@@ -0,0 +1,146 @@
+Title: Alternate Descriptors
+
+See the [Alternate Descriptors](../../alternate-descriptors.html) page for the full details of how this feature works.
+
+For our example we'll use the standard "moviefun" code which contains a `Movie` entity and `Movies` session bean.  To add a twist
+for testing and demonstrate alternate descriptors, we will create an interceptor that will be used only in our test cases.
+
+To add this to our application, we simply need a `test.ejb-jar.xml` in the same location that the regular `ejb-jar.xml` would be expected.
+
+That gives us the following files in our project:
+
+ - src/main/resources/META-INF/ejb-jar.xml
+ - src/main/resources/META-INF/persistence.xml
+ - src/main/resources/META-INF/test.ejb-jar.xml
+
+## The test.ejb-jar.xml
+
+The normal `ejb-jar.xml` simply contains `<ejb-jar/>`, however the `test.ejb-jar.xml` we add an extra interceptor:
+
+    <?xml version="1.0" encoding="UTF-8" standalone="yes"?>
+    <ejb-jar xmlns="http://java.sun.com/xml/ns/javaee">
+      <assembly-descriptor>
+        <interceptor-binding>
+          <ejb-name>Movies</ejb-name>
+          <interceptor-class>org.superbiz.altdd.MoviesTest$Interceptor</interceptor-class>
+        </interceptor-binding>
+      </assembly-descriptor>
+    </ejb-jar>
+
+## The TestCase
+
+To enable our `test.ejb-jar.xml` in the test case, we simply set the `openejb.altdd.prefix` property when creating the embedded `EJBContainer`
+
+     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("movieDatabase", "new://Resource?type=DataSource");
+             p.put("movieDatabase.JdbcDriver", "org.hsqldb.jdbcDriver");
+             p.put("movieDatabase.JdbcUrl", "jdbc:hsqldb:mem:moviedb");
+
+             p.put("openejb.altdd.prefix", "test");
+
+             EJBContainer.createEJBContainer(p).getContext().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 {
+                 try {
+                     userTransaction.commit();
+                     fail("Transaction should have been rolled back");
+                 } catch (RollbackException e) {
+                     // Good, we don't want to clean up the db
+                 }
+             }
+         }
+
+         public static class Interceptor {
+
+             @Resource
+             private SessionContext sessionContext;
+
+             @AroundInvoke
+             public Object invoke(InvocationContext context) throws Exception {
+
+                 sessionContext.setRollbackOnly();
+
+                 return context.proceed();
+             }
+         }
+     }
+
+As noted in [the documentation](../../alternate-descriptors.html), several prefixes can be used at once.
+
+# Running
+
+
+    -------------------------------------------------------
+     T E S T S
+    -------------------------------------------------------
+    Running org.superbiz.altdd.MoviesTest
+    Apache OpenEJB 4.0.0-beta-1    build: 20111002-04:06
+    http://openejb.apache.org/
+    INFO - openejb.home = /Users/dblevins/examples/alternate-descriptors
+    INFO - openejb.base = /Users/dblevins/examples/alternate-descriptors
+    INFO - Using 'javax.ejb.embeddable.EJBContainer=true'
+    INFO - Configuring Service(id=Default Security Service, type=SecurityService, provider-id=Default Security Service)
+    INFO - Configuring Service(id=Default Transaction Manager, type=TransactionManager, provider-id=Default Transaction Manager)
+    INFO - Configuring Service(id=movieDatabase, type=Resource, provider-id=Default JDBC Database)
+    INFO - Found EjbModule in classpath: /Users/dblevins/examples/alternate-descriptors/target/classes
+    INFO - Beginning load: /Users/dblevins/examples/alternate-descriptors/target/classes
+    INFO - AltDD ejb-jar.xml -> file:/Users/dblevins/examples/alternate-descriptors/target/classes/META-INF/test.ejb-jar.xml
+    INFO - Configuring enterprise application: /Users/dblevins/examples/alternate-descriptors
+    WARN - Method 'lookup' is not available for 'javax.annotation.Resource'. Probably using an older Runtime.
+    INFO - Configuring Service(id=Default Stateful Container, type=Container, provider-id=Default Stateful Container)
+    INFO - Auto-creating a container for bean Movies: Container(type=STATEFUL, id=Default Stateful Container)
+    INFO - Configuring Service(id=Default Managed Container, type=Container, provider-id=Default Managed Container)
+    INFO - Auto-creating a container for bean org.superbiz.altdd.MoviesTest: Container(type=MANAGED, id=Default Managed Container)
+    INFO - Configuring PersistenceUnit(name=movie-unit)
+    INFO - Auto-creating a Resource with id 'movieDatabaseNonJta' of type 'DataSource for 'movie-unit'.
+    INFO - Configuring Service(id=movieDatabaseNonJta, type=Resource, provider-id=movieDatabase)
+    INFO - Adjusting PersistenceUnit movie-unit <non-jta-data-source> to Resource ID 'movieDatabaseNonJta' from 'movieDatabaseUnmanaged'
+    INFO - Enterprise application "/Users/dblevins/examples/alternate-descriptors" loaded.
+    INFO - Assembling app: /Users/dblevins/examples/alternate-descriptors
+    INFO - PersistenceUnit(name=movie-unit, provider=org.apache.openjpa.persistence.PersistenceProviderImpl) - provider time 411ms
+    INFO - Jndi(name="java:global/alternate-descriptors/Movies!org.superbiz.altdd.Movies")
+    INFO - Jndi(name="java:global/alternate-descriptors/Movies")
+    INFO - Jndi(name="java:global/EjbModule1893321675/org.superbiz.altdd.MoviesTest!org.superbiz.altdd.MoviesTest")
+    INFO - Jndi(name="java:global/EjbModule1893321675/org.superbiz.altdd.MoviesTest")
+    INFO - Created Ejb(deployment-id=Movies, ejb-name=Movies, container=Default Stateful Container)
+    INFO - Created Ejb(deployment-id=org.superbiz.altdd.MoviesTest, ejb-name=org.superbiz.altdd.MoviesTest, container=Default Managed Container)
+    INFO - Started Ejb(deployment-id=Movies, ejb-name=Movies, container=Default Stateful Container)
+    INFO - Started Ejb(deployment-id=org.superbiz.altdd.MoviesTest, ejb-name=org.superbiz.altdd.MoviesTest, container=Default Managed Container)
+    INFO - Deployed Application(path=/Users/dblevins/examples/alternate-descriptors)
+    Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 2.569 sec
+
+    Results :
+
+    Tests run: 1, Failures: 0, Errors: 0, Skipped: 0
+

Added: openejb/trunk/openejb/examples/application-composer/README.md
URL: http://svn.apache.org/viewvc/openejb/trunk/openejb/examples/application-composer/README.md?rev=1190757&view=auto
==============================================================================
--- openejb/trunk/openejb/examples/application-composer/README.md (added)
+++ openejb/trunk/openejb/examples/application-composer/README.md Sat Oct 29 04:54:40 2011
@@ -0,0 +1,159 @@
+Title: Application Composer
+
+The `org.apache.openejb.junit.ApplicationComposer` is JUnit test runner modeled after the way we've done testing internally in OpenEJB for years (since about 2006).
+It involves no classpath scanning at all.  If you want something to be in the app, you must build it directly in your testcase.
+
+With the `ApplicationComposer` you can do identical testing that OpenEJB uses internally, but with limited dependency on OpenEJB itself.  The main dependency is on the code
+that is used to build the actual applications:
+
+    <dependency>
+      <groupId>org.apache.openejb</groupId>
+      <artifactId>openejb-jee</artifactId>
+      <version>4.0.0-beta-1</version>
+    </dependency>
+
+# Composing an Application
+
+The main difference to the embedded `EJBContainer` API is building the application in the test code.  This is done with one or more methods in the test case annotated
+with `org.apache.openejb.junit.Module` using the following format:
+
+    @Module
+    public <return-value> <module-name>() {
+
+Where **module-name** is the name you wish to use for that module and **return-value** can be any one of the following:
+
+ - java.lang.Class
+ - java.lang.Class[]
+ - org.apache.openejb.jee.EjbJar
+ - org.apache.openejb.jee.EnterpriseBean
+ - org.apache.openejb.jee.Application
+ - org.apache.openejb.jee.Connector
+ - org.apache.openejb.jee.Beans
+ - org.apache.openejb.jee.jpa.unit.Persistence
+ - org.apache.openejb.jee.jpa.unit.PersistenceUnit
+
+# Example
+
+Used in an actual testcase, that might look like so:
+
+    import junit.framework.TestCase;
+    import org.apache.openejb.jee.EjbJar;
+    import org.apache.openejb.jee.StatefulBean;
+    import org.apache.openejb.jee.jpa.unit.PersistenceUnit;
+    import org.apache.openejb.junit.ApplicationComposer;
+    import org.apache.openejb.junit.Configuration;
+    import org.apache.openejb.junit.Module;
+    import org.junit.Test;
+    import org.junit.runner.RunWith;
+
+    import javax.annotation.Resource;
+    import javax.ejb.EJB;
+    import javax.persistence.EntityManager;
+    import javax.persistence.PersistenceContext;
+    import javax.transaction.UserTransaction;
+    import java.util.List;
+    import java.util.Properties;
+
+    //START SNIPPET: code
+    @RunWith(ApplicationComposer.class)
+    public class MoviesTest extends TestCase {
+
+        @EJB
+        private Movies movies;
+
+        @Resource
+        private UserTransaction userTransaction;
+
+        @PersistenceContext
+        private EntityManager entityManager;
+
+        @Module
+        public PersistenceUnit persistence() {
+            PersistenceUnit unit = new PersistenceUnit("movie-unit");
+            unit.setJtaDataSource("movieDatabase");
+            unit.setNonJtaDataSource("movieDatabaseUnmanaged");
+            unit.getClazz().add(Movie.class.getName());
+            unit.setProperty("openjpa.jdbc.SynchronizeMappings", "buildSchema(ForeignKeys=true)");
+            return unit;
+        }
+
+        @Module
+        public EjbJar beans() {
+            EjbJar ejbJar = new EjbJar("movie-beans");
+            ejbJar.addEnterpriseBean(new StatefulBean(MoviesImpl.class));
+            return ejbJar;
+        }
+
+        @Configuration
+        public Properties config() throws Exception {
+            Properties p = new Properties();
+            p.put("movieDatabase", "new://Resource?type=DataSource");
+            p.put("movieDatabase.JdbcDriver", "org.hsqldb.jdbcDriver");
+            p.put("movieDatabase.JdbcUrl", "jdbc:hsqldb:mem:moviedb");
+            return p;
+        }
+
+        @Test
+        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();
+            }
+        }
+    }
+
+# Running
+
+    -------------------------------------------------------
+     T E S T S
+    -------------------------------------------------------
+    Running org.superbiz.composed.MoviesTest
+    INFO - Configuring Service(id=Default Security Service, type=SecurityService, provider-id=Default Security Service)
+    INFO - Configuring Service(id=Default Transaction Manager, type=TransactionManager, provider-id=Default Transaction Manager)
+    INFO - Configuring Service(id=movieDatabase, type=Resource, provider-id=Default JDBC Database)
+    INFO - Configuring enterprise application: /Users/dblevins/examples/application-composer/MoviesTest
+    WARN - Method 'lookup' is not available for 'javax.annotation.Resource'. Probably using an older Runtime.
+    INFO - Configuring Service(id=Default Managed Container, type=Container, provider-id=Default Managed Container)
+    INFO - Auto-creating a container for bean org.superbiz.composed.MoviesTest: Container(type=MANAGED, id=Default Managed Container)
+    INFO - Configuring Service(id=Default Stateful Container, type=Container, provider-id=Default Stateful Container)
+    INFO - Auto-creating a container for bean MoviesImpl: Container(type=STATEFUL, id=Default Stateful Container)
+    INFO - Configuring PersistenceUnit(name=movie-unit)
+    INFO - Auto-creating a Resource with id 'movieDatabaseNonJta' of type 'DataSource for 'movie-unit'.
+    INFO - Configuring Service(id=movieDatabaseNonJta, type=Resource, provider-id=movieDatabase)
+    INFO - Adjusting PersistenceUnit movie-unit <non-jta-data-source> to Resource ID 'movieDatabaseNonJta' from 'movieDatabaseUnmanaged'
+    INFO - Enterprise application "/Users/dblevins/examples/application-composer/MoviesTest" loaded.
+    INFO - Assembling app: /Users/dblevins/examples/application-composer/MoviesTest
+    INFO - PersistenceUnit(name=movie-unit, provider=org.apache.openjpa.persistence.PersistenceProviderImpl) - provider time 449ms
+    INFO - Jndi(name=org.superbiz.composed.MoviesTestLocalBean) --> Ejb(deployment-id=org.superbiz.composed.MoviesTest)
+    INFO - Jndi(name=global/MoviesTest/EjbModule2027711095/MoviesTest!org.superbiz.composed.MoviesTest) --> Ejb(deployment-id=org.superbiz.composed.MoviesTest)
+    INFO - Jndi(name=global/MoviesTest/EjbModule2027711095/MoviesTest) --> Ejb(deployment-id=org.superbiz.composed.MoviesTest)
+    INFO - Jndi(name=MoviesImplLocal) --> Ejb(deployment-id=MoviesImpl)
+    INFO - Jndi(name=global/MoviesTest/movie-beans/MoviesImpl!org.superbiz.composed.Movies) --> Ejb(deployment-id=MoviesImpl)
+    INFO - Jndi(name=global/MoviesTest/movie-beans/MoviesImpl) --> Ejb(deployment-id=MoviesImpl)
+    INFO - Created Ejb(deployment-id=org.superbiz.composed.MoviesTest, ejb-name=MoviesTest, container=Default Managed Container)
+    INFO - Created Ejb(deployment-id=MoviesImpl, ejb-name=MoviesImpl, container=Default Stateful Container)
+    INFO - Started Ejb(deployment-id=org.superbiz.composed.MoviesTest, ejb-name=MoviesTest, container=Default Managed Container)
+    INFO - Started Ejb(deployment-id=MoviesImpl, ejb-name=MoviesImpl, container=Default Stateful Container)
+    INFO - Deployed Application(path=/Users/dblevins/examples/application-composer/MoviesTest)
+    INFO - Undeploying app: /Users/dblevins/examples/application-composer/MoviesTest
+    Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 2.221 sec
+
+    Results :
+
+    Tests run: 1, Failures: 0, Errors: 0, Skipped: 0

Added: openejb/trunk/openejb/examples/applicationexception/README.md
URL: http://svn.apache.org/viewvc/openejb/trunk/openejb/examples/applicationexception/README.md?rev=1190757&view=auto
==============================================================================
--- openejb/trunk/openejb/examples/applicationexception/README.md (added)
+++ openejb/trunk/openejb/examples/applicationexception/README.md Sat Oct 29 04:54:40 2011
@@ -0,0 +1,99 @@
+Title: @ApplicationException annotation
+
+*TODO Improve this document*
+
+# Declaring an @ApplicationException
+
+    import javax.ejb.ApplicationException;
+
+    /**
+     * @version $Rev: 784112 $ $Date: 2009-06-12 06:23:57 -0700 (Fri, 12 Jun 2009) $
+     */
+    @ApplicationException(rollback = true)
+    public abstract class BusinessException extends RuntimeException {
+    }
+
+By default, @ApplicationException is inherited
+
+    public class ValueRequiredException extends BusinessException {
+    }
+
+# In the bean code
+
+    @Stateless
+    public class ThrowBusinessExceptionImpl implements ThrowBusinessException {
+
+        public void throwValueRequiredException() throws BusinessException {
+            throw new ValueRequiredException();
+        }
+
+    }
+
+Normally throwing a `RuntimeException` would cause the container to both rollback the transaction and destroy the bean instance that threw the exception.
+
+As `BusinessException` has been annotated `@ApplicationException(rollback = true)` only the transaction rollback will occur and the bean will not get destroyed.
+
+# The TestCase
+
+    import org.junit.Assert;
+    import org.junit.Before;
+    import org.junit.Test;
+
+    import javax.naming.Context;
+    import javax.naming.InitialContext;
+    import java.util.Properties;
+
+    public class ThrowBusinessExceptionImplTest {
+
+        private InitialContext initialContext;
+
+        @Before
+        public void setUp() throws Exception {
+            Properties properties = new Properties();
+            properties.setProperty(Context.INITIAL_CONTEXT_FACTORY, "org.apache.openejb.client.LocalInitialContextFactory");
+
+            initialContext = new InitialContext(properties);
+        }
+
+        @Test(expected = ValueRequiredException.class)
+        public void testCounterViaRemoteInterface() throws Exception {
+            Object object = initialContext.lookup("ThrowBusinessExceptionImplRemote");
+
+            Assert.assertNotNull(object);
+            Assert.assertTrue(object instanceof ThrowBusinessException);
+            ThrowBusinessException bean = (ThrowBusinessException) object;
+            bean.throwValueRequiredException();
+        }
+    }
+
+# Running
+
+    -------------------------------------------------------
+     T E S T S
+    -------------------------------------------------------
+    Running org.superbiz.appexception.ThrowBusinessExceptionImplTest
+    Apache OpenEJB 4.0.0-beta-1    build: 20111002-04:06
+    http://openejb.apache.org/
+    INFO - openejb.home = /Users/dblevins/examples/applicationexception
+    INFO - openejb.base = /Users/dblevins/examples/applicationexception
+    INFO - Configuring Service(id=Default Security Service, type=SecurityService, provider-id=Default Security Service)
+    INFO - Configuring Service(id=Default Transaction Manager, type=TransactionManager, provider-id=Default Transaction Manager)
+    INFO - Found EjbModule in classpath: /Users/dblevins/examples/applicationexception/target/classes
+    INFO - Beginning load: /Users/dblevins/examples/applicationexception/target/classes
+    INFO - Configuring enterprise application: /Users/dblevins/examples/applicationexception/classpath.ear
+    INFO - Configuring Service(id=Default Stateless Container, type=Container, provider-id=Default Stateless Container)
+    INFO - Auto-creating a container for bean ThrowBusinessExceptionImpl: Container(type=STATELESS, id=Default Stateless Container)
+    INFO - Enterprise application "/Users/dblevins/examples/applicationexception/classpath.ear" loaded.
+    INFO - Assembling app: /Users/dblevins/examples/applicationexception/classpath.ear
+    INFO - Jndi(name=ThrowBusinessExceptionImplRemote) --> Ejb(deployment-id=ThrowBusinessExceptionImpl)
+    INFO - Jndi(name=global/classpath.ear/applicationexception/ThrowBusinessExceptionImpl!org.superbiz.appexception.ThrowBusinessException) --> Ejb(deployment-id=ThrowBusinessExceptionImpl)
+    INFO - Jndi(name=global/classpath.ear/applicationexception/ThrowBusinessExceptionImpl) --> Ejb(deployment-id=ThrowBusinessExceptionImpl)
+    INFO - Created Ejb(deployment-id=ThrowBusinessExceptionImpl, ejb-name=ThrowBusinessExceptionImpl, container=Default Stateless Container)
+    INFO - Started Ejb(deployment-id=ThrowBusinessExceptionImpl, ejb-name=ThrowBusinessExceptionImpl, container=Default Stateless Container)
+    INFO - Deployed Application(path=/Users/dblevins/examples/applicationexception/classpath.ear)
+    Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 1.434 sec
+
+    Results :
+
+    Tests run: 1, Failures: 0, Errors: 0, Skipped: 0
+

Modified: openejb/trunk/openejb/examples/applicationexception/src/test/java/org/superbiz/appexception/ThrowBusinessExceptionImplTest.java
URL: http://svn.apache.org/viewvc/openejb/trunk/openejb/examples/applicationexception/src/test/java/org/superbiz/appexception/ThrowBusinessExceptionImplTest.java?rev=1190757&r1=1190756&r2=1190757&view=diff
==============================================================================
--- openejb/trunk/openejb/examples/applicationexception/src/test/java/org/superbiz/appexception/ThrowBusinessExceptionImplTest.java (original)
+++ openejb/trunk/openejb/examples/applicationexception/src/test/java/org/superbiz/appexception/ThrowBusinessExceptionImplTest.java Sat Oct 29 04:54:40 2011
@@ -24,6 +24,9 @@ import javax.naming.Context;
 import javax.naming.InitialContext;
 import java.util.Properties;
 
+// TODO This test case does not actually show that the bean was not destroyed.  The effect of @ApplicationException is not demonstrated
+// Maybe have two methods that throw runtime exceptions and compare the behavior of both
+// TODO Remote the business interface and show only POJO usage
 public class ThrowBusinessExceptionImplTest {
 
     //START SNIPPET: setup

Modified: openejb/trunk/openejb/examples/async-methods/README.md
URL: http://svn.apache.org/viewvc/openejb/trunk/openejb/examples/async-methods/README.md?rev=1190757&r1=1190756&r2=1190757&view=diff
==============================================================================
--- openejb/trunk/openejb/examples/async-methods/README.md (original)
+++ openejb/trunk/openejb/examples/async-methods/README.md Sat Oct 29 04:54:40 2011
@@ -129,7 +129,7 @@ It waits for the processing to complete 
     [INFO] Final Memory: 13M/145M
     [INFO] ------------------------------------------------------------------------
 
-# How it works<small>under the covers</small>
+# How it works <small>under the covers</small>
 
 Under the covers what makes this work is:
 
@@ -144,7 +144,7 @@ To get progress along the way, simply pa
 
 #Related Examples
 
-For complex asynchronous processing, JavaEE's answer is `MessageDrivenBean`. Have a look at the simple-mdb example
+For complex asynchronous processing, JavaEE's answer is `@MessageDrivenBean`. Have a look at the [simple-mdb](../simple-mdb/README.html) example
 
 [1]: http://download.oracle.com/javase/6/docs/api/java/util/concurrent/Future.html
 [3]: http://download.oracle.com/javase/6/docs/api/java/util/concurrent/Executor.html

Modified: openejb/trunk/openejb/examples/cdi-basic/README.md
URL: http://svn.apache.org/viewvc/openejb/trunk/openejb/examples/cdi-basic/README.md?rev=1190757&r1=1190756&r2=1190757&view=diff
==============================================================================
--- openejb/trunk/openejb/examples/cdi-basic/README.md (original)
+++ openejb/trunk/openejb/examples/cdi-basic/README.md Sat Oct 29 04:54:40 2011
@@ -1,3 +1,5 @@
+Title: CDI @Inject
+
 To use `@Inject`, the first thing you need is a `META-INF/beans.xml` file in the module
 or jar.  This effectively turns on CDI and allows the `@Inject` references to work.
 No `META-INF/beans.xml` no injection, period.  This may seem overly strict,
@@ -11,6 +13,8 @@ referencing `@Inject Faculty` will get t
 is to share the same instance of `Faculty`, see the concept of `scopes` -- this is
 exactly what scopes are for.
 
+# Example
+
 In this example we have an `@Stateless` bean `Course` with an `@Inject` reference to an
 object of type `Faculty`.  When `Course` is created, the container will also create an
 instance of `Faculty`.  The `@PostConstruct` will be called on the `Faculty`,
@@ -23,3 +27,138 @@ into it in its `@Setup` method.  By the 
 all the real work should be done and we should be ready to go.  In the test case we do
 some basic asserts to ensure everything was constructed, all `@PostConstruct` methods
 called and everyting injected.
+
+## Faculty <small>a basic injectable pojo</small>
+
+    public class Faculty {
+
+        private List<String> facultyMembers;
+
+        private String facultyName;
+
+        @PostConstruct
+        public void initialize() {
+            this.facultyMembers = new ArrayList<String>();
+            facultyMembers.add("Ian Schultz");
+            facultyMembers.add("Diane Reyes");
+            facultyName = "Computer Science";
+        }
+
+        public List<String> getFacultyMembers() {
+            return facultyMembers;
+        }
+
+        public String getFacultyName() {
+            return facultyName;
+        }
+
+    }
+
+## Course <small>a simple session bean</small>
+
+    @Stateless
+    public class Course {
+
+        @Inject
+        private Faculty faculty;
+
+        private String courseName;
+
+        private int capacity;
+
+        @PostConstruct
+        private void init() {
+            assert faculty != null;
+
+            // These strings can be externalized
+            // We'll see how to do that later
+            this.courseName = "CDI 101 - Introduction to CDI";
+            this.capacity = 100;
+        }
+
+        public String getCourseName() {
+            return courseName;
+        }
+
+        public int getCapacity() {
+            return capacity;
+        }
+
+        public Faculty getFaculty() {
+            return faculty;
+        }
+    }
+
+# TestCode
+
+    public class CourseTest extends TestCase {
+
+        @EJB
+        private Course course;
+
+        @Before
+        public void setUp() throws Exception {
+            EJBContainer.createEJBContainer().getContext().bind("inject", this);
+        }
+
+        @Test
+        public void test() {
+
+            // Was the EJB injected?
+            assertTrue(course != null);
+
+            // Was the Course @PostConstruct called?
+            assertNotNull(course.getCourseName());
+            assertTrue(course.getCapacity() > 0);
+
+            // Was a Faculty instance injected into Course?
+            final Faculty faculty = course.getFaculty();
+            assertTrue(faculty != null);
+
+            // Was the @PostConstruct called on Faculty?
+            assertEquals(faculty.getFacultyName(), "Computer Science");
+            assertEquals(faculty.getFacultyMembers().size(), 2);
+        }
+    }
+
+# Running
+
+
+    -------------------------------------------------------
+     T E S T S
+    -------------------------------------------------------
+    Running org.superbiz.cdi.basic.CourseTest
+    Apache OpenEJB 4.0.0-beta-1    build: 20111002-04:06
+    http://openejb.apache.org/
+    INFO - openejb.home = /Users/dblevins/examples/cdi-basic
+    INFO - openejb.base = /Users/dblevins/examples/cdi-basic
+    INFO - Using 'javax.ejb.embeddable.EJBContainer=true'
+    INFO - Configuring Service(id=Default Security Service, type=SecurityService, provider-id=Default Security Service)
+    INFO - Configuring Service(id=Default Transaction Manager, type=TransactionManager, provider-id=Default Transaction Manager)
+    INFO - Found EjbModule in classpath: /Users/dblevins/examples/cdi-basic/target/classes
+    INFO - Beginning load: /Users/dblevins/examples/cdi-basic/target/classes
+    INFO - Configuring enterprise application: /Users/dblevins/examples/cdi-basic
+    INFO - Configuring Service(id=Default Managed Container, type=Container, provider-id=Default Managed Container)
+    INFO - Auto-creating a container for bean cdi-basic.Comp: Container(type=MANAGED, id=Default Managed Container)
+    INFO - Configuring Service(id=Default Stateless Container, type=Container, provider-id=Default Stateless Container)
+    INFO - Auto-creating a container for bean Course: Container(type=STATELESS, id=Default Stateless Container)
+    INFO - Enterprise application "/Users/dblevins/examples/cdi-basic" loaded.
+    INFO - Assembling app: /Users/dblevins/examples/cdi-basic
+    INFO - Jndi(name="java:global/cdi-basic/cdi-basic.Comp!org.apache.openejb.BeanContext$Comp")
+    INFO - Jndi(name="java:global/cdi-basic/cdi-basic.Comp")
+    INFO - Jndi(name="java:global/cdi-basic/Course!org.superbiz.cdi.basic.Course")
+    INFO - Jndi(name="java:global/cdi-basic/Course")
+    INFO - Jndi(name="java:global/EjbModule1833350875/org.superbiz.cdi.basic.CourseTest!org.superbiz.cdi.basic.CourseTest")
+    INFO - Jndi(name="java:global/EjbModule1833350875/org.superbiz.cdi.basic.CourseTest")
+    INFO - Created Ejb(deployment-id=Course, ejb-name=Course, container=Default Stateless Container)
+    INFO - Created Ejb(deployment-id=cdi-basic.Comp, ejb-name=cdi-basic.Comp, container=Default Managed Container)
+    INFO - Created Ejb(deployment-id=org.superbiz.cdi.basic.CourseTest, ejb-name=org.superbiz.cdi.basic.CourseTest, container=Default Managed Container)
+    INFO - Started Ejb(deployment-id=Course, ejb-name=Course, container=Default Stateless Container)
+    INFO - Started Ejb(deployment-id=cdi-basic.Comp, ejb-name=cdi-basic.Comp, container=Default Managed Container)
+    INFO - Started Ejb(deployment-id=org.superbiz.cdi.basic.CourseTest, ejb-name=org.superbiz.cdi.basic.CourseTest, container=Default Managed Container)
+    INFO - Deployed Application(path=/Users/dblevins/examples/cdi-basic)
+    Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 1.126 sec
+
+    Results :
+
+    Tests run: 1, Failures: 0, Errors: 0, Skipped: 0