You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tomee.apache.org by jg...@apache.org on 2011/10/03 15:04:04 UTC

svn commit: r1178401 [1/3] - in /openejb/trunk/arquillian-tomee: arquillian-tomee-common/src/main/java/org/apache/openejb/arquillian/common/ arquillian-tomee-remote/src/main/java/org/apache/openejb/arquillian/remote/ arquillian-tomee-tests/ arquillian-...

Author: jgallimore
Date: Mon Oct  3 13:04:03 2011
New Revision: 1178401

URL: http://svn.apache.org/viewvc?rev=1178401&view=rev
Log:
OPENEJB-1687 copying tests to common test package

Added:
    openejb/trunk/arquillian-tomee/arquillian-tomee-tests/src/
    openejb/trunk/arquillian-tomee/arquillian-tomee-tests/src/test/
    openejb/trunk/arquillian-tomee/arquillian-tomee-tests/src/test/java/
    openejb/trunk/arquillian-tomee/arquillian-tomee-tests/src/test/java/org/
    openejb/trunk/arquillian-tomee/arquillian-tomee-tests/src/test/java/org/apache/
    openejb/trunk/arquillian-tomee/arquillian-tomee-tests/src/test/java/org/apache/openejb/
    openejb/trunk/arquillian-tomee/arquillian-tomee-tests/src/test/java/org/apache/openejb/arquillian/
    openejb/trunk/arquillian-tomee/arquillian-tomee-tests/src/test/java/org/apache/openejb/arquillian/tests/
    openejb/trunk/arquillian-tomee/arquillian-tomee-tests/src/test/java/org/apache/openejb/arquillian/tests/ModuleNameInjectionTest.java
    openejb/trunk/arquillian-tomee/arquillian-tomee-tests/src/test/java/org/apache/openejb/arquillian/tests/Runner.java
    openejb/trunk/arquillian-tomee/arquillian-tomee-tests/src/test/java/org/apache/openejb/arquillian/tests/ServletCdiInjectionTest.java
    openejb/trunk/arquillian-tomee/arquillian-tomee-tests/src/test/java/org/apache/openejb/arquillian/tests/ServletEjbLocalInjectionTest.java
    openejb/trunk/arquillian-tomee/arquillian-tomee-tests/src/test/java/org/apache/openejb/arquillian/tests/ServletEjbRemoteTest.java
    openejb/trunk/arquillian-tomee/arquillian-tomee-tests/src/test/java/org/apache/openejb/arquillian/tests/ServletEnvEntryInjectionTest.java
    openejb/trunk/arquillian-tomee/arquillian-tomee-tests/src/test/java/org/apache/openejb/arquillian/tests/ServletFilterCdiInjectionTest.java
    openejb/trunk/arquillian-tomee/arquillian-tomee-tests/src/test/java/org/apache/openejb/arquillian/tests/ServletFilterEjbLocalInjectionTest.java
    openejb/trunk/arquillian-tomee/arquillian-tomee-tests/src/test/java/org/apache/openejb/arquillian/tests/ServletFilterEjbRemoteInjectionTest.java
    openejb/trunk/arquillian-tomee/arquillian-tomee-tests/src/test/java/org/apache/openejb/arquillian/tests/ServletFilterEnvEntryInjectionTest.java
    openejb/trunk/arquillian-tomee/arquillian-tomee-tests/src/test/java/org/apache/openejb/arquillian/tests/ServletFilterPersistenceInjectionTest.java
    openejb/trunk/arquillian-tomee/arquillian-tomee-tests/src/test/java/org/apache/openejb/arquillian/tests/ServletListenerEjbLocalInjectionTest.java
    openejb/trunk/arquillian-tomee/arquillian-tomee-tests/src/test/java/org/apache/openejb/arquillian/tests/ServletListenerEjbRemoteTest.java
    openejb/trunk/arquillian-tomee/arquillian-tomee-tests/src/test/java/org/apache/openejb/arquillian/tests/ServletListenerEnvEntryInjectionTest.java
    openejb/trunk/arquillian-tomee/arquillian-tomee-tests/src/test/java/org/apache/openejb/arquillian/tests/ServletListenerPersistenceInjectionTest.java
    openejb/trunk/arquillian-tomee/arquillian-tomee-tests/src/test/java/org/apache/openejb/arquillian/tests/ServletPersistenceInjectionTest.java
    openejb/trunk/arquillian-tomee/arquillian-tomee-tests/src/test/java/org/apache/openejb/arquillian/tests/ServletResourceEnvEntryInjectionTest.java
    openejb/trunk/arquillian-tomee/arquillian-tomee-tests/src/test/java/org/apache/openejb/arquillian/tests/SharedEnvironmentTest.java
    openejb/trunk/arquillian-tomee/arquillian-tomee-tests/src/test/java/org/apache/openejb/arquillian/tests/TestSetup.java
    openejb/trunk/arquillian-tomee/arquillian-tomee-tests/src/test/resources/
    openejb/trunk/arquillian-tomee/arquillian-tomee-tests/src/test/resources/arquillian.xml
    openejb/trunk/arquillian-tomee/arquillian-tomee-tests/src/test/resources/persistence.xml
Modified:
    openejb/trunk/arquillian-tomee/arquillian-tomee-common/src/main/java/org/apache/openejb/arquillian/common/FileUtils.java
    openejb/trunk/arquillian-tomee/arquillian-tomee-remote/src/main/java/org/apache/openejb/arquillian/remote/RemoteTomEEContainer.java
    openejb/trunk/arquillian-tomee/arquillian-tomee-tests/pom.xml

Modified: openejb/trunk/arquillian-tomee/arquillian-tomee-common/src/main/java/org/apache/openejb/arquillian/common/FileUtils.java
URL: http://svn.apache.org/viewvc/openejb/trunk/arquillian-tomee/arquillian-tomee-common/src/main/java/org/apache/openejb/arquillian/common/FileUtils.java?rev=1178401&r1=1178400&r2=1178401&view=diff
==============================================================================
--- openejb/trunk/arquillian-tomee/arquillian-tomee-common/src/main/java/org/apache/openejb/arquillian/common/FileUtils.java (original)
+++ openejb/trunk/arquillian-tomee/arquillian-tomee-common/src/main/java/org/apache/openejb/arquillian/common/FileUtils.java Mon Oct  3 13:04:03 2011
@@ -33,7 +33,7 @@ public class FileUtils {
         deleteOnExit(tempDir);
         return tempDir;
     }
-
+    
     private FileUtils() {
     }
 
@@ -49,7 +49,7 @@ public class FileUtils {
         });
     }
 
-    private static void deleteOnExit(File file) {
+    public static void deleteOnExit(File file) {
         delete.add(file.getAbsolutePath());
     }
 

Modified: openejb/trunk/arquillian-tomee/arquillian-tomee-remote/src/main/java/org/apache/openejb/arquillian/remote/RemoteTomEEContainer.java
URL: http://svn.apache.org/viewvc/openejb/trunk/arquillian-tomee/arquillian-tomee-remote/src/main/java/org/apache/openejb/arquillian/remote/RemoteTomEEContainer.java?rev=1178401&r1=1178400&r2=1178401&view=diff
==============================================================================
--- openejb/trunk/arquillian-tomee/arquillian-tomee-remote/src/main/java/org/apache/openejb/arquillian/remote/RemoteTomEEContainer.java (original)
+++ openejb/trunk/arquillian-tomee/arquillian-tomee-remote/src/main/java/org/apache/openejb/arquillian/remote/RemoteTomEEContainer.java Mon Oct  3 13:04:03 2011
@@ -31,6 +31,7 @@ import java.util.HashMap;
 import java.util.Iterator;
 import java.util.Map;
 
+import org.apache.openejb.arquillian.common.FileUtils;
 import org.apache.openejb.arquillian.common.MavenCache;
 import org.apache.openejb.arquillian.common.TomEEContainer;
 import org.apache.openejb.config.RemoteServer;
@@ -90,6 +91,8 @@ public class RemoteTomEEContainer extend
 	    		throw new LifecycleException("Error finding OPENEJB_HOME");
 	    	}
 	    	
+	    	//FileUtils.deleteOnExit(openejbHome);
+	    	
 	    	System.setProperty("tomee.http.port", String.valueOf(configuration.getHttpPort()));
 	    	System.setProperty("tomee.shutdown.port", String.valueOf(configuration.getStopPort()));
 	    	System.setProperty("java.naming.provider.url","http://localhost:" + configuration.getHttpPort() + "/openejb/ejb");

Modified: openejb/trunk/arquillian-tomee/arquillian-tomee-tests/pom.xml
URL: http://svn.apache.org/viewvc/openejb/trunk/arquillian-tomee/arquillian-tomee-tests/pom.xml?rev=1178401&r1=1178400&r2=1178401&view=diff
==============================================================================
--- openejb/trunk/arquillian-tomee/arquillian-tomee-tests/pom.xml (original)
+++ openejb/trunk/arquillian-tomee/arquillian-tomee-tests/pom.xml Mon Oct  3 13:04:03 2011
@@ -34,12 +34,6 @@
   <dependencies>
 
     <dependency>
-      <groupId>org.apache.openejb</groupId>
-      <artifactId>tomee-embedded</artifactId>
-      <version>1.0.0-beta-2-SNAPSHOT</version>
-    </dependency>
-
-    <dependency>
       <groupId>org.jboss.arquillian</groupId>
       <artifactId>arquillian-spi</artifactId>
       <version>${version.arquillian}</version>
@@ -70,30 +64,6 @@
     </dependency>
 
     <dependency>
-      <groupId>org.apache.tomcat</groupId>
-      <artifactId>tomcat-catalina</artifactId>
-      <version>${version.org.apache.tomcat}</version>
-    </dependency>
-
-    <dependency>
-      <groupId>org.apache.tomcat</groupId>
-      <artifactId>tomcat-coyote</artifactId>
-      <version>${version.org.apache.tomcat}</version>
-    </dependency>
-
-    <dependency>
-      <groupId>org.apache.tomcat</groupId>
-      <artifactId>tomcat-jasper</artifactId>
-      <version>${version.org.apache.tomcat}</version>
-      <exclusions>
-        <exclusion>
-          <groupId>org.eclipse.jdt.core.compiler</groupId>
-          <artifactId>ecj</artifactId>
-        </exclusion>
-      </exclusions>
-    </dependency>
-
-    <dependency>
       <groupId>org.jboss.arquillian</groupId>
       <artifactId>arquillian-junit</artifactId>
       <version>${version.arquillian}</version>
@@ -106,61 +76,56 @@
       <version>${version.cdi-api}</version>
       <scope>test</scope>
     </dependency>
-
-    <dependency>
-      <groupId>junit</groupId>
-      <artifactId>junit</artifactId>
-      <version>4.8.1</version>
-      <scope>test</scope>
-    </dependency>
-
-    <dependency>
-      <groupId>org.eclipse.jdt.core.compiler</groupId>
-      <artifactId>ecj</artifactId>
-      <version>3.5.1</version>
-      <type>jar</type>
-      <scope>compile</scope>
-    </dependency>
+    
     <dependency>
       <groupId>org.apache.openejb</groupId>
       <artifactId>javaee-api</artifactId>
       <version>6.0-1</version>
       <type>jar</type>
     </dependency>
+
     <dependency>
-      <groupId>org.apache.velocity</groupId>
-      <artifactId>velocity</artifactId>
-      <version>1.6.4</version>
-      <type>jar</type>
-      <scope>compile</scope>
-    </dependency>
-    <dependency>
-      <groupId>org.apache.geronimo.specs</groupId>
-      <artifactId>geronimo-j2ee-deployment_1.1_spec</artifactId>
-      <version>1.1</version>
-      <type>jar</type>
-      <scope>compile</scope>
-    </dependency>
-    <dependency>
-      <groupId>org.apache.openejb</groupId>
-      <artifactId>openejb-client</artifactId>
-      <version>${version.openejb}</version>
-      <type>jar</type>
-    </dependency>
-    <dependency>
-      <groupId>org.apache.openejb</groupId>
-      <artifactId>openejb-tomcat-catalina</artifactId>
-      <version>${version.openejb}</version>
-      <type>jar</type>
-      <scope>compile</scope>
+      <groupId>junit</groupId>
+      <artifactId>junit</artifactId>
+      <version>4.8.1</version>
+      <scope>test</scope>
     </dependency>
+
     <dependency>
-      <groupId>org.apache.openejb</groupId>
-      <artifactId>openejb-core</artifactId>
-      <version>${version.openejb}</version>
-      <type>jar</type>
-      <scope>compile</scope>
+    	<groupId>commons-lang</groupId>
+    	<artifactId>commons-lang</artifactId>
+    	<version>2.4</version>
+    	<type>jar</type>
+    	<scope>compile</scope>
     </dependency>
   </dependencies>
 
+  <profiles>
+  	<profile>
+  	  <id>arquillian-tomee-embedded</id>
+  	  <activation>
+  	    <activeByDefault>true</activeByDefault>
+  	  </activation>
+  	  <dependencies>
+  	    <dependency>
+  	      <groupId>org.apache.openejb</groupId>
+  	      <artifactId>arquillian-tomee-embedded</artifactId>
+  	      <version>1.0-SNAPSHOT</version>
+  	    </dependency>
+  	  </dependencies>
+  	</profile>
+
+  	<profile>
+  	  <id>arquillian-tomee-remote</id>
+  	  <dependencies>
+  	    <dependency>
+  	      <groupId>org.apache.openejb</groupId>
+  	      <artifactId>arquillian-tomee-remote</artifactId>
+  	      <version>1.0-SNAPSHOT</version>
+  	    </dependency>
+  	  </dependencies>
+  	</profile>
+
+  </profiles>
+
 </project>

Added: openejb/trunk/arquillian-tomee/arquillian-tomee-tests/src/test/java/org/apache/openejb/arquillian/tests/ModuleNameInjectionTest.java
URL: http://svn.apache.org/viewvc/openejb/trunk/arquillian-tomee/arquillian-tomee-tests/src/test/java/org/apache/openejb/arquillian/tests/ModuleNameInjectionTest.java?rev=1178401&view=auto
==============================================================================
--- openejb/trunk/arquillian-tomee/arquillian-tomee-tests/src/test/java/org/apache/openejb/arquillian/tests/ModuleNameInjectionTest.java (added)
+++ openejb/trunk/arquillian-tomee/arquillian-tomee-tests/src/test/java/org/apache/openejb/arquillian/tests/ModuleNameInjectionTest.java Mon Oct  3 13:04:03 2011
@@ -0,0 +1,330 @@
+/**
+ * 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.arquillian.tests;
+
+import org.jboss.arquillian.api.Deployment;
+import org.jboss.arquillian.junit.Arquillian;
+import org.jboss.shrinkwrap.api.spec.WebArchive;
+import org.jboss.shrinkwrap.descriptor.api.Node;
+import org.jboss.shrinkwrap.descriptor.api.spec.servlet.web.WebAppDescriptor;
+import org.jboss.shrinkwrap.descriptor.spi.NodeProvider;
+import org.junit.Assert;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+
+import javax.annotation.Resource;
+import javax.ejb.EJB;
+import javax.ejb.LocalBean;
+import javax.ejb.Singleton;
+import javax.inject.Inject;
+import javax.servlet.Filter;
+import javax.servlet.FilterChain;
+import javax.servlet.FilterConfig;
+import javax.servlet.ServletException;
+import javax.servlet.ServletRequest;
+import javax.servlet.ServletResponse;
+import java.io.IOException;
+
+@RunWith(Arquillian.class)
+public class ModuleNameInjectionTest extends TestSetup {
+
+    public static final String TEST_NAME = ModuleNameInjectionTest.class.getSimpleName();
+
+    @Test
+    public void testCdi() throws Exception {
+        validateTest("testCdi=true");
+    }
+
+    @Test
+    public void testEjb() throws Exception {
+        validateTest("testEjb=true");
+    }
+
+    @Test
+    public void testFilter() throws Exception {
+        validateTest("testFilter=true");
+    }
+
+    @Deployment(testable = false)
+    public static WebArchive getArchive() {
+        return new ModuleNameInjectionTest().createDeployment(PojoServletFilter.class, Orange.class, Green.class);
+    }
+
+    protected void decorateDescriptor(WebAppDescriptor descriptor) {
+        descriptor.filter(PojoServletFilter.class, "/" + getTestContextName());
+    }
+
+    public static class PojoServletFilter implements Filter, Environment {
+
+        @Resource(name = "returnEmail")
+        private String returnEmail;
+
+        @Resource(name = "connectionPool")
+        private Integer connectionPool;
+
+        @Resource(name = "startCount")
+        private Long startCount;
+
+        @Resource(name = "initSize")
+        private Short initSize;
+
+        @Resource(name = "totalQuantity")
+        private Byte totalQuantity;
+
+        @Resource(name = "enableEmail")
+        private Boolean enableEmail;
+
+        @Resource(name = "optionDefault")
+        private Character optionDefault;
+
+        @Override
+        public String getReturnEmail() {
+            return returnEmail;
+        }
+
+        @Override
+        public Integer getConnectionPool() {
+            return connectionPool;
+        }
+
+        @Override
+        public Long getStartCount() {
+            return startCount;
+        }
+
+        @Override
+        public Short getInitSize() {
+            return initSize;
+        }
+
+        @Override
+        public Byte getTotalQuantity() {
+            return totalQuantity;
+        }
+
+        @Override
+        public Boolean getEnableEmail() {
+            return enableEmail;
+        }
+
+        @Override
+        public Character getOptionDefault() {
+            return optionDefault;
+        }
+
+        @Inject
+        private Green green;
+
+        @EJB
+        private Orange orange;
+
+        public void init(FilterConfig config) {
+        }
+
+        public void destroy() {
+        }
+
+        @Override
+        public void doFilter(ServletRequest req, ServletResponse resp, FilterChain chain) throws ServletException, IOException {
+            run(req, resp, this);
+        }
+
+
+        public void testCdi() {
+            assertEnvironment(green);
+        }
+
+        public void testEjb() {
+            assertEnvironment(orange);
+        }
+
+        public void testFilter() {
+            assertEnvironment(this);
+        }
+
+        public void assertEnvironment(Environment actual) {
+            Assert.assertNotNull("component", actual);
+
+            Environment expected = new Green("tomee@apache.org", 20, 200000l, (short) 6, (byte) 5, true, 'X');
+
+            Assert.assertEquals("ReturnEmail", expected.getReturnEmail(), actual.getReturnEmail());
+            Assert.assertEquals("ConnectionPool", expected.getConnectionPool(), actual.getConnectionPool());
+            Assert.assertEquals("StartCount", expected.getStartCount(), actual.getStartCount());
+            Assert.assertEquals("InitSize", expected.getInitSize(), actual.getInitSize());
+            Assert.assertEquals("TotalQuantity", expected.getTotalQuantity(), actual.getTotalQuantity());
+            Assert.assertEquals("EnableEmail", expected.getEnableEmail(), actual.getEnableEmail());
+            Assert.assertEquals("OptionDefault", expected.getOptionDefault(), actual.getOptionDefault());
+        }
+    }
+
+    public static class Green implements Environment {
+
+        @Resource(name = "returnEmail")
+        private String returnEmail;
+
+        @Resource(name = "connectionPool")
+        private Integer connectionPool;
+
+        @Resource(name = "startCount")
+        private Long startCount;
+
+        @Resource(name = "initSize")
+        private Short initSize;
+
+        @Resource(name = "totalQuantity")
+        private Byte totalQuantity;
+
+        @Resource(name = "enableEmail")
+        private Boolean enableEmail;
+
+        @Resource(name = "optionDefault")
+        private Character optionDefault;
+
+        @Inject
+        public Green() {
+        }
+
+        public Green(String returnEmail, Integer connectionPool, Long startCount, Short initSize, Byte totalQuantity, Boolean enableEmail, Character optionDefault) {
+            this.returnEmail = returnEmail;
+            this.connectionPool = connectionPool;
+            this.startCount = startCount;
+            this.initSize = initSize;
+            this.totalQuantity = totalQuantity;
+            this.enableEmail = enableEmail;
+            this.optionDefault = optionDefault;
+        }
+
+        @Override
+        public String getReturnEmail() {
+            return returnEmail;
+        }
+
+        @Override
+        public Integer getConnectionPool() {
+            return connectionPool;
+        }
+
+        @Override
+        public Long getStartCount() {
+            return startCount;
+        }
+
+        @Override
+        public Short getInitSize() {
+            return initSize;
+        }
+
+        @Override
+        public Byte getTotalQuantity() {
+            return totalQuantity;
+        }
+
+        @Override
+        public Boolean getEnableEmail() {
+            return enableEmail;
+        }
+
+        @Override
+        public Character getOptionDefault() {
+            return optionDefault;
+        }
+    }
+
+    @Singleton
+    @LocalBean
+    public static class Orange implements Environment {
+
+        @Resource(name = "returnEmail")
+        private String returnEmail;
+
+        @Resource(name = "connectionPool")
+        private Integer connectionPool;
+
+        @Resource(name = "startCount")
+        private Long startCount;
+
+        @Resource(name = "initSize")
+        private Short initSize;
+
+        @Resource(name = "totalQuantity")
+        private Byte totalQuantity;
+
+        @Resource(name = "enableEmail")
+        private Boolean enableEmail;
+
+        @Resource(name = "optionDefault")
+        private Character optionDefault;
+
+        @Override
+        public String getReturnEmail() {
+            return returnEmail;
+        }
+
+        @Override
+        public Integer getConnectionPool() {
+            return connectionPool;
+        }
+
+        @Override
+        public Long getStartCount() {
+            return startCount;
+        }
+
+        @Override
+        public Short getInitSize() {
+            return initSize;
+        }
+
+        @Override
+        public Byte getTotalQuantity() {
+            return totalQuantity;
+        }
+
+        @Override
+        public Boolean getEnableEmail() {
+            return enableEmail;
+        }
+
+        @Override
+        public Character getOptionDefault() {
+            return optionDefault;
+        }
+    }
+
+
+    /**
+     * @version $Rev$ $Date$
+     */
+    public static interface Environment {
+        String getReturnEmail();
+
+        Integer getConnectionPool();
+
+        Long getStartCount();
+
+        Short getInitSize();
+
+        Byte getTotalQuantity();
+
+        Boolean getEnableEmail();
+
+        Character getOptionDefault();
+    }
+}
+
+
+

Added: openejb/trunk/arquillian-tomee/arquillian-tomee-tests/src/test/java/org/apache/openejb/arquillian/tests/Runner.java
URL: http://svn.apache.org/viewvc/openejb/trunk/arquillian-tomee/arquillian-tomee-tests/src/test/java/org/apache/openejb/arquillian/tests/Runner.java?rev=1178401&view=auto
==============================================================================
--- openejb/trunk/arquillian-tomee/arquillian-tomee-tests/src/test/java/org/apache/openejb/arquillian/tests/Runner.java (added)
+++ openejb/trunk/arquillian-tomee/arquillian-tomee-tests/src/test/java/org/apache/openejb/arquillian/tests/Runner.java Mon Oct  3 13:04:03 2011
@@ -0,0 +1,54 @@
+/**
+ * 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.arquillian.tests;
+
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+import java.io.IOException;
+import java.io.PrintWriter;
+import java.lang.reflect.Method;
+
+/**
+* @version $Rev$ $Date$
+*/
+public class Runner {
+
+    public static void run(HttpServletRequest req, HttpServletResponse resp, Object obj) throws IOException {
+        req.getQueryString();
+        final Class<?> clazz = obj.getClass();
+        final Method[] methods = clazz.getMethods();
+
+        resp.setContentType("text/plain");
+        final PrintWriter writer = resp.getWriter();
+
+        for (Method method : methods) {
+            if (method.getName().startsWith("test")) {
+
+                writer.print(method.getName());
+
+                writer.print("=");
+
+                try {
+                    method.invoke(obj);
+                    writer.println("true");
+                } catch (Throwable e) {
+                    writer.println("false");
+                }
+            }
+        }
+    }
+}

Added: openejb/trunk/arquillian-tomee/arquillian-tomee-tests/src/test/java/org/apache/openejb/arquillian/tests/ServletCdiInjectionTest.java
URL: http://svn.apache.org/viewvc/openejb/trunk/arquillian-tomee/arquillian-tomee-tests/src/test/java/org/apache/openejb/arquillian/tests/ServletCdiInjectionTest.java?rev=1178401&view=auto
==============================================================================
--- openejb/trunk/arquillian-tomee/arquillian-tomee-tests/src/test/java/org/apache/openejb/arquillian/tests/ServletCdiInjectionTest.java (added)
+++ openejb/trunk/arquillian-tomee/arquillian-tomee-tests/src/test/java/org/apache/openejb/arquillian/tests/ServletCdiInjectionTest.java Mon Oct  3 13:04:03 2011
@@ -0,0 +1,151 @@
+/**
+ * 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.arquillian.tests;
+
+import org.apache.commons.lang.StringUtils;
+import org.jboss.arquillian.api.Deployment;
+import org.jboss.arquillian.junit.Arquillian;
+import org.jboss.shrinkwrap.api.ArchivePaths;
+import org.jboss.shrinkwrap.api.ShrinkWrap;
+import org.jboss.shrinkwrap.api.asset.EmptyAsset;
+import org.jboss.shrinkwrap.api.asset.StringAsset;
+import org.jboss.shrinkwrap.api.spec.WebArchive;
+import org.jboss.shrinkwrap.descriptor.api.Descriptors;
+import org.jboss.shrinkwrap.descriptor.api.Node;
+import org.jboss.shrinkwrap.descriptor.api.spec.servlet.web.WebAppDescriptor;
+import org.jboss.shrinkwrap.descriptor.spi.NodeProvider;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+
+import javax.annotation.PostConstruct;
+import javax.annotation.Resource;
+import javax.ejb.EJB;
+import javax.ejb.Local;
+import javax.ejb.LocalBean;
+import javax.ejb.Stateless;
+import javax.enterprise.inject.spi.BeanManager;
+import javax.inject.Inject;
+import javax.servlet.ServletException;
+import javax.servlet.http.HttpServlet;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+import java.io.ByteArrayOutputStream;
+import java.io.IOException;
+import java.io.InputStream;
+import java.net.URL;
+
+import static junit.framework.Assert.assertNotNull;
+import static junit.framework.Assert.assertTrue;
+
+@RunWith(Arquillian.class)
+public class ServletCdiInjectionTest {
+
+    public static final String TEST_NAME = ServletCdiInjectionTest.class.getSimpleName();
+
+    @Test
+    public void pojoInjectionShouldSucceed() throws Exception {
+        validateTest("OpenEJB is on the wheel of a 2011 Lexus IS 350");
+    }
+
+    @Test
+    public void beanManagerInjectionShouldSucceed() throws Exception {
+        validateTest("beanManager");
+    }
+
+
+//    @Test
+    public void testNothing() {
+    }
+
+    @Deployment(testable = false)
+    public static WebArchive createDeployment() {
+        WebAppDescriptor descriptor = Descriptors.create(WebAppDescriptor.class)
+                .version("3.0")
+                .servlet(PojoServlet.class, "/" + TEST_NAME);
+
+        WebArchive archive = ShrinkWrap.create(WebArchive.class, TEST_NAME + ".war")
+                .addClass(PojoServlet.class)
+                .addClass(Car.class)
+                .setWebXML(new StringAsset(descriptor.exportAsString()))
+                .addAsWebInfResource(EmptyAsset.INSTANCE, ArchivePaths.create("beans.xml"));
+
+        System.err.println(descriptor.exportAsString());
+
+        return archive;
+    }
+
+    public static class PojoServlet extends HttpServlet {
+
+        @Resource
+        private BeanManager beanManager;
+
+        @Inject
+        private Car car;
+
+        @PostConstruct
+        public void construct() {
+            System.out.println("construct");
+        }
+
+        @Override
+        protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
+            String name = req.getParameter("name");
+            if (StringUtils.isEmpty(name)) {
+                name = "OpenEJB";
+            }
+
+            if (car != null) {
+                resp.getOutputStream().println(car.drive(name));
+            }
+
+            if (beanManager != null) {
+                resp.getOutputStream().println("beanManager");
+            }
+        }
+    }
+
+    public static class Car {
+        private final String make = "Lexus", model = "IS 350";
+        private final int year = 2011;
+
+        public String drive(String name) {
+            return name + " is on the wheel of a " + year + " " + make + " " + model;
+        }
+    }
+
+    private void validateTest(String expectedOutput) throws IOException {
+        final InputStream is = new URL("http://localhost:9080/" + TEST_NAME + "/" + TEST_NAME).openStream();
+        final ByteArrayOutputStream os = new ByteArrayOutputStream();
+
+        int bytesRead = -1;
+        byte[] buffer = new byte[8192];
+        while ((bytesRead = is.read(buffer)) > -1) {
+            os.write(buffer, 0, bytesRead);
+        }
+
+        is.close();
+        os.close();
+
+        String output = new String(os.toByteArray(), "UTF-8");
+        assertNotNull("Response shouldn't be null", output);
+        assertTrue("Output should contain: " + expectedOutput, output.contains(expectedOutput));
+    }
+
+}
+
+
+

Added: openejb/trunk/arquillian-tomee/arquillian-tomee-tests/src/test/java/org/apache/openejb/arquillian/tests/ServletEjbLocalInjectionTest.java
URL: http://svn.apache.org/viewvc/openejb/trunk/arquillian-tomee/arquillian-tomee-tests/src/test/java/org/apache/openejb/arquillian/tests/ServletEjbLocalInjectionTest.java?rev=1178401&view=auto
==============================================================================
--- openejb/trunk/arquillian-tomee/arquillian-tomee-tests/src/test/java/org/apache/openejb/arquillian/tests/ServletEjbLocalInjectionTest.java (added)
+++ openejb/trunk/arquillian-tomee/arquillian-tomee-tests/src/test/java/org/apache/openejb/arquillian/tests/ServletEjbLocalInjectionTest.java Mon Oct  3 13:04:03 2011
@@ -0,0 +1,174 @@
+/**
+ * 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.arquillian.tests;
+
+import org.apache.commons.lang.StringUtils;
+import org.jboss.arquillian.api.Deployment;
+import org.jboss.arquillian.junit.Arquillian;
+import org.jboss.shrinkwrap.api.ArchivePaths;
+import org.jboss.shrinkwrap.api.ShrinkWrap;
+import org.jboss.shrinkwrap.api.asset.EmptyAsset;
+import org.jboss.shrinkwrap.api.asset.StringAsset;
+import org.jboss.shrinkwrap.api.spec.WebArchive;
+import org.jboss.shrinkwrap.descriptor.api.Descriptors;
+import org.jboss.shrinkwrap.descriptor.api.Node;
+import org.jboss.shrinkwrap.descriptor.api.spec.servlet.web.WebAppDescriptor;
+import org.jboss.shrinkwrap.descriptor.spi.NodeProvider;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+
+import javax.annotation.Resource;
+import javax.ejb.EJB;
+import javax.ejb.Local;
+import javax.ejb.LocalBean;
+import javax.ejb.Stateless;
+import javax.inject.Inject;
+import javax.servlet.ServletException;
+import javax.servlet.http.HttpServlet;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+import java.io.ByteArrayOutputStream;
+import java.io.IOException;
+import java.io.InputStream;
+import java.net.URL;
+
+import static junit.framework.Assert.assertNotNull;
+import static junit.framework.Assert.assertTrue;
+
+@RunWith(Arquillian.class)
+public class ServletEjbLocalInjectionTest {
+
+    public static final String TEST_NAME = ServletEjbLocalInjectionTest.class.getSimpleName();
+
+    @Test
+    public void localEjbInjectionShouldSucceed() throws Exception {
+        final String expectedOutput = "Local: OpenEJB is employed at TomEE Software Inc.";
+        validateTest(expectedOutput);
+    }
+
+    @Test
+    public void localBeanEjbInjectionShouldSucceed() throws Exception {
+        final String expectedOutput = "OpenEJB shops at Apache Marketplace";
+        validateTest(expectedOutput);
+    }
+
+    @Deployment(testable = false)
+    public static WebArchive createDeployment() {
+        WebAppDescriptor descriptor = Descriptors.create(WebAppDescriptor.class)
+                .version("3.0")
+                .servlet(PojoServlet.class, "/" + TEST_NAME);
+
+        WebArchive archive = ShrinkWrap.create(WebArchive.class, TEST_NAME + ".war")
+                .addClass(PojoServlet.class)
+                .addClass(CompanyLocal.class)
+                .addClass(Company.class)
+                .addClass(DefaultCompany.class)
+                .addClass(OtherCompany.class)
+                .addClass(SuperMarket.class)
+                .setWebXML(new StringAsset(descriptor.exportAsString()));
+
+        return archive;
+    }
+
+    public static class PojoServlet extends HttpServlet {
+
+        @EJB(beanName = "DefaultCompany")
+        private CompanyLocal localCompany;
+
+        @EJB
+        private SuperMarket market;
+
+        @Override
+        protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
+            String name = req.getParameter("name");
+            if (StringUtils.isEmpty(name)) {
+                name = "OpenEJB";
+            }
+
+            if (localCompany != null) {
+                resp.getOutputStream().println("Local: " + localCompany.employ(name));
+            }
+            if (market != null) {
+                resp.getOutputStream().println(market.shop(name));
+            }
+        }
+    }
+
+    public static interface Company {
+    }
+
+    @Local
+    public static interface CompanyLocal extends Company {
+        public String employ(String employeeName);
+    }
+
+    @Stateless
+    public static class DefaultCompany implements CompanyLocal {
+
+        private final String name = "TomEE Software Inc.";
+
+        public String employ(String employeeName) {
+            return employeeName + " is employed at " + name;
+        }
+
+    }
+
+    @Stateless
+    public static class OtherCompany implements CompanyLocal {
+
+        private final String name = "Other Software Inc.";
+
+        public String employ(String employeeName) {
+            return employeeName + " is employed at " + name;
+        }
+
+    }
+
+    @Stateless
+    @LocalBean
+    public static class SuperMarket {
+
+        private final String name = "Apache Marketplace";
+
+        public String shop(String employeeName) {
+            return employeeName + " shops at " + name;
+        }
+
+    }
+
+    private void validateTest(String expectedOutput) throws IOException {
+        final InputStream is = new URL("http://localhost:9080/" + TEST_NAME + "/" + TEST_NAME).openStream();
+        final ByteArrayOutputStream os = new ByteArrayOutputStream();
+
+        int bytesRead = -1;
+        byte[] buffer = new byte[8192];
+        while ((bytesRead = is.read(buffer)) > -1) {
+            os.write(buffer, 0, bytesRead);
+        }
+
+        is.close();
+        os.close();
+
+        String output = new String(os.toByteArray(), "UTF-8");
+        assertNotNull("Response shouldn't be null", output);
+        assertTrue("Output should contain: " + expectedOutput, output.contains(expectedOutput));
+    }
+
+}
+
+
+

Added: openejb/trunk/arquillian-tomee/arquillian-tomee-tests/src/test/java/org/apache/openejb/arquillian/tests/ServletEjbRemoteTest.java
URL: http://svn.apache.org/viewvc/openejb/trunk/arquillian-tomee/arquillian-tomee-tests/src/test/java/org/apache/openejb/arquillian/tests/ServletEjbRemoteTest.java?rev=1178401&view=auto
==============================================================================
--- openejb/trunk/arquillian-tomee/arquillian-tomee-tests/src/test/java/org/apache/openejb/arquillian/tests/ServletEjbRemoteTest.java (added)
+++ openejb/trunk/arquillian-tomee/arquillian-tomee-tests/src/test/java/org/apache/openejb/arquillian/tests/ServletEjbRemoteTest.java Mon Oct  3 13:04:03 2011
@@ -0,0 +1,131 @@
+/**
+ * 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.arquillian.tests;
+
+import org.apache.commons.lang.StringUtils;
+import org.jboss.arquillian.api.Deployment;
+import org.jboss.arquillian.junit.Arquillian;
+import org.jboss.shrinkwrap.api.ArchivePaths;
+import org.jboss.shrinkwrap.api.ShrinkWrap;
+import org.jboss.shrinkwrap.api.asset.EmptyAsset;
+import org.jboss.shrinkwrap.api.asset.StringAsset;
+import org.jboss.shrinkwrap.api.spec.WebArchive;
+import org.jboss.shrinkwrap.descriptor.api.Descriptors;
+import org.jboss.shrinkwrap.descriptor.api.spec.servlet.web.WebAppDescriptor;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+
+import javax.ejb.EJB;
+import javax.ejb.Remote;
+import javax.ejb.Stateless;
+import javax.servlet.ServletException;
+import javax.servlet.http.HttpServlet;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+import java.io.ByteArrayOutputStream;
+import java.io.IOException;
+import java.io.InputStream;
+import java.net.URL;
+
+import static junit.framework.Assert.assertNotNull;
+import static junit.framework.Assert.assertTrue;
+
+@RunWith(Arquillian.class)
+public class ServletEjbRemoteTest {
+
+    public static final String TEST_NAME = ServletEjbRemoteTest.class.getSimpleName();
+
+    @Test
+    public void ejbInjectionShouldSucceed() throws Exception {
+        final String expectedOutput = "Remote: OpenEJB is employed at TomEE Software Inc.";
+        validateTest(expectedOutput);
+    }
+
+    @Deployment(testable = false)
+    public static WebArchive createDeployment() {
+        WebAppDescriptor descriptor = Descriptors.create(WebAppDescriptor.class)
+                .version("3.0")
+                .servlet(RemoteServlet.class, "/" + TEST_NAME);
+
+        WebArchive archive = ShrinkWrap.create(WebArchive.class, TEST_NAME + ".war")
+                .addClass(RemoteServlet.class)
+                .addClass(CompanyRemote.class)
+                .addClass(DefaultCompany.class)
+                .setWebXML(new StringAsset(descriptor.exportAsString()));
+
+        System.err.println(descriptor.exportAsString());
+
+        return archive;
+    }
+
+    public static class RemoteServlet extends HttpServlet {
+
+        @EJB
+        private CompanyRemote remoteCompany;
+
+        @Override
+        protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
+            String name = req.getParameter("name");
+            if (StringUtils.isEmpty(name)) {
+                name = "OpenEJB";
+            }
+
+            if (remoteCompany != null) {
+                resp.getOutputStream().println("Remote: " + remoteCompany.employ(name));
+            }
+        }
+
+    }
+
+    @Remote
+    public static interface CompanyRemote {
+        public String employ(String employeeName);
+    }
+
+    @Stateless
+    public static class DefaultCompany implements CompanyRemote {
+
+        private final String name = "TomEE Software Inc.";
+
+        public String employ(String employeeName) {
+            return employeeName + " is employed at " + name;
+        }
+
+    }
+
+    private void validateTest(String expectedOutput) throws IOException {
+        final InputStream is = new URL("http://localhost:9080/" + TEST_NAME + "/" + TEST_NAME).openStream();
+        final ByteArrayOutputStream os = new ByteArrayOutputStream();
+
+        int bytesRead = -1;
+        byte[] buffer = new byte[8192];
+        while ((bytesRead = is.read(buffer)) > -1) {
+            os.write(buffer, 0, bytesRead);
+        }
+
+        is.close();
+        os.close();
+
+        String output = new String(os.toByteArray(), "UTF-8");
+        assertNotNull("Response shouldn't be null", output);
+        assertTrue("Output should contain: " + expectedOutput, output.contains(expectedOutput));
+    }
+
+}
+
+
+

Added: openejb/trunk/arquillian-tomee/arquillian-tomee-tests/src/test/java/org/apache/openejb/arquillian/tests/ServletEnvEntryInjectionTest.java
URL: http://svn.apache.org/viewvc/openejb/trunk/arquillian-tomee/arquillian-tomee-tests/src/test/java/org/apache/openejb/arquillian/tests/ServletEnvEntryInjectionTest.java?rev=1178401&view=auto
==============================================================================
--- openejb/trunk/arquillian-tomee/arquillian-tomee-tests/src/test/java/org/apache/openejb/arquillian/tests/ServletEnvEntryInjectionTest.java (added)
+++ openejb/trunk/arquillian-tomee/arquillian-tomee-tests/src/test/java/org/apache/openejb/arquillian/tests/ServletEnvEntryInjectionTest.java Mon Oct  3 13:04:03 2011
@@ -0,0 +1,268 @@
+/**
+ * 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.arquillian.tests;
+
+import org.apache.commons.lang.StringUtils;
+import org.jboss.arquillian.api.Deployment;
+import org.jboss.arquillian.junit.Arquillian;
+import org.jboss.shrinkwrap.api.ArchivePaths;
+import org.jboss.shrinkwrap.api.ShrinkWrap;
+import org.jboss.shrinkwrap.api.asset.EmptyAsset;
+import org.jboss.shrinkwrap.api.asset.StringAsset;
+import org.jboss.shrinkwrap.api.spec.WebArchive;
+import org.jboss.shrinkwrap.descriptor.api.Descriptors;
+import org.jboss.shrinkwrap.descriptor.api.Node;
+import org.jboss.shrinkwrap.descriptor.api.spec.servlet.web.WebAppDescriptor;
+import org.jboss.shrinkwrap.descriptor.spi.NodeProvider;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+
+import javax.annotation.Resource;
+import javax.ejb.EJB;
+import javax.ejb.Local;
+import javax.ejb.LocalBean;
+import javax.ejb.Stateless;
+import javax.inject.Inject;
+import javax.servlet.ServletException;
+import javax.servlet.http.HttpServlet;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+import java.io.ByteArrayOutputStream;
+import java.io.IOException;
+import java.io.InputStream;
+import java.net.URL;
+
+import static junit.framework.Assert.assertNotNull;
+import static junit.framework.Assert.assertTrue;
+
+/**
+ * TODO Add float and double
+ */
+@RunWith(Arquillian.class)
+public class ServletEnvEntryInjectionTest {
+
+    public static final String TEST_NAME = ServletEnvEntryInjectionTest.class.getSimpleName();
+
+
+    @Test
+    public void stringEnvEntryInjectionShouldSucceed() throws Exception {
+        final String expectedOutput = "tomee@apache.org";
+        validateTest(expectedOutput);
+    }
+
+    @Test
+    public void integerTypeEnvEntryInjectionShouldSucceed() throws Exception {
+        final String expectedOutput = "Connection Pool: 20";
+        validateTest(expectedOutput);
+    }
+
+    @Test
+    public void longTypeEnvEntryInjectionShouldSucceed() throws Exception {
+        final String expectedOutput = "Start Count: 200000";
+        validateTest(expectedOutput);
+    }
+
+    @Test
+    public void shortTypeEnvEntryInjectionShouldSucceed() throws Exception {
+        final String expectedOutput = "Init Size: 5";
+        validateTest(expectedOutput);
+    }
+
+    @Test
+    public void byteTypeEnvEntryInjectionShouldSucceed() throws Exception {
+        final String expectedOutput = "Total Quantity: 5";
+        validateTest(expectedOutput);
+    }
+
+    @Test
+    public void booleanTypeEnvEntryInjectionShouldSucceed() throws Exception {
+        final String expectedOutput = "Enable Email: true";
+        validateTest(expectedOutput);
+    }
+
+    @Test
+    public void charTypeEnvEntryInjectionShouldSucceed() throws Exception {
+        final String expectedOutput = "Option Default: X";
+        validateTest(expectedOutput);
+    }
+
+    @Test
+    public void classEnvEntryInjectionShouldSucceed() throws Exception {
+        final String expectedOutput = "java.lang.String";
+        validateTest(expectedOutput);
+    }
+
+    @Test
+    public void enumEnvEntryInjectionShouldSucceed() throws Exception {
+        final String expectedOutput = "DefaultCode: OK";
+        validateTest(expectedOutput);
+    }
+
+    @Test
+    public void lookupEnvEntryInjectionShouldSucceed() throws Exception {
+        final String expectedOutput = "Name:";
+        validateTest(expectedOutput);
+    }
+
+    @Deployment(testable = false)
+    public static WebArchive createDeployment() {
+        WebAppDescriptor descriptor = Descriptors.create(WebAppDescriptor.class)
+                .version("3.0")
+                .servlet(PojoServlet.class, "/" + TEST_NAME);
+
+        addEnvEntry(descriptor, "returnEmail", "java.lang.String", "tomee@apache.org");
+        addEnvEntry(descriptor, "connectionPool", "java.lang.Integer", "20");
+        addEnvEntry(descriptor, "startCount", "java.lang.Long", "200000");
+        addEnvEntry(descriptor, "initSize", "java.lang.Short", "5");
+        addEnvEntry(descriptor, "enableEmail", "java.lang.Boolean", "true");
+        addEnvEntry(descriptor, "totalQuantity", "java.lang.Byte", "5");
+        addEnvEntry(descriptor, "optionDefault", "java.lang.Character", "X");
+        addEnvEntry(descriptor, "auditWriter", "java.lang.Class", "java.lang.String");
+        addEnvEntry(descriptor, "defaultCode", Code.class.getName(), "OK");
+
+        Node rootNode = ((NodeProvider) descriptor).getRootNode();
+        Node appNode = rootNode.get("/web-app").iterator().next();
+        appNode.create("/env-entry")
+                .create("env-entry-name").text("name")
+                .parent()
+                .create("lookup-name").text("java:module/ModuleName")
+        ;
+
+
+        WebArchive archive = ShrinkWrap.create(WebArchive.class, TEST_NAME + ".war")
+                .addClass(PojoServlet.class)
+                .setWebXML(new StringAsset(descriptor.exportAsString()));
+
+        System.err.println(descriptor.exportAsString());
+
+        return archive;
+    }
+
+    public static enum Code {
+        OK,
+        ERROR;
+    }
+
+    public static class PojoServlet extends HttpServlet {
+
+        @Resource(name = "returnEmail")
+        private String returnEmail;
+
+        @Resource(name = "connectionPool")
+        private Integer connectionPool;
+
+        @Resource(name = "startCount")
+        private Long startCount;
+
+        @Resource(name = "initSize")
+        private Short initSize;
+
+        @Resource(name = "totalQuantity")
+        private Byte totalQuantity;
+
+        @Resource(name = "enableEmail")
+        private Boolean enableEmail;
+
+        @Resource(name = "optionDefault")
+        private Character optionDefault;
+
+        @Resource(name = "defaultCode")
+        private Code defaultCode;
+
+        @Resource(name = "auditWriter")
+        @SuppressWarnings("unchecked")
+        private Class auditWriter;
+
+        @Resource(name = "name")
+        private String name;
+
+        @Override
+        protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
+            String name = req.getParameter("name");
+            if (StringUtils.isEmpty(name)) {
+                name = "OpenEJB";
+            }
+
+            if (connectionPool != null) {
+                resp.getOutputStream().println("Connection Pool: " + connectionPool);
+            }
+            if (startCount != null) {
+                resp.getOutputStream().println("Start Count: " + startCount);
+            }
+            if (initSize != null) {
+                resp.getOutputStream().println("Init Size: " + initSize);
+            }
+            if (totalQuantity != null) {
+                resp.getOutputStream().println("Total Quantity: " + totalQuantity);
+            }
+            if (enableEmail != null) {
+                resp.getOutputStream().println("Enable Email: " + enableEmail);
+            }
+            if (optionDefault != null) {
+                resp.getOutputStream().println("Option Default: " + optionDefault);
+            }
+            if (StringUtils.isNotEmpty(returnEmail) && returnEmail.equals("tomee@apache.org")) {
+                resp.getOutputStream().println(returnEmail);
+            }
+            if (auditWriter != null) {
+                resp.getOutputStream().println(auditWriter.getName());
+            }
+            if (defaultCode != null) {
+                resp.getOutputStream().println("DefaultCode: " + defaultCode);
+            }
+
+            if (this.name != null) {
+                resp.getOutputStream().println("Name: " + this.name);
+            }
+        }
+    }
+
+    private static void addEnvEntry(WebAppDescriptor descriptor, String name, String type, String value) {
+        Node rootNode = ((NodeProvider) descriptor).getRootNode();
+        Node appNode = rootNode.get("/web-app").iterator().next();
+        appNode.create("/env-entry")
+                .create("env-entry-name").text(name)
+                .parent()
+                .create("env-entry-type").text(type)
+                .parent()
+                .create("env-entry-value").text(value)
+        ;
+
+    }
+
+    private void validateTest(String expectedOutput) throws IOException {
+        final InputStream is = new URL("http://localhost:9080/" + TEST_NAME + "/" + TEST_NAME).openStream();
+        final ByteArrayOutputStream os = new ByteArrayOutputStream();
+
+        int bytesRead = -1;
+        byte[] buffer = new byte[8192];
+        while ((bytesRead = is.read(buffer)) > -1) {
+            os.write(buffer, 0, bytesRead);
+        }
+
+        is.close();
+        os.close();
+
+        String output = new String(os.toByteArray(), "UTF-8");
+        assertNotNull("Response shouldn't be null", output);
+        assertTrue("Output should contain: " + expectedOutput, output.contains(expectedOutput));
+    }
+
+}
+
+
+

Added: openejb/trunk/arquillian-tomee/arquillian-tomee-tests/src/test/java/org/apache/openejb/arquillian/tests/ServletFilterCdiInjectionTest.java
URL: http://svn.apache.org/viewvc/openejb/trunk/arquillian-tomee/arquillian-tomee-tests/src/test/java/org/apache/openejb/arquillian/tests/ServletFilterCdiInjectionTest.java?rev=1178401&view=auto
==============================================================================
--- openejb/trunk/arquillian-tomee/arquillian-tomee-tests/src/test/java/org/apache/openejb/arquillian/tests/ServletFilterCdiInjectionTest.java (added)
+++ openejb/trunk/arquillian-tomee/arquillian-tomee-tests/src/test/java/org/apache/openejb/arquillian/tests/ServletFilterCdiInjectionTest.java Mon Oct  3 13:04:03 2011
@@ -0,0 +1,86 @@
+/**
+ * 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.arquillian.tests;
+
+import org.jboss.arquillian.api.Deployment;
+import org.jboss.arquillian.junit.Arquillian;
+import org.jboss.shrinkwrap.api.spec.WebArchive;
+import org.jboss.shrinkwrap.descriptor.api.spec.servlet.web.WebAppDescriptor;
+import org.junit.Assert;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+
+import javax.inject.Inject;
+import javax.servlet.*;
+import java.io.IOException;
+
+@RunWith(Arquillian.class)
+public class ServletFilterCdiInjectionTest extends TestSetup {
+
+    public static final String TEST_NAME = ServletFilterCdiInjectionTest.class.getSimpleName();
+
+    @Test
+    public void pojoInjectionShouldSucceed() throws Exception {
+        final String expectedOutput = "testCdi=true";
+        validateTest(expectedOutput);
+    }
+
+    @Deployment(testable = false)
+    public static WebArchive getArchive() {
+        return new ServletFilterCdiInjectionTest().createDeployment(PojoServletFilter.class, Car.class);
+    }
+
+    protected void decorateDescriptor(WebAppDescriptor descriptor) {
+        descriptor.filter(PojoServletFilter.class, "/" + getTestContextName());
+    }
+
+    public static class PojoServletFilter implements Filter {
+
+        @Inject
+        private Car car;
+
+        public void init(FilterConfig config) {
+        }
+
+        public void destroy() {
+        }
+
+        @Override
+        public void doFilter(ServletRequest req, ServletResponse resp, FilterChain chain) throws ServletException, IOException {
+            run(req, resp, this);
+        }
+
+        public void testCdi() {
+            Assert.assertNotNull(car);
+            car.drive("test");
+        }
+    }
+
+    public static class Car {
+        private final String make = "Lexus", model = "IS 350";
+        private final int year = 2011;
+
+        public String drive(String name) {
+            return name + " is on the wheel of a " + year + " " + make + " " + model;
+        }
+    }
+
+
+}
+
+
+

Added: openejb/trunk/arquillian-tomee/arquillian-tomee-tests/src/test/java/org/apache/openejb/arquillian/tests/ServletFilterEjbLocalInjectionTest.java
URL: http://svn.apache.org/viewvc/openejb/trunk/arquillian-tomee/arquillian-tomee-tests/src/test/java/org/apache/openejb/arquillian/tests/ServletFilterEjbLocalInjectionTest.java?rev=1178401&view=auto
==============================================================================
--- openejb/trunk/arquillian-tomee/arquillian-tomee-tests/src/test/java/org/apache/openejb/arquillian/tests/ServletFilterEjbLocalInjectionTest.java (added)
+++ openejb/trunk/arquillian-tomee/arquillian-tomee-tests/src/test/java/org/apache/openejb/arquillian/tests/ServletFilterEjbLocalInjectionTest.java Mon Oct  3 13:04:03 2011
@@ -0,0 +1,125 @@
+/**
+ * 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.arquillian.tests;
+
+import org.jboss.arquillian.api.Deployment;
+import org.jboss.arquillian.junit.Arquillian;
+import org.jboss.shrinkwrap.api.spec.WebArchive;
+import org.jboss.shrinkwrap.descriptor.api.spec.servlet.web.WebAppDescriptor;
+import org.junit.Assert;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+
+import javax.ejb.EJB;
+import javax.ejb.Local;
+import javax.ejb.LocalBean;
+import javax.ejb.Stateless;
+import javax.servlet.*;
+import java.io.IOException;
+
+@RunWith(Arquillian.class)
+public class ServletFilterEjbLocalInjectionTest extends TestSetup {
+
+    @Test
+    public void localEjbInjectionShouldSucceed() throws Exception {
+        final String expectedOutput = "testLocalEjb=true";
+        validateTest(expectedOutput);
+    }
+
+    @Test
+    public void localBeanEjbInjectionShouldSucceed() throws Exception {
+        final String expectedOutput = "testLocalBean=true";
+        validateTest(expectedOutput);
+    }
+
+    @Deployment(testable = false)
+    public static WebArchive getArchive() {
+        return new ServletFilterEjbLocalInjectionTest().createDeployment(PojoServletFilter.class,
+                CompanyLocal.class, Company.class, DefaultCompany.class, SuperMarket.class);
+    }
+
+    protected void decorateDescriptor(WebAppDescriptor descriptor) {
+        descriptor.filter(PojoServletFilter.class, "/" + getTestContextName());
+    }
+
+    public static class PojoServletFilter implements Filter {
+
+        @EJB
+        private CompanyLocal localCompany;
+
+        @EJB
+        private SuperMarket market;
+
+        public void init(FilterConfig config) {
+        }
+
+        public void destroy() {
+        }
+
+        @Override
+        public void doFilter(ServletRequest req, ServletResponse resp, FilterChain chain) throws ServletException, IOException {
+            run(req, resp, this);
+        }
+
+        public void testLocalBean() {
+            Assert.assertNotNull(market);
+            market.shop("test");
+        }
+
+        public void testLocalEjb() {
+            Assert.assertNotNull(localCompany);
+            localCompany.employ("test");
+        }
+
+
+    }
+
+    public static interface Company {
+        public String employ(String employeeName);
+    }
+
+    @Local
+    public static interface CompanyLocal extends Company {
+    }
+
+    @Stateless
+    public static class DefaultCompany implements CompanyLocal {
+
+        private final String name = "TomEE Software Inc.";
+
+        public String employ(String employeeName) {
+            return employeeName + " is employed at " + name;
+        }
+
+    }
+
+    @Stateless
+    @LocalBean
+    public static class SuperMarket {
+
+        private final String name = "Apache Marketplace";
+
+        public String shop(String employeeName) {
+            return employeeName + " shops at " + name;
+        }
+
+    }
+
+}
+
+
+

Added: openejb/trunk/arquillian-tomee/arquillian-tomee-tests/src/test/java/org/apache/openejb/arquillian/tests/ServletFilterEjbRemoteInjectionTest.java
URL: http://svn.apache.org/viewvc/openejb/trunk/arquillian-tomee/arquillian-tomee-tests/src/test/java/org/apache/openejb/arquillian/tests/ServletFilterEjbRemoteInjectionTest.java?rev=1178401&view=auto
==============================================================================
--- openejb/trunk/arquillian-tomee/arquillian-tomee-tests/src/test/java/org/apache/openejb/arquillian/tests/ServletFilterEjbRemoteInjectionTest.java (added)
+++ openejb/trunk/arquillian-tomee/arquillian-tomee-tests/src/test/java/org/apache/openejb/arquillian/tests/ServletFilterEjbRemoteInjectionTest.java Mon Oct  3 13:04:03 2011
@@ -0,0 +1,93 @@
+/**
+ * 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.arquillian.tests;
+
+import org.jboss.arquillian.api.Deployment;
+import org.jboss.arquillian.junit.Arquillian;
+import org.jboss.shrinkwrap.api.spec.WebArchive;
+import org.jboss.shrinkwrap.descriptor.api.spec.servlet.web.WebAppDescriptor;
+import org.junit.Assert;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+
+import javax.ejb.EJB;
+import javax.ejb.Remote;
+import javax.ejb.Stateless;
+import javax.servlet.*;
+import java.io.IOException;
+
+@RunWith(Arquillian.class)
+public class ServletFilterEjbRemoteInjectionTest extends TestSetup {
+
+    @Test
+    public void ejbInjectionShouldSucceed() throws Exception {
+        final String expectedOutput = "testEjb=true";
+        validateTest(expectedOutput);
+    }
+
+    @Deployment(testable = false)
+    public static WebArchive getArchive() {
+        return new ServletFilterEjbRemoteInjectionTest().createDeployment(RemoteServletFilter.class, CompanyRemote.class, DefaultCompany.class);
+    }
+
+    protected void decorateDescriptor(WebAppDescriptor descriptor) {
+        descriptor.filter(RemoteServletFilter.class, "/" + getTestContextName());
+    }
+
+    public static class RemoteServletFilter implements Filter {
+
+        @EJB
+        private CompanyRemote remoteCompany;
+
+        public void init(FilterConfig config) {
+        }
+
+        public void destroy() {
+        }
+
+        @Override
+        public void doFilter(ServletRequest req, ServletResponse resp, FilterChain chain) throws ServletException, IOException {
+            run(req, resp, this);
+        }
+
+        public void testEjb () {
+            Assert.assertNotNull(remoteCompany);
+            remoteCompany.employ("test");
+        }
+
+    }
+
+    @Remote
+    public static interface CompanyRemote {
+        public String employ(String employeeName);
+    }
+
+    @Stateless
+    public static class DefaultCompany implements CompanyRemote {
+
+        private final String name = "TomEE Software Inc.";
+
+        public String employ(String employeeName) {
+            return employeeName + " is employed at " + name;
+        }
+
+    }
+
+}
+
+
+

Added: openejb/trunk/arquillian-tomee/arquillian-tomee-tests/src/test/java/org/apache/openejb/arquillian/tests/ServletFilterEnvEntryInjectionTest.java
URL: http://svn.apache.org/viewvc/openejb/trunk/arquillian-tomee/arquillian-tomee-tests/src/test/java/org/apache/openejb/arquillian/tests/ServletFilterEnvEntryInjectionTest.java?rev=1178401&view=auto
==============================================================================
--- openejb/trunk/arquillian-tomee/arquillian-tomee-tests/src/test/java/org/apache/openejb/arquillian/tests/ServletFilterEnvEntryInjectionTest.java (added)
+++ openejb/trunk/arquillian-tomee/arquillian-tomee-tests/src/test/java/org/apache/openejb/arquillian/tests/ServletFilterEnvEntryInjectionTest.java Mon Oct  3 13:04:03 2011
@@ -0,0 +1,345 @@
+/**
+ * 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.arquillian.tests;
+
+import org.apache.commons.lang.StringUtils;
+import org.jboss.arquillian.api.Deployment;
+import org.jboss.arquillian.junit.Arquillian;
+import org.jboss.shrinkwrap.api.ArchivePaths;
+import org.jboss.shrinkwrap.api.ShrinkWrap;
+import org.jboss.shrinkwrap.api.asset.EmptyAsset;
+import org.jboss.shrinkwrap.api.asset.StringAsset;
+import org.jboss.shrinkwrap.api.spec.WebArchive;
+import org.jboss.shrinkwrap.descriptor.api.Descriptors;
+import org.jboss.shrinkwrap.descriptor.api.Node;
+import org.jboss.shrinkwrap.descriptor.api.spec.servlet.web.WebAppDescriptor;
+import org.jboss.shrinkwrap.descriptor.spi.NodeProvider;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+
+import javax.annotation.Resource;
+import javax.ejb.EJB;
+import javax.ejb.Local;
+import javax.ejb.LocalBean;
+import javax.ejb.Stateless;
+import javax.inject.Inject;
+import javax.servlet.*;
+import java.io.ByteArrayOutputStream;
+import java.io.IOException;
+import java.io.InputStream;
+import java.net.URL;
+
+import static junit.framework.Assert.assertNotNull;
+import static junit.framework.Assert.assertTrue;
+
+@RunWith(Arquillian.class)
+public class ServletFilterEnvEntryInjectionTest {
+
+    public static final String TEST_NAME = ServletFilterEnvEntryInjectionTest.class.getSimpleName();
+
+    @Test
+    public void localEjbInjectionShouldSucceed() throws Exception {
+        final String expectedOutput = "Local: OpenEJB is employed at TomEE Software Inc.";
+        validateTest(expectedOutput);
+    }
+
+    @Test
+    public void localBeanEjbInjectionShouldSucceed() throws Exception {
+        final String expectedOutput = "OpenEJB shops at Apache Marketplace";
+        validateTest(expectedOutput);
+    }
+
+//    @Test
+    public void pojoInjectionShouldSucceed() throws Exception {
+        final String expectedOutput = "OpenEJB is on the wheel of a 2011 Lexus IS 350";
+        validateTest(expectedOutput);
+    }
+
+    @Test
+    public void stringEnvEntryInjectionShouldSucceed() throws Exception {
+        final String expectedOutput = "tomee@apache.org";
+        validateTest(expectedOutput);
+    }
+
+    @Test
+    public void integerTypeEnvEntryInjectionShouldSucceed() throws Exception {
+        final String expectedOutput = "Connection Pool: 20";
+        validateTest(expectedOutput);
+    }
+
+    @Test
+    public void longTypeEnvEntryInjectionShouldSucceed() throws Exception {
+        final String expectedOutput = "Start Count: 200000";
+        validateTest(expectedOutput);
+    }
+
+    @Test
+    public void shortTypeEnvEntryInjectionShouldSucceed() throws Exception {
+        final String expectedOutput = "Init Size: 5";
+        validateTest(expectedOutput);
+    }
+
+    @Test
+    public void byteTypeEnvEntryInjectionShouldSucceed() throws Exception {
+        final String expectedOutput = "Total Quantity: 5";
+        validateTest(expectedOutput);
+    }
+
+    @Test
+    public void booleanTypeEnvEntryInjectionShouldSucceed() throws Exception {
+        final String expectedOutput = "Enable Email: true";
+        validateTest(expectedOutput);
+    }
+
+    @Test
+    public void charTypeEnvEntryInjectionShouldSucceed() throws Exception {
+        final String expectedOutput = "Option Default: X";
+        validateTest(expectedOutput);
+    }
+
+//    @Test
+    public void classEnvEntryInjectionShouldSucceed() throws Exception {
+        final String expectedOutput = "java.lang.String";
+        validateTest(expectedOutput);
+    }
+
+//    @Test
+    public void enumEnvEntryInjectionShouldSucceed() throws Exception {
+        final String expectedOutput = "DefaultCode: OK";
+        validateTest(expectedOutput);
+    }
+
+    @Deployment(testable = false)
+    public static WebArchive createDeployment() {
+        WebAppDescriptor descriptor = Descriptors.create(WebAppDescriptor.class)
+                .version("3.0")
+                .filter(PojoServletFilter.class, "/" + TEST_NAME);
+
+        addEnvEntry(descriptor, "returnEmail", "java.lang.String", "tomee@apache.org");
+        addEnvEntry(descriptor, "connectionPool", "java.lang.Integer", "20");
+        addEnvEntry(descriptor, "startCount", "java.lang.Long", "200000");
+        addEnvEntry(descriptor, "initSize", "java.lang.Short", "5");
+        addEnvEntry(descriptor, "enableEmail", "java.lang.Boolean", "true");
+        addEnvEntry(descriptor, "totalQuantity", "java.lang.Byte", "5");
+        addEnvEntry(descriptor, "optionDefault", "java.lang.Character", "X");
+        addEnvEntry(descriptor, "auditWriter", "java.lang.Class", "java.lang.String");
+        addEnvEntry(descriptor, "defaultCode", "java.lang.Enum", "org.apache.openejb.arquillian.ServletFilterPojoInjectionTest$Code.OK");
+
+        WebArchive archive = ShrinkWrap.create(WebArchive.class, TEST_NAME + ".war")
+                .addClass(PojoServletFilter.class)
+                .addClass(Car.class)
+                .addClass(CompanyLocal.class)
+                .addClass(Company.class)
+                .addClass(DefaultCompany.class)
+                .addClass(SuperMarket.class)
+                .setWebXML(new StringAsset(descriptor.exportAsString()))
+                .addAsWebInfResource(EmptyAsset.INSTANCE, ArchivePaths.create("beans.xml"));
+
+        System.err.println(descriptor.exportAsString());
+
+        return archive;
+    }
+
+    public static enum Code {
+        OK,
+        ERROR;
+    }
+
+    public static class PojoServletFilter implements Filter {
+
+        @Inject
+        private Car car;
+
+        @EJB
+        private CompanyLocal localCompany;
+
+        @EJB
+        private SuperMarket market;
+
+        @Resource(name = "returnEmail")
+        private String returnEmail;
+
+        @Resource(name = "connectionPool")
+        private Integer connectionPool;
+
+        @Resource(name = "startCount")
+        private Long startCount;
+
+        @Resource(name = "initSize")
+        private Short initSize;
+
+        @Resource(name = "totalQuantity")
+        private Byte totalQuantity;
+
+        @Resource(name = "enableEmail")
+        private Boolean enableEmail;
+
+        @Resource(name = "optionDefault")
+        private Character optionDefault;
+
+        /* TODO: Enable this resource after functionality is fixed
+        @Resource
+        */
+        private Code defaultCode;
+
+        /* TODO: Enable this resource after functionality is fixed
+                @Resource
+                @SuppressWarnings("unchecked")
+        */
+        private Class auditWriter;
+
+
+        private FilterConfig config;
+
+        public void init(FilterConfig config) {
+            this.config = config;
+        }
+
+        public void destroy() {
+        }
+
+        @Override
+        public void doFilter(ServletRequest req, ServletResponse resp, FilterChain chain) throws ServletException, IOException {
+            String name = req.getParameter("name");
+            if (StringUtils.isEmpty(name)) {
+                name = "OpenEJB";
+            }
+
+            if (car != null) {
+                resp.getOutputStream().println(car.drive(name));
+            }
+            if (localCompany != null) {
+                resp.getOutputStream().println("Local: " + localCompany.employ(name));
+            }
+            if (market != null) {
+                resp.getOutputStream().println(market.shop(name));
+            }
+            if (connectionPool != null) {
+                resp.getOutputStream().println("Connection Pool: " + connectionPool);
+            }
+            if (startCount != null) {
+                resp.getOutputStream().println("Start Count: " + startCount);
+            }
+            if (initSize != null) {
+                resp.getOutputStream().println("Init Size: " + initSize);
+            }
+            if (totalQuantity != null) {
+                resp.getOutputStream().println("Total Quantity: " + totalQuantity);
+            }
+            if (enableEmail != null) {
+                resp.getOutputStream().println("Enable Email: " + enableEmail);
+            }
+            if (optionDefault != null) {
+                resp.getOutputStream().println("Option Default: " + optionDefault);
+            }
+            if (StringUtils.isNotEmpty(returnEmail) && returnEmail.equals("tomee@apache.org")) {
+                resp.getOutputStream().println(returnEmail);
+            }
+            if (auditWriter != null) {
+                resp.getOutputStream().println(auditWriter.getClass().getName());
+            }
+            if (defaultCode != null) {
+                resp.getOutputStream().println("DefaultCode: " + defaultCode);
+            }
+        }
+
+
+    }
+
+    public static class Car {
+        private final String make = "Lexus", model = "IS 350";
+        private final int year = 2011;
+
+        public String drive(String name) {
+            return name + " is on the wheel of a " + year + " " + make + " " + model;
+        }
+    }
+
+
+    public static interface Company {
+        public String employ(String employeeName);
+    }
+
+    @Local
+    public static interface CompanyLocal extends Company {
+    }
+
+    @Stateless
+    public static class DefaultCompany implements CompanyLocal {
+
+        private final String name = "TomEE Software Inc.";
+
+        public String employ(String employeeName) {
+            return employeeName + " is employed at " + name;
+        }
+
+    }
+
+    @Stateless
+    @LocalBean
+    public static class SuperMarket {
+
+        private final String name = "Apache Marketplace";
+
+        public String shop(String employeeName) {
+            return employeeName + " shops at " + name;
+        }
+
+    }
+
+    private static void addEnvEntry(WebAppDescriptor descriptor, String name, String type, String value) {
+        Node rootNode = ((NodeProvider) descriptor).getRootNode();
+        Node appNode = rootNode.get("/web-app").iterator().next();
+        appNode.create("/env-entry")
+                .create("env-entry-name").text(name)
+                .parent()
+                .create("env-entry-type").text(type)
+                .parent()
+                .create("env-entry-value").text(value)
+/*
+                .parent()
+                .create("injection-target")
+                .create("injection-target-class").text("org.apache.openejb.arquillian.ServletPojoInjectionTest$PojoServletFilter")
+                .parent()
+                .create("injection-target-name").text(name)
+*/
+        ;
+
+    }
+
+    private void validateTest(String expectedOutput) throws IOException {
+        final InputStream is = new URL("http://localhost:9080/" + TEST_NAME + "/" + TEST_NAME).openStream();
+        final ByteArrayOutputStream os = new ByteArrayOutputStream();
+
+        int bytesRead = -1;
+        byte[] buffer = new byte[8192];
+        while ((bytesRead = is.read(buffer)) > -1) {
+            os.write(buffer, 0, bytesRead);
+        }
+
+        is.close();
+        os.close();
+
+        String output = new String(os.toByteArray(), "UTF-8");
+        assertNotNull("Response shouldn't be null", output);
+        assertTrue("Output should contain: " + expectedOutput, output.contains(expectedOutput));
+    }
+
+}
+
+
+

Added: openejb/trunk/arquillian-tomee/arquillian-tomee-tests/src/test/java/org/apache/openejb/arquillian/tests/ServletFilterPersistenceInjectionTest.java
URL: http://svn.apache.org/viewvc/openejb/trunk/arquillian-tomee/arquillian-tomee-tests/src/test/java/org/apache/openejb/arquillian/tests/ServletFilterPersistenceInjectionTest.java?rev=1178401&view=auto
==============================================================================
--- openejb/trunk/arquillian-tomee/arquillian-tomee-tests/src/test/java/org/apache/openejb/arquillian/tests/ServletFilterPersistenceInjectionTest.java (added)
+++ openejb/trunk/arquillian-tomee/arquillian-tomee-tests/src/test/java/org/apache/openejb/arquillian/tests/ServletFilterPersistenceInjectionTest.java Mon Oct  3 13:04:03 2011
@@ -0,0 +1,156 @@
+/**
+ * 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.arquillian.tests;
+
+import org.jboss.arquillian.api.Deployment;
+import org.jboss.arquillian.junit.Arquillian;
+import org.jboss.shrinkwrap.api.ArchivePaths;
+import org.jboss.shrinkwrap.api.spec.WebArchive;
+import org.jboss.shrinkwrap.descriptor.api.spec.servlet.web.WebAppDescriptor;
+import org.junit.Assert;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+
+import javax.annotation.Resource;
+import javax.persistence.*;
+import javax.servlet.*;
+import javax.transaction.UserTransaction;
+import java.io.IOException;
+
+@RunWith(Arquillian.class)
+public class ServletFilterPersistenceInjectionTest extends TestSetup {
+
+    @Test
+    public void transactionInjectionShouldSucceed() throws Exception {
+        final String expectedOutput = "testUserTransaction=true";
+        validateTest(expectedOutput);
+    }
+
+    @Test
+    public void persistentContextInjectionShouldSucceed() throws Exception {
+        final String expectedOutput = "testEntityManager=true";
+        validateTest(expectedOutput);
+    }
+
+    @Test
+    public void persistenceUnitInjectionShouldSucceed() throws Exception {
+        final String expectedOutput = "testEntityManagerFactory=true";
+        validateTest(expectedOutput);
+    }
+
+    @Deployment(testable = false)
+    public static WebArchive getArchive() {
+        return new ServletFilterPersistenceInjectionTest().createDeployment(PersistenceServletFilter.class, Address.class);
+    }
+
+    protected void decorateDescriptor(WebAppDescriptor descriptor) {
+        descriptor.filter(PersistenceServletFilter.class, "/" + getTestContextName());
+    }
+
+    public void decorateArchive(WebArchive archive) {
+        archive.addAsManifestResource("persistence.xml", ArchivePaths.create("persistence.xml"));
+    }
+
+    public static class PersistenceServletFilter implements Filter {
+
+        @Resource
+        private UserTransaction transaction;
+
+        @PersistenceUnit
+        private EntityManagerFactory entityMgrFactory;
+
+        @PersistenceContext
+        private EntityManager entityManager;
+
+        public void init(FilterConfig config) {
+        }
+
+        public void destroy() {
+        }
+
+        @Override
+        public void doFilter(ServletRequest req, ServletResponse resp, FilterChain chain) throws ServletException, IOException {
+            run(req, resp, this);
+        }
+
+        public void testEntityManagerFactory() {
+            Assert.assertNotNull(entityMgrFactory);
+
+            Address a = new Address();
+            EntityManager em = entityMgrFactory.createEntityManager();
+            em.contains(a);
+        }
+
+        public void testEntityManager() {
+            Assert.assertNotNull(entityManager);
+            Address a = new Address();
+            entityManager.contains(a);
+        }
+
+        public void testUserTransaction() throws Exception{
+            Assert.assertNotNull(transaction);
+            transaction.begin();
+            transaction.commit();
+        }
+
+    }
+
+    @Entity
+    public static class Address {
+        public String getStreet() {
+            return street;
+        }
+
+        public void setStreet(String street) {
+            this.street = street;
+        }
+
+        public String getCity() {
+            return city;
+        }
+
+        public void setCity(String city) {
+            this.city = city;
+        }
+
+        public String getState() {
+            return state;
+        }
+
+        public void setState(String state) {
+            this.state = state;
+        }
+
+        public String getZip() {
+            return zip;
+        }
+
+        public void setZip(String zip) {
+            this.zip = zip;
+        }
+
+        private String street = "123 Lakeview St.", city = "Paradise", state = "ZZ", zip = "00000";
+
+        public String toString() {
+            return "Street: " + street + ", City: " + city + ", State: " + state + ", Zip: " + zip;
+        }
+    }
+
+}
+
+
+