[jboss-cvs] JBossAS SVN: r106015 - in projects/jboss-jca/trunk/codegenerator/src/main: java/org/jboss/jca/codegenerator/code and 1 other directories.

jboss-cvs-commits at lists.jboss.org jboss-cvs-commits at lists.jboss.org
Sun Jun 13 06:41:22 EDT 2010


Author: jeff.zhang
Date: 2010-06-13 06:41:21 -0400 (Sun, 13 Jun 2010)
New Revision: 106015

Added:
   projects/jboss-jca/trunk/codegenerator/src/main/java/org/jboss/jca/codegenerator/code/TestCodeGen.java
   projects/jboss-jca/trunk/codegenerator/src/main/resources/jca.xml.template
   projects/jboss-jca/trunk/codegenerator/src/main/resources/jndi.properties.template
   projects/jboss-jca/trunk/codegenerator/src/main/resources/logging.properties.template
   projects/jboss-jca/trunk/codegenerator/src/main/resources/naming.xml.template
   projects/jboss-jca/trunk/codegenerator/src/main/resources/stdio.xml.template
   projects/jboss-jca/trunk/codegenerator/src/main/resources/transaction.xml.template
Modified:
   projects/jboss-jca/trunk/codegenerator/src/main/java/org/jboss/jca/codegenerator/BaseProfile.java
   projects/jboss-jca/trunk/codegenerator/src/main/java/org/jboss/jca/codegenerator/JCA10Profile.java
   projects/jboss-jca/trunk/codegenerator/src/main/java/org/jboss/jca/codegenerator/JCA15Profile.java
   projects/jboss-jca/trunk/codegenerator/src/main/java/org/jboss/jca/codegenerator/JCA16Profile.java
   projects/jboss-jca/trunk/codegenerator/src/main/java/org/jboss/jca/codegenerator/Utils.java
   projects/jboss-jca/trunk/codegenerator/src/main/resources/build.xml.template
Log:
[JBJCA-356] use Arquillian tools to test generation codes

Modified: projects/jboss-jca/trunk/codegenerator/src/main/java/org/jboss/jca/codegenerator/BaseProfile.java
===================================================================
--- projects/jboss-jca/trunk/codegenerator/src/main/java/org/jboss/jca/codegenerator/BaseProfile.java	2010-06-13 04:56:18 UTC (rev 106014)
+++ projects/jboss-jca/trunk/codegenerator/src/main/java/org/jboss/jca/codegenerator/BaseProfile.java	2010-06-13 10:41:21 UTC (rev 106015)
@@ -28,6 +28,7 @@
 import java.io.File;
 import java.io.FileWriter;
 import java.io.IOException;
+import java.net.URL;
 
 /**
  * A BaseProfile.
@@ -56,11 +57,11 @@
       generateRaCode(def);
       generateOutboundCode(def);
       generateInboundCode(def);
-      
+
+      generateTestCode(def);
+
       generateAntXml(def.getOutputDir());
-      
-      if (!def.isUseAnnotation())
-         generateRaXml(def, def.getOutputDir());
+      generateRaXml(def, def.getOutputDir());
    }
 
    /**
@@ -200,19 +201,22 @@
     */
    void generateRaXml(Definition def, String outputDir)
    {
-      try
+      if (!def.isUseAnnotation())
       {
-         outputDir = outputDir + File.separatorChar + "src" + File.separatorChar + 
-            "main" + File.separatorChar + "resources";
-         FileWriter rafw = Utils.createFile("ra.xml", outputDir + File.separatorChar + "META-INF");
-         RaXmlGen raGen = getRaXmlGen(def);
-         raGen.generate(def, rafw);
-         rafw.close();
+         try
+         {
+            outputDir = outputDir + File.separatorChar + "src" + File.separatorChar + 
+               "main" + File.separatorChar + "resources";
+            FileWriter rafw = Utils.createFile("ra.xml", outputDir + File.separatorChar + "META-INF");
+            RaXmlGen raGen = getRaXmlGen(def);
+            raGen.generate(def, rafw);
+            rafw.close();
+         }
+         catch (IOException ioe)
+         {
+            ioe.printStackTrace();
+         }
       }
-      catch (IOException ioe)
-      {
-         ioe.printStackTrace();
-      }
    }
    
    /**
@@ -224,4 +228,64 @@
    {
       return null;
    }
+   
+   
+   /**
+    * generate test code
+    * 
+    * @param def Definition 
+    */
+   void generateTestCode(Definition def)
+   {
+      if (!def.isSupportOutbound())
+         return;
+      
+      try
+      {
+         String clazzName = this.getClass().getPackage().getName() + ".code.TestCodeGen";
+         String javaFile = "ConnectorTestCase.java";
+         FileWriter fw = Utils.createTestFile(javaFile, def.getRaPackage(), def.getOutputDir());
+
+         Class<?> clazz = Class.forName(clazzName, true, Thread.currentThread().getContextClassLoader());
+         AbstractCodeGen codeGen = (AbstractCodeGen)clazz.newInstance();
+         
+         codeGen.generate(def, fw);
+         
+         fw.flush();
+         fw.close();
+         
+         copyTestResourceFiles(def.getOutputDir(), "jca.xml");
+         copyTestResourceFiles(def.getOutputDir(), "naming.xml");
+         copyTestResourceFiles(def.getOutputDir(), "stdio.xml");
+         copyTestResourceFiles(def.getOutputDir(), "transaction.xml");
+         copyTestResourceFiles(def.getOutputDir(), "logging.properties");
+         copyTestResourceFiles(def.getOutputDir(), "jndi.properties");
+      }
+      catch (IOException ioe)
+      {
+         ioe.printStackTrace();
+      }
+      catch (Exception e)
+      {
+         e.printStackTrace();
+      }
+   }
+
+   /**
+    * copy some test resource files
+    * 
+    * @param outputDir output directory
+    * @param filename filename
+    * @throws IOException ioException
+    */
+   private void copyTestResourceFiles(String outputDir, String filename) throws IOException
+   {
+      String testResourceDir = outputDir + "/src/test/resources";
+      FileWriter fw = Utils.createFile(filename, testResourceDir);
+      URL buildFile = BaseProfile.class.getResource("/" + filename + ".template");
+      String buildString = Utils.readFileIntoString(buildFile);
+      fw.write(buildString);
+      fw.close();
+   }
+
 }

Modified: projects/jboss-jca/trunk/codegenerator/src/main/java/org/jboss/jca/codegenerator/JCA10Profile.java
===================================================================
--- projects/jboss-jca/trunk/codegenerator/src/main/java/org/jboss/jca/codegenerator/JCA10Profile.java	2010-06-13 04:56:18 UTC (rev 106014)
+++ projects/jboss-jca/trunk/codegenerator/src/main/java/org/jboss/jca/codegenerator/JCA10Profile.java	2010-06-13 10:41:21 UTC (rev 106015)
@@ -40,22 +40,7 @@
    {
    }
    
-  
    /**
-    * generate code
-    * @param def Definition 
-    */
-   @Override
-   public void generate(Definition def)
-   {
-      generateOutboundCode(def);
-
-      generateAntXml(def.getOutputDir());
-      generateRaXml(def, def.getOutputDir());
-   }
-
-
-   /**
     * get right profile ra xmlGen
     * @param def Definition
     * @return RaXmlGen profile ra xmlGen

Modified: projects/jboss-jca/trunk/codegenerator/src/main/java/org/jboss/jca/codegenerator/JCA15Profile.java
===================================================================
--- projects/jboss-jca/trunk/codegenerator/src/main/java/org/jboss/jca/codegenerator/JCA15Profile.java	2010-06-13 04:56:18 UTC (rev 106014)
+++ projects/jboss-jca/trunk/codegenerator/src/main/java/org/jboss/jca/codegenerator/JCA15Profile.java	2010-06-13 10:41:21 UTC (rev 106015)
@@ -40,24 +40,7 @@
    {
    }
    
-  
    /**
-    * generate code
-    * @param def Definition 
-    */
-   @Override
-   public void generate(Definition def)
-   {
-      generateRaCode(def);
-      generateOutboundCode(def);
-      generateInboundCode(def);
-
-      generateAntXml(def.getOutputDir());
-      generateRaXml(def, def.getOutputDir());
-   }
-
-
-   /**
     * get right profile ra xmlGen
     * @param def Definition
     * @return RaXmlGen profile ra xmlGen

Modified: projects/jboss-jca/trunk/codegenerator/src/main/java/org/jboss/jca/codegenerator/JCA16Profile.java
===================================================================
--- projects/jboss-jca/trunk/codegenerator/src/main/java/org/jboss/jca/codegenerator/JCA16Profile.java	2010-06-13 04:56:18 UTC (rev 106014)
+++ projects/jboss-jca/trunk/codegenerator/src/main/java/org/jboss/jca/codegenerator/JCA16Profile.java	2010-06-13 10:41:21 UTC (rev 106015)
@@ -40,25 +40,7 @@
    {
    }
    
-  
    /**
-    * generate code
-    * @param def Definition 
-    */
-   @Override
-   public void generate(Definition def)
-   {
-      generateRaCode(def);
-      generateOutboundCode(def);
-      generateInboundCode(def);
-      
-      generateAntXml(def.getOutputDir());
-      
-      if (!def.isUseAnnotation())
-         generateRaXml(def, def.getOutputDir());
-   }
-
-   /**
     * get right profile ra xmlGen
     * @param def Definition
     * @return RaXmlGen profile ra xmlGen

Modified: projects/jboss-jca/trunk/codegenerator/src/main/java/org/jboss/jca/codegenerator/Utils.java
===================================================================
--- projects/jboss-jca/trunk/codegenerator/src/main/java/org/jboss/jca/codegenerator/Utils.java	2010-06-13 04:56:18 UTC (rev 106014)
+++ projects/jboss-jca/trunk/codegenerator/src/main/java/org/jboss/jca/codegenerator/Utils.java	2010-06-13 10:41:21 UTC (rev 106015)
@@ -101,6 +101,36 @@
    {
       String directory = "src" + File.separatorChar + "main" + File.separatorChar + "java";
 
+      return createPackageFile(name, packageName, directory, outDir);
+   }
+   
+   /**
+    * Create test file
+    * @param name The name of the class
+    * @param packageName The package name
+    * @param outDir output directory
+    * @return The file
+    * @exception IOException Thrown if an error occurs 
+    */
+   public static FileWriter createTestFile(String name, String packageName, String outDir) throws IOException
+   {
+      String directory = "src" + File.separatorChar + "test" + File.separatorChar + "java";
+
+      return createPackageFile(name, packageName, directory, outDir);
+   }
+   
+   /**
+    * Create file in the package
+    * @param name The name of the class
+    * @param packageName The package name
+    * @param directory layout directory
+    * @param outDir output directory
+    * @return The file
+    * @exception IOException Thrown if an error occurs 
+    */
+   private static FileWriter createPackageFile(String name, String packageName, 
+         String directory, String outDir) throws IOException
+   {
       if (packageName != null && !packageName.trim().equals(""))
       {
          directory = directory + File.separatorChar +

Added: projects/jboss-jca/trunk/codegenerator/src/main/java/org/jboss/jca/codegenerator/code/TestCodeGen.java
===================================================================
--- projects/jboss-jca/trunk/codegenerator/src/main/java/org/jboss/jca/codegenerator/code/TestCodeGen.java	                        (rev 0)
+++ projects/jboss-jca/trunk/codegenerator/src/main/java/org/jboss/jca/codegenerator/code/TestCodeGen.java	2010-06-13 10:41:21 UTC (rev 106015)
@@ -0,0 +1,287 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2010, 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.codegenerator.code;
+
+import org.jboss.jca.codegenerator.Definition;
+
+import java.io.IOException;
+import java.io.Writer;
+
+/**
+ * A Test CodeGen.
+ * 
+ * @author Jeff Zhang
+ * @version $Revision: $
+ */
+public class TestCodeGen extends AbstractCodeGen
+{
+
+   /**
+    * Output class
+    * @param def definition
+    * @param out Writer
+    * @throws IOException ioException
+    */
+   @Override
+   public void writeClassBody(Definition def, Writer out) throws IOException
+   {
+      int indent = 1;
+      out.write("@RunWith(Arquillian.class)");
+      writeEol(out);
+      out.write("public class " + getClassName(def));
+      writeLeftCurlyBracket(out, 0);
+      writeIndent(out, indent);
+      out.write("private static Logger log = Logger.getLogger(" + getClassName(def) + ".class);");
+      writeEol(out);
+      writeIndent(out, indent);
+      out.write("private static final String JNDI_PREFIX = \"java:/eis/\";");
+      writeEol(out);
+      writeIndent(out, indent);
+      out.write("private static String deploymentName = null;");
+      writeEol(out);
+
+      writeDeployment(def, out, indent);
+      writeTestBasic(def, out, indent);
+
+      writeRightCurlyBracket(out, 0);
+   }
+   
+   /**
+    * Output class import
+    * @param def definition
+    * @param out Writer
+    * @throws IOException ioException
+    */
+   @Override
+   public void writeImport(Definition def, Writer out) throws IOException
+   {
+      out.write("package " + def.getRaPackage() + ";");
+      writeEol(out);
+      writeEol(out);
+      out.write("import java.util.UUID;");
+      writeEol(out);
+      out.write("import javax.naming.Context;");
+      writeEol(out);
+      out.write("import javax.naming.InitialContext;");
+      writeEol(out);
+      out.write("import javax.naming.NamingException;");
+      writeEol(out);
+      out.write("import org.jboss.arquillian.api.Deployment;");
+      writeEol(out);
+      out.write("import org.jboss.arquillian.junit.Arquillian;");
+      writeEol(out);
+      out.write("import org.jboss.logging.Logger;");
+      writeEol(out);
+      writeEol(out);
+      out.write("import org.jboss.shrinkwrap.api.ShrinkWrap;");
+      writeEol(out);
+      out.write("import org.jboss.shrinkwrap.api.spec.JavaArchive;");
+      writeEol(out);
+      out.write("import org.jboss.shrinkwrap.api.spec.ResourceAdapterArchive;");
+      writeEol(out);
+      writeEol(out);
+      out.write("import org.junit.Test;");
+      writeEol(out);
+      out.write("import org.junit.runner.RunWith;");
+      writeEol(out);
+      out.write("import static org.junit.Assert.*;");
+      writeEol(out);
+      writeEol(out);
+      writeEol(out);
+   }
+   
+   /**
+    * get this class name
+    * @param def definition
+    * @return String class name
+    */
+   @Override
+   public String getClassName(Definition def)
+   {
+      return "ConnectorTestCase";
+   }
+   
+   /**
+    * Output create deployment method
+    * @param def definition
+    * @param out Writer
+    * @param indent space number
+    * @throws IOException ioException
+    */
+   private void writeDeployment(Definition def, Writer out, int indent) throws IOException
+   {
+      writeIndent(out, indent);
+      out.write("/**");
+      writeEol(out);
+      writeIndent(out, indent);
+      out.write(" * Define the deployment");
+      writeEol(out);
+      writeIndent(out, indent);
+      out.write(" *");
+      writeEol(out);
+      writeIndent(out, indent);
+      out.write(" * @return The deployment archive");
+      writeEol(out);
+      writeIndent(out, indent);
+      out.write(" */");
+      writeEol(out);
+      
+      writeIndent(out, indent);
+      out.write("@Deployment");
+      writeEol(out);
+      writeIndent(out, indent);
+      out.write("public static ResourceAdapterArchive createDeployment()");
+      writeLeftCurlyBracket(out, indent);
+      
+      writeIndent(out, indent + 1);
+      out.write("deploymentName = UUID.randomUUID().toString();");
+      writeEol(out);
+      writeIndent(out, indent + 1);
+      out.write("ResourceAdapterArchive raa =");
+      writeEol(out);
+      writeIndent(out, indent + 2);
+      out.write("ShrinkWrap.create(ResourceAdapterArchive.class, deploymentName + \".rar\");");
+      writeEol(out);
+      writeIndent(out, indent + 1);
+      out.write("JavaArchive ja = ShrinkWrap.create(JavaArchive.class, UUID.randomUUID().toString() + \".jar\");");
+      writeEol(out);
+      writeIndent(out, indent + 1);
+      out.write("ja.addClasses(");
+      
+      if (def.isUseRa())
+      {
+         out.write(def.getRaClass() + ".class, ");
+      }
+      out.write(def.getMcfClass() + ".class, " + def.getMcClass() + ".class, " + 
+         def.getMcMetaClass() + ".class, " + def.getCmClass() + ".class, ");
+      if (def.isUseCciConnection())
+      {
+         out.write(def.getCciConnFactoryClass() + ".class, " + def.getCciConnFactoryClass() + ".class, " + 
+            def.getConnMetaClass() + ".class, " + def.getRaMetaClass() + ".class, " + 
+            def.getConnSpecClass() + ".class");
+      }
+      else
+      {
+         out.write(def.getCfInterfaceClass() + ".class, " + def.getCfClass() + ".class, " + 
+            def.getConnInterfaceClass() + ".class, " + def.getConnImplClass() + ".class");
+      }
+      
+      out.write(");");
+      writeEol(out);
+      writeIndent(out, indent + 1);
+      out.write("raa.addLibrary(ja);");
+      writeEol(out);
+      writeEol(out);
+      if (!def.isUseAnnotation())
+      {
+         writeIndent(out, indent + 1);
+         out.write("raa.addManifestResource(\"META-INF/ra.xml\", \"ra.xml\");");
+         writeEol(out);
+         writeEol(out);
+      }
+      writeIndent(out, indent + 1);
+      out.write("return raa;");
+      writeEol(out);
+      
+      writeRightCurlyBracket(out, indent);
+      writeEol(out);
+   }
+   
+   /**
+    * Output test basic method
+    * @param def definition
+    * @param out Writer
+    * @param indent space number
+    * @throws IOException ioException
+    */
+   private void writeTestBasic(Definition def, Writer out, int indent) throws IOException
+   {
+      writeIndent(out, indent);
+      out.write("/**");
+      writeEol(out);
+      writeIndent(out, indent);
+      out.write(" * Test Basic");
+      writeEol(out);
+      writeIndent(out, indent);
+      out.write(" *");
+      writeEol(out);
+      writeIndent(out, indent);
+      out.write(" * @exception Throwable Thrown if case of an error");
+      writeEol(out);
+      writeIndent(out, indent);
+      out.write(" */");
+      writeEol(out);
+
+      writeIndent(out, indent);
+      out.write("@Test");
+      writeEol(out);
+      writeIndent(out, indent);
+      out.write("public void testBasic() throws Throwable");
+      writeLeftCurlyBracket(out, indent);
+      
+      writeIndent(out, indent + 1);
+      out.write("Context context = null;");
+      writeEol(out);
+      writeIndent(out, indent + 1);
+      out.write("try");
+      writeLeftCurlyBracket(out, indent + 1);
+      writeIndent(out, indent + 2);
+      out.write("context = new InitialContext();");
+      writeEol(out);
+      writeIndent(out, indent + 2);
+      out.write("Object o = context.lookup(JNDI_PREFIX + deploymentName);");
+      writeEol(out);
+      writeIndent(out, indent + 2);
+      out.write("assertNotNull(o);");
+      writeRightCurlyBracket(out, indent + 1);
+      writeIndent(out, indent + 1);
+      out.write("catch (Throwable t)");
+      writeLeftCurlyBracket(out, indent + 1);
+      writeIndent(out, indent + 2);
+      out.write("log.error(t.getMessage(), t);");
+      writeEol(out);
+      writeIndent(out, indent + 2);
+      out.write("fail(t.getMessage());");
+      writeRightCurlyBracket(out, indent + 1);
+      writeIndent(out, indent + 1);
+      out.write("finally");
+      writeLeftCurlyBracket(out, indent + 1);
+      writeIndent(out, indent + 2);
+      out.write("if (context != null)");
+      writeLeftCurlyBracket(out, indent + 2);
+      writeIndent(out, indent + 3);
+      out.write("try");
+      writeLeftCurlyBracket(out, indent + 3);
+      writeIndent(out, indent + 4);
+      out.write("context.close();");
+      writeRightCurlyBracket(out, indent + 3);
+      writeIndent(out, indent + 3);
+      out.write("catch (NamingException ne)");
+      writeLeftCurlyBracket(out, indent + 3);
+      writeIndent(out, indent + 4);
+      out.write("// Ignore");
+      writeRightCurlyBracket(out, indent + 3);
+      writeRightCurlyBracket(out, indent + 2);
+      writeRightCurlyBracket(out, indent + 1);
+      writeRightCurlyBracket(out, indent);
+   }
+}

Modified: projects/jboss-jca/trunk/codegenerator/src/main/resources/build.xml.template
===================================================================
--- projects/jboss-jca/trunk/codegenerator/src/main/resources/build.xml.template	2010-06-13 04:56:18 UTC (rev 106014)
+++ projects/jboss-jca/trunk/codegenerator/src/main/resources/build.xml.template	2010-06-13 10:41:21 UTC (rev 106015)
@@ -7,11 +7,35 @@
   <property name="target.dir" value="${basedir}/target" />
   <property name="lib.dir" value="${basedir}/lib" />
 
+  <property name="javac.debug" value="on" />
+  <property name="javac.deprecation" value="on" />
+  <property name="javac.optimize" value="off" />
+
+  <property name="junit.printsummary" value="yes" />
+  <property name="junit.haltonerror" value="no" />
+  <property name="junit.haltonfailure" value="no" />
+  <property name="junit.fork" value="yes" />
+  <property name="junit.timeout" value="60000" />
+  <property name="junit.jvm" value="" />
+  <property name="junit.jvm.options" value="-Xms128m -Xmx512m -XX:MaxPermSize=256m" />
+  <property name="junit.batchtest.haltonerror" value="no" />
+  <property name="junit.batchtest.haltonfailure" value="no" />
+  <property name="junit.batchtest.fork" value="yes" />
+  
   <path id="lib.path.id">
     <fileset dir="${lib.dir}">
       <include name="**/*.jar"/>
     </fileset>
   </path>
+    
+  <path id="test.lib.path.id">
+    <fileset dir="${lib.dir}">
+      <include name="**/*.jar"/>
+    </fileset>
+    <fileset dir="${build.dir}">
+      <include name="**/*.jar"/>
+    </fileset>
+  </path>
   
   <!-- ================================= 
        Target: compile
@@ -40,7 +64,74 @@
     </jar>
   </target>
   
+      
   <!-- ================================= 
+       Target: prepare-test
+       ================================= -->
+  <target name="prepare-test">
+    <mkdir dir="${build.dir}/test" />
+
+    <javac srcdir="src/test"
+           destdir="${build.dir}/test"
+           classpathref="test.lib.path.id"
+           debug="${javac.debug}"
+           deprecation="${javac.deprecation}"
+           optimize="${javac.optimize}">
+      <compilerarg value="-Xlint"/>
+    </javac> 
+
+    <copy todir="${build.dir}/test">
+      <fileset dir="src/main/resources"/>
+      <fileset dir="src/test/resources"/>
+    </copy>
+  </target>
+
+  <!-- ================================= 
+       Target: test
+       ================================= -->
+  <target name="test" depends="rar, prepare-test">
+    <mkdir dir="${basedir}/reports"/>
+
+    <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="${target.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="${build.dir}/test"/>
+      <sysproperty key="xb.builder.useUnorderedSequence" value="true"/>
+      <sysproperty key="javax.xml.stream.XMLInputFactory" value="com.sun.xml.internal.stream.XMLInputFactoryImpl"/>
+      
+      <classpath>
+        <fileset dir="${lib.dir}" includes="*.jar" />
+        <fileset dir="${build.dir}" includes="*.jar" />
+        <pathelement location="${build.dir}/test"/>
+      </classpath>
+      
+      <formatter type="plain"/>
+      <formatter type="xml"/>
+      
+      <batchtest todir="${basedir}/reports"
+                 haltonerror="${junit.batchtest.haltonerror}"
+                 haltonfailure="${junit.batchtest.haltonfailure}"
+                 fork="${junit.batchtest.fork}">
+        
+        <fileset dir="${build.dir}/test">
+          <include name="**/*TestCase.class"/>
+        </fileset>
+      </batchtest>
+
+    </junit>
+    
+  </target>
+  
+  <!-- ================================= 
        Target: docs
        ================================= -->
   <target name="docs" depends="compile">

Added: projects/jboss-jca/trunk/codegenerator/src/main/resources/jca.xml.template
===================================================================
--- projects/jboss-jca/trunk/codegenerator/src/main/resources/jca.xml.template	                        (rev 0)
+++ projects/jboss-jca/trunk/codegenerator/src/main/resources/jca.xml.template	2010-06-13 10:41:21 UTC (rev 106015)
@@ -0,0 +1,87 @@
+<deployment>
+
+  <!-- Bean Validation -->
+  <bean name="BeanValidation" class="org.jboss.jca.core.bv.BeanValidation">
+    <depends>NamingServer</depends>
+  </bean>
+
+  <!-- Thread group -->
+  <bean name="ThreadGroup"
+        class="java.lang.ThreadGroup">
+    <constructor>
+      <parameter>workmanager</parameter>
+    </constructor>
+    <ignoreStop/>
+    <ignoreDestroy/>
+  </bean>
+
+  <!-- Thread factory -->
+  <bean name="ThreadFactory"
+        interface="java.util.concurrent.ThreadFactory"
+        class="org.jboss.threads.JBossThreadFactory">
+    <constructor>
+      <parameter><inject bean="ThreadGroup"/></parameter>
+      <parameter>false</parameter>
+      <parameter>5</parameter>
+      <parameter>work</parameter>
+      <parameter><null/></parameter>
+      <parameter><null/></parameter>
+    </constructor>
+  </bean>
+
+  <!-- Short running thread pool -->
+  <bean name="ShortRunningThreadPool">
+    <constructor factoryMethod="threadFactoryExecutor" 
+                 factoryClass="org.jboss.threads.JBossExecutors">
+      <parameter><inject bean="ThreadFactory"/></parameter>
+    </constructor>
+  </bean>
+
+  <!-- Long running thread pool -->
+  <bean name="LongRunningThreadPool">
+    <constructor factoryMethod="threadFactoryExecutor" 
+                 factoryClass="org.jboss.threads.JBossExecutors">
+      <parameter><inject bean="ThreadFactory"/></parameter>
+    </constructor>
+  </bean>
+
+  <!-- Work Manager -->
+  <bean name="WorkManager" interface="org.jboss.jca.core.api.WorkManager" class="org.jboss.jca.core.workmanager.WorkManagerImpl">
+    <!-- The short running thread pool -->
+    <property name="ShortRunningThreadPool"><inject bean="ShortRunningThreadPool"/></property>
+
+    <!-- The long running thread pool -->
+    <property name="LongRunningThreadPool"><inject bean="LongRunningThreadPool"/></property>
+
+    <!-- The XA terminator -->
+    <property name="XATerminator"><inject bean="TransactionManager" property="XATerminator"/></property>
+  </bean>
+  
+  <!-- Default Bootstrap context -->
+  <bean name="DefaultBootstrapContext" 
+        interface="org.jboss.jca.core.api.CloneableBootstrapContext"
+        class="org.jboss.jca.core.bootstrapcontext.BaseCloneableBootstrapContext">
+
+    <!-- The Transaction Synchronization Registry -->
+    <property name="TransactionSynchronizationRegistry"><inject bean="TransactionSynchronizationRegistry"/></property>
+
+    <!-- The Work Manager -->
+    <property name="WorkManager"><inject bean="WorkManager"/></property>
+
+    <!-- The XA terminator -->
+    <property name="XATerminator"><inject bean="TransactionManager" property="XATerminator"/></property>
+  </bean>
+
+  <!-- RA deployer -->
+  <bean name="RADeployer" interface="com.github.fungal.spi.deployers.Deployer" class="org.jboss.jca.deployers.fungal.RADeployer">
+    <property name="ArchiveValidation">true</property>
+    <property name="ArchiveValidationFailOnWarn">false</property>
+    <property name="ArchiveValidationFailOnError">true</property>
+    <property name="BeanValidation">true</property>
+    <property name="PrintStream"><inject bean="JBossStdioContext" property="Out"/></property>
+    <property name="DefaultBootstrapContext"><inject bean="DefaultBootstrapContext"/></property>
+    <depends>BeanValidation</depends>
+    <depends>JBossStdioContextSelector</depends>
+  </bean>
+
+</deployment>

Added: projects/jboss-jca/trunk/codegenerator/src/main/resources/jndi.properties.template
===================================================================
--- projects/jboss-jca/trunk/codegenerator/src/main/resources/jndi.properties.template	                        (rev 0)
+++ projects/jboss-jca/trunk/codegenerator/src/main/resources/jndi.properties.template	2010-06-13 10:41:21 UTC (rev 106015)
@@ -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/codegenerator/src/main/resources/logging.properties.template
===================================================================
--- projects/jboss-jca/trunk/codegenerator/src/main/resources/logging.properties.template	                        (rev 0)
+++ projects/jboss-jca/trunk/codegenerator/src/main/resources/logging.properties.template	2010-06-13 10:41:21 UTC (rev 106015)
@@ -0,0 +1,39 @@
+
+# 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/codegenerator/src/main/resources/naming.xml.template
===================================================================
--- projects/jboss-jca/trunk/codegenerator/src/main/resources/naming.xml.template	                        (rev 0)
+++ projects/jboss-jca/trunk/codegenerator/src/main/resources/naming.xml.template	2010-06-13 10:41:21 UTC (rev 106015)
@@ -0,0 +1,49 @@
+<deployment>
+
+  <!-- Naming -->
+  <bean name="LookupPool">
+    <constructor factoryMethod="newFixedThreadPool"
+                 factoryClass="java.util.concurrent.Executors">
+      <parameter>2</parameter>
+    </constructor>
+  </bean>
+
+  <bean name="NamingBeanImpl" class="org.jnp.server.NamingBeanImpl">
+    <!-- Install this bean as the global JVM NamingServer -->
+    <property name="installGlobalService">true</property>
+    
+    <property name="useGlobalService">false</property>
+  </bean>
+
+  <bean name="NamingServer" class="org.jnp.server.Main">
+    <property name="namingInfo"><inject bean="NamingBeanImpl"/></property>
+
+    <!-- The call by value mode. true if all lookups are unmarshalled using
+         the caller's TCL, false if in VM lookups return the value by reference.
+      -->
+    <property name="callByValue">false</property>
+    
+    <!-- The listening port for the bootstrap JNP service. Set this to -1
+         to run the NamingService without the JNP invoker listening port.
+      -->
+    <property name="port">1099</property>
+    
+    <!-- The bootstrap JNP server bind address. This also sets the default
+         RMI service bind address. Empty == all addresses
+      -->
+    <property name="bindAddress">${jboss.jca.bindaddress:localhost}</property>
+
+    <!-- The port of the RMI naming service, 0 == anonymous -->
+    <property name="rmiPort">0</property>
+
+    <!-- The RMI service bind address. Empty == all addresses -->
+    <property name="rmiBindAddress">${jboss.jca.bindaddress:localhost}</property>
+
+    <!-- Set the java.rmi.server.hostname system property to rmiBindAddress -->
+    <property name="enableRmiServerHostname">true</property>
+
+    <!-- The thread pool service used to control the bootstrap lookups -->
+    <property name="lookupExector"><inject bean="LookupPool"/></property>
+  </bean>
+
+</deployment>

Added: projects/jboss-jca/trunk/codegenerator/src/main/resources/stdio.xml.template
===================================================================
--- projects/jboss-jca/trunk/codegenerator/src/main/resources/stdio.xml.template	                        (rev 0)
+++ projects/jboss-jca/trunk/codegenerator/src/main/resources/stdio.xml.template	2010-06-13 10:41:21 UTC (rev 106015)
@@ -0,0 +1,46 @@
+<deployment>
+
+  <bean name="JBossStdioSystemOutStream" class="org.jboss.stdio.LoggingOutputStream">
+    <constructor>
+      <parameter>STDOUT</parameter>
+      <parameter>INFO</parameter>
+    </constructor>
+  </bean>
+
+  <bean name="JBossStdioSystemErrStream" class="org.jboss.stdio.LoggingOutputStream">
+    <constructor>
+      <parameter>STDERR</parameter>
+      <parameter>ERROR</parameter>
+    </constructor>
+  </bean>
+
+  <bean name="JBossStdioSystemInStream" class="org.jboss.stdio.NullInputStream">
+    <constructor factoryMethod="getInstance"/>
+  </bean>
+
+  <bean name="JBossStdioContext" class="org.jboss.stdio.StdioContext">
+    <constructor factoryMethod="create">
+      <parameter>
+        <inject bean="JBossStdioSystemInStream"/>
+      </parameter>
+      <parameter class="java.io.OutputStream">
+        <inject bean="JBossStdioSystemOutStream"/>
+      </parameter>
+      <parameter>
+        <inject bean="JBossStdioSystemErrStream"/>
+      </parameter>
+    </constructor>
+  </bean>
+
+  <bean name="JBossStdioService" class="org.jboss.stdio.StdioService">
+    <depends>JBossStdioContext</depends>
+  </bean>
+
+  <bean name="JBossStdioContextSelector" class="org.jboss.stdio.SimpleStdioContextSelector">
+    <constructor>
+      <parameter><inject bean="JBossStdioContext"/></parameter>
+    </constructor>
+    <install method="install"/>
+  </bean>
+
+</deployment>

Added: projects/jboss-jca/trunk/codegenerator/src/main/resources/transaction.xml.template
===================================================================
--- projects/jboss-jca/trunk/codegenerator/src/main/resources/transaction.xml.template	                        (rev 0)
+++ projects/jboss-jca/trunk/codegenerator/src/main/resources/transaction.xml.template	2010-06-13 10:41:21 UTC (rev 106015)
@@ -0,0 +1,187 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<deployment>
+
+  <bean name="LoggingEnvironmentBean" class="com.arjuna.common.internal.util.logging.LoggingEnvironmentBean">
+    <constructor factoryClass="com.arjuna.common.internal.util.logging.commonPropertyManager" factoryMethod="getLoggingEnvironmentBean"/>        
+    <property name="loggingFactory">com.arjuna.common.internal.util.logging.jakarta.JakartaRelevelingLogFactory;com.arjuna.common.internal.util.logging.jakarta.Log4JLogger</property>
+  </bean>
+
+  <bean name="RecoveryEnvironmentBean" class="com.arjuna.ats.arjuna.common.RecoveryEnvironmentBean">
+    <constructor factoryClass="com.arjuna.ats.arjuna.common.recoveryPropertyManager" factoryMethod="getRecoveryEnvironmentBean"/>
+    <property name="recoveryInetAddress">localhost</property>
+    <property name="recoveryPort">4712</property>
+    <property name="transactionStatusManagerInetAddress">localhost</property>
+    <property name="transactionStatusManagerPort">4713</property>
+    <property name="recoveryExtensions">
+      <list elementClass="java.lang.String">
+        <value>com.arjuna.ats.internal.arjuna.recovery.AtomicActionRecoveryModule</value>
+        <value>com.arjuna.ats.internal.txoj.recovery.TORecoveryModule</value>
+        <value>com.arjuna.ats.internal.jta.recovery.arjunacore.XARecoveryModule</value>
+      </list>
+    </property>
+    <property name="expiryScanners">
+      <list elementClass="java.lang.String">
+        <value>com.arjuna.ats.internal.arjuna.recovery.ExpiredTransactionStatusManagerScanner</value>
+      </list>
+    </property>
+    <property name="recoveryActivators">
+      <null/>
+    </property>
+  </bean>
+
+  <bean name="CoreEnvironmentBean" class="com.arjuna.ats.arjuna.common.CoreEnvironmentBean">
+    <constructor factoryClass="com.arjuna.ats.arjuna.common.arjPropertyManager" factoryMethod="getCoreEnvironmentBean"/>
+    <property name="socketProcessIdPort">0</property>
+    <property name="nodeIdentifier">1</property>
+    <property name="socketProcessIdMaxPorts">10</property>
+  </bean>
+
+  <bean name="CoordinatorEnvironmentBean" class="com.arjuna.ats.arjuna.common.CoordinatorEnvironmentBean">
+    <constructor factoryClass="com.arjuna.ats.arjuna.common.arjPropertyManager" factoryMethod="getCoordinatorEnvironmentBean"/>
+    <property name="enableStatistics">false</property>
+    <property name="defaultTimeout">300</property>
+  </bean>
+
+  <bean name="ObjectStoreEnvironmentBean" class="com.arjuna.ats.arjuna.common.ObjectStoreEnvironmentBean">
+    <constructor factoryClass="com.arjuna.ats.arjuna.common.arjPropertyManager" factoryMethod="getObjectStoreEnvironmentBean"/>
+    <property name="objectStoreDir">${jboss.jca.home}/tmp/tx-object-store</property>
+  </bean>
+
+  <bean name="ObjectStoreBrowserBean" class="com.arjuna.ats.arjuna.tools.osb.mbean.ObjStoreBean">
+    <constructor factoryClass="com.arjuna.ats.arjuna.tools.osb.mbean.ObjStoreBean" factoryMethod="getObjectStoreBrowserBean"/>
+    <depends>ObjectStoreEnvironmentBean</depends>
+  </bean>
+
+  <bean name="JTAEnvironmentBean" class="com.arjuna.ats.jta.common.JTAEnvironmentBean">
+    <constructor factoryClass="com.arjuna.ats.jta.common.jtaPropertyManager" factoryMethod="getJTAEnvironmentBean"/>
+    <property name="lastResourceOptimisationInterface">org.jboss.tm.LastResource</property>
+    <property name="transactionManagerClassName">com.arjuna.ats.jbossatx.jta.TransactionManagerDelegate</property>
+    <property name="userTransactionClassName">com.arjuna.ats.internal.jta.transaction.arjunacore.UserTransactionImple</property>
+    <property name="transactionSynchronizationRegistryClassName">com.arjuna.ats.internal.jta.transaction.arjunacore.TransactionSynchronizationRegistryImple</property>
+    <property name="xaRecoveryNodes">
+      <list elementClass="java.lang.String">
+        <value>1</value>
+      </list>
+    </property>
+    <property name="xaResourceOrphanFilterClassNames">
+      <list elementClass="java.lang.String">
+        <value>com.arjuna.ats.internal.jta.recovery.arjunacore.JTATransactionLogXAResourceOrphanFilter</value>
+        <value>com.arjuna.ats.internal.jta.recovery.arjunacore.JTANodeNameXAResourceOrphanFilter</value>
+      </list>
+    </property>
+  </bean>
+
+  <bean name="RecoveryManager" class="com.arjuna.ats.jbossatx.jta.RecoveryManagerService">
+    <depends>LoggingEnvironmentBean</depends>
+    <depends>RecoveryEnvironmentBean</depends>
+  </bean>
+
+  <bean name="XATerminator" class="com.arjuna.ats.internal.jbossatx.jta.jca.XATerminator"/>
+
+  <bean name="TransactionSynchronizationRegistry" class="com.arjuna.ats.internal.jta.transaction.arjunacore.TransactionSynchronizationRegistryImple"/>
+
+  <bean name="TransactionManager" class="com.arjuna.ats.jbossatx.jta.TransactionManagerService">
+    <property name="jbossXATerminator"><inject bean="XATerminator"/></property>
+    <property name="transactionSynchronizationRegistry"><inject bean="TransactionSynchronizationRegistry"/></property>
+    <depends>LoggingEnvironmentBean</depends>
+    <depends>RecoveryEnvironmentBean</depends>
+    <depends>CoreEnvironmentBean</depends>
+    <depends>CoordinatorEnvironmentBean</depends>
+    <depends>ObjectStoreEnvironmentBean</depends>
+    <depends>JTAEnvironmentBean</depends>
+    <depends>RecoveryManager</depends>
+    <depends>TransactionManagerJNDIBinding</depends>
+    <depends>TransactionSynchronizationRegistryJNDIBinding</depends>
+    <depends>TransactionPropagationContextImporterJNDIBinding</depends>
+    <depends>TransactionPropagationContextExporterJNDIBinding</depends>
+  </bean>
+
+  <bean name="TransactionStatistics" class="com.arjuna.ats.arjuna.coordinator.TxStats">
+    <constructor factoryClass="com.arjuna.ats.arjuna.coordinator.TxStats" factoryMethod="getInstance"/>
+  </bean>
+
+  <bean name="TransactionManagerJNDIBinding" class="com.arjuna.ats.jta.utils.JNDIReferenceBindingBean">
+    <property name="bindName">java:/TransactionManager</property>
+    <property name="className">
+      <inject bean="JTAEnvironmentBean" property="transactionManagerClassName"/>
+    </property>
+    <property name="factory">
+      <inject bean="JTAEnvironmentBean" property="transactionManagerClassName"/>
+    </property>
+
+    <install method="bind"/>
+    <uninstall method="unbind"/>
+
+    <depends>NamingServer</depends>
+  </bean>
+
+  <bean name="TransactionSynchronizationRegistryJNDIBinding" class="com.arjuna.ats.jta.utils.JNDIReferenceBindingBean">
+    <property name="bindName">java:/TransactionSynchronizationRegistry</property>
+    <property name="className">
+      <inject bean="JTAEnvironmentBean" property="transactionSynchronizationRegistryClassName"/>
+    </property>
+    <property name="factory">
+      <inject bean="JTAEnvironmentBean" property="transactionSynchronizationRegistryClassName"/>
+    </property>
+
+    <install method="bind"/>
+    <uninstall method="unbind"/>
+
+    <depends>NamingServer</depends>
+  </bean>
+
+  <bean name="TransactionPropagationContextImporterJNDIBinding" class="com.arjuna.ats.jta.utils.JNDIReferenceBindingBean">
+    <property name="bindName">java:/TransactionPropagationContextImporter</property>
+    <property name="className">com.arjuna.ats.internal.jbossatx.jta.PropagationContextManager</property>
+    <property name="factory">com.arjuna.ats.internal.jbossatx.jta.PropagationContextManager</property>
+
+    <install method="bind"/>
+    <uninstall method="unbind"/>
+
+    <depends>NamingServer</depends>
+  </bean>
+
+  <bean name="TransactionPropagationContextExporterJNDIBinding" class="com.arjuna.ats.jta.utils.JNDIReferenceBindingBean">
+    <property name="bindName">java:/TransactionPropagationContextExporter</property>
+    <property name="className">com.arjuna.ats.internal.jbossatx.jta.PropagationContextManager</property>
+    <property name="factory">com.arjuna.ats.internal.jbossatx.jta.PropagationContextManager</property>
+
+    <install method="bind"/>
+    <uninstall method="unbind"/>
+
+    <depends>NamingServer</depends>
+  </bean>
+
+  <!-- Ensure TransactionPropagationContextUtil's ref to TransactionPropagationContextFactory is set. See JBAS-7784. -->
+  <bean name="TransactionPropagationContextFactory" class="org.jboss.tm.TransactionPropagationContextFactory">
+    <constructor factoryClass="org.jboss.tm.TransactionPropagationContextUtil" factoryMethod="getTPCFactory"/>
+    <!--  The factory method looks up the JNDI binding, so we depend on it -->
+    <depends>TransactionPropagationContextExporterJNDIBinding</depends>
+  </bean>
+
+  <!-- Make javax.transaction.TransactionManager available for injection -->
+  <bean name="RealTransactionManager">
+    <constructor factoryMethod="getTransactionManager">
+      <factory bean="TransactionManager"/>
+    </constructor>
+  </bean>
+
+  <!-- Handles user transaction providers and listeners -->
+  <bean name="UserTransactionRegistry" class="org.jboss.tm.usertx.UserTransactionRegistry">
+    <!-- Register providers -->
+    <incallback method="addProvider"/>
+    <uncallback method="removeProvider"/>
+
+    <!-- Register listeners -->
+    <incallback method="addListener"/>
+    <uncallback method="removeListener"/>
+  </bean>
+  
+  <!-- The provider for default in process UserTransactions -->
+  <bean name="DefaultUserTransactionprovider" class="org.jboss.tm.usertx.client.ServerVMClientUserTransaction">
+    <constructor factoryClass="org.jboss.tm.usertx.client.ServerVMClientUserTransaction" factoryMethod="getSingleton"/>
+    <depends>TransactionManager</depends>
+  </bean>
+  
+</deployment>



More information about the jboss-cvs-commits mailing list