[jboss-cvs] JBossAS SVN: r97362 - in projects/jboss-jca/trunk: doc/userguide/en/modules and 16 other directories.

jboss-cvs-commits at lists.jboss.org jboss-cvs-commits at lists.jboss.org
Thu Dec 3 09:50:28 EST 2009


Author: jesper.pedersen
Date: 2009-12-03 09:50:26 -0500 (Thu, 03 Dec 2009)
New Revision: 97362

Added:
   projects/jboss-jca/trunk/embedded/src/test/
   projects/jboss-jca/trunk/embedded/src/test/java/
   projects/jboss-jca/trunk/embedded/src/test/java/org/
   projects/jboss-jca/trunk/embedded/src/test/java/org/jboss/
   projects/jboss-jca/trunk/embedded/src/test/java/org/jboss/jca/
   projects/jboss-jca/trunk/embedded/src/test/java/org/jboss/jca/test/
   projects/jboss-jca/trunk/embedded/src/test/java/org/jboss/jca/test/embedded/
   projects/jboss-jca/trunk/embedded/src/test/java/org/jboss/jca/test/embedded/rars/
   projects/jboss-jca/trunk/embedded/src/test/java/org/jboss/jca/test/embedded/rars/simple/
   projects/jboss-jca/trunk/embedded/src/test/java/org/jboss/jca/test/embedded/rars/simple/MessageListener.java
   projects/jboss-jca/trunk/embedded/src/test/java/org/jboss/jca/test/embedded/rars/simple/TestActivationSpec.java
   projects/jboss-jca/trunk/embedded/src/test/java/org/jboss/jca/test/embedded/rars/simple/TestConnection.java
   projects/jboss-jca/trunk/embedded/src/test/java/org/jboss/jca/test/embedded/rars/simple/TestConnectionInterface.java
   projects/jboss-jca/trunk/embedded/src/test/java/org/jboss/jca/test/embedded/rars/simple/TestManagedConnection.java
   projects/jboss-jca/trunk/embedded/src/test/java/org/jboss/jca/test/embedded/rars/simple/TestManagedConnectionFactory.java
   projects/jboss-jca/trunk/embedded/src/test/java/org/jboss/jca/test/embedded/rars/simple/TestResourceAdapter.java
   projects/jboss-jca/trunk/embedded/src/test/java/org/jboss/jca/test/embedded/rars/simple/package.html
   projects/jboss-jca/trunk/embedded/src/test/java/org/jboss/jca/test/embedded/unit/
   projects/jboss-jca/trunk/embedded/src/test/java/org/jboss/jca/test/embedded/unit/ShrinkWrapTestCase.java
   projects/jboss-jca/trunk/embedded/src/test/resources/
   projects/jboss-jca/trunk/embedded/src/test/resources/jndi.properties
   projects/jboss-jca/trunk/embedded/src/test/resources/logging.properties
   projects/jboss-jca/trunk/embedded/src/test/resources/simple.rar/
   projects/jboss-jca/trunk/embedded/src/test/resources/simple.rar/META-INF/
   projects/jboss-jca/trunk/embedded/src/test/resources/simple.rar/META-INF/ra.xml
Modified:
   projects/jboss-jca/trunk/build.xml
   projects/jboss-jca/trunk/doc/userguide/en/modules/embedded.xml
   projects/jboss-jca/trunk/embedded/build.xml
   projects/jboss-jca/trunk/embedded/src/main/java/org/jboss/jca/embedded/EmbeddedJCA.java
   projects/jboss-jca/trunk/ivy.xml
Log:
[JBJCA-228] [JBJCA-229] Support ShrinkWrap archives in the embedded configuration

Modified: projects/jboss-jca/trunk/build.xml
===================================================================
--- projects/jboss-jca/trunk/build.xml	2009-12-03 14:39:02 UTC (rev 97361)
+++ projects/jboss-jca/trunk/build.xml	2009-12-03 14:50:26 UTC (rev 97362)
@@ -103,6 +103,7 @@
   <property name="version.jboss.naming" value="5.0.3.GA"/>
   <property name="version.jboss.papaki" value="1.0.0.Beta2"/>
   <property name="version.jboss.reflect" value="2.0.2.GA"/>
+  <property name="version.jboss.shrinkwrap" value="1.0.0-alpha-2"/>
   <property name="version.jboss.slf4j" value="1.0.2.GA"/>
   <property name="version.jboss.slf4j.logmanager" value="1.0.0.CR2"/>
   <property name="version.jboss.ts" value="4.6.1.GA"/>
@@ -237,6 +238,7 @@
        ================================= -->
   <target name="prepare-test" depends="jars">
     <ant dir="core" inheritRefs="true" target="prepare-test"/>
+    <ant dir="embedded" inheritRefs="true" target="prepare-test"/>
     <ant dir="deployers" inheritRefs="true" target="prepare-test"/>
   </target>
   
@@ -245,6 +247,7 @@
        ================================= -->
   <target name="test" depends="prepare-test">
     <ant dir="core" inheritRefs="true" target="test"/>
+    <ant dir="embedded" inheritRefs="true" target="test"/>
     <ant dir="deployers" inheritRefs="true" target="test"/>
   </target>
   
@@ -255,7 +258,7 @@
   <!-- we should refactor this to make one-test target can be run on the component build.xml
     <ant dir="core" inheritRefs="true" target="one-test"/>
    -->
-    <ant dir="deployers" inheritRefs="true" target="one-test"/>
+    <ant dir="embedded" inheritRefs="true" target="one-test"/>
   </target>
 
   <!-- ================================= 

Modified: projects/jboss-jca/trunk/doc/userguide/en/modules/embedded.xml
===================================================================
--- projects/jboss-jca/trunk/doc/userguide/en/modules/embedded.xml	2009-12-03 14:39:02 UTC (rev 97361)
+++ projects/jboss-jca/trunk/doc/userguide/en/modules/embedded.xml	2009-12-03 14:50:26 UTC (rev 97362)
@@ -10,7 +10,7 @@
 
       <para>The configuration is useful when you want a</para>
 
-      <itemizedlist>
+      <itemizedlist spacing="compact">
         <listitem>
           JCA container within your environment
         </listitem>
@@ -46,10 +46,16 @@
    <section id="embedded_usage">
       <title>Usage</title>
 
-      <para>The code sample below shows a simple usage of using the JBoss JCA embedded environment
-        in a JUnit 4 test case.</para>
+      <para>JBoss JCA Embedded supports both a simple and an advanced usage model, using pre-assembled
+        resource adapter archives (.rar) or dynamic resource adapter archives based on ShrinkWrap.</para>
 
-      <programlisting>
+      <section id="embedded_usage_simple">
+        <title>Simple usage</title>
+
+        <para>The code sample below shows a simple usage of deploying a pre-assembled resource adapter archive
+          into the JBoss JCA Embedded environment.</para>
+
+        <programlisting>
 import org.jboss.jca.embedded.EmbeddedJCA;
 
 import java.net.URL;
@@ -104,8 +110,123 @@
       embedded.shutdown();
    }
 }
-      </programlisting>
+        </programlisting>
 
+        <para>See the JBoss JCA Embedded API documentation for additional functionality.</para>
+
+      </section>
+
+      <section id="embedded_usage_advanced">
+        <title>Advanced usage</title>
+
+        <para>The code sample below shows an advanced usage of deploying a dynamic ShrinkWrap resource adapter archive
+          into the JBoss JCA Embedded environment.</para>
+
+        <programlisting>
+<![CDATA[
+import org.jboss.jca.embedded.EmbeddedJCA;
+import org.jboss.jca.test.embedded.rars.simple.MessageListener;
+import org.jboss.jca.test.embedded.rars.simple.TestActivationSpec;
+import org.jboss.jca.test.embedded.rars.simple.TestConnection;
+import org.jboss.jca.test.embedded.rars.simple.TestConnectionInterface;
+import org.jboss.jca.test.embedded.rars.simple.TestManagedConnection;
+import org.jboss.jca.test.embedded.rars.simple.TestManagedConnectionFactory;
+import org.jboss.jca.test.embedded.rars.simple.TestResourceAdapter;
+
+import java.util.UUID;
+
+import org.jboss.logging.Logger;
+import org.jboss.shrinkwrap.api.Archives;
+import org.jboss.shrinkwrap.api.spec.JavaArchive;
+import org.jboss.shrinkwrap.api.spec.ResourceAdapterArchive;
+
+import org.junit.AfterClass;
+import org.junit.BeforeClass;
+import org.junit.Test;
+import static org.junit.Assert.*;
+
+public class ShrinkWrapTestCase
+{
+   private static Logger log = Logger.getLogger(ShrinkWrapTestCase.class);
+
+   /*
+    * Embedded
+    */
+   private static EmbeddedJCA embedded;
+
+   /**
+    * Basic ShrinkWrap ResourceAdapterArchive test case
+    * @exception Throwable Thrown if case of an error
+    */
+   @Test
+   public void testBasic() throws Throwable
+   {
+      ResourceAdapterArchive raa =
+         Archives.create(UUID.randomUUID().toString() + ".rar", 
+                         ResourceAdapterArchive.class);
+
+      JavaArchive ja = 
+         Archives.create(UUID.randomUUID().toString() + ".jar", JavaArchive.class);
+
+      ja.addClasses(MessageListener.class, TestActivationSpec.class, 
+                    TestConnection.class, TestConnectionInterface.class, 
+                    TestManagedConnection.class, TestManagedConnectionFactory.class,
+                    TestResourceAdapter.class);
+
+      raa.addLibrary(ja);
+      raa.addManifestResource("simple.rar/META-INF/ra.xml", "ra.xml");
+
+      try
+      {
+         embedded.deploy(raa);
+      }
+      catch (Throwable t)
+      {
+         log.error(t.getMessage(), t);
+         fail(t.getMessage());
+      }
+      finally
+      {
+         embedded.undeploy(raa);
+      }
+   }
+
+   /**
+    * Lifecycle start, before the suite is executed
+    * @exception Throwable Thrown if case of an error
+    */
+   @BeforeClass
+   public static void beforeClass() throws Throwable
+   {
+      // Create and set an embedded JCA instance
+      embedded = new EmbeddedJCA();
+
+      // Startup
+      embedded.startup();
+   }
+
+   /**
+    * Lifecycle stop, after the suite is executed
+    * @exception Throwable Thrown if case of an error
+    */
+   @AfterClass
+   public static void afterClass() throws Throwable
+   {
+      // Shutdown embedded
+      embedded.shutdown();
+
+      // Set embedded to null
+      embedded = null;
+   }
+}
+]]>
+        </programlisting>
+
+        <para>See the <ulink url="http://www.jboss.org/community/wiki/ShrinkWrap">
+          ShrinkWrap</ulink> web site for a full description of the project and additional documentation.</para>
+
+      </section>
+
    </section>
 
 

Modified: projects/jboss-jca/trunk/embedded/build.xml
===================================================================
--- projects/jboss-jca/trunk/embedded/build.xml	2009-12-03 14:39:02 UTC (rev 97361)
+++ projects/jboss-jca/trunk/embedded/build.xml	2009-12-03 14:50:26 UTC (rev 97362)
@@ -87,4 +87,119 @@
     </javadoc>
   </target>
 
+  <!-- ================================= 
+       Target: prepare-test
+       ================================= -->
+  <target name="prepare-test">
+    <mkdir dir="${build.embedded.dir}" />
+    <mkdir dir="${build.embedded.dir}/test" />
+
+    <javac srcdir="src/test"
+           destdir="${build.embedded.dir}/test"
+           classpathref="test.lib.path.id"
+           debug="${javac.debug}"
+           deprecation="${javac.deprecation}"
+           optimize="${javac.optimize}">
+      <compilerarg value="-Xlint"/>
+    </javac> 
+
+    <copy todir="${build.embedded.dir}/test">
+      <fileset dir="src/test/resources"/>
+    </copy>
+
+    <ant target="test-jars"/>
+
+  </target>
+
+  <!-- ================================= 
+       Target: test-jars 
+       ================================= -->
+  <target name="test-jars">
+  </target>
+
+  <!-- ================================= 
+       Target: test
+       ================================= -->
+  <target name="test" depends="jars, prepare-test">
+    <mkdir dir="${reports.dir}"/>
+    <mkdir dir="${reports.dir}/embedded"/>
+
+    <junit dir="src/test"
+           printsummary="${junit.printsummary}"
+           haltonerror="${junit.haltonerror}"
+           haltonfailure="${junit.haltonfailure}"
+           fork="${junit.fork}"
+           timeout="${junit.timeout}">
+      
+      <jvmarg line="${junit.jvm.options}"/>
+      <sysproperty key="archives.dir" value="${build.embedded.dir}"/>
+      <sysproperty key="java.util.logging.manager" value="org.jboss.logmanager.LogManager"/>
+      <sysproperty key="log4j.defaultInitOverride" value="true"/>
+      <sysproperty key="org.jboss.logging.Logger.pluginClass" value="org.jboss.logging.logmanager.LoggerPluginImpl"/>
+      <sysproperty key="test.dir" value="${test.dir}"/>
+      <sysproperty key="xb.builder.useUnorderedSequence" value="true"/>
+      <sysproperty key="javax.xml.stream.XMLInputFactory" value="com.sun.xml.internal.stream.XMLInputFactoryImpl"/>
+      
+      <classpath>
+        <pathelement location="${build.embedded.dir}/test"/>
+        <fileset dir="${target.dir}" includes="*.jar"/>
+        <fileset dir="${lib.dir}/test" includes="*.jar" />
+      </classpath>
+      
+      <formatter type="plain"/>
+      <formatter type="xml"/>
+      
+      <batchtest todir="${reports.dir}/embedded"
+                 haltonerror="${junit.batchtest.haltonerror}"
+                 haltonfailure="${junit.batchtest.haltonfailure}"
+                 fork="${junit.batchtest.fork}">
+        
+        <fileset dir="${build.embedded.dir}/test">
+          <include name="**/*TestCase.class"/>
+        </fileset>
+      </batchtest>
+
+    </junit>
+    
+  </target>
+
+  <!-- ================================= 
+       Target: one-test
+       ================================= -->
+  <target name="one-test" depends="jars, prepare-test">
+    <mkdir dir="${reports.dir}"/>
+    <mkdir dir="${reports.dir}/embedded"/>
+
+    <junit dir="src/test"
+           printsummary="${junit.printsummary}"
+           haltonerror="${junit.haltonerror}"
+           haltonfailure="${junit.haltonfailure}"
+           fork="${junit.fork}"
+           timeout="${junit.timeout}">
+      
+      <jvmarg line="${junit.jvm.options}"/>
+      <sysproperty key="archives.dir" value="${build.embedded.dir}"/>
+      <sysproperty key="java.util.logging.manager" value="org.jboss.logmanager.LogManager"/>
+      <sysproperty key="log4j.defaultInitOverride" value="true"/>
+      <sysproperty key="org.jboss.logging.Logger.pluginClass" value="org.jboss.logging.logmanager.LoggerPluginImpl"/>
+      <sysproperty key="test.dir" value="${test.dir}"/>
+      <sysproperty key="xb.builder.useUnorderedSequence" value="true"/>
+      <sysproperty key="javax.xml.stream.XMLInputFactory" value="com.sun.xml.internal.stream.XMLInputFactoryImpl"/>
+      
+      <classpath>
+        <pathelement location="${build.embedded.dir}/test"/>
+        <fileset dir="${target.dir}" includes="*.jar"/>
+        <fileset dir="${lib.dir}/test" includes="*.jar" />
+      </classpath>
+      
+      <formatter type="plain"/>
+      <formatter type="xml"/>
+      
+      <test todir="${reports.dir}/embedded" name="${test}"
+                 haltonerror="${junit.batchtest.haltonerror}"
+                 haltonfailure="${junit.batchtest.haltonfailure}"
+                 fork="${junit.batchtest.fork}"/>
+    </junit>
+  </target>
+
 </project>

Modified: projects/jboss-jca/trunk/embedded/src/main/java/org/jboss/jca/embedded/EmbeddedJCA.java
===================================================================
--- projects/jboss-jca/trunk/embedded/src/main/java/org/jboss/jca/embedded/EmbeddedJCA.java	2009-12-03 14:39:02 UTC (rev 97361)
+++ projects/jboss-jca/trunk/embedded/src/main/java/org/jboss/jca/embedded/EmbeddedJCA.java	2009-12-03 14:50:26 UTC (rev 97362)
@@ -25,8 +25,17 @@
 import org.jboss.jca.fungal.impl.KernelConfiguration;
 import org.jboss.jca.fungal.impl.KernelImpl;
 
+import java.io.File;
+import java.io.FileOutputStream;
+import java.io.IOException;
+import java.io.InputStream;
 import java.net.URL;
+import java.util.ArrayList;
+import java.util.List;
 
+import org.jboss.shrinkwrap.api.spec.ResourceAdapterArchive;
+import org.jboss.shrinkwrap.api.exporter.ZipExporter;
+
 /**
  * The embedded JBoss JCA container
  * @author <a href="mailto:jesper.pedersen at jboss.org">Jesper Pedersen</a>
@@ -39,6 +48,9 @@
    /** Kernel */
    private KernelImpl kernel;
 
+   /** ShrinkWrap deployments */
+   private List<File> shrinkwrapDeployments;
+
    /**
     * Constructs an embedded JCA environment using
     * the full JCA 1.6 profile
@@ -58,6 +70,7 @@
    public EmbeddedJCA(boolean fullProfile)
    {
       this.fullProfile = fullProfile;
+      this.shrinkwrapDeployments = null;
    }
 
    /**
@@ -86,6 +99,15 @@
     */
    public void shutdown() throws Throwable
    {
+      if (shrinkwrapDeployments != null && shrinkwrapDeployments.size() > 0)
+      {
+         List<File> copy = new ArrayList<File>(shrinkwrapDeployments);
+         for (File f : copy)
+         {
+            removeDeployment(f);
+         }
+      }
+
       if (fullProfile)
       {
          undeploy(EmbeddedJCA.class.getClassLoader(), "jca.xml");
@@ -129,6 +151,75 @@
 
    /**
     * Deploy
+    * @param raa The resource adapter archive
+    * @exception Throwable If an error occurs
+    */
+   public void deploy(ResourceAdapterArchive raa) throws Throwable
+   {
+      if (raa == null)
+         throw new IllegalArgumentException("Url is null");      
+
+      InputStream is = raa.as(ZipExporter.class).exportZip();
+
+      File parentDirectory = new File(SecurityActions.getSystemProperty("java.io.tmpdir"));
+      File raaFile = new File(parentDirectory, raa.getName());
+
+      if (shrinkwrapDeployments != null && shrinkwrapDeployments.contains(raaFile))
+         throw new IOException(raa.getName() + " already deployed");
+
+      if (raaFile.exists())
+         recursiveDelete(raaFile);
+
+      FileOutputStream os = new FileOutputStream(raaFile);
+
+      byte[] buffer = new byte[4096];
+      int read = 0;
+      try
+      {
+         while ((read = is.read(buffer)) != -1)
+         {
+            os.write(buffer, 0, read);
+         }
+
+         os.flush();
+      }
+      finally
+      {
+         if (os != null)
+         {
+            try
+            {
+               os.close();
+            }
+            catch (IOException ignore)
+            {
+               // Ignore
+            }
+         }
+
+         if (is != null)
+         {
+            try
+            {
+               is.close();
+            }
+            catch (IOException ignore)
+            {
+               // Ignore
+            }
+         }
+      }
+
+      if (shrinkwrapDeployments == null)
+         shrinkwrapDeployments = new ArrayList<File>(1);
+
+      shrinkwrapDeployments.add(raaFile);
+     
+      kernel.getMainDeployer().deploy(raaFile.toURI().toURL());
+   }
+
+   /**
+    * Deploy
     * @param cl The class loader
     * @param name The resource name
     * @exception Throwable If an error occurs
@@ -177,6 +268,27 @@
 
    /**
     * Undeploy
+    * @param raa The resource adapter archive
+    * @exception Throwable If an error occurs
+    */
+   public void undeploy(ResourceAdapterArchive raa) throws Throwable
+   {
+      if (raa == null)
+         throw new IllegalArgumentException("Url is null");      
+
+      File parentDirectory = new File(SecurityActions.getSystemProperty("java.io.tmpdir"));
+      File raaFile = new File(parentDirectory, raa.getName());
+
+      if (!shrinkwrapDeployments.contains(raaFile))
+         throw new IOException(raa.getName() + " not deployed");
+
+      kernel.getMainDeployer().undeploy(raaFile.toURI().toURL());
+
+      removeDeployment(raaFile);
+   }
+
+   /**
+    * Undeploy
     * @param cl The class loader
     * @param name The resource name
     * @exception Throwable If an error occurs
@@ -209,4 +321,57 @@
       URL url = clz.getClassLoader().getResource(name);
       kernel.getMainDeployer().undeploy(url);
    }
+
+   /**
+    * Remove ShrinkWrap deployment
+    * @param deployment The deployment
+    * @exception IOException Thrown if the deployment cant be removed
+    */
+   private void removeDeployment(File deployment) throws IOException
+   {
+      /*
+      if (deployment == null)
+         throw new IllegalArgumentException("Deployment is null");      
+
+      if (deployment.exists())
+      {
+         shrinkwrapDeployments.remove(deployment);
+
+         if (shrinkwrapDeployments.size() == 0)
+            shrinkwrapDeployments = null;
+
+         recursiveDelete(deployment);
+      }
+      */
+   }
+
+   /**
+    * Recursive delete
+    * @param f The file handler
+    * @exception IOException Thrown if a file could not be deleted
+    */
+   private void recursiveDelete(File f) throws IOException
+   {
+      if (f != null && f.exists())
+      {
+         File[] files = f.listFiles();
+         if (files != null)
+         {
+            for (int i = 0; i < files.length; i++)
+            {
+               if (files[i].isDirectory())
+               {
+                  recursiveDelete(files[i]);
+               } 
+               else
+               {
+                  if (!files[i].delete())
+                     throw new IOException("Could not delete " + files[i]);
+               }
+            }
+         }
+         if (!f.delete())
+            throw new IOException("Could not delete " + f);
+      }
+   }
 }

Added: projects/jboss-jca/trunk/embedded/src/test/java/org/jboss/jca/test/embedded/rars/simple/MessageListener.java
===================================================================
--- projects/jboss-jca/trunk/embedded/src/test/java/org/jboss/jca/test/embedded/rars/simple/MessageListener.java	                        (rev 0)
+++ projects/jboss-jca/trunk/embedded/src/test/java/org/jboss/jca/test/embedded/rars/simple/MessageListener.java	2009-12-03 14:50:26 UTC (rev 97362)
@@ -0,0 +1,37 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2009, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.jca.test.embedded.rars.simple;
+
+/**
+ * MessageListener
+ * @author <a href="mailto:jeff.zhang at jboss.org">Jeff Zhang</a>
+ * @version $Revision: $
+ */
+public interface MessageListener
+{
+   /**
+    * receive message
+    *
+    * @param msg String.
+    */
+   public void onMessage(String msg);
+}

Added: projects/jboss-jca/trunk/embedded/src/test/java/org/jboss/jca/test/embedded/rars/simple/TestActivationSpec.java
===================================================================
--- projects/jboss-jca/trunk/embedded/src/test/java/org/jboss/jca/test/embedded/rars/simple/TestActivationSpec.java	                        (rev 0)
+++ projects/jboss-jca/trunk/embedded/src/test/java/org/jboss/jca/test/embedded/rars/simple/TestActivationSpec.java	2009-12-03 14:50:26 UTC (rev 97362)
@@ -0,0 +1,75 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2009, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.jca.test.embedded.rars.simple;
+
+import javax.resource.ResourceException;
+import javax.resource.spi.ActivationSpec;
+import javax.resource.spi.InvalidPropertyException;
+import javax.resource.spi.ResourceAdapter;
+
+import org.jboss.logging.Logger;
+
+/**
+ * TestActivationSpec
+ * @author <a href="mailto:jeff.zhang at jboss.org">Jeff Zhang</a>
+ * @version $Revision: $
+ */
+public class TestActivationSpec implements ActivationSpec
+{
+   private static Logger log = Logger.getLogger(TestActivationSpec.class);
+   
+   /**
+    * This method may be called by a deployment tool to validate the overall
+    * activation configuration information provided by the endpoint deployer.
+    * 
+    * @throws InvalidPropertyException indicates invalid
+    *         configuration property settings.
+    */
+   @SuppressWarnings(value = { "deprecation" })
+   public void validate() throws InvalidPropertyException
+   {
+      log.debug("call validate");
+   }
+
+   /**
+    * Get the associated <code>ResourceAdapter</code> object.
+    *
+    * @return the associated <code>ResourceAdapter</code> object.
+    */
+   public ResourceAdapter getResourceAdapter()
+   {
+      log.debug("call getResourceAdapter");
+      return null;
+   }
+
+   /**
+    * Associate this object with a <code>ResourceAdapter</code> object. 
+    *
+    * @param ra <code>ResourceAdapter</code> object to be associated with.
+    *
+    * @throws ResourceException generic exception.
+    */
+   public void setResourceAdapter(ResourceAdapter ra) throws ResourceException
+   {
+      log.debug("call setResourceAdapter");
+   }
+}

Added: projects/jboss-jca/trunk/embedded/src/test/java/org/jboss/jca/test/embedded/rars/simple/TestConnection.java
===================================================================
--- projects/jboss-jca/trunk/embedded/src/test/java/org/jboss/jca/test/embedded/rars/simple/TestConnection.java	                        (rev 0)
+++ projects/jboss-jca/trunk/embedded/src/test/java/org/jboss/jca/test/embedded/rars/simple/TestConnection.java	2009-12-03 14:50:26 UTC (rev 97362)
@@ -0,0 +1,43 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2009, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.jca.test.embedded.rars.simple;
+
+import org.jboss.logging.Logger;
+
+/**
+ * TestConnection
+ * @author <a href="mailto:jeff.zhang at jboss.org">Jeff Zhang</a>
+ * @version $Revision: $
+ */
+public class TestConnection implements TestConnectionInterface
+{
+   private static Logger log = Logger.getLogger(TestConnection.class);
+
+   /** 
+    * CallMe
+    **/
+   public void callMe()
+   {
+      log.debug("call callMe");
+
+   }
+}

Added: projects/jboss-jca/trunk/embedded/src/test/java/org/jboss/jca/test/embedded/rars/simple/TestConnectionInterface.java
===================================================================
--- projects/jboss-jca/trunk/embedded/src/test/java/org/jboss/jca/test/embedded/rars/simple/TestConnectionInterface.java	                        (rev 0)
+++ projects/jboss-jca/trunk/embedded/src/test/java/org/jboss/jca/test/embedded/rars/simple/TestConnectionInterface.java	2009-12-03 14:50:26 UTC (rev 97362)
@@ -0,0 +1,35 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2009, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.jca.test.embedded.rars.simple;
+
+/**
+ * TestConnectionInterface
+ * @author <a href="mailto:jeff.zhang at jboss.org">Jeff Zhang</a>
+ * @version $Revision: $
+ */
+public interface TestConnectionInterface
+{
+   /** 
+    * CallMe
+    **/
+   public void callMe();
+}

Added: projects/jboss-jca/trunk/embedded/src/test/java/org/jboss/jca/test/embedded/rars/simple/TestManagedConnection.java
===================================================================
--- projects/jboss-jca/trunk/embedded/src/test/java/org/jboss/jca/test/embedded/rars/simple/TestManagedConnection.java	                        (rev 0)
+++ projects/jboss-jca/trunk/embedded/src/test/java/org/jboss/jca/test/embedded/rars/simple/TestManagedConnection.java	2009-12-03 14:50:26 UTC (rev 97362)
@@ -0,0 +1,175 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2009, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.jca.test.embedded.rars.simple;
+
+import java.io.PrintWriter;
+
+import javax.resource.ResourceException;
+import javax.resource.spi.ConnectionEventListener;
+import javax.resource.spi.ConnectionRequestInfo;
+import javax.resource.spi.LocalTransaction;
+import javax.resource.spi.ManagedConnection;
+import javax.resource.spi.ManagedConnectionMetaData;
+import javax.security.auth.Subject;
+import javax.transaction.xa.XAResource;
+
+import org.jboss.logging.Logger;
+
+/**
+ * TestManagedConnection
+ * @author <a href="mailto:jeff.zhang at jboss.org">Jeff Zhang</a>
+ * @version $Revision: $
+ */
+public class TestManagedConnection implements ManagedConnection
+{
+   private static Logger log = Logger.getLogger(TestManagedConnection.class);
+
+   /** Adds a connection event listener to the ManagedConnection 
+    *  instance.
+    *
+    *  @param  listener   a new ConnectionEventListener to be registered
+   */
+   public void addConnectionEventListener(ConnectionEventListener listener)
+   {
+      log.debug("call addConnectionEventListener");
+   }
+
+   /** Used by the container to change the association of an 
+    *  application-level connection handle with a ManagedConneciton 
+    *  instance. 
+    *  @param   connection  Application-level connection handle
+    *
+    *  @throws  ResourceException     Failed to associate the connection
+    *                                 handle with this ManagedConnection
+    *                                 instance
+   */
+   public void associateConnection(Object connection) throws ResourceException
+   {
+      log.debug("call associateConnection");
+   }
+
+   /** Application server calls this method to force any cleanup on the 
+    *  ManagedConnection instance.
+    *  
+    *  @throws    ResourceException     generic exception if operation fails
+    */
+   public void cleanup() throws ResourceException
+   {
+      log.debug("call cleanup");
+   }
+
+   /** Destroys the physical connection to the underlying resource manager.
+   *
+   *  @throws    ResourceException     generic exception if operation failed
+   */
+   public void destroy() throws ResourceException
+   {
+      log.debug("call destroy");
+   }
+
+   /** Creates a new connection handle for the underlying physical connection 
+    *  represented by the ManagedConnection instance. 
+    *  
+    *  @param        subject        security context as JAAS subject
+    *  @param        cxRequestInfo  ConnectionRequestInfo instance
+    *  @return       generic Object instance representing the connection handle. 
+    *  @throws  ResourceException     generic exception if operation fails
+    *
+    */
+   public Object getConnection(Subject subject,
+         ConnectionRequestInfo cxRequestInfo) throws ResourceException
+   {
+      log.debug("call getConnection");
+      return null;
+   }
+
+   /** Returns an <code>javax.resource.spi.LocalTransaction</code> instance. 
+    *
+    *  @return     LocalTransaction instance
+    *
+    *  @throws     ResourceException     generic exception if operation fails
+   */
+   public LocalTransaction getLocalTransaction() throws ResourceException
+   {
+      log.debug("call getLocalTransaction");
+      return null;
+   }
+
+   /** Gets the log writer for this ManagedConnection instance.
+   *
+   *  @return   Character ourput stream associated with this Managed-
+   *            Connection instance
+   *     
+   *  @throws     ResourceException     generic exception if operation fails
+  */
+   public PrintWriter getLogWriter() throws ResourceException
+   {
+      log.debug("call getLogWriter");
+      return null;
+   }
+
+   /** <p>Gets the metadata information for this connection's underlying 
+    *  EIS resource manager instance. 
+    *  @return     ManagedConnectionMetaData instance
+    *
+    *  @throws     ResourceException     generic exception if operation fails
+   */
+   public ManagedConnectionMetaData getMetaData() throws ResourceException
+   {
+      log.debug("call destroy");
+      return null;
+   }
+
+   /** Returns an <code>javax.transaction.xa.XAresource</code> instance. 
+    *
+    *  @return     XAResource instance
+    *
+    *  @throws     ResourceException     generic exception if operation fails
+   */
+   public XAResource getXAResource() throws ResourceException
+   {
+      log.debug("call getXAResource");
+      return null;
+   }
+
+   /** Removes an already registered connection event listener from the 
+    *  ManagedConnection instance.
+    *
+    *  @param  listener   already registered connection event listener to be 
+    *                     removed
+   */
+   public void removeConnectionEventListener(ConnectionEventListener listener)
+   {
+      log.debug("call removeConnectionEventListener");
+   }
+
+   /** Sets the log writer for this ManagedConnection instance.
+   *
+   *  @param      out        Character Output stream to be associated
+   *
+   *  @throws     ResourceException  generic exception if operation fails
+   */
+   public void setLogWriter(PrintWriter out) throws ResourceException
+   {
+      log.debug("call setLogWriter");
+   }
+}

Added: projects/jboss-jca/trunk/embedded/src/test/java/org/jboss/jca/test/embedded/rars/simple/TestManagedConnectionFactory.java
===================================================================
--- projects/jboss-jca/trunk/embedded/src/test/java/org/jboss/jca/test/embedded/rars/simple/TestManagedConnectionFactory.java	                        (rev 0)
+++ projects/jboss-jca/trunk/embedded/src/test/java/org/jboss/jca/test/embedded/rars/simple/TestManagedConnectionFactory.java	2009-12-03 14:50:26 UTC (rev 97362)
@@ -0,0 +1,150 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2009, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.jca.test.embedded.rars.simple;
+
+import java.io.PrintWriter;
+import java.util.Set;
+
+import javax.resource.ResourceException;
+import javax.resource.spi.ConnectionManager;
+import javax.resource.spi.ConnectionRequestInfo;
+import javax.resource.spi.ManagedConnection;
+import javax.resource.spi.ManagedConnectionFactory;
+import javax.security.auth.Subject;
+
+import org.jboss.logging.Logger;
+
+/**
+ * TestManagedConnectionFactory
+ *
+ * @author  <a href="mailto:jeff.zhang at jboss.org">Jeff Zhang</a>.
+ * @version $Revision: $
+ */
+public class TestManagedConnectionFactory implements
+      ManagedConnectionFactory
+{
+   private static final long serialVersionUID = 1L;
+   private static Logger log = Logger.getLogger(TestManagedConnectionFactory.class);
+
+   /**
+    * Creates a Connection Factory instance. 
+    *
+    *  @param    cxManager    ConnectionManager to be associated with created EIS connection factory instance
+    *  @return   EIS-specific Connection Factory instance or javax.resource.cci.ConnectionFactory instance
+    *  @throws   ResourceException     Generic exception
+    */
+   public Object createConnectionFactory(ConnectionManager cxManager) throws ResourceException
+   {
+      log.debug("call createConnectionFactory");
+      return null;
+   }
+
+   /**
+    * Creates a Connection Factory instance. 
+    *
+    *  @return   EIS-specific Connection Factory instance or javax.resource.cci.ConnectionFactory instance
+    *  @throws   ResourceException     Generic exception
+    */
+   public Object createConnectionFactory() throws ResourceException
+   {
+      log.debug("call createConnectionFactory");
+      return null;
+   }
+
+   /** 
+    * Creates a new physical connection to the underlying EIS resource manager.
+    *
+    *  @param   subject        Caller's security information
+    *  @param   cxRequestInfo  Additional resource adapter specific connection request information
+    *  @throws  ResourceException     generic exception
+    *  @return  ManagedConnection instance
+    */
+   public ManagedConnection createManagedConnection(Subject subject,
+         ConnectionRequestInfo cxRequestInfo) throws ResourceException
+   {
+      log.debug("call createManagedConnection");
+      return null;
+   }
+
+   /** 
+    * Returns a matched connection from the candidate set of connections. 
+    *  @param   connectionSet   candidate connection set
+    *  @param   subject         caller's security information
+    *  @param   cxRequestInfo   additional resource adapter specific connection request information  
+    *
+    *  @throws  ResourceException     generic exception
+    *  @return  ManagedConnection     if resource adapter finds an acceptable match otherwise null
+    **/
+   public ManagedConnection matchManagedConnections(Set connectionSet,
+      Subject subject, ConnectionRequestInfo cxRequestInfo)
+      throws ResourceException
+   {
+      log.debug("call matchManagedConnections");
+      return null;
+   }
+
+   /** 
+    * Get the log writer for this ManagedConnectionFactory instance.
+    *  @return  PrintWriter
+    *  @throws  ResourceException     generic exception
+    */
+   public PrintWriter getLogWriter() throws ResourceException
+   {
+      log.debug("call getLogWriter");
+      return null;
+   }
+
+   /** 
+    * Set the log writer for this ManagedConnectionFactory instance.</p>
+    *
+    *  @param   out PrintWriter - an out stream for error logging and tracing
+    *  @throws  ResourceException     generic exception
+    */
+   public void setLogWriter(PrintWriter out) throws ResourceException
+   {
+      log.debug("call setLogWriter");
+
+   }
+
+   /**
+    * Hash code
+    * @return The hash
+    */
+   @Override
+   public int hashCode()
+   {
+      return 42;
+   }
+
+   /**
+    * Equals
+    * @param other The other object
+    * @return True if equal; otherwise false
+    */
+   public boolean equals(Object other)
+   {
+      if (other == null)
+         return false;
+
+      return getClass().equals(other.getClass());
+   }
+}

Added: projects/jboss-jca/trunk/embedded/src/test/java/org/jboss/jca/test/embedded/rars/simple/TestResourceAdapter.java
===================================================================
--- projects/jboss-jca/trunk/embedded/src/test/java/org/jboss/jca/test/embedded/rars/simple/TestResourceAdapter.java	                        (rev 0)
+++ projects/jboss-jca/trunk/embedded/src/test/java/org/jboss/jca/test/embedded/rars/simple/TestResourceAdapter.java	2009-12-03 14:50:26 UTC (rev 97362)
@@ -0,0 +1,103 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2009, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.jca.test.embedded.rars.simple;
+
+import javax.resource.ResourceException;
+import javax.resource.spi.ActivationSpec;
+import javax.resource.spi.BootstrapContext;
+import javax.resource.spi.ResourceAdapter;
+import javax.resource.spi.ResourceAdapterInternalException;
+import javax.resource.spi.endpoint.MessageEndpointFactory;
+import javax.transaction.xa.XAResource;
+
+import org.jboss.logging.Logger;
+
+/**
+ * TestResourceAdapter
+ *
+ * @author  <a href="mailto:jeff.zhang at jboss.org">Jeff Zhang</a>.
+ * @version $Revision: $
+ */
+public class TestResourceAdapter implements ResourceAdapter
+{
+   private static Logger log = Logger.getLogger(TestResourceAdapter.class);
+   
+   /**
+    * This is called during the activation of a message endpoint. 
+    *
+    * @param endpointFactory a message endpoint factory instance.
+    * @param spec an activation spec JavaBean instance.
+    * @throws ResourceException generic exception 
+    */
+   public void endpointActivation(MessageEndpointFactory endpointFactory,
+      ActivationSpec spec) throws ResourceException
+   {
+      log.debug("call endpointActivation");
+   }
+
+   /**
+    * This is called when a message endpoint is deactivated. 
+    * 
+    * @param endpointFactory a message endpoint factory instance.
+    * @param spec an activation spec JavaBean instance.
+    */
+   public void endpointDeactivation(MessageEndpointFactory endpointFactory,
+      ActivationSpec spec)
+   {
+      log.debug("call endpointDeactivation");
+   }
+
+   /**
+    * This method is called by the application server during crash recovery.
+    * 
+    * @param specs an array of ActivationSpec JavaBeans 
+    * @throws ResourceException generic exception 
+    * @return an array of XAResource objects
+    */
+   public XAResource[] getXAResources(ActivationSpec[] specs)
+      throws ResourceException
+   {
+      log.debug("call getXAResources");
+      return null;
+   }
+
+   /**
+    * This is called when a resource adapter instance is bootstrapped. 
+    *
+    * @param ctx a bootstrap context containing references 
+    * @throws ResourceAdapterInternalException indicates bootstrap failure.
+    */
+   public void start(BootstrapContext ctx)
+      throws ResourceAdapterInternalException
+   {
+      log.debug("call start");
+   }
+
+   /**
+    * This is called when a resource adapter instance is undeployed or
+    * during application server shutdown. 
+    */
+   public void stop()
+   {
+      log.debug("call stop");
+   }
+}

Added: projects/jboss-jca/trunk/embedded/src/test/java/org/jboss/jca/test/embedded/rars/simple/package.html
===================================================================
--- projects/jboss-jca/trunk/embedded/src/test/java/org/jboss/jca/test/embedded/rars/simple/package.html	                        (rev 0)
+++ projects/jboss-jca/trunk/embedded/src/test/java/org/jboss/jca/test/embedded/rars/simple/package.html	2009-12-03 14:50:26 UTC (rev 97362)
@@ -0,0 +1,3 @@
+<body>
+Simple resource adapter.
+</body>

Added: projects/jboss-jca/trunk/embedded/src/test/java/org/jboss/jca/test/embedded/unit/ShrinkWrapTestCase.java
===================================================================
--- projects/jboss-jca/trunk/embedded/src/test/java/org/jboss/jca/test/embedded/unit/ShrinkWrapTestCase.java	                        (rev 0)
+++ projects/jboss-jca/trunk/embedded/src/test/java/org/jboss/jca/test/embedded/unit/ShrinkWrapTestCase.java	2009-12-03 14:50:26 UTC (rev 97362)
@@ -0,0 +1,167 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2009, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+
+package org.jboss.jca.test.embedded.unit;
+
+import org.jboss.jca.embedded.EmbeddedJCA;
+import org.jboss.jca.test.embedded.rars.simple.MessageListener;
+import org.jboss.jca.test.embedded.rars.simple.TestActivationSpec;
+import org.jboss.jca.test.embedded.rars.simple.TestConnection;
+import org.jboss.jca.test.embedded.rars.simple.TestConnectionInterface;
+import org.jboss.jca.test.embedded.rars.simple.TestManagedConnection;
+import org.jboss.jca.test.embedded.rars.simple.TestManagedConnectionFactory;
+import org.jboss.jca.test.embedded.rars.simple.TestResourceAdapter;
+
+import java.util.UUID;
+
+import org.jboss.logging.Logger;
+import org.jboss.shrinkwrap.api.Archives;
+import org.jboss.shrinkwrap.api.spec.JavaArchive;
+import org.jboss.shrinkwrap.api.spec.ResourceAdapterArchive;
+
+import org.junit.AfterClass;
+import org.junit.BeforeClass;
+import org.junit.Test;
+import static org.junit.Assert.*;
+
+/**
+ * Test cases for deploying resource adapter archives (.RAR)
+ * using ShrinkWrap
+ * 
+ * @author <a href="mailto:jesper.pedersen at jboss.org">Jesper Pedersen</a>
+ * @version $Revision: $
+ */
+public class ShrinkWrapTestCase
+{
+
+   // --------------------------------------------------------------------------------||
+   // Class Members ------------------------------------------------------------------||
+   // --------------------------------------------------------------------------------||
+
+   private static Logger log = Logger.getLogger(ShrinkWrapTestCase.class);
+
+   /*
+    * Embedded
+    */
+   private static EmbeddedJCA embedded;
+
+   // --------------------------------------------------------------------------------||
+   // Tests --------------------------------------------------------------------------||
+   // --------------------------------------------------------------------------------||
+
+   /**
+    * Null ShrinkWrap ResourceAdapterArchive test case
+    * @exception Throwable Thrown if case of an error
+    */
+   @Test
+   public void testNull() throws Throwable
+   {
+      ResourceAdapterArchive raa = null; 
+
+      try
+      {
+         embedded.deploy(raa);
+         fail("Null deployment successful");
+      }
+      catch (Throwable t)
+      {
+         // Ok
+      }
+      finally
+      {
+         try
+         {
+            embedded.undeploy(raa);
+            fail("Null undeployment successful");
+         }
+         catch (Throwable t)
+         {
+            // Ok
+         }
+      }
+   }
+
+   /**
+    * Basic ShrinkWrap ResourceAdapterArchive test case
+    * @exception Throwable Thrown if case of an error
+    */
+   @Test
+   public void testBasic() throws Throwable
+   {
+      ResourceAdapterArchive raa =
+         Archives.create(UUID.randomUUID().toString() + ".rar", ResourceAdapterArchive.class);
+
+      JavaArchive ja = Archives.create(UUID.randomUUID().toString() + ".jar", JavaArchive.class);
+      ja.addClasses(MessageListener.class, TestActivationSpec.class, TestConnection.class,
+                    TestConnectionInterface.class, TestManagedConnection.class, 
+                    TestManagedConnectionFactory.class, TestResourceAdapter.class);
+
+      raa.addLibrary(ja);
+      raa.addManifestResource("simple.rar/META-INF/ra.xml", "ra.xml");
+
+      try
+      {
+         embedded.deploy(raa);
+      }
+      catch (Throwable t)
+      {
+         log.error(t.getMessage(), t);
+         fail(t.getMessage());
+      }
+      finally
+      {
+         embedded.undeploy(raa);
+      }
+   }
+
+   // --------------------------------------------------------------------------------||
+   // Lifecycle Methods --------------------------------------------------------------||
+   // --------------------------------------------------------------------------------||
+
+   /**
+    * Lifecycle start, before the suite is executed
+    * @throws Throwable throwable exception 
+    */
+   @BeforeClass
+   public static void beforeClass() throws Throwable
+   {
+      // Create and set an embedded JCA instance
+      embedded = new EmbeddedJCA();
+
+      // Startup
+      embedded.startup();
+   }
+
+   /**
+    * Lifecycle stop, after the suite is executed
+    * @throws Throwable throwable exception 
+    */
+   @AfterClass
+   public static void afterClass() throws Throwable
+   {
+      // Shutdown embedded
+      embedded.shutdown();
+
+      // Set embedded to null
+      embedded = null;
+   }
+}

Added: projects/jboss-jca/trunk/embedded/src/test/resources/jndi.properties
===================================================================
--- projects/jboss-jca/trunk/embedded/src/test/resources/jndi.properties	                        (rev 0)
+++ projects/jboss-jca/trunk/embedded/src/test/resources/jndi.properties	2009-12-03 14:50:26 UTC (rev 97362)
@@ -0,0 +1,2 @@
+java.naming.factory.initial=org.jnp.interfaces.LocalOnlyContextFactory
+java.naming.factory.url.pkgs=org.jboss.naming:org.jnp.interfaces

Added: projects/jboss-jca/trunk/embedded/src/test/resources/logging.properties
===================================================================
--- projects/jboss-jca/trunk/embedded/src/test/resources/logging.properties	                        (rev 0)
+++ projects/jboss-jca/trunk/embedded/src/test/resources/logging.properties	2009-12-03 14:50:26 UTC (rev 97362)
@@ -0,0 +1,62 @@
+#
+# JBoss, Home of Professional Open Source.
+# Copyright 2009, Red Hat Middleware LLC, and individual contributors
+# as indicated by the @author tags. See the copyright.txt file in the
+# distribution for a full listing of individual contributors.
+#
+# This is free software; you can redistribute it and/or modify it
+# under the terms of the GNU Lesser General Public License as
+# published by the Free Software Foundation; either version 2.1 of
+# the License, or (at your option) any later version.
+#
+# This software is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+# Lesser General Public License for more details.
+#
+# You should have received a copy of the GNU Lesser General Public
+# License along with this software; if not, write to the Free
+# Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+# 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+#
+
+### $Id: $ ###
+
+# Additional logger names to configure (root logger is always configured)
+loggers=org.jboss.jca,org.jboss,org.jnp,com.arjuna
+
+# Root logger level
+logger.level=${jboss.jca.log.level:INFO}
+logger.handlers=CONSOLE, FILE
+
+# org.jboss.jca
+logger.org.jboss.jca.level=DEBUG
+
+# org.jboss
+logger.org.jboss.level=INFO
+
+# org.jnp
+logger.org.jnp.level=INFO
+
+# com.arjuna
+logger.com.arjuna.level=INFO
+
+# Console handler configuration
+handler.CONSOLE=org.jboss.logmanager.handlers.ConsoleHandler
+handler.CONSOLE.properties=autoFlush
+handler.CONSOLE.level=${jboss.jca.log.console.level:INFO}
+handler.CONSOLE.autoFlush=true
+handler.CONSOLE.formatter=PATTERN
+
+# File handler configuration
+handler.FILE=org.jboss.logmanager.handlers.FileHandler
+handler.FILE.level=${jboss.jca.log.file.level:DEBUG}
+handler.FILE.properties=autoFlush,fileName
+handler.FILE.autoFlush=true
+handler.FILE.fileName=${test.dir}/deployers/test.log
+handler.FILE.formatter=PATTERN
+
+# Formatter pattern configuration
+formatter.PATTERN=org.jboss.logmanager.formatters.PatternFormatter
+formatter.PATTERN.properties=pattern
+formatter.PATTERN.pattern=%d{HH:mm:ss,SSS} %-5p [%c{1}] %m%n

Added: projects/jboss-jca/trunk/embedded/src/test/resources/simple.rar/META-INF/ra.xml
===================================================================
--- projects/jboss-jca/trunk/embedded/src/test/resources/simple.rar/META-INF/ra.xml	                        (rev 0)
+++ projects/jboss-jca/trunk/embedded/src/test/resources/simple.rar/META-INF/ra.xml	2009-12-03 14:50:26 UTC (rev 97362)
@@ -0,0 +1,41 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!-- $Id $ -->
+
+<connector xmlns="http://java.sun.com/xml/ns/javaee"
+           xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+           xsi:schemaLocation="http://java.sun.com/xml/ns/javaee
+           http://java.sun.com/xml/ns/j2ee/connector_1_6.xsd"
+           version="1.6" metadata-complete="true">
+
+  <vendor-name>Red Hat Middleware LLC</vendor-name>
+  <eis-type>Test RA</eis-type>
+  <resourceadapter-version>0.1</resourceadapter-version>
+  
+  <resourceadapter>
+    <resourceadapter-class>org.jboss.jca.test.embedded.rars.simple.TestResourceAdapter</resourceadapter-class>
+    
+    <outbound-resourceadapter>
+      <connection-definition>
+        <managedconnectionfactory-class>org.jboss.jca.test.embedded.rars.simple.TestManagedConnectionFactory</managedconnectionfactory-class>
+        
+        <connectionfactory-interface>javax.resource.spi.ManagedConnection</connectionfactory-interface>
+        <connectionfactory-impl-class>org.jboss.jca.test.embedded.rars.simple.TestManagedConnection</connectionfactory-impl-class>
+        <connection-interface>org.jboss.jca.test.embedded.rars.simple.TestConnectionInterface</connection-interface>
+        <connection-impl-class>org.jboss.jca.test.embedded.rars.simple.TestConnection</connection-impl-class>
+      </connection-definition>
+      <transaction-support>LocalTransaction</transaction-support>
+      <reauthentication-support>false</reauthentication-support>
+    </outbound-resourceadapter>
+    <inbound-resourceadapter>
+      <messageadapter>        
+        <messagelistener>
+          <messagelistener-type>org.jboss.jca.test.embedded.rars.simple.MessageListener</messagelistener-type>
+          <activationspec>
+            <activationspec-class>org.jboss.jca.test.embedded.rars.simple.TestActivationSpec</activationspec-class>
+          </activationspec>
+        </messagelistener>
+      </messageadapter>
+    </inbound-resourceadapter>
+  </resourceadapter>
+</connector>

Modified: projects/jboss-jca/trunk/ivy.xml
===================================================================
--- projects/jboss-jca/trunk/ivy.xml	2009-12-03 14:39:02 UTC (rev 97361)
+++ projects/jboss-jca/trunk/ivy.xml	2009-12-03 14:50:26 UTC (rev 97362)
@@ -89,6 +89,9 @@
     <dependency org="org.jboss.microcontainer" name="jboss-kernel" rev="${version.jboss.mc.kernel}" conf="standalone->default"/>
     <dependency org="org.jboss.naming" name="jnpserver" rev="${version.jboss.naming}" conf="standalone->default;sjc->*"/>
     <dependency org="org.jboss.papaki" name="papaki-core" rev="${version.jboss.papaki}" conf="standalone->default;sjc->*"/>
+    <dependency org="org.jboss.shrinkwrap" name="shrinkwrap-api" rev="${version.jboss.shrinkwrap}" conf="standalone->default;sjc->*"/>
+    <dependency org="org.jboss.shrinkwrap" name="shrinkwrap-impl-base" rev="${version.jboss.shrinkwrap}" conf="standalone->default;sjc->*"/>
+    <dependency org="org.jboss.shrinkwrap" name="shrinkwrap-spi" rev="${version.jboss.shrinkwrap}" conf="standalone->default;sjc->*"/>
     <dependency org="org.jboss.slf4j" name="slf4j-jboss-logging" rev="${version.jboss.slf4j}" conf="standalone->default;sjc->*"/>
     <dependency org="org.jboss.security" name="jboss-security-spi-bare" rev="${version.jboss.security}" conf="standalone->default;sjc->*"/>
     <dependency org="org.jboss.slf4j" name="slf4j-jboss-logmanager" rev="${version.jboss.slf4j.logmanager}" conf="standalone->default;sjc->*"/>




More information about the jboss-cvs-commits mailing list