[jboss-svn-commits] JBoss Common SVN: r4068 - in arquillian/trunk: container-glassfish-embedded and 40 other directories.

jboss-svn-commits at lists.jboss.org jboss-svn-commits at lists.jboss.org
Sat Feb 27 18:32:37 EST 2010


Author: aslak
Date: 2010-02-27 18:32:35 -0500 (Sat, 27 Feb 2010)
New Revision: 4068

Added:
   arquillian/trunk/container-glassfish-embedded/src/main/java/org/jboss/arquillian/glassfish/GlassFishDeploymentAppender.java
   arquillian/trunk/container-glassfish-embedded/src/main/resources/META-INF/services/org.jboss.arquillian.spi.AuxiliaryArchiveAppender
   arquillian/trunk/container-jboss-embedded/src/main/java/org/jboss/arquillian/jboss/JbossDeploymentAppender.java
   arquillian/trunk/container-jboss-embedded/src/main/resources/META-INF/services/org.jboss.arquillian.spi.AuxiliaryArchiveAppender
   arquillian/trunk/container-jboss-remote-51/src/main/java/org/jboss/arquillian/jboss/JbossDeploymentAppender.java
   arquillian/trunk/container-jboss-remote-51/src/main/resources/META-INF/services/org.jboss.arquillian.spi.AuxiliaryArchiveAppender
   arquillian/trunk/container-jboss-remote-60/src/main/java/org/jboss/arquillian/jboss/JbossDeploymentAppender.java
   arquillian/trunk/container-jboss-remote-60/src/main/resources/META-INF/services/org.jboss.arquillian.spi.AuxiliaryArchiveAppender
   arquillian/trunk/testenricher/
   arquillian/trunk/testenricher/cdi/
   arquillian/trunk/testenricher/cdi/pom.xml
   arquillian/trunk/testenricher/cdi/src/
   arquillian/trunk/testenricher/cdi/src/main/
   arquillian/trunk/testenricher/cdi/src/main/java/
   arquillian/trunk/testenricher/cdi/src/main/java/org/
   arquillian/trunk/testenricher/cdi/src/main/java/org/jboss/
   arquillian/trunk/testenricher/cdi/src/main/java/org/jboss/arquillian/
   arquillian/trunk/testenricher/cdi/src/main/java/org/jboss/arquillian/testenricher/
   arquillian/trunk/testenricher/cdi/src/main/java/org/jboss/arquillian/testenricher/cdi/
   arquillian/trunk/testenricher/cdi/src/main/java/org/jboss/arquillian/testenricher/cdi/CDIInjectionEnricher.java
   arquillian/trunk/testenricher/cdi/src/main/java/org/jboss/arquillian/testenricher/cdi/SecurityActions.java
   arquillian/trunk/testenricher/cdi/src/main/resources/
   arquillian/trunk/testenricher/cdi/src/test/
   arquillian/trunk/testenricher/cdi/src/test/java/
   arquillian/trunk/testenricher/cdi/src/test/resources/
   arquillian/trunk/testenricher/ejb/
   arquillian/trunk/testenricher/ejb/pom.xml
   arquillian/trunk/testenricher/ejb/src/
   arquillian/trunk/testenricher/ejb/src/main/
   arquillian/trunk/testenricher/ejb/src/main/java/
   arquillian/trunk/testenricher/ejb/src/main/java/org/
   arquillian/trunk/testenricher/ejb/src/main/java/org/jboss/
   arquillian/trunk/testenricher/ejb/src/main/java/org/jboss/arquillian/
   arquillian/trunk/testenricher/ejb/src/main/java/org/jboss/arquillian/testenricher/
   arquillian/trunk/testenricher/ejb/src/main/java/org/jboss/arquillian/testenricher/ejb/
   arquillian/trunk/testenricher/ejb/src/main/java/org/jboss/arquillian/testenricher/ejb/EJBInjectionEnricher.java
   arquillian/trunk/testenricher/ejb/src/main/java/org/jboss/arquillian/testenricher/ejb/SecurityActions.java
   arquillian/trunk/testenricher/pom.xml
   arquillian/trunk/testenricher/resource/
   arquillian/trunk/testenricher/resource/pom.xml
   arquillian/trunk/testenricher/resource/src/
   arquillian/trunk/testenricher/resource/src/main/
   arquillian/trunk/testenricher/resource/src/main/java/
   arquillian/trunk/testenricher/resource/src/main/java/org/
   arquillian/trunk/testenricher/resource/src/main/java/org/jboss/
   arquillian/trunk/testenricher/resource/src/main/java/org/jboss/arquillian/
   arquillian/trunk/testenricher/resource/src/main/java/org/jboss/arquillian/testenricher/
   arquillian/trunk/testenricher/resource/src/main/java/org/jboss/arquillian/testenricher/resource/
   arquillian/trunk/testenricher/resource/src/main/java/org/jboss/arquillian/testenricher/resource/ResourceInjectionEnricher.java
   arquillian/trunk/testenricher/resource/src/main/java/org/jboss/arquillian/testenricher/resource/SecurityActions.java
Modified:
   arquillian/trunk/container-glassfish-embedded/pom.xml
   arquillian/trunk/container-jboss-embedded/pom.xml
   arquillian/trunk/container-jboss-remote-51/pom.xml
   arquillian/trunk/container-jboss-remote-60/pom.xml
Log:
ARQ-63 Restructured the testenricher impls


Modified: arquillian/trunk/container-glassfish-embedded/pom.xml
===================================================================
--- arquillian/trunk/container-glassfish-embedded/pom.xml	2010-02-27 21:18:56 UTC (rev 4067)
+++ arquillian/trunk/container-glassfish-embedded/pom.xml	2010-02-27 23:32:35 UTC (rev 4068)
@@ -67,9 +67,19 @@
 
       <dependency>
          <groupId>org.jboss.arquillian</groupId>
-         <artifactId>arquillian-jboss-testenricher</artifactId>
+         <artifactId>arquillian-testenricher-cdi</artifactId>
          <version>${project.version}</version>
       </dependency>
+      <dependency>
+         <groupId>org.jboss.arquillian</groupId>
+         <artifactId>arquillian-testenricher-ejb</artifactId>
+         <version>${project.version}</version>
+      </dependency>
+      <dependency>
+         <groupId>org.jboss.arquillian</groupId>
+         <artifactId>arquillian-testenricher-resource</artifactId>
+         <version>${project.version}</version>
+      </dependency>
 
       <!-- 
     org.glassfish.embedded

Added: arquillian/trunk/container-glassfish-embedded/src/main/java/org/jboss/arquillian/glassfish/GlassFishDeploymentAppender.java
===================================================================
--- arquillian/trunk/container-glassfish-embedded/src/main/java/org/jboss/arquillian/glassfish/GlassFishDeploymentAppender.java	                        (rev 0)
+++ arquillian/trunk/container-glassfish-embedded/src/main/java/org/jboss/arquillian/glassfish/GlassFishDeploymentAppender.java	2010-02-27 23:32:35 UTC (rev 4068)
@@ -0,0 +1,59 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2009, Red Hat Middleware LLC, and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * Licensed 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.jboss.arquillian.glassfish;
+
+import org.jboss.arquillian.spi.AuxiliaryArchiveAppender;
+import org.jboss.arquillian.spi.TestEnricher;
+import org.jboss.arquillian.testenricher.cdi.CDIInjectionEnricher;
+import org.jboss.arquillian.testenricher.ejb.EJBInjectionEnricher;
+import org.jboss.arquillian.testenricher.resource.ResourceInjectionEnricher;
+import org.jboss.shrinkwrap.api.Archive;
+import org.jboss.shrinkwrap.api.Archives;
+import org.jboss.shrinkwrap.api.spec.JavaArchive;
+
+/**
+ * 
+ * Package the required dependencies needed by the GlassFish Embedded Container plugin 
+ * to run in container. 
+ *
+ * @author <a href="mailto:aslak at conduct.no">Aslak Knutsen</a>
+ * @version $Revision: $
+ */
+public class GlassFishDeploymentAppender implements AuxiliaryArchiveAppender
+{
+
+   /* (non-Javadoc)
+    * @see org.jboss.arquillian.spi.DeploymentAppender#createArchive()
+    */
+   @Override
+   public Archive<?> createAuxiliaryArchive()
+   {
+      JavaArchive archive = Archives.create("jboss-testenrichers.jar", JavaArchive.class)
+                        .addPackages(
+                              true, 
+                              EJBInjectionEnricher.class.getPackage(),
+                              ResourceInjectionEnricher.class.getPackage(),
+                              CDIInjectionEnricher.class.getPackage())
+                        .addServiceProvider(
+                              TestEnricher.class, 
+                              EJBInjectionEnricher.class,
+                              ResourceInjectionEnricher.class,
+                              CDIInjectionEnricher.class);
+      return archive;
+   }
+
+}

Added: arquillian/trunk/container-glassfish-embedded/src/main/resources/META-INF/services/org.jboss.arquillian.spi.AuxiliaryArchiveAppender
===================================================================
--- arquillian/trunk/container-glassfish-embedded/src/main/resources/META-INF/services/org.jboss.arquillian.spi.AuxiliaryArchiveAppender	                        (rev 0)
+++ arquillian/trunk/container-glassfish-embedded/src/main/resources/META-INF/services/org.jboss.arquillian.spi.AuxiliaryArchiveAppender	2010-02-27 23:32:35 UTC (rev 4068)
@@ -0,0 +1 @@
+org.jboss.arquillian.glassfish.GlassFishDeploymentAppender
\ No newline at end of file

Modified: arquillian/trunk/container-jboss-embedded/pom.xml
===================================================================
--- arquillian/trunk/container-jboss-embedded/pom.xml	2010-02-27 21:18:56 UTC (rev 4067)
+++ arquillian/trunk/container-jboss-embedded/pom.xml	2010-02-27 23:32:35 UTC (rev 4068)
@@ -39,15 +39,31 @@
       </dependency>
 
       <dependency>
+         <groupId>org.jboss.shrinkwrap</groupId>
+         <artifactId>shrinkwrap-impl-base</artifactId>
+      </dependency>
+
+      <dependency>
          <groupId>org.jboss.arquillian</groupId>
          <artifactId>arquillian-protocol-servlet</artifactId>
          <version>${project.version}</version>
       </dependency>
+
       <dependency>
          <groupId>org.jboss.arquillian</groupId>
-         <artifactId>arquillian-jboss-testenricher</artifactId>
+         <artifactId>arquillian-testenricher-cdi</artifactId>
          <version>${project.version}</version>
       </dependency>
+      <dependency>
+         <groupId>org.jboss.arquillian</groupId>
+         <artifactId>arquillian-testenricher-ejb</artifactId>
+         <version>${project.version}</version>
+      </dependency>
+      <dependency>
+         <groupId>org.jboss.arquillian</groupId>
+         <artifactId>arquillian-testenricher-resource</artifactId>
+         <version>${project.version}</version>
+      </dependency>
 
       <!-- 
     org.jboss.embedded
@@ -56,6 +72,16 @@
          <groupId>org.jboss.embedded</groupId>
          <artifactId>jboss-embedded-assembly</artifactId>
          <classifier>launcher</classifier>
+         <exclusions>
+            <exclusion>
+               <groupId>org.jboss.shrinkwrap</groupId>
+               <artifactId>shrinkwrap-api</artifactId>
+            </exclusion>
+            <exclusion>
+               <groupId>org.jboss.shrinkwrap</groupId>
+               <artifactId>shrinkwrap-impl-base</artifactId>
+            </exclusion>
+         </exclusions>
       </dependency>
 
       <dependency>

Added: arquillian/trunk/container-jboss-embedded/src/main/java/org/jboss/arquillian/jboss/JbossDeploymentAppender.java
===================================================================
--- arquillian/trunk/container-jboss-embedded/src/main/java/org/jboss/arquillian/jboss/JbossDeploymentAppender.java	                        (rev 0)
+++ arquillian/trunk/container-jboss-embedded/src/main/java/org/jboss/arquillian/jboss/JbossDeploymentAppender.java	2010-02-27 23:32:35 UTC (rev 4068)
@@ -0,0 +1,60 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2009, Red Hat Middleware LLC, and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * Licensed 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.jboss.arquillian.jboss;
+
+import org.jboss.arquillian.spi.AuxiliaryArchiveAppender;
+import org.jboss.arquillian.spi.TestEnricher;
+import org.jboss.arquillian.testenricher.cdi.CDIInjectionEnricher;
+import org.jboss.arquillian.testenricher.ejb.EJBInjectionEnricher;
+import org.jboss.arquillian.testenricher.resource.ResourceInjectionEnricher;
+import org.jboss.shrinkwrap.api.Archive;
+import org.jboss.shrinkwrap.api.Archives;
+import org.jboss.shrinkwrap.api.spec.JavaArchive;
+
+/**
+ * EmbeddedDeploymentAppender
+ * 
+ * Package the required dependencies needed by the Jboss Embedded Container plugin 
+ * to run in container. 
+ *
+ * @author <a href="mailto:aslak at conduct.no">Aslak Knutsen</a>
+ * @version $Revision: $
+ */
+public class JbossDeploymentAppender implements AuxiliaryArchiveAppender
+{
+
+   /* (non-Javadoc)
+    * @see org.jboss.arquillian.spi.DeploymentAppender#createArchive()
+    */
+   @Override
+   public Archive<?> createAuxiliaryArchive()
+   {
+      JavaArchive archive = Archives.create("jboss-testenrichers.jar", JavaArchive.class)
+                        .addPackages(
+                              true, 
+                              EJBInjectionEnricher.class.getPackage(),
+                              ResourceInjectionEnricher.class.getPackage(),
+                              CDIInjectionEnricher.class.getPackage())
+                        .addServiceProvider(
+                              TestEnricher.class, 
+                              EJBInjectionEnricher.class,
+                              ResourceInjectionEnricher.class,
+                              CDIInjectionEnricher.class);
+      return archive;
+   }
+
+}

Added: arquillian/trunk/container-jboss-embedded/src/main/resources/META-INF/services/org.jboss.arquillian.spi.AuxiliaryArchiveAppender
===================================================================
--- arquillian/trunk/container-jboss-embedded/src/main/resources/META-INF/services/org.jboss.arquillian.spi.AuxiliaryArchiveAppender	                        (rev 0)
+++ arquillian/trunk/container-jboss-embedded/src/main/resources/META-INF/services/org.jboss.arquillian.spi.AuxiliaryArchiveAppender	2010-02-27 23:32:35 UTC (rev 4068)
@@ -0,0 +1 @@
+org.jboss.arquillian.jboss.JbossDeploymentAppender
\ No newline at end of file

Modified: arquillian/trunk/container-jboss-remote-51/pom.xml
===================================================================
--- arquillian/trunk/container-jboss-remote-51/pom.xml	2010-02-27 21:18:56 UTC (rev 4067)
+++ arquillian/trunk/container-jboss-remote-51/pom.xml	2010-02-27 23:32:35 UTC (rev 4068)
@@ -42,11 +42,17 @@
          <artifactId>arquillian-protocol-servlet</artifactId>
          <version>${project.version}</version>
       </dependency>
+
       <dependency>
          <groupId>org.jboss.arquillian</groupId>
-         <artifactId>arquillian-jboss-testenricher</artifactId>
+         <artifactId>arquillian-testenricher-ejb</artifactId>
          <version>${project.version}</version>
       </dependency>
+      <dependency>
+         <groupId>org.jboss.arquillian</groupId>
+         <artifactId>arquillian-testenricher-resource</artifactId>
+         <version>${project.version}</version>
+      </dependency>
 
       <!-- 
     org.jboss

Added: arquillian/trunk/container-jboss-remote-51/src/main/java/org/jboss/arquillian/jboss/JbossDeploymentAppender.java
===================================================================
--- arquillian/trunk/container-jboss-remote-51/src/main/java/org/jboss/arquillian/jboss/JbossDeploymentAppender.java	                        (rev 0)
+++ arquillian/trunk/container-jboss-remote-51/src/main/java/org/jboss/arquillian/jboss/JbossDeploymentAppender.java	2010-02-27 23:32:35 UTC (rev 4068)
@@ -0,0 +1,57 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2009, Red Hat Middleware LLC, and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * Licensed 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.jboss.arquillian.jboss;
+
+import org.jboss.arquillian.spi.AuxiliaryArchiveAppender;
+import org.jboss.arquillian.spi.TestEnricher;
+import org.jboss.arquillian.testenricher.ejb.EJBInjectionEnricher;
+import org.jboss.arquillian.testenricher.resource.ResourceInjectionEnricher;
+import org.jboss.shrinkwrap.api.Archive;
+import org.jboss.shrinkwrap.api.Archives;
+import org.jboss.shrinkwrap.api.spec.JavaArchive;
+
+/**
+ * EmbeddedDeploymentAppender
+ * 
+ * Package the required dependencies needed by the Jboss Embedded Container plugin 
+ * to run in container. 
+ *
+ * @author <a href="mailto:aslak at conduct.no">Aslak Knutsen</a>
+ * @version $Revision: $
+ */
+public class JbossDeploymentAppender implements AuxiliaryArchiveAppender
+{
+
+   /* (non-Javadoc)
+    * @see org.jboss.arquillian.spi.DeploymentAppender#createArchive()
+    */
+   @Override
+   public Archive<?> createAuxiliaryArchive()
+   {
+      JavaArchive archive = Archives.create("jboss-testenrichers.jar", JavaArchive.class)
+                        .addPackages(
+                              true, 
+                              EJBInjectionEnricher.class.getPackage(),
+                              ResourceInjectionEnricher.class.getPackage())
+                        .addServiceProvider(
+                              TestEnricher.class, 
+                              EJBInjectionEnricher.class,
+                              ResourceInjectionEnricher.class);
+      return archive;
+   }
+
+}

Added: arquillian/trunk/container-jboss-remote-51/src/main/resources/META-INF/services/org.jboss.arquillian.spi.AuxiliaryArchiveAppender
===================================================================
--- arquillian/trunk/container-jboss-remote-51/src/main/resources/META-INF/services/org.jboss.arquillian.spi.AuxiliaryArchiveAppender	                        (rev 0)
+++ arquillian/trunk/container-jboss-remote-51/src/main/resources/META-INF/services/org.jboss.arquillian.spi.AuxiliaryArchiveAppender	2010-02-27 23:32:35 UTC (rev 4068)
@@ -0,0 +1 @@
+org.jboss.arquillian.jboss.JbossDeploymentAppender
\ No newline at end of file

Modified: arquillian/trunk/container-jboss-remote-60/pom.xml
===================================================================
--- arquillian/trunk/container-jboss-remote-60/pom.xml	2010-02-27 21:18:56 UTC (rev 4067)
+++ arquillian/trunk/container-jboss-remote-60/pom.xml	2010-02-27 23:32:35 UTC (rev 4068)
@@ -42,11 +42,22 @@
          <artifactId>arquillian-protocol-servlet</artifactId>
          <version>${project.version}</version>
       </dependency>
+
       <dependency>
          <groupId>org.jboss.arquillian</groupId>
-         <artifactId>arquillian-jboss-testenricher</artifactId>
+         <artifactId>arquillian-testenricher-cdi</artifactId>
          <version>${project.version}</version>
       </dependency>
+      <dependency>
+         <groupId>org.jboss.arquillian</groupId>
+         <artifactId>arquillian-testenricher-ejb</artifactId>
+         <version>${project.version}</version>
+      </dependency>
+      <dependency>
+         <groupId>org.jboss.arquillian</groupId>
+         <artifactId>arquillian-testenricher-resource</artifactId>
+         <version>${project.version}</version>
+      </dependency>
 
       <!-- 
     org.jboss
@@ -56,7 +67,7 @@
          <groupId>org.jboss.jbossas</groupId>
          <artifactId>jboss-as-client</artifactId>
          <type>pom</type>
-         <version>6.0.0.20100216-M2</version>
+         <version>6.0.0.M1</version>
       </dependency>
    </dependencies>
 </project>

Added: arquillian/trunk/container-jboss-remote-60/src/main/java/org/jboss/arquillian/jboss/JbossDeploymentAppender.java
===================================================================
--- arquillian/trunk/container-jboss-remote-60/src/main/java/org/jboss/arquillian/jboss/JbossDeploymentAppender.java	                        (rev 0)
+++ arquillian/trunk/container-jboss-remote-60/src/main/java/org/jboss/arquillian/jboss/JbossDeploymentAppender.java	2010-02-27 23:32:35 UTC (rev 4068)
@@ -0,0 +1,60 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2009, Red Hat Middleware LLC, and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * Licensed 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.jboss.arquillian.jboss;
+
+import org.jboss.arquillian.spi.AuxiliaryArchiveAppender;
+import org.jboss.arquillian.spi.TestEnricher;
+import org.jboss.arquillian.testenricher.cdi.CDIInjectionEnricher;
+import org.jboss.arquillian.testenricher.ejb.EJBInjectionEnricher;
+import org.jboss.arquillian.testenricher.resource.ResourceInjectionEnricher;
+import org.jboss.shrinkwrap.api.Archive;
+import org.jboss.shrinkwrap.api.Archives;
+import org.jboss.shrinkwrap.api.spec.JavaArchive;
+
+/**
+ * EmbeddedDeploymentAppender
+ * 
+ * Package the required dependencies needed by the Jboss Embedded Container plugin 
+ * to run in container. 
+ *
+ * @author <a href="mailto:aslak at conduct.no">Aslak Knutsen</a>
+ * @version $Revision: $
+ */
+public class JbossDeploymentAppender implements AuxiliaryArchiveAppender
+{
+
+   /* (non-Javadoc)
+    * @see org.jboss.arquillian.spi.DeploymentAppender#createArchive()
+    */
+   @Override
+   public Archive<?> createAuxiliaryArchive()
+   {
+      JavaArchive archive = Archives.create("jboss-testenrichers.jar", JavaArchive.class)
+                        .addPackages(
+                              true, 
+                              EJBInjectionEnricher.class.getPackage(),
+                              ResourceInjectionEnricher.class.getPackage(),
+                              CDIInjectionEnricher.class.getPackage())
+                        .addServiceProvider(
+                              TestEnricher.class, 
+                              EJBInjectionEnricher.class,
+                              ResourceInjectionEnricher.class,
+                              CDIInjectionEnricher.class);
+      return archive;
+   }
+
+}

Added: arquillian/trunk/container-jboss-remote-60/src/main/resources/META-INF/services/org.jboss.arquillian.spi.AuxiliaryArchiveAppender
===================================================================
--- arquillian/trunk/container-jboss-remote-60/src/main/resources/META-INF/services/org.jboss.arquillian.spi.AuxiliaryArchiveAppender	                        (rev 0)
+++ arquillian/trunk/container-jboss-remote-60/src/main/resources/META-INF/services/org.jboss.arquillian.spi.AuxiliaryArchiveAppender	2010-02-27 23:32:35 UTC (rev 4068)
@@ -0,0 +1 @@
+org.jboss.arquillian.jboss.JbossDeploymentAppender
\ No newline at end of file


Property changes on: arquillian/trunk/testenricher
___________________________________________________________________
Name: svn:ignore
   + .classpath
.project
.settings
target




Property changes on: arquillian/trunk/testenricher/cdi
___________________________________________________________________
Name: svn:ignore
   + .classpath
.project
.settings
target



Added: arquillian/trunk/testenricher/cdi/pom.xml
===================================================================
--- arquillian/trunk/testenricher/cdi/pom.xml	                        (rev 0)
+++ arquillian/trunk/testenricher/cdi/pom.xml	2010-02-27 23:32:35 UTC (rev 4068)
@@ -0,0 +1,60 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+   xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+
+   <!-- Parent -->
+   <parent>
+      <groupId>org.jboss.arquillian</groupId>
+      <artifactId>arquillian-build</artifactId>
+      <version>1.0.0-SNAPSHOT</version>
+      <relativePath>../../build/pom.xml</relativePath>
+   </parent>
+
+   <!-- Model Version -->
+   <modelVersion>4.0.0</modelVersion>
+
+   <!-- Artifact Configuration -->
+   <artifactId>arquillian-testenricher-cdi</artifactId>
+   <name>Arquillian TestEnricher CDI</name>
+   <description>CDI TestEnricher for the Arquillian Project</description>
+
+
+   <!-- Properties -->
+   <properties>
+
+      <!-- Versioning -->
+
+   </properties>
+
+   <!-- Dependencies -->
+   <dependencies>
+
+      <!-- 
+    org.jboss.arquillian
+     -->
+      <dependency>
+         <groupId>org.jboss.arquillian</groupId>
+         <artifactId>arquillian-spi</artifactId>
+         <version>${project.version}</version>
+      </dependency>
+
+
+      <dependency>
+         <groupId>org.jboss.shrinkwrap</groupId>
+         <artifactId>shrinkwrap-impl-base</artifactId>
+         <scope>test</scope>
+      </dependency>
+      <dependency>
+         <groupId>javax.enterprise</groupId> 
+         <artifactId>cdi-api</artifactId>
+         <version>1.0</version>
+         <scope>provided</scope>       
+      </dependency>
+      <dependency>
+         <groupId>junit</groupId>
+         <artifactId>junit</artifactId>
+         <scope>test</scope>
+      </dependency>
+   </dependencies>
+</project>
+

Copied: arquillian/trunk/testenricher/cdi/src/main/java/org/jboss/arquillian/testenricher/cdi/CDIInjectionEnricher.java (from rev 4065, arquillian/trunk/testenricher-jboss/src/main/java/org/jboss/arquillian/testenricher/jboss/CDIInjectionEnricher.java)
===================================================================
--- arquillian/trunk/testenricher/cdi/src/main/java/org/jboss/arquillian/testenricher/cdi/CDIInjectionEnricher.java	                        (rev 0)
+++ arquillian/trunk/testenricher/cdi/src/main/java/org/jboss/arquillian/testenricher/cdi/CDIInjectionEnricher.java	2010-02-27 23:32:35 UTC (rev 4068)
@@ -0,0 +1,90 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2009, Red Hat Middleware LLC, and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * Licensed 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.jboss.arquillian.testenricher.cdi;
+
+import javax.enterprise.context.spi.CreationalContext;
+import javax.enterprise.inject.spi.BeanManager;
+import javax.enterprise.inject.spi.InjectionTarget;
+import javax.naming.InitialContext;
+
+import org.jboss.arquillian.spi.TestEnricher;
+
+/**
+ * CDIInjectionEnricher
+ *
+ * @author <a href="mailto:aslak at conduct.no">Aslak Knutsen</a>
+ * @version $Revision: $
+ */
+public class CDIInjectionEnricher implements TestEnricher 
+{
+   private static final String JNDI_BEAN_MANAGER = "java:comp/BeanManager";
+   private static final String JNDI_BEAN_MANAGER_JBOSS = "java:app/BeanManager";
+   private static final String ANNOTATION_NAME = "javax.inject.Inject";
+   
+   @Override
+   public void enrich(Object testCase)
+   {
+      if(SecurityActions.isClassPresent(ANNOTATION_NAME)) 
+      {
+         injectClass(testCase);
+      }
+   }
+   
+   protected void injectClass(Object testCase) 
+   {
+      try 
+      {
+         BeanManager beanManager = lookupBeanManager();
+         if(beanManager != null) {
+            injectNonContextualInstance(beanManager, testCase);            
+         }
+      }
+      catch (Exception e) 
+      {
+         throw new RuntimeException("Could not inject members", e);
+      }
+   }
+   
+   @SuppressWarnings("unchecked")
+   protected void injectNonContextualInstance(BeanManager manager, Object instance)
+   {
+      CreationalContext<Object> creationalContext =  manager.createCreationalContext(null);
+      InjectionTarget<Object> injectionTarget = (InjectionTarget<Object>) manager.createInjectionTarget(
+            manager.createAnnotatedType(instance.getClass()));
+      injectionTarget.inject(instance, creationalContext);
+   }
+
+   protected BeanManager lookupBeanManager() 
+   {
+      try 
+      {
+         return (BeanManager)new InitialContext().lookup(JNDI_BEAN_MANAGER);   
+      }
+      catch (Exception e) 
+      {
+         // TODO: hack until JBoss fix BeanManager binding 
+         try 
+         {
+            return (BeanManager)new InitialContext().lookup(JNDI_BEAN_MANAGER_JBOSS);
+         } 
+         catch (Exception e2) 
+         {
+            return null;
+         }
+      }
+   }
+}

Copied: arquillian/trunk/testenricher/cdi/src/main/java/org/jboss/arquillian/testenricher/cdi/SecurityActions.java (from rev 4033, arquillian/trunk/testenricher-jboss/src/main/java/org/jboss/arquillian/testenricher/jboss/SecurityActions.java)
===================================================================
--- arquillian/trunk/testenricher/cdi/src/main/java/org/jboss/arquillian/testenricher/cdi/SecurityActions.java	                        (rev 0)
+++ arquillian/trunk/testenricher/cdi/src/main/java/org/jboss/arquillian/testenricher/cdi/SecurityActions.java	2010-02-27 23:32:35 UTC (rev 4068)
@@ -0,0 +1,223 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2009, Red Hat Middleware LLC, and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * Licensed 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.jboss.arquillian.testenricher.cdi;
+
+import java.lang.annotation.Annotation;
+import java.lang.reflect.Constructor;
+import java.lang.reflect.Field;
+import java.security.AccessController;
+import java.security.PrivilegedAction;
+import java.security.PrivilegedActionException;
+import java.security.PrivilegedExceptionAction;
+import java.util.ArrayList;
+import java.util.List;
+
+/**
+ * SecurityActions
+ * 
+ * A set of privileged actions that are not to leak out
+ * of this package 
+ *
+ * @author <a href="mailto:andrew.rubinger at jboss.org">ALR</a>
+ * @version $Revision: $
+ */
+final class SecurityActions
+{
+
+   //-------------------------------------------------------------------------------||
+   // Constructor ------------------------------------------------------------------||
+   //-------------------------------------------------------------------------------||
+
+   /**
+    * No instantiation
+    */
+   private SecurityActions()
+   {
+      throw new UnsupportedOperationException("No instantiation");
+   }
+
+   //-------------------------------------------------------------------------------||
+   // Utility Methods --------------------------------------------------------------||
+   //-------------------------------------------------------------------------------||
+
+   /**
+    * Obtains the Thread Context ClassLoader
+    */
+   static ClassLoader getThreadContextClassLoader()
+   {
+      return AccessController.doPrivileged(GetTcclAction.INSTANCE);
+   }
+
+   /**
+    * Obtains the Constructor specified from the given Class and argument types
+    * @param clazz
+    * @param argumentTypes
+    * @return
+    * @throws NoSuchMethodException
+    */
+   static Constructor<?> getConstructor(final Class<?> clazz, final Class<?>... argumentTypes)
+         throws NoSuchMethodException
+   {
+      try
+      {
+         return AccessController.doPrivileged(new PrivilegedExceptionAction<Constructor<?>>()
+         {
+            @Override
+            public Constructor<?> run() throws NoSuchMethodException
+            {
+               return clazz.getConstructor(argumentTypes);
+            }
+         });
+      }
+      // Unwrap
+      catch (final PrivilegedActionException pae)
+      {
+         final Throwable t = pae.getCause();
+         // Rethrow
+         if (t instanceof NoSuchMethodException)
+         {
+            throw (NoSuchMethodException) t;
+         }
+         else
+         {
+            // No other checked Exception thrown by Class.getConstructor
+            try
+            {
+               throw (RuntimeException) t;
+            }
+            // Just in case we've really messed up
+            catch (final ClassCastException cce)
+            {
+               throw new RuntimeException("Obtained unchecked Exception; this code should never be reached", t);
+            }
+         }
+      }
+   }
+
+   /**
+    * Create a new instance by finding a constructor that matches the argumentTypes signature 
+    * using the arguments for instantiation.
+    * 
+    * @param className Full classname of class to create
+    * @param argumentTypes The constructor argument types
+    * @param arguments The constructor arguments
+    * @return a new instance
+    * @throws IllegalArgumentException if className, argumentTypes, or arguments are null
+    * @throws RuntimeException if any exceptions during creation
+    * @author <a href="mailto:aslak at conduct.no">Aslak Knutsen</a>
+    * @author <a href="mailto:andrew.rubinger at jboss.org">ALR</a>
+    */
+   static <T> T newInstance(final String className, final Class<?>[] argumentTypes, final Object[] arguments,
+         final Class<T> expectedType)
+   {
+      if (className == null)
+      {
+         throw new IllegalArgumentException("ClassName must be specified");
+      }
+      if (argumentTypes == null)
+      {
+         throw new IllegalArgumentException("ArgumentTypes must be specified. Use empty array if no arguments");
+      }
+      if (arguments == null)
+      {
+         throw new IllegalArgumentException("Arguments must be specified. Use empty array if no arguments");
+      }
+      final Object obj;
+      try
+      {
+         final ClassLoader tccl = getThreadContextClassLoader();
+         final Class<?> implClass = Class.forName(className, false, tccl);
+         Constructor<?> constructor = getConstructor(implClass, argumentTypes);
+         obj = constructor.newInstance(arguments);
+      }
+      catch (Exception e)
+      {
+         throw new RuntimeException("Could not create new instance of " + className
+               + ", missing package from classpath?", e);
+      }
+
+      // Cast
+      try
+      {
+         return expectedType.cast(obj);
+      }
+      catch (final ClassCastException cce)
+      {
+         // Reconstruct so we get some useful information
+         throw new ClassCastException("Incorrect expected type, " + expectedType.getName() + ", defined for "
+               + obj.getClass().getName());
+      }
+   }
+
+   public static boolean isClassPresent(String name) 
+   {
+      try 
+      {
+         ClassLoader classLoader = getThreadContextClassLoader();
+         classLoader.loadClass(name); 
+         return true;
+      }
+      catch (ClassNotFoundException e) 
+      {
+         return false;
+      }
+   }
+   
+   public static List<Field> getFieldsWithAnnotation(final Class<?> source, final Class<? extends Annotation> annotationClass) 
+   {
+      List<Field> declaredAccessableFields = AccessController.doPrivileged(new PrivilegedAction<List<Field>>()
+      {
+         @Override
+         public List<Field> run()
+         {
+            List<Field> foundFields = new ArrayList<Field>();
+            for(Field field : source.getDeclaredFields())
+            {
+               if(field.isAnnotationPresent(annotationClass))
+               {
+                  if(!field.isAccessible()) 
+                  {
+                     field.setAccessible(true);
+                  }
+                  foundFields.add(field);
+               }
+            }
+            return foundFields;
+         }
+      });
+      return declaredAccessableFields;
+   }
+   
+   //-------------------------------------------------------------------------------||
+   // Inner Classes ----------------------------------------------------------------||
+   //-------------------------------------------------------------------------------||
+
+   /**
+    * Single instance to get the TCCL
+    */
+   private enum GetTcclAction implements PrivilegedAction<ClassLoader> {
+      INSTANCE;
+
+      @Override
+      public ClassLoader run()
+      {
+         return Thread.currentThread().getContextClassLoader();
+      }
+
+   }
+
+}


Property changes on: arquillian/trunk/testenricher/ejb
___________________________________________________________________
Name: svn:ignore
   + .classpath
.project
.settings
target



Added: arquillian/trunk/testenricher/ejb/pom.xml
===================================================================
--- arquillian/trunk/testenricher/ejb/pom.xml	                        (rev 0)
+++ arquillian/trunk/testenricher/ejb/pom.xml	2010-02-27 23:32:35 UTC (rev 4068)
@@ -0,0 +1,60 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+   xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+
+   <!-- Parent -->
+   <parent>
+      <groupId>org.jboss.arquillian</groupId>
+      <artifactId>arquillian-build</artifactId>
+      <version>1.0.0-SNAPSHOT</version>
+      <relativePath>../../build/pom.xml</relativePath>
+   </parent>
+
+   <!-- Model Version -->
+   <modelVersion>4.0.0</modelVersion>
+
+   <!-- Artifact Configuration -->
+   <artifactId>arquillian-testenricher-ejb</artifactId>
+   <name>Arquillian TestEnricher EJB</name>
+   <description>EJB TestEnricher for the Arquillian Project</description>
+
+
+   <!-- Properties -->
+   <properties>
+
+      <!-- Versioning -->
+
+   </properties>
+
+   <!-- Dependencies -->
+   <dependencies>
+
+      <!-- 
+    org.jboss.arquillian
+     -->
+      <dependency>
+         <groupId>org.jboss.arquillian</groupId>
+         <artifactId>arquillian-spi</artifactId>
+         <version>${project.version}</version>
+      </dependency>
+
+
+      <dependency>
+         <groupId>org.jboss.shrinkwrap</groupId>
+         <artifactId>shrinkwrap-impl-base</artifactId>
+         <scope>test</scope>
+      </dependency>
+      <dependency>
+        <groupId>javax.ejb</groupId>
+        <artifactId>ejb-api</artifactId>
+        <version>3.0</version>
+        <scope>provided</scope>
+      </dependency>
+      <dependency>
+         <groupId>junit</groupId>
+         <artifactId>junit</artifactId>
+         <scope>test</scope>
+      </dependency>
+   </dependencies>
+</project>
+

Copied: arquillian/trunk/testenricher/ejb/src/main/java/org/jboss/arquillian/testenricher/ejb/EJBInjectionEnricher.java (from rev 4033, arquillian/trunk/testenricher-jboss/src/main/java/org/jboss/arquillian/testenricher/jboss/EJBInjectionEnricher.java)
===================================================================
--- arquillian/trunk/testenricher/ejb/src/main/java/org/jboss/arquillian/testenricher/ejb/EJBInjectionEnricher.java	                        (rev 0)
+++ arquillian/trunk/testenricher/ejb/src/main/java/org/jboss/arquillian/testenricher/ejb/EJBInjectionEnricher.java	2010-02-27 23:32:35 UTC (rev 4068)
@@ -0,0 +1,98 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2009, Red Hat Middleware LLC, and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * Licensed 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.jboss.arquillian.testenricher.ejb;
+
+import java.lang.annotation.Annotation;
+import java.lang.reflect.Field;
+import java.util.List;
+
+import javax.naming.InitialContext;
+import javax.naming.NamingException;
+
+import org.jboss.arquillian.spi.TestEnricher;
+
+/**
+ * InjectionEnricher
+ *
+ * @author <a href="mailto:aslak at conduct.no">Aslak Knutsen</a>
+ * @version $Revision: $
+ */
+public class EJBInjectionEnricher implements TestEnricher
+{
+   
+   private static final String ANNOTATION_NAME = "javax.ejb.EJB";
+   private static final String ANNOTATION_FIELD_BEAN_INTERFACE = "beanInterface";
+   private static final String ANNOTATION_FIELD_MAPPED_NAME = "mappedName";
+   
+   @Override
+   public void enrich(Object testCase)
+   {
+      if(SecurityActions.isClassPresent(ANNOTATION_NAME)) 
+      {
+         injectClass(testCase);
+      }
+   }
+
+   protected void injectClass(Object testCase) 
+   {
+      try 
+      {
+         @SuppressWarnings("unchecked")
+         Class<? extends Annotation> ejbAnnotation = (Class<? extends Annotation>)SecurityActions.getThreadContextClassLoader().loadClass(ANNOTATION_NAME);
+         
+         List<Field> annotatedFields = SecurityActions.getFieldsWithAnnotation(
+               testCase.getClass(), 
+               ejbAnnotation);
+         
+         for(Field field : annotatedFields) 
+         {
+            Object ejb = lookupEJB(field);
+            field.set(testCase, ejb);
+         }
+      } 
+      catch (Exception e) 
+      {
+         throw new RuntimeException("Could not inject members", e);
+      }
+   }
+
+   protected Object lookupEJB(Field field) throws Exception 
+   {
+      // TODO: figure out test context ? 
+      InitialContext context = createContext();
+      try 
+      {
+         return context.lookup("java:global/test.ear/test/" + field.getType().getSimpleName() + "Bean");
+      } 
+      catch (NamingException e) 
+      {
+    	  try 
+    	  {
+    	     return context.lookup("test/" + field.getType().getSimpleName() + "Bean/local");
+    	  } 
+    	  catch (NamingException e2) 
+    	  {
+    	     return context.lookup("test/" + field.getType().getSimpleName() + "Bean/remote");    	    
+    	  }
+      }
+   }
+   
+   protected InitialContext createContext() throws Exception
+   {
+      return new InitialContext();
+   }
+}

Added: arquillian/trunk/testenricher/ejb/src/main/java/org/jboss/arquillian/testenricher/ejb/SecurityActions.java
===================================================================
--- arquillian/trunk/testenricher/ejb/src/main/java/org/jboss/arquillian/testenricher/ejb/SecurityActions.java	                        (rev 0)
+++ arquillian/trunk/testenricher/ejb/src/main/java/org/jboss/arquillian/testenricher/ejb/SecurityActions.java	2010-02-27 23:32:35 UTC (rev 4068)
@@ -0,0 +1,223 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2009, Red Hat Middleware LLC, and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * Licensed 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.jboss.arquillian.testenricher.ejb;
+
+import java.lang.annotation.Annotation;
+import java.lang.reflect.Constructor;
+import java.lang.reflect.Field;
+import java.security.AccessController;
+import java.security.PrivilegedAction;
+import java.security.PrivilegedActionException;
+import java.security.PrivilegedExceptionAction;
+import java.util.ArrayList;
+import java.util.List;
+
+/**
+ * SecurityActions
+ * 
+ * A set of privileged actions that are not to leak out
+ * of this package 
+ *
+ * @author <a href="mailto:andrew.rubinger at jboss.org">ALR</a>
+ * @version $Revision: $
+ */
+final class SecurityActions
+{
+
+   //-------------------------------------------------------------------------------||
+   // Constructor ------------------------------------------------------------------||
+   //-------------------------------------------------------------------------------||
+
+   /**
+    * No instantiation
+    */
+   private SecurityActions()
+   {
+      throw new UnsupportedOperationException("No instantiation");
+   }
+
+   //-------------------------------------------------------------------------------||
+   // Utility Methods --------------------------------------------------------------||
+   //-------------------------------------------------------------------------------||
+
+   /**
+    * Obtains the Thread Context ClassLoader
+    */
+   static ClassLoader getThreadContextClassLoader()
+   {
+      return AccessController.doPrivileged(GetTcclAction.INSTANCE);
+   }
+
+   /**
+    * Obtains the Constructor specified from the given Class and argument types
+    * @param clazz
+    * @param argumentTypes
+    * @return
+    * @throws NoSuchMethodException
+    */
+   static Constructor<?> getConstructor(final Class<?> clazz, final Class<?>... argumentTypes)
+         throws NoSuchMethodException
+   {
+      try
+      {
+         return AccessController.doPrivileged(new PrivilegedExceptionAction<Constructor<?>>()
+         {
+            @Override
+            public Constructor<?> run() throws NoSuchMethodException
+            {
+               return clazz.getConstructor(argumentTypes);
+            }
+         });
+      }
+      // Unwrap
+      catch (final PrivilegedActionException pae)
+      {
+         final Throwable t = pae.getCause();
+         // Rethrow
+         if (t instanceof NoSuchMethodException)
+         {
+            throw (NoSuchMethodException) t;
+         }
+         else
+         {
+            // No other checked Exception thrown by Class.getConstructor
+            try
+            {
+               throw (RuntimeException) t;
+            }
+            // Just in case we've really messed up
+            catch (final ClassCastException cce)
+            {
+               throw new RuntimeException("Obtained unchecked Exception; this code should never be reached", t);
+            }
+         }
+      }
+   }
+
+   /**
+    * Create a new instance by finding a constructor that matches the argumentTypes signature 
+    * using the arguments for instantiation.
+    * 
+    * @param className Full classname of class to create
+    * @param argumentTypes The constructor argument types
+    * @param arguments The constructor arguments
+    * @return a new instance
+    * @throws IllegalArgumentException if className, argumentTypes, or arguments are null
+    * @throws RuntimeException if any exceptions during creation
+    * @author <a href="mailto:aslak at conduct.no">Aslak Knutsen</a>
+    * @author <a href="mailto:andrew.rubinger at jboss.org">ALR</a>
+    */
+   static <T> T newInstance(final String className, final Class<?>[] argumentTypes, final Object[] arguments,
+         final Class<T> expectedType)
+   {
+      if (className == null)
+      {
+         throw new IllegalArgumentException("ClassName must be specified");
+      }
+      if (argumentTypes == null)
+      {
+         throw new IllegalArgumentException("ArgumentTypes must be specified. Use empty array if no arguments");
+      }
+      if (arguments == null)
+      {
+         throw new IllegalArgumentException("Arguments must be specified. Use empty array if no arguments");
+      }
+      final Object obj;
+      try
+      {
+         final ClassLoader tccl = getThreadContextClassLoader();
+         final Class<?> implClass = Class.forName(className, false, tccl);
+         Constructor<?> constructor = getConstructor(implClass, argumentTypes);
+         obj = constructor.newInstance(arguments);
+      }
+      catch (Exception e)
+      {
+         throw new RuntimeException("Could not create new instance of " + className
+               + ", missing package from classpath?", e);
+      }
+
+      // Cast
+      try
+      {
+         return expectedType.cast(obj);
+      }
+      catch (final ClassCastException cce)
+      {
+         // Reconstruct so we get some useful information
+         throw new ClassCastException("Incorrect expected type, " + expectedType.getName() + ", defined for "
+               + obj.getClass().getName());
+      }
+   }
+
+   public static boolean isClassPresent(String name) 
+   {
+      try 
+      {
+         ClassLoader classLoader = getThreadContextClassLoader();
+         classLoader.loadClass(name); 
+         return true;
+      }
+      catch (ClassNotFoundException e) 
+      {
+         return false;
+      }
+   }
+   
+   public static List<Field> getFieldsWithAnnotation(final Class<?> source, final Class<? extends Annotation> annotationClass) 
+   {
+      List<Field> declaredAccessableFields = AccessController.doPrivileged(new PrivilegedAction<List<Field>>()
+      {
+         @Override
+         public List<Field> run()
+         {
+            List<Field> foundFields = new ArrayList<Field>();
+            for(Field field : source.getDeclaredFields())
+            {
+               if(field.isAnnotationPresent(annotationClass))
+               {
+                  if(!field.isAccessible()) 
+                  {
+                     field.setAccessible(true);
+                  }
+                  foundFields.add(field);
+               }
+            }
+            return foundFields;
+         }
+      });
+      return declaredAccessableFields;
+   }
+   
+   //-------------------------------------------------------------------------------||
+   // Inner Classes ----------------------------------------------------------------||
+   //-------------------------------------------------------------------------------||
+
+   /**
+    * Single instance to get the TCCL
+    */
+   private enum GetTcclAction implements PrivilegedAction<ClassLoader> {
+      INSTANCE;
+
+      @Override
+      public ClassLoader run()
+      {
+         return Thread.currentThread().getContextClassLoader();
+      }
+
+   }
+
+}

Added: arquillian/trunk/testenricher/pom.xml
===================================================================
--- arquillian/trunk/testenricher/pom.xml	                        (rev 0)
+++ arquillian/trunk/testenricher/pom.xml	2010-02-27 23:32:35 UTC (rev 4068)
@@ -0,0 +1,34 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+  vi:ts=2:sw=2:expandtab:
+-->
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+  xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+
+  <!-- Parent -->
+  <parent>
+    <groupId>org.jboss.arquillian</groupId>
+    <artifactId>arquillian-parent</artifactId>
+    <version>1.0.0-SNAPSHOT</version>
+  </parent>
+
+  <!-- Model Information -->
+  <modelVersion>4.0.0</modelVersion>
+
+  <!-- Artifact Information  -->
+  <artifactId>arquillian-testenricher-parent</artifactId>
+  <packaging>pom</packaging>
+  <name>Arguillian TestEnricher Aggregator</name>
+  <url>http://www.jboss.org</url>
+  <description>Arguillian TestEnricher Aggregator</description>
+
+  <!-- Aggregate Modules -->
+  <modules>
+    
+    <module>cdi</module>
+    <module>ejb</module>
+    <module>resource</module>
+
+  </modules>
+
+</project>


Property changes on: arquillian/trunk/testenricher/resource
___________________________________________________________________
Name: svn:ignore
   + .classpath
.project
.settings
target



Added: arquillian/trunk/testenricher/resource/pom.xml
===================================================================
--- arquillian/trunk/testenricher/resource/pom.xml	                        (rev 0)
+++ arquillian/trunk/testenricher/resource/pom.xml	2010-02-27 23:32:35 UTC (rev 4068)
@@ -0,0 +1,60 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+   xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+
+   <!-- Parent -->
+   <parent>
+      <groupId>org.jboss.arquillian</groupId>
+      <artifactId>arquillian-build</artifactId>
+      <version>1.0.0-SNAPSHOT</version>
+      <relativePath>../../build/pom.xml</relativePath>
+   </parent>
+
+   <!-- Model Version -->
+   <modelVersion>4.0.0</modelVersion>
+
+   <!-- Artifact Configuration -->
+   <artifactId>arquillian-testenricher-resource</artifactId>
+   <name>Arquillian TestEnricher Resource</name>
+   <description>Resource TestEnricher for the Arquillian Project</description>
+
+
+   <!-- Properties -->
+   <properties>
+
+      <!-- Versioning -->
+
+   </properties>
+
+   <!-- Dependencies -->
+   <dependencies>
+
+      <!-- 
+    org.jboss.arquillian
+     -->
+      <dependency>
+         <groupId>org.jboss.arquillian</groupId>
+         <artifactId>arquillian-spi</artifactId>
+         <version>${project.version}</version>
+      </dependency>
+
+
+      <dependency>
+         <groupId>org.jboss.shrinkwrap</groupId>
+         <artifactId>shrinkwrap-impl-base</artifactId>
+         <scope>test</scope>
+      </dependency>
+      <dependency>
+         <groupId>javax.annotation</groupId> 
+         <artifactId>jsr250-api</artifactId>
+         <version>1.0</version>
+         <scope>provided</scope>       
+      </dependency>
+      <dependency>
+         <groupId>junit</groupId>
+         <artifactId>junit</artifactId>
+         <scope>test</scope>
+      </dependency>
+   </dependencies>
+</project>
+

Copied: arquillian/trunk/testenricher/resource/src/main/java/org/jboss/arquillian/testenricher/resource/ResourceInjectionEnricher.java (from rev 4033, arquillian/trunk/testenricher-jboss/src/main/java/org/jboss/arquillian/testenricher/jboss/ResourceInjectionEnricher.java)
===================================================================
--- arquillian/trunk/testenricher/resource/src/main/java/org/jboss/arquillian/testenricher/resource/ResourceInjectionEnricher.java	                        (rev 0)
+++ arquillian/trunk/testenricher/resource/src/main/java/org/jboss/arquillian/testenricher/resource/ResourceInjectionEnricher.java	2010-02-27 23:32:35 UTC (rev 4068)
@@ -0,0 +1,95 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2009, Red Hat Middleware LLC, and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * Licensed 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.jboss.arquillian.testenricher.resource;
+
+import java.lang.annotation.Annotation;
+import java.lang.reflect.Field;
+import java.util.List;
+
+import javax.annotation.Resource;
+import javax.naming.InitialContext;
+
+import org.jboss.arquillian.spi.TestEnricher;
+
+/**
+ * ResourceInjectionEnricher
+ *
+ * @author <a href="mailto:aslak at conduct.no">Aslak Knutsen</a>
+ * @version $Revision: $
+ */
+public class ResourceInjectionEnricher implements TestEnricher
+{
+   private static final String RESOURCE_LOOKUP_PREFIX = "java:/comp/env";
+   private static final String ANNOTATION_NAME = "javax.annotation.Resource";
+   
+   @Override
+   public void enrich(Object testCase)
+   {
+      if(SecurityActions.isClassPresent(ANNOTATION_NAME)) 
+      {
+         injectClass(testCase);
+      }
+   }
+
+   protected void injectClass(Object testCase) 
+   {
+      try 
+      {
+         @SuppressWarnings("unchecked")
+         Class<? extends Annotation> resourceAnnotation = (Class<? extends Annotation>)SecurityActions.getThreadContextClassLoader().loadClass(ANNOTATION_NAME);
+         
+         List<Field> annotatedFields = SecurityActions.getFieldsWithAnnotation(
+               testCase.getClass(), 
+               resourceAnnotation);
+         
+         for(Field field : annotatedFields) 
+         {
+            Object ejb = lookup(getResourceName(field));
+            field.set(testCase, ejb);
+         }
+      } 
+      catch (Exception e) 
+      {
+         throw new RuntimeException("Could not inject members", e);
+      }
+   }
+
+   protected Object lookup(String jndiName) throws Exception 
+   {
+      // TODO: figure out test context ? 
+      InitialContext context = new InitialContext();
+      return context.lookup(jndiName);
+   }
+   
+   protected String getResourceName(Field field)
+   {
+      Resource resource = field.getAnnotation(Resource.class);
+      String mappedName = resource.mappedName();
+      if (!mappedName.equals(""))
+      {
+         return mappedName;
+      }
+      String name = resource.name();
+      if (!name.equals(""))
+      {
+         return RESOURCE_LOOKUP_PREFIX + "/" + name;
+      }
+      String propertyName = field.getName();
+      String className = field.getDeclaringClass().getName();
+      return RESOURCE_LOOKUP_PREFIX + "/" + className + "/" + propertyName;
+   }
+}

Added: arquillian/trunk/testenricher/resource/src/main/java/org/jboss/arquillian/testenricher/resource/SecurityActions.java
===================================================================
--- arquillian/trunk/testenricher/resource/src/main/java/org/jboss/arquillian/testenricher/resource/SecurityActions.java	                        (rev 0)
+++ arquillian/trunk/testenricher/resource/src/main/java/org/jboss/arquillian/testenricher/resource/SecurityActions.java	2010-02-27 23:32:35 UTC (rev 4068)
@@ -0,0 +1,223 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2009, Red Hat Middleware LLC, and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * Licensed 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.jboss.arquillian.testenricher.resource;
+
+import java.lang.annotation.Annotation;
+import java.lang.reflect.Constructor;
+import java.lang.reflect.Field;
+import java.security.AccessController;
+import java.security.PrivilegedAction;
+import java.security.PrivilegedActionException;
+import java.security.PrivilegedExceptionAction;
+import java.util.ArrayList;
+import java.util.List;
+
+/**
+ * SecurityActions
+ * 
+ * A set of privileged actions that are not to leak out
+ * of this package 
+ *
+ * @author <a href="mailto:andrew.rubinger at jboss.org">ALR</a>
+ * @version $Revision: $
+ */
+final class SecurityActions
+{
+
+   //-------------------------------------------------------------------------------||
+   // Constructor ------------------------------------------------------------------||
+   //-------------------------------------------------------------------------------||
+
+   /**
+    * No instantiation
+    */
+   private SecurityActions()
+   {
+      throw new UnsupportedOperationException("No instantiation");
+   }
+
+   //-------------------------------------------------------------------------------||
+   // Utility Methods --------------------------------------------------------------||
+   //-------------------------------------------------------------------------------||
+
+   /**
+    * Obtains the Thread Context ClassLoader
+    */
+   static ClassLoader getThreadContextClassLoader()
+   {
+      return AccessController.doPrivileged(GetTcclAction.INSTANCE);
+   }
+
+   /**
+    * Obtains the Constructor specified from the given Class and argument types
+    * @param clazz
+    * @param argumentTypes
+    * @return
+    * @throws NoSuchMethodException
+    */
+   static Constructor<?> getConstructor(final Class<?> clazz, final Class<?>... argumentTypes)
+         throws NoSuchMethodException
+   {
+      try
+      {
+         return AccessController.doPrivileged(new PrivilegedExceptionAction<Constructor<?>>()
+         {
+            @Override
+            public Constructor<?> run() throws NoSuchMethodException
+            {
+               return clazz.getConstructor(argumentTypes);
+            }
+         });
+      }
+      // Unwrap
+      catch (final PrivilegedActionException pae)
+      {
+         final Throwable t = pae.getCause();
+         // Rethrow
+         if (t instanceof NoSuchMethodException)
+         {
+            throw (NoSuchMethodException) t;
+         }
+         else
+         {
+            // No other checked Exception thrown by Class.getConstructor
+            try
+            {
+               throw (RuntimeException) t;
+            }
+            // Just in case we've really messed up
+            catch (final ClassCastException cce)
+            {
+               throw new RuntimeException("Obtained unchecked Exception; this code should never be reached", t);
+            }
+         }
+      }
+   }
+
+   /**
+    * Create a new instance by finding a constructor that matches the argumentTypes signature 
+    * using the arguments for instantiation.
+    * 
+    * @param className Full classname of class to create
+    * @param argumentTypes The constructor argument types
+    * @param arguments The constructor arguments
+    * @return a new instance
+    * @throws IllegalArgumentException if className, argumentTypes, or arguments are null
+    * @throws RuntimeException if any exceptions during creation
+    * @author <a href="mailto:aslak at conduct.no">Aslak Knutsen</a>
+    * @author <a href="mailto:andrew.rubinger at jboss.org">ALR</a>
+    */
+   static <T> T newInstance(final String className, final Class<?>[] argumentTypes, final Object[] arguments,
+         final Class<T> expectedType)
+   {
+      if (className == null)
+      {
+         throw new IllegalArgumentException("ClassName must be specified");
+      }
+      if (argumentTypes == null)
+      {
+         throw new IllegalArgumentException("ArgumentTypes must be specified. Use empty array if no arguments");
+      }
+      if (arguments == null)
+      {
+         throw new IllegalArgumentException("Arguments must be specified. Use empty array if no arguments");
+      }
+      final Object obj;
+      try
+      {
+         final ClassLoader tccl = getThreadContextClassLoader();
+         final Class<?> implClass = Class.forName(className, false, tccl);
+         Constructor<?> constructor = getConstructor(implClass, argumentTypes);
+         obj = constructor.newInstance(arguments);
+      }
+      catch (Exception e)
+      {
+         throw new RuntimeException("Could not create new instance of " + className
+               + ", missing package from classpath?", e);
+      }
+
+      // Cast
+      try
+      {
+         return expectedType.cast(obj);
+      }
+      catch (final ClassCastException cce)
+      {
+         // Reconstruct so we get some useful information
+         throw new ClassCastException("Incorrect expected type, " + expectedType.getName() + ", defined for "
+               + obj.getClass().getName());
+      }
+   }
+
+   public static boolean isClassPresent(String name) 
+   {
+      try 
+      {
+         ClassLoader classLoader = getThreadContextClassLoader();
+         classLoader.loadClass(name); 
+         return true;
+      }
+      catch (ClassNotFoundException e) 
+      {
+         return false;
+      }
+   }
+   
+   public static List<Field> getFieldsWithAnnotation(final Class<?> source, final Class<? extends Annotation> annotationClass) 
+   {
+      List<Field> declaredAccessableFields = AccessController.doPrivileged(new PrivilegedAction<List<Field>>()
+      {
+         @Override
+         public List<Field> run()
+         {
+            List<Field> foundFields = new ArrayList<Field>();
+            for(Field field : source.getDeclaredFields())
+            {
+               if(field.isAnnotationPresent(annotationClass))
+               {
+                  if(!field.isAccessible()) 
+                  {
+                     field.setAccessible(true);
+                  }
+                  foundFields.add(field);
+               }
+            }
+            return foundFields;
+         }
+      });
+      return declaredAccessableFields;
+   }
+   
+   //-------------------------------------------------------------------------------||
+   // Inner Classes ----------------------------------------------------------------||
+   //-------------------------------------------------------------------------------||
+
+   /**
+    * Single instance to get the TCCL
+    */
+   private enum GetTcclAction implements PrivilegedAction<ClassLoader> {
+      INSTANCE;
+
+      @Override
+      public ClassLoader run()
+      {
+         return Thread.currentThread().getContextClassLoader();
+      }
+
+   }
+
+}



More information about the jboss-svn-commits mailing list