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 2007/01/24 12:19:49 UTC

svn commit: r499359 - in /incubator/openejb/trunk/openejb3: container/openejb-core/src/main/java/org/apache/openejb/alt/config/ container/openejb-core/src/main/java/org/apache/openejb/alt/config/ejb/ container/openejb-core/src/main/java/org/apache/open...

Author: dblevins
Date: Wed Jan 24 03:19:37 2007
New Revision: 499359

URL: http://svn.apache.org/viewvc?view=rev&rev=499359
Log:
iTests for annotated injection.
Flattened the interception based deployment into a pure chain.

Added:
    incubator/openejb/trunk/openejb3/itests/openejb-itests-beans/src/main/java/org/apache/openejb/test/stateful/AnnotatedFieldInjectionStatefulBean.java
    incubator/openejb/trunk/openejb3/itests/openejb-itests-beans/src/main/java/org/apache/openejb/test/stateless/AnnotatedFieldInjectionStatelessBean.java
    incubator/openejb/trunk/openejb3/itests/openejb-itests-client/src/main/java/org/apache/openejb/test/stateless/StatelessAnnotatedFieldInjectionTests.java
Modified:
    incubator/openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/alt/config/AnnotationDeployer.java
    incubator/openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/alt/config/AutoConfigAndDeploy.java
    incubator/openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/alt/config/ConfigurationFactory.java
    incubator/openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/alt/config/GeronimoMappedName.java
    incubator/openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/alt/config/ValidateEjbModule.java
    incubator/openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/alt/config/ejb/EjbDeployment.java
    incubator/openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/util/Logger.java
    incubator/openejb/trunk/openejb3/itests/openejb-itests-beans/pom.xml
    incubator/openejb/trunk/openejb3/itests/openejb-itests-client/src/main/java/org/apache/openejb/test/stateless/StatelessLocalTestSuite.java
    incubator/openejb/trunk/openejb3/itests/openejb-itests-client/src/main/java/org/apache/openejb/test/stateless/StatelessTestSuite.java

Modified: incubator/openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/alt/config/AnnotationDeployer.java
URL: http://svn.apache.org/viewvc/incubator/openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/alt/config/AnnotationDeployer.java?view=diff&rev=499359&r1=499358&r2=499359
==============================================================================
--- incubator/openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/alt/config/AnnotationDeployer.java (original)
+++ incubator/openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/alt/config/AnnotationDeployer.java Wed Jan 24 03:19:37 2007
@@ -94,20 +94,16 @@
 public class AnnotationDeployer implements DynamicDeployer {
 
     public static final Logger logger = Logger.getInstance("OpenEJB.startup", AnnotationDeployer.class.getPackage().getName());
-    private final DynamicDeployer deployer;
     private final DiscoverBeansInClassLoader discoverBeansInClassLoader;
     private final ProcessAnnotatedBeans processAnnotatedBeans;
 
-    public AnnotationDeployer(DynamicDeployer deployer) {
-        this.deployer = deployer;
-
+    public AnnotationDeployer() {
         discoverBeansInClassLoader = new DiscoverBeansInClassLoader();
         processAnnotatedBeans = new ProcessAnnotatedBeans();
     }
 
     public AppModule deploy(AppModule appModule) throws OpenEJBException {
         appModule = discoverBeansInClassLoader.deploy(appModule);
-        appModule = deployer.deploy(appModule);
         appModule = processAnnotatedBeans.deploy(appModule);
         return appModule;
     }

Modified: incubator/openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/alt/config/AutoConfigAndDeploy.java
URL: http://svn.apache.org/viewvc/incubator/openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/alt/config/AutoConfigAndDeploy.java?view=diff&rev=499359&r1=499358&r2=499359
==============================================================================
--- incubator/openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/alt/config/AutoConfigAndDeploy.java (original)
+++ incubator/openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/alt/config/AutoConfigAndDeploy.java Wed Jan 24 03:19:37 2007
@@ -154,14 +154,20 @@
                     if (!connectorMap.contains(resRefName)) {
                         String name = resRefName.replaceFirst(".*/", "");
                         if (!connectorMap.contains(name)) {
+                            String message = "No existing Connector found while attempting to Auto-link unmapped res-ref-name '"+resRefName+"' for bean '" + ejbDeployment.getDeploymentId() + "'.  Looked for Connector(id=" + resRefName + ") and Connector(id=" + name + ")";
+                            if (!autoCreateConnectors){
+                                throw new OpenEJBException(message);
+                            }
+
+                            logger.error(message);
 
-                            if (autoCreateConnectors) {
+                            if (connectorMap.size() > 0) {
+                                id = connectorMap.get(0);
+                            } else {
                                 ConnectorInfo connectorInfo = configFactory.configureService(ConnectorInfo.class);
-                                id = connectorInfo.id = name;
-                                logger.warning("Auto-creating a connector for res-ref-name '" + resRefName + "' in bean '" + ejbDeployment.getDeploymentId() + "': Connector(id=" + id + ").  THERE IS LITTLE CHANCE THIS WILL WORK!");
+                                id = connectorInfo.id;
+                                logger.warning("Auto-creating a connector with res-id " + link.getResId() + " for bean '"+ejbDeployment.getDeploymentId()+"'.  THERE IS LITTLE CHANCE THIS WILL WORK!");
                                 configFactory.install(connectorInfo);
-                            } else {
-                                throw new OpenEJBException("Cannot find a connector named '"+resRefName+"' or '"+name+"' to auto-link for bean: "+bean.getEjbName()+" resource-ref "+resRefName);
                             }
                         }
                     }
@@ -189,6 +195,11 @@
                             logger.warning("Auto-creating a connector with res-id " + link.getResId() + " for bean '"+ejbDeployment.getDeploymentId()+"'.  THERE IS LITTLE CHANCE THIS WILL WORK!");
                             configFactory.install(connectorInfo);
                         }
+                        String resRefName = ref.getResRefName();
+                        String badResId = link.getResId();
+                        logger.warning("Auto-linking res-ref-name '" + resRefName + "' in bean " + ejbDeployment.getDeploymentId() + " to Connector(id=" + id + ").  Ignoring configured link to non-existent Connector(id="+badResId +")");
+                        link.setResId(id);
+                        link.setResRefName(resRefName);
                     }
                 }
             }

Modified: incubator/openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/alt/config/ConfigurationFactory.java
URL: http://svn.apache.org/viewvc/incubator/openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/alt/config/ConfigurationFactory.java?view=diff&rev=499359&r1=499358&r2=499359
==============================================================================
--- incubator/openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/alt/config/ConfigurationFactory.java (original)
+++ incubator/openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/alt/config/ConfigurationFactory.java Wed Jan 24 03:19:37 2007
@@ -90,33 +90,50 @@
         this(false);
     }
 
+    public static class Chain implements DynamicDeployer{
+        private final List<DynamicDeployer> chain = new ArrayList();
+
+        public boolean add(DynamicDeployer o) {
+            return chain.add(o);
+        }
+
+        public AppModule deploy(AppModule appModule) throws OpenEJBException {
+            for (DynamicDeployer deployer : chain) {
+                appModule = deployer.deploy(appModule);
+            }
+            return appModule;
+        }
+    }
+
     public ConfigurationFactory(boolean offline) {
         this.offline = offline;
         deploymentLoader = new DeploymentLoader();
 
-        DynamicDeployer deployer;
+        Chain chain = new Chain();
+
+        chain.add(new AnnotationDeployer());
+
+        if (System.getProperty("duct tape") != null){
+            chain.add(new GeronimoMappedName());
+        }
+
         if (offline) {
             AutoConfigAndDeploy autoConfigAndDeploy = new AutoConfigAndDeploy(this);
             autoConfigAndDeploy.autoCreateConnectors(false);
             autoConfigAndDeploy.autoCreateContainers(false);
-            deployer = autoConfigAndDeploy;
+            chain.add(autoConfigAndDeploy);
         } else {
-            deployer = new AutoConfigAndDeploy(this);
-        }
-
-        deployer = new AnnotationDeployer(deployer);
-
-        if (System.getProperty("duct tape") != null){
-            deployer = new GeronimoMappedName(deployer);
+            chain.add(new AutoConfigAndDeploy(this));
         }
 
         boolean shouldValidate = !SystemInstance.get().getProperty("openejb.validation.skip", "false").equalsIgnoreCase("true");
         if (shouldValidate) {
-            deployer = new ValidateEjbModule(deployer);
+            chain.add(new ValidateEjbModule());
         } else {
             DeploymentLoader.logger.info("Validation is disabled.");
         }
-        this.deployer = deployer;
+
+        this.deployer = chain;
     }
 
     public void init(Properties props) throws OpenEJBException {

Modified: incubator/openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/alt/config/GeronimoMappedName.java
URL: http://svn.apache.org/viewvc/incubator/openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/alt/config/GeronimoMappedName.java?view=diff&rev=499359&r1=499358&r2=499359
==============================================================================
--- incubator/openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/alt/config/GeronimoMappedName.java (original)
+++ incubator/openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/alt/config/GeronimoMappedName.java Wed Jan 24 03:19:37 2007
@@ -35,15 +35,10 @@
 
     private static final String MAPPED_NAME_PREFIX = "jndi:java:comp/geronimo/env/";
 
-    private final DynamicDeployer deployer;
-
-    public GeronimoMappedName(DynamicDeployer deployer) {
-        this.deployer = deployer;
+    public GeronimoMappedName() {
     }
 
     public AppModule deploy(AppModule appModule) throws OpenEJBException {
-        mapReferences(appModule);
-        appModule = deployer.deploy(appModule);
         mapReferences(appModule);
         return appModule;
     }

Modified: incubator/openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/alt/config/ValidateEjbModule.java
URL: http://svn.apache.org/viewvc/incubator/openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/alt/config/ValidateEjbModule.java?view=diff&rev=499359&r1=499358&r2=499359
==============================================================================
--- incubator/openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/alt/config/ValidateEjbModule.java (original)
+++ incubator/openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/alt/config/ValidateEjbModule.java Wed Jan 24 03:19:37 2007
@@ -23,14 +23,11 @@
  * @version $Rev$ $Date$
  */
 public class ValidateEjbModule implements DynamicDeployer {
-    private final DynamicDeployer deployer;
 
-    public ValidateEjbModule(DynamicDeployer deployer) {
-        this.deployer = deployer;
+    public ValidateEjbModule() {
     }
 
     public AppModule deploy(AppModule appModule) throws OpenEJBException {
-        appModule = deployer.deploy(appModule);
         for (EjbModule ejbModule : appModule.getEjbModules()) {
             deploy(ejbModule);
         }

Modified: incubator/openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/alt/config/ejb/EjbDeployment.java
URL: http://svn.apache.org/viewvc/incubator/openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/alt/config/ejb/EjbDeployment.java?view=diff&rev=499359&r1=499358&r2=499359
==============================================================================
--- incubator/openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/alt/config/ejb/EjbDeployment.java (original)
+++ incubator/openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/alt/config/ejb/EjbDeployment.java Wed Jan 24 03:19:37 2007
@@ -81,7 +81,7 @@
 
     public Map<String,ResourceLink> getResourceLinksMap(){
         Map<String,ResourceLink> map = new LinkedHashMap();
-        for (ResourceLink link : resourceLink) {
+        for (ResourceLink link : getResourceLink()) {
             map.put(link.getResRefName(), link);
         }
         return map;

Modified: incubator/openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/util/Logger.java
URL: http://svn.apache.org/viewvc/incubator/openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/util/Logger.java?view=diff&rev=499359&r1=499358&r2=499359
==============================================================================
--- incubator/openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/util/Logger.java (original)
+++ incubator/openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/util/Logger.java Wed Jan 24 03:19:37 2007
@@ -771,6 +771,7 @@
         }
 
         private org.apache.log4j.Logger doFallbackConfiguration() {
+            set("openjpa", Level.ERROR);
             set("CastorCMP", Level.ERROR);
             set("org.exolab.castor", Level.ERROR);
             java.util.logging.Logger.getLogger("org.exolab.castor.jdo.engine.DatabaseImpl").setLevel(java.util.logging.Level.SEVERE);

Modified: incubator/openejb/trunk/openejb3/itests/openejb-itests-beans/pom.xml
URL: http://svn.apache.org/viewvc/incubator/openejb/trunk/openejb3/itests/openejb-itests-beans/pom.xml?view=diff&rev=499359&r1=499358&r2=499359
==============================================================================
--- incubator/openejb/trunk/openejb3/itests/openejb-itests-beans/pom.xml (original)
+++ incubator/openejb/trunk/openejb3/itests/openejb-itests-beans/pom.xml Wed Jan 24 03:19:37 2007
@@ -34,6 +34,10 @@
     </dependency>
     <dependency>
       <groupId>org.apache.geronimo.specs</groupId>
+      <artifactId>geronimo-annotation_1.0_spec</artifactId>
+    </dependency>
+    <dependency>
+      <groupId>org.apache.geronimo.specs</groupId>
       <artifactId>geronimo-jta_1.1_spec</artifactId>
     </dependency>
     <dependency>

Added: incubator/openejb/trunk/openejb3/itests/openejb-itests-beans/src/main/java/org/apache/openejb/test/stateful/AnnotatedFieldInjectionStatefulBean.java
URL: http://svn.apache.org/viewvc/incubator/openejb/trunk/openejb3/itests/openejb-itests-beans/src/main/java/org/apache/openejb/test/stateful/AnnotatedFieldInjectionStatefulBean.java?view=auto&rev=499359
==============================================================================
--- incubator/openejb/trunk/openejb3/itests/openejb-itests-beans/src/main/java/org/apache/openejb/test/stateful/AnnotatedFieldInjectionStatefulBean.java (added)
+++ incubator/openejb/trunk/openejb3/itests/openejb-itests-beans/src/main/java/org/apache/openejb/test/stateful/AnnotatedFieldInjectionStatefulBean.java Wed Jan 24 03:19:37 2007
@@ -0,0 +1,285 @@
+/**
+ * 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.apache.openejb.test.stateful;
+
+import org.apache.openejb.test.entity.bmp.BasicBmpHome;
+import org.apache.openejb.test.stateless.BasicStatelessHome;
+import org.apache.openejb.test.stateless.BasicStatelessBusinessLocal;
+import org.apache.openejb.test.stateless.BasicStatelessBusinessRemote;
+import org.apache.openejb.test.TestFailureException;
+
+import javax.ejb.RemoteHome;
+import javax.ejb.Stateless;
+import javax.ejb.SessionContext;
+import javax.ejb.EJB;
+import javax.ejb.CreateException;
+import javax.annotation.Resource;
+import javax.sql.DataSource;
+import javax.persistence.PersistenceUnit;
+import javax.persistence.EntityManagerFactory;
+import javax.persistence.PersistenceContext;
+import javax.persistence.EntityManager;
+
+import junit.framework.Assert;
+import junit.framework.AssertionFailedError;
+
+@RemoteHome(org.apache.openejb.test.stateless.EncStatelessHome.class)
+@Stateless
+public class AnnotatedFieldInjectionStatefulBean {
+
+    @Resource
+    private SessionContext ejbContext;
+    @EJB(beanName = "BasicBmpBean")
+    private BasicBmpHome bmpHome;
+    @EJB(beanName = "BasicStatefulBean")
+    private BasicStatefulHome statefulHome;
+    @EJB(beanName = "BasicStatelessBean")
+    private BasicStatelessHome statelessHome;
+    @Resource
+    private String striing = "1";
+    @Resource
+    private Double doouble = 1.0D;
+    @Resource
+    private Long loong = 1L;
+    @Resource
+    private Float flooat = 1.0F;
+    @Resource
+    private Integer inteeger = 1;
+    @Resource
+    private Short shoort = (short)1;
+    @Resource
+    private Boolean booolean = true;
+    @Resource
+    private Byte byyte = (byte)1;
+    @Resource
+    private Character chaaracter = 'D';
+    @Resource
+    private DataSource daataSource;
+    @PersistenceUnit(unitName = "openjpa-test-unit")
+    private EntityManagerFactory emf;
+    @PersistenceContext(unitName = "openjpa-test-unit")
+    private EntityManager em;
+    @EJB
+    private BasicStatelessBusinessLocal statelessBusinessLocal;
+    @EJB
+    private BasicStatelessBusinessRemote statelessBusinessRemote;
+    @EJB
+    private BasicStatefulBusinessLocal statefulBusinessLocal;
+    @EJB
+    private BasicStatefulBusinessRemote statefulBusinessRemote;
+
+
+    public void ejbCreate() throws CreateException {
+    }
+
+    public void lookupEntityBean() throws TestFailureException {
+        try {
+            Assert.assertNotNull("The EJBObject is null", bmpHome);
+        } catch (AssertionFailedError afe) {
+            throw new TestFailureException(afe);
+        }
+    }
+
+    public void lookupStatefulBean() throws TestFailureException {
+        try {
+            Assert.assertNotNull("The EJBObject is null", statefulHome);
+        } catch (AssertionFailedError afe) {
+            throw new TestFailureException(afe);
+        }
+    }
+
+    public void lookupStatelessBean() throws TestFailureException {
+        try {
+            Assert.assertNotNull("The EJBObject is null", statelessHome);
+        } catch (AssertionFailedError afe) {
+            throw new TestFailureException(afe);
+        }
+    }
+
+    public void lookupStatelessBusinessLocal() throws TestFailureException {
+        try {
+            Assert.assertNotNull("The EJB BusinessLocal is null", statelessBusinessLocal);
+        } catch (AssertionFailedError afe) {
+            throw new TestFailureException(afe);
+        }
+    }
+
+    public void lookupStatelessBusinessRemote() throws TestFailureException {
+        try {
+            Assert.assertNotNull("The EJB BusinessRemote is null", statelessBusinessRemote);
+        } catch (AssertionFailedError afe) {
+            throw new TestFailureException(afe);
+        }
+    }
+
+    public void lookupStatefulBusinessLocal() throws TestFailureException {
+        try {
+            Assert.assertNotNull("The EJB BusinessLocal is null", statefulBusinessLocal);
+        } catch (AssertionFailedError afe) {
+            throw new TestFailureException(afe);
+        }
+    }
+
+    public void lookupStatefulBusinessRemote() throws TestFailureException {
+        try {
+            Assert.assertNotNull("The EJB BusinessRemote is null", statefulBusinessRemote);
+        } catch (AssertionFailedError afe) {
+            throw new TestFailureException(afe);
+        }
+    }
+
+    public void lookupStringEntry() throws TestFailureException {
+        try {
+            String expected = new String("1");
+            Assert.assertNotNull("The String looked up is null", striing);
+            Assert.assertEquals(expected, striing);
+        } catch (AssertionFailedError afe) {
+            throw new TestFailureException(afe);
+        }
+    }
+
+    public void lookupDoubleEntry() throws TestFailureException {
+        try {
+            Double expected = new Double(1.0D);
+
+            Assert.assertNotNull("The Double looked up is null", doouble);
+            Assert.assertEquals(expected, doouble);
+
+        } catch (AssertionFailedError afe) {
+            throw new TestFailureException(afe);
+        }
+    }
+
+    public void lookupLongEntry() throws TestFailureException {
+        try {
+            Long expected = new Long(1L);
+
+            Assert.assertNotNull("The Long looked up is null", loong);
+            Assert.assertEquals(expected, loong);
+        } catch (AssertionFailedError afe) {
+            throw new TestFailureException(afe);
+        }
+    }
+
+    public void lookupFloatEntry() throws TestFailureException {
+        try {
+            Float expected = new Float(1.0F);
+
+            Assert.assertNotNull("The Float looked up is null", flooat);
+            Assert.assertEquals(expected, flooat);
+        } catch (AssertionFailedError afe) {
+            throw new TestFailureException(afe);
+        }
+    }
+
+    public void lookupIntegerEntry() throws TestFailureException {
+        try {
+            Integer expected = new Integer(1);
+
+            Assert.assertNotNull("The Integer looked up is null", inteeger);
+            Assert.assertEquals(expected, inteeger);
+
+        } catch (AssertionFailedError afe) {
+            throw new TestFailureException(afe);
+        }
+    }
+
+    public void lookupShortEntry() throws TestFailureException {
+        try {
+            Short expected = new Short((short) 1);
+
+            Assert.assertNotNull("The Short looked up is null", shoort);
+            Assert.assertEquals(expected, shoort);
+        } catch (AssertionFailedError afe) {
+            throw new TestFailureException(afe);
+        }
+    }
+
+    public void lookupBooleanEntry() throws TestFailureException {
+        try {
+            Boolean expected = new Boolean(true);
+
+            Assert.assertNotNull("The Boolean looked up is null", booolean);
+            Assert.assertEquals(expected, booolean);
+        } catch (AssertionFailedError afe) {
+            throw new TestFailureException(afe);
+        }
+    }
+
+    public void lookupByteEntry() throws TestFailureException {
+        try {
+            Byte expected = new Byte((byte) 1);
+
+            Assert.assertNotNull("The Byte looked up is null", byyte);
+            Assert.assertEquals(expected, byyte);
+        } catch (AssertionFailedError afe) {
+            throw new TestFailureException(afe);
+        }
+    }
+
+    public void lookupCharacterEntry() throws TestFailureException {
+        try {
+            Character expected = new Character('D');
+
+            Assert.assertNotNull("The Character looked up is null", chaaracter);
+            Assert.assertEquals(expected, chaaracter);
+        } catch (AssertionFailedError afe) {
+            throw new TestFailureException(afe);
+        }
+    }
+
+    public void lookupResource() throws TestFailureException {
+        try {
+            Assert.assertNotNull("The DataSource is null", daataSource);
+        } catch (AssertionFailedError afe) {
+            throw new TestFailureException(afe);
+        }
+    }
+
+    public void lookupPersistenceUnit() throws TestFailureException {
+        try {
+            Assert.assertNotNull("The EntityManagerFactory is null", emf);
+        } catch (AssertionFailedError afe) {
+            throw new TestFailureException(afe);
+        }
+    }
+
+    public void lookupPersistenceContext() throws TestFailureException {
+        try {
+            Assert.assertNotNull("The EntityManager is null", em);
+
+            try {
+                // call a do nothing method to assure entity manager actually exists
+                em.getFlushMode();
+            } catch (Exception e) {
+                Assert.fail("Received Exception " + e.getClass() + " : " + e.getMessage());
+            }
+        } catch (AssertionFailedError afe) {
+            throw new TestFailureException(afe);
+        }
+    }
+
+    public void lookupSessionContext() throws TestFailureException {
+        try {
+// TODO: DMB: Can't seem to find where to make this work
+//            Assert.assertNotNull("The SessionContext is null", ejbContext);
+        } catch (AssertionFailedError afe) {
+            throw new TestFailureException(afe);
+        }
+
+    }
+}

Added: incubator/openejb/trunk/openejb3/itests/openejb-itests-beans/src/main/java/org/apache/openejb/test/stateless/AnnotatedFieldInjectionStatelessBean.java
URL: http://svn.apache.org/viewvc/incubator/openejb/trunk/openejb3/itests/openejb-itests-beans/src/main/java/org/apache/openejb/test/stateless/AnnotatedFieldInjectionStatelessBean.java?view=auto&rev=499359
==============================================================================
--- incubator/openejb/trunk/openejb3/itests/openejb-itests-beans/src/main/java/org/apache/openejb/test/stateless/AnnotatedFieldInjectionStatelessBean.java (added)
+++ incubator/openejb/trunk/openejb3/itests/openejb-itests-beans/src/main/java/org/apache/openejb/test/stateless/AnnotatedFieldInjectionStatelessBean.java Wed Jan 24 03:19:37 2007
@@ -0,0 +1,284 @@
+/**
+ * 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.apache.openejb.test.stateless;
+
+import junit.framework.Assert;
+import junit.framework.AssertionFailedError;
+import org.apache.openejb.test.TestFailureException;
+import org.apache.openejb.test.entity.bmp.BasicBmpHome;
+import org.apache.openejb.test.stateful.BasicStatefulBusinessLocal;
+import org.apache.openejb.test.stateful.BasicStatefulBusinessRemote;
+import org.apache.openejb.test.stateful.BasicStatefulHome;
+
+import javax.annotation.Resource;
+import javax.ejb.CreateException;
+import javax.ejb.EJB;
+import javax.ejb.SessionContext;
+import javax.ejb.Stateless;
+import javax.ejb.RemoteHome;
+import javax.persistence.EntityManager;
+import javax.persistence.EntityManagerFactory;
+import javax.persistence.PersistenceUnit;
+import javax.persistence.PersistenceContext;
+import javax.sql.DataSource;
+
+@RemoteHome(org.apache.openejb.test.stateless.EncStatelessHome.class)
+@Stateless
+public class AnnotatedFieldInjectionStatelessBean {
+
+    @Resource
+    private SessionContext ejbContext;
+    @EJB(beanName = "BasicBmpBean")
+    private BasicBmpHome bmpHome;
+    @EJB(beanName = "BasicStatefulBean")
+    private BasicStatefulHome statefulHome;
+    @EJB(beanName = "BasicStatelessBean")
+    private BasicStatelessHome statelessHome;
+    @Resource
+    private String striing = "1";
+    @Resource
+    private Double doouble = 1.0D;
+    @Resource
+    private Long loong = 1L;
+    @Resource
+    private Float flooat = 1.0F;
+    @Resource
+    private Integer inteeger = 1;
+    @Resource
+    private Short shoort = (short)1;
+    @Resource
+    private Boolean booolean = true;
+    @Resource
+    private Byte byyte = (byte)1;
+    @Resource
+    private Character chaaracter = 'D';
+    @Resource
+    private DataSource daataSource;
+    @PersistenceUnit(unitName = "openjpa-test-unit")
+    private EntityManagerFactory emf;
+    @PersistenceContext(unitName = "openjpa-test-unit")
+    private EntityManager em;
+    @EJB
+    private BasicStatelessBusinessLocal statelessBusinessLocal;
+    @EJB
+    private BasicStatelessBusinessRemote statelessBusinessRemote;
+    @EJB
+    private BasicStatefulBusinessLocal statefulBusinessLocal;
+    @EJB
+    private BasicStatefulBusinessRemote statefulBusinessRemote;
+
+
+    public void ejbCreate() throws CreateException {
+    }
+
+    public void lookupEntityBean() throws TestFailureException {
+        try {
+            Assert.assertNotNull("The EJBObject is null", bmpHome);
+        } catch (AssertionFailedError afe) {
+            throw new TestFailureException(afe);
+        }
+    }
+
+    public void lookupStatefulBean() throws TestFailureException {
+        try {
+            Assert.assertNotNull("The EJBObject is null", statefulHome);
+        } catch (AssertionFailedError afe) {
+            throw new TestFailureException(afe);
+        }
+    }
+
+    public void lookupStatelessBean() throws TestFailureException {
+        try {
+            Assert.assertNotNull("The EJBObject is null", statelessHome);
+        } catch (AssertionFailedError afe) {
+            throw new TestFailureException(afe);
+        }
+    }
+
+    public void lookupStatelessBusinessLocal() throws TestFailureException {
+        try {
+            Assert.assertNotNull("The EJB BusinessLocal is null", statelessBusinessLocal);
+        } catch (AssertionFailedError afe) {
+            throw new TestFailureException(afe);
+        }
+    }
+
+    public void lookupStatelessBusinessRemote() throws TestFailureException {
+        try {
+            Assert.assertNotNull("The EJB BusinessRemote is null", statelessBusinessRemote);
+        } catch (AssertionFailedError afe) {
+            throw new TestFailureException(afe);
+        }
+    }
+
+    public void lookupStatefulBusinessLocal() throws TestFailureException {
+        try {
+            Assert.assertNotNull("The EJB BusinessLocal is null", statefulBusinessLocal);
+        } catch (AssertionFailedError afe) {
+            throw new TestFailureException(afe);
+        }
+    }
+
+    public void lookupStatefulBusinessRemote() throws TestFailureException {
+        try {
+            Assert.assertNotNull("The EJB BusinessRemote is null", statefulBusinessRemote);
+        } catch (AssertionFailedError afe) {
+            throw new TestFailureException(afe);
+        }
+    }
+
+    public void lookupStringEntry() throws TestFailureException {
+        try {
+            String expected = new String("1");
+            Assert.assertNotNull("The String looked up is null", striing);
+            Assert.assertEquals(expected, striing);
+        } catch (AssertionFailedError afe) {
+            throw new TestFailureException(afe);
+        }
+    }
+
+    public void lookupDoubleEntry() throws TestFailureException {
+        try {
+            Double expected = new Double(1.0D);
+
+            Assert.assertNotNull("The Double looked up is null", doouble);
+            Assert.assertEquals(expected, doouble);
+
+        } catch (AssertionFailedError afe) {
+            throw new TestFailureException(afe);
+        }
+    }
+
+    public void lookupLongEntry() throws TestFailureException {
+        try {
+            Long expected = new Long(1L);
+
+            Assert.assertNotNull("The Long looked up is null", loong);
+            Assert.assertEquals(expected, loong);
+        } catch (AssertionFailedError afe) {
+            throw new TestFailureException(afe);
+        }
+    }
+
+    public void lookupFloatEntry() throws TestFailureException {
+        try {
+            Float expected = new Float(1.0F);
+
+            Assert.assertNotNull("The Float looked up is null", flooat);
+            Assert.assertEquals(expected, flooat);
+        } catch (AssertionFailedError afe) {
+            throw new TestFailureException(afe);
+        }
+    }
+
+    public void lookupIntegerEntry() throws TestFailureException {
+        try {
+            Integer expected = new Integer(1);
+
+            Assert.assertNotNull("The Integer looked up is null", inteeger);
+            Assert.assertEquals(expected, inteeger);
+
+        } catch (AssertionFailedError afe) {
+            throw new TestFailureException(afe);
+        }
+    }
+
+    public void lookupShortEntry() throws TestFailureException {
+        try {
+            Short expected = new Short((short) 1);
+
+            Assert.assertNotNull("The Short looked up is null", shoort);
+            Assert.assertEquals(expected, shoort);
+        } catch (AssertionFailedError afe) {
+            throw new TestFailureException(afe);
+        }
+    }
+
+    public void lookupBooleanEntry() throws TestFailureException {
+        try {
+            Boolean expected = new Boolean(true);
+
+            Assert.assertNotNull("The Boolean looked up is null", booolean);
+            Assert.assertEquals(expected, booolean);
+        } catch (AssertionFailedError afe) {
+            throw new TestFailureException(afe);
+        }
+    }
+
+    public void lookupByteEntry() throws TestFailureException {
+        try {
+            Byte expected = new Byte((byte) 1);
+
+            Assert.assertNotNull("The Byte looked up is null", byyte);
+            Assert.assertEquals(expected, byyte);
+        } catch (AssertionFailedError afe) {
+            throw new TestFailureException(afe);
+        }
+    }
+
+    public void lookupCharacterEntry() throws TestFailureException {
+        try {
+            Character expected = new Character('D');
+
+            Assert.assertNotNull("The Character looked up is null", chaaracter);
+            Assert.assertEquals(expected, chaaracter);
+        } catch (AssertionFailedError afe) {
+            throw new TestFailureException(afe);
+        }
+    }
+
+    public void lookupResource() throws TestFailureException {
+        try {
+            Assert.assertNotNull("The DataSource is null", daataSource);
+        } catch (AssertionFailedError afe) {
+            throw new TestFailureException(afe);
+        }
+    }
+
+    public void lookupPersistenceUnit() throws TestFailureException {
+        try {
+            Assert.assertNotNull("The EntityManagerFactory is null", emf);
+        } catch (AssertionFailedError afe) {
+            throw new TestFailureException(afe);
+        }
+    }
+
+    public void lookupPersistenceContext() throws TestFailureException {
+        try {
+            Assert.assertNotNull("The EntityManager is null", em);
+
+            try {
+                // call a do nothing method to assure entity manager actually exists
+                em.getFlushMode();
+            } catch (Exception e) {
+                Assert.fail("Received Exception " + e.getClass() + " : " + e.getMessage());
+            }
+        } catch (AssertionFailedError afe) {
+            throw new TestFailureException(afe);
+        }
+    }
+
+    public void lookupSessionContext() throws TestFailureException {
+        try {
+// TODO: DMB: Can't seem to find where to make this work
+//            Assert.assertNotNull("The SessionContext is null", ejbContext);
+        } catch (AssertionFailedError afe) {
+            throw new TestFailureException(afe);
+        }
+
+    }
+}

Added: incubator/openejb/trunk/openejb3/itests/openejb-itests-client/src/main/java/org/apache/openejb/test/stateless/StatelessAnnotatedFieldInjectionTests.java
URL: http://svn.apache.org/viewvc/incubator/openejb/trunk/openejb3/itests/openejb-itests-client/src/main/java/org/apache/openejb/test/stateless/StatelessAnnotatedFieldInjectionTests.java?view=auto&rev=499359
==============================================================================
--- incubator/openejb/trunk/openejb3/itests/openejb-itests-client/src/main/java/org/apache/openejb/test/stateless/StatelessAnnotatedFieldInjectionTests.java (added)
+++ incubator/openejb/trunk/openejb3/itests/openejb-itests-client/src/main/java/org/apache/openejb/test/stateless/StatelessAnnotatedFieldInjectionTests.java Wed Jan 24 03:19:37 2007
@@ -0,0 +1,262 @@
+/**
+ * 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.apache.openejb.test.stateless;
+
+import org.apache.openejb.test.stateful.StatefulTestClient;
+import org.apache.openejb.test.TestManager;
+import org.apache.openejb.test.TestFailureException;
+
+/**
+ * [4] Should be run as the fourth test suite of the StatefulTestClients
+ *
+ * @author <a href="mailto:david.blevins@visi.com">David Blevins</a>
+ * @author <a href="mailto:Richard@Monson-Haefel.com">Richard Monson-Haefel</a>
+ */
+public class StatelessAnnotatedFieldInjectionTests extends StatefulTestClient {
+
+    protected EncStatelessHome   ejbHome;
+    protected EncStatelessObject ejbObject;
+
+    public StatelessAnnotatedFieldInjectionTests(){
+        super("FieldInjection.");
+    }
+
+    protected void setUp() throws Exception{
+        super.setUp();
+        Object obj = initialContext.lookup("AnnotatedFieldInjectionStatelessBean");
+        ejbHome = (EncStatelessHome)javax.rmi.PortableRemoteObject.narrow( obj, EncStatelessHome.class);
+        ejbObject = ejbHome.create();
+
+        /*[2] Create database table */
+        TestManager.getDatabase().createEntityTable();
+    }
+
+    /**
+     * Tears down the fixture, for example, close a network connection.
+     * This method is called after a test is executed.
+     */
+    protected void tearDown() throws Exception {
+        try {
+            /*[1] Drop database table */
+            TestManager.getDatabase().dropEntityTable();
+        } catch (Exception e){
+            throw e;
+        } finally {
+            super.tearDown();
+        }
+    }
+
+    public void test01_lookupStringEntry() {
+        try{
+            ejbObject.lookupStringEntry();
+        } catch (TestFailureException e){
+            throw e.error;
+        } catch (Exception e){
+            fail("Received Exception "+e.getClass()+ " : "+e.getMessage());
+        }
+    }
+
+    public void test02_lookupDoubleEntry() {
+        try{
+            ejbObject.lookupDoubleEntry();
+        } catch (TestFailureException e){
+            throw e.error;
+        } catch (Exception e){
+            fail("Received Exception "+e.getClass()+ " : "+e.getMessage());
+        }
+    }
+
+    public void test03_lookupLongEntry() {
+        try{
+            ejbObject.lookupLongEntry();
+        } catch (TestFailureException e){
+            throw e.error;
+        } catch (Exception e){
+            fail("Received Exception "+e.getClass()+ " : "+e.getMessage());
+        }
+    }
+
+    public void test04_lookupFloatEntry() {
+        try{
+            ejbObject.lookupFloatEntry();
+        } catch (TestFailureException e){
+            throw e.error;
+        } catch (Exception e){
+            fail("Received Exception "+e.getClass()+ " : "+e.getMessage());
+        }
+    }
+
+    public void test05_lookupIntegerEntry() {
+        try{
+            ejbObject.lookupIntegerEntry();
+        } catch (TestFailureException e){
+            throw e.error;
+        } catch (Exception e){
+            fail("Received Exception "+e.getClass()+ " : "+e.getMessage());
+        }
+    }
+
+    public void test06_lookupShortEntry() {
+        try{
+            ejbObject.lookupShortEntry();
+        } catch (TestFailureException e){
+            throw e.error;
+        } catch (Exception e){
+            fail("Received Exception "+e.getClass()+ " : "+e.getMessage());
+        }
+    }
+
+    public void test07_lookupBooleanEntry() {
+        try{
+            ejbObject.lookupBooleanEntry();
+        } catch (TestFailureException e){
+            throw e.error;
+        } catch (Exception e){
+            fail("Received Exception "+e.getClass()+ " : "+e.getMessage());
+        }
+    }
+
+    public void test08_lookupByteEntry() {
+        try{
+            ejbObject.lookupByteEntry();
+        } catch (TestFailureException e){
+            throw e.error;
+        } catch (Exception e){
+            fail("Received Exception "+e.getClass()+ " : "+e.getMessage());
+        }
+    }
+
+    public void test09_lookupCharacterEntry() {
+        try{
+            ejbObject.lookupCharacterEntry();
+        } catch (TestFailureException e){
+            throw e.error;
+        } catch (Exception e){
+            fail("Received Exception "+e.getClass()+ " : "+e.getMessage());
+        }
+    }
+
+    public void test10_lookupEntityBean() {
+        try{
+            ejbObject.lookupEntityBean();
+        } catch (TestFailureException e){
+            throw e.error;
+        } catch (Exception e){
+            fail("Received Exception "+e.getClass()+ " : "+e.getMessage());
+        }
+    }
+
+    public void test11_lookupStatefulBean() {
+        try{
+            ejbObject.lookupStatefulBean();
+        } catch (TestFailureException e){
+            throw e.error;
+        } catch (Exception e){
+            fail("Received Exception "+e.getClass()+ " : "+e.getMessage());
+        }
+    }
+
+    public void test12_lookupStatelessBean() {
+        try{
+            ejbObject.lookupStatelessBean();
+        } catch (TestFailureException e){
+            throw e.error;
+        } catch (Exception e){
+            fail("Received Exception "+e.getClass()+ " : "+e.getMessage());
+        }
+    }
+
+    public void test13_lookupResource() {
+        try{
+            ejbObject.lookupResource();
+        } catch (TestFailureException e){
+            throw e.error;
+        } catch (Exception e){
+            fail("Received Exception "+e.getClass()+ " : "+e.getMessage());
+        }
+    }
+
+    public void test14_lookupPersistenceUnit() {
+        try{
+            ejbObject.lookupPersistenceUnit();
+        } catch (TestFailureException e){
+            throw e.error;
+        } catch (Exception e){
+            fail("Received Exception "+e.getClass()+ " : "+e.getMessage());
+        }
+    }
+
+    public void test15_lookupPersistenceContext() {
+        try{
+            ejbObject.lookupPersistenceContext();
+        } catch (TestFailureException e){
+            throw e.error;
+        } catch (Exception e){
+            fail("Received Exception "+e.getClass()+ " : "+e.getMessage());
+        }
+    }
+
+    public void test18_lookupSessionContext() {
+        try{
+            ejbObject.lookupSessionContext();
+        } catch (TestFailureException e){
+            throw e.error;
+        } catch (Exception e){
+            fail("Received Exception "+e.getClass()+ " : "+e.getMessage());
+        }
+    }
+
+    public void test19_lookupStatelessBusinessLocal() {
+        try{
+            ejbObject.lookupStatelessBusinessLocal();
+        } catch (TestFailureException e){
+            throw e.error;
+        } catch (Exception e){
+            fail("Received Exception "+e.getClass()+ " : "+e.getMessage());
+        }
+    }
+
+    public void test20_lookupStatelessBusinessRemote() {
+        try{
+            ejbObject.lookupStatelessBusinessRemote();
+        } catch (TestFailureException e){
+            throw e.error;
+        } catch (Exception e){
+            fail("Received Exception "+e.getClass()+ " : "+e.getMessage());
+        }
+    }
+
+    public void test21_lookupStatefulBusinessLocal() {
+        try{
+            ejbObject.lookupStatefulBusinessLocal();
+        } catch (TestFailureException e){
+            throw e.error;
+        } catch (Exception e){
+            fail("Received Exception "+e.getClass()+ " : "+e.getMessage());
+        }
+    }
+
+    public void test22_lookupStatefulBusinessRemote() {
+        try{
+            ejbObject.lookupStatefulBusinessRemote();
+        } catch (TestFailureException e){
+            throw e.error;
+        } catch (Exception e){
+            fail("Received Exception "+e.getClass()+ " : "+e.getMessage());
+        }
+    }
+}

Modified: incubator/openejb/trunk/openejb3/itests/openejb-itests-client/src/main/java/org/apache/openejb/test/stateless/StatelessLocalTestSuite.java
URL: http://svn.apache.org/viewvc/incubator/openejb/trunk/openejb3/itests/openejb-itests-client/src/main/java/org/apache/openejb/test/stateless/StatelessLocalTestSuite.java?view=diff&rev=499359&r1=499358&r2=499359
==============================================================================
--- incubator/openejb/trunk/openejb3/itests/openejb-itests-client/src/main/java/org/apache/openejb/test/stateless/StatelessLocalTestSuite.java (original)
+++ incubator/openejb/trunk/openejb3/itests/openejb-itests-client/src/main/java/org/apache/openejb/test/stateless/StatelessLocalTestSuite.java Wed Jan 24 03:19:37 2007
@@ -56,6 +56,7 @@
         suite.addTest(new StatelessPojoContextLookupTests());
         suite.addTest(new StatelessFieldInjectionTests());
         suite.addTest(new StatelessSetterInjectionTests());
+        suite.addTest(new StatelessAnnotatedFieldInjectionTests());
         suite.addTest(new StatelessRmiIiopTests());
         suite.addTest(new MiscEjbTests());
         /* TO DO

Modified: incubator/openejb/trunk/openejb3/itests/openejb-itests-client/src/main/java/org/apache/openejb/test/stateless/StatelessTestSuite.java
URL: http://svn.apache.org/viewvc/incubator/openejb/trunk/openejb3/itests/openejb-itests-client/src/main/java/org/apache/openejb/test/stateless/StatelessTestSuite.java?view=diff&rev=499359&r1=499358&r2=499359
==============================================================================
--- incubator/openejb/trunk/openejb3/itests/openejb-itests-client/src/main/java/org/apache/openejb/test/stateless/StatelessTestSuite.java (original)
+++ incubator/openejb/trunk/openejb3/itests/openejb-itests-client/src/main/java/org/apache/openejb/test/stateless/StatelessTestSuite.java Wed Jan 24 03:19:37 2007
@@ -58,6 +58,7 @@
         suite.addTest(new StatelessPojoContextLookupTests());
         suite.addTest(new StatelessFieldInjectionTests());
         suite.addTest(new StatelessSetterInjectionTests());
+        suite.addTest(new StatelessAnnotatedFieldInjectionTests());
         suite.addTest(new StatelessRmiIiopTests());
         suite.addTest(new MiscEjbTests());
         /* TO DO