[jboss-svn-commits] JBL Code SVN: r5638 - in labs/jbossesb/trunk/product: . core core/common/tests core/listeners/tests core/services/src/META-INF core/services/src/org/jboss/soa/esb/internal/core/objectstore core/services/tests

jboss-svn-commits at lists.jboss.org jboss-svn-commits at lists.jboss.org
Wed Aug 9 10:53:12 EDT 2006


Author: tfennelly
Date: 2006-08-09 10:53:04 -0400 (Wed, 09 Aug 2006)
New Revision: 5638

Modified:
   labs/jbossesb/trunk/product/build.xml
   labs/jbossesb/trunk/product/core/build.xml
   labs/jbossesb/trunk/product/core/common/tests/build.xml
   labs/jbossesb/trunk/product/core/listeners/tests/build.xml
   labs/jbossesb/trunk/product/core/services/src/META-INF/application.xml
   labs/jbossesb/trunk/product/core/services/src/org/jboss/soa/esb/internal/core/objectstore/DaoUidTable.java
   labs/jbossesb/trunk/product/core/services/tests/build.xml
Log:
Added "instrumented" version of the ear build.  This allows us to get coverage figures out of the likes of the Trailblazer and other QA tests.

Modified: labs/jbossesb/trunk/product/build.xml
===================================================================
--- labs/jbossesb/trunk/product/build.xml	2006-08-09 14:14:32 UTC (rev 5637)
+++ labs/jbossesb/trunk/product/build.xml	2006-08-09 14:53:04 UTC (rev 5638)
@@ -237,6 +237,10 @@
 			</copy>
 	</target>
 
+    <target name="earinstr" depends="purge,test">
+		<ant dir="core" target="earinstr"/>
+    </target>
+	
 	<!-- Clean targets -->
 	<target name="org.jboss.esb.clean">
 		<echo message="Cleaning modules"/>

Modified: labs/jbossesb/trunk/product/core/build.xml
===================================================================
--- labs/jbossesb/trunk/product/core/build.xml	2006-08-09 14:14:32 UTC (rev 5637)
+++ labs/jbossesb/trunk/product/core/build.xml	2006-08-09 14:53:04 UTC (rev 5638)
@@ -66,15 +66,20 @@
 
     <target name="-ear">
         <ear    destfile="${org.jboss.esb.internal.dest}/dist/lib/jbossesb-appl.ear"
-		appxml="services/src/META-INF/application.xml"
-        >
-	    <fileset dir="${org.jboss.esb.internal.dest}/dist/lib"
-	    	includes="*.jar"
-		/>
-	</ear>
+			appxml="services/src/META-INF/application.xml">
+		    <fileset dir="${org.jboss.esb.internal.dest}/dist/lib"
+		    	includes="*.jar"
+			/>
+		</ear>
+    </target>
 
+    <target name="earinstr">
+   		<echo message="Building Instrumented App"/>
+        <ear destfile="${org.jboss.esb.internal.dest}/dist/lib/jbossesb-appl.ear" appxml="services/src/META-INF/application.xml">
+		    <fileset dir="${org.jboss.esb.internal.dest}/tests/coverage" includes="*.jar"/>
+        </ear>
     </target>
-
+	
     <!-- =================================================================== -->
     <!-- Clean  all                                                          -->
     <!-- =================================================================== -->

Modified: labs/jbossesb/trunk/product/core/common/tests/build.xml
===================================================================
--- labs/jbossesb/trunk/product/core/common/tests/build.xml	2006-08-09 14:14:32 UTC (rev 5637)
+++ labs/jbossesb/trunk/product/core/common/tests/build.xml	2006-08-09 14:53:04 UTC (rev 5638)
@@ -8,6 +8,8 @@
     <property name="org.jboss.esb.tests.classes.dir" value="${org.jboss.esb.internal.dest}/tests"/>
     <property name="org.jboss.esb.tests.report.dir" value="${org.jboss.esb.internal.dest}/tests/junit"/>
     <property name="org.jboss.esb.root.dir" value="../.."/>
+    <property name="org.jboss.esb.module.tests.coverage.dir" value="${org.jboss.esb.internal.dest}/tests/coverage/common"/>
+    <property name="org.jboss.esb.module.classes.instr.dir" value="${org.jboss.esb.module.tests.coverage.dir}/instr" />
     <property environment="env"/>
 	<property name="org.jboss.esb.ejb3_embedded.lib.dir" value="${org.jboss.esb.root.dir}/../lib/ejb3_embedded"/>
     <property name="org.jboss.esb.ext.lib.dir" value="${org.jboss.esb.root.dir}/lib/ext"/>
@@ -65,13 +67,9 @@
     <!--                             T E S T                                    -->
     <!-- ====================================================================== -->
     <target name="org.jboss.esb.common.internal.test">
-    	
-	    <property name="org.jboss.esb.module.tests.coverage.dir" value="${org.jboss.esb.internal.dest}/tests/coverage/common"/>
-        <property name="org.jboss.esb.module.classes.instr.dir" value="${org.jboss.esb.module.tests.coverage.dir}/instr" />
-
 		<!-- Instrument the code for code coverage - using emma... -->
     	<delete dir="${org.jboss.esb.module.tests.coverage.dir}" />
-	    <mkdir dir="${org.jboss.esb.module.tests.coverage.dir}" />
+	    <mkdir dir="${org.jboss.esb.module.classes.instr.dir}" />
 	    <emma>
 			<instr 	instrpath="${org.jboss.esb.module.classes.dir}" 
 					destdir="${org.jboss.esb.module.classes.instr.dir}" 
@@ -90,6 +88,12 @@
 		        <html outfile="${org.jboss.esb.module.tests.coverage.dir}/index.html" depth="method" columns="name,line,class,method,block"/>
 			</report>
 	    </emma>
+
+    	<!-- Jar up the instrumented code = plus the uninstrumented interfaces etc from the uninstrumented binaries. -->
+        <jar destfile="${org.jboss.esb.internal.dest}/tests/coverage/${org.jboss.esb.common.jar.name}.jar">
+        	<fileset dir="${org.jboss.esb.module.classes.dir}" />
+        	<fileset dir="${org.jboss.esb.module.classes.instr.dir}" />
+        </jar>
     </target>
 
     <!-- ====================================================================== -->

Modified: labs/jbossesb/trunk/product/core/listeners/tests/build.xml
===================================================================
--- labs/jbossesb/trunk/product/core/listeners/tests/build.xml	2006-08-09 14:14:32 UTC (rev 5637)
+++ labs/jbossesb/trunk/product/core/listeners/tests/build.xml	2006-08-09 14:53:04 UTC (rev 5638)
@@ -78,6 +78,12 @@
 		        <html outfile="${org.jboss.esb.module.tests.coverage.dir}/index.html" depth="method" columns="name,line,class,method,block"/>
 			</report>
 	    </emma>
+
+    	<!-- Jar up the instrumented code = plus the uninstrumented interfaces etc from the uninstrumented binaries. -->
+        <jar destfile="${org.jboss.esb.internal.dest}/tests/coverage/${org.jboss.esb.listeners.jar.name}.jar">
+        	<fileset dir="${org.jboss.esb.module.classes.dir}" />
+        	<fileset dir="${org.jboss.esb.module.classes.instr.dir}" />
+        </jar>
     </target>
 
     <!-- ====================================================================== -->

Modified: labs/jbossesb/trunk/product/core/services/src/META-INF/application.xml
===================================================================
--- labs/jbossesb/trunk/product/core/services/src/META-INF/application.xml	2006-08-09 14:14:32 UTC (rev 5637)
+++ labs/jbossesb/trunk/product/core/services/src/META-INF/application.xml	2006-08-09 14:53:04 UTC (rev 5638)
@@ -12,9 +12,6 @@
 		<java>jbossesb-listeners.jar</java>
 	</module>
 	<module>
-		<java>jbossesb-processors.jar</java>
-	</module>
-	<module>
 		<java>jbossesb-common.jar</java>
 	</module>
 </application>
\ No newline at end of file

Modified: labs/jbossesb/trunk/product/core/services/src/org/jboss/soa/esb/internal/core/objectstore/DaoUidTable.java
===================================================================
--- labs/jbossesb/trunk/product/core/services/src/org/jboss/soa/esb/internal/core/objectstore/DaoUidTable.java	2006-08-09 14:14:32 UTC (rev 5637)
+++ labs/jbossesb/trunk/product/core/services/src/org/jboss/soa/esb/internal/core/objectstore/DaoUidTable.java	2006-08-09 14:53:04 UTC (rev 5638)
@@ -1,26 +1,25 @@
 /*
-* JBoss, Home of Professional Open Source
-* Copyright 2006, JBoss Inc., and individual contributors as indicated
-* by the @authors tag. See the copyright.txt 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.
-*/
+ * JBoss, Home of Professional Open Source
+ * Copyright 2006, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt 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.soa.esb.internal.core.objectstore;
 
 import org.apache.log4j.Logger;
@@ -32,205 +31,244 @@
 import java.sql.ResultSet;
 
 /**
- * Data access object for the SQL table that the Object Store
- * uses to assign Unique Identifiers (UID) to any object in the framework
+ * Data access object for the SQL table that the Object Store uses to assign
+ * Unique Identifiers (UID) to any object in the framework
+ * 
  * @see IpersistHandler#getUidChunk(int)
  */
-public class DaoUidTable extends SqlDbTable
-{
-  /**
-   * Key value for the row in the UID table that holds UIDs for BusinessObjects
-   * "jbossEsb_objuid"
-   */
-  public static final String SEQUENCE_OBJ   = "jbossEsb_objuid";
-  /**
-   * Key value for the row in the UID table that holds UIDs for BatchProcess
-   * "jbossEsb_batchuid"
-   */
-  public static final String SEQUENCE_BATCH = "jbossEsb_batchuid";
+public class DaoUidTable extends SqlDbTable {
+	/**
+	 * Key value for the row in the UID table that holds UIDs for
+	 * BusinessObjects "jbossEsb_objuid"
+	 */
+	public static final String SEQUENCE_OBJ = "jbossEsb_objuid";
 
-  private Logger         m_oLogger;
+	/**
+	 * Key value for the row in the UID table that holds UIDs for BatchProcess
+	 * "jbossEsb_batchuid"
+	 */
+	public static final String SEQUENCE_BATCH = "jbossEsb_batchuid";
 
-  private DaoUidTable() throws Exception {this(null,null); }
-  /**
-   * Instantiate a DaoUidTable object using the javax.sql.DataSource object
-   * within  &lt;arg 1&gt;, with table name held in &lt;arg 2&gt;
-   * @param p_oConn JdbcCleanConn - Connection to use for preparing and executing
-   * all SQL statements in this DAO
-   * @param p_sTblName String - SQL table name to use in the context of this
-   * DaoUidTable object
-   * @throws Exception - pass through from invoked methods - see Exception.getMessage()
-   * at runtime for details
-   * @see JdbcCleanConn
-   */
-  public DaoUidTable(JdbcCleanConn p_oConn,String p_sTblName) throws Exception
-  { super(p_oConn,p_sTblName);
-    m_oLogger  = Util.getDefaultLogger(this.getClass());
-    if (null != m_oaFields)
-    { m_oaFields[UID].setPrimaryKey(true);
-    }
-    m_oaPS = new PreparedStatement[PS_MAX];
-  } //________________________________
-  /**
-   * List of fields for select statement - provided only to avoid time
-   * consuming 'select *' statements
-   * @return String - a Comma separated list of fields
-   */
-  protected String getSelectFields()
-  { return "uid,sequence_name,last_used_uid";
-  } //________________________________
+	private Logger m_oLogger;
 
-  // -------------------------------------------------------------
-  // Column constants
-  // -------------------------------------------------------------
-  private static int s_iFld = 0;
-  /**
-   * Column index for field representing the UID of this table row
-   */
-  public static final int  UID           = s_iFld++;
-  /**
-   * Column index for field representing the sequence name of this row
-   * @see DoiUidTable#SEQUENCE_OBJ
-   * @see DoiUidTable#SEQUENCE_BATCH
-   */
-  public static final int  SEQ_NAME      = s_iFld++;
-  /**
-   * Column index for field representing the last used UID number for this
-   * particular sequence name
-   */
-  public static final int  LAST_USED_UID = s_iFld++;
+	private DaoUidTable() throws Exception {
+		this(null, null);
+	}
 
+	/**
+	 * Instantiate a DaoUidTable object using the javax.sql.DataSource object
+	 * within &lt;arg 1&gt;, with table name held in &lt;arg 2&gt;
+	 * 
+	 * @param p_oConn
+	 *            JdbcCleanConn - Connection to use for preparing and executing
+	 *            all SQL statements in this DAO
+	 * @param p_sTblName
+	 *            String - SQL table name to use in the context of this
+	 *            DaoUidTable object
+	 * @throws Exception -
+	 *             pass through from invoked methods - see
+	 *             Exception.getMessage() at runtime for details
+	 * @see JdbcCleanConn
+	 */
+	public DaoUidTable(JdbcCleanConn p_oConn, String p_sTblName)
+			throws Exception {
+		super(p_oConn, p_sTblName);
+		m_oLogger = Util.getDefaultLogger(this.getClass());
+		if (null != m_oaFields) {
+			m_oaFields[UID].setPrimaryKey(true);
+		}
+		m_oaPS = new PreparedStatement[PS_MAX];
+	} // ________________________________
 
-  /**
-   * This method is supplied to comply with the parent class but it should
-   * NEVER be used
-   * @param p_PS PreparedStatement
-   * @param p_o Object
-   * @throws Exception - This will ALWAYS throw an Exception - Inserts to
-   * this table class should be handled ONLY by the Rosetta Administrator
-   * @return int - It will never return a value
-   */
-  public int setInsValues(PreparedStatement p_PS,Object p_o)
-  throws Exception
-   { String sErr = "No Inserts to UID table";
-     m_oLogger.error(sErr);
-     throw new Exception (sErr);
-   } //________________________________
-   /**
-    * Provided for compatibility - Never used - Will always return null
-    * @param p_oRS ResultSet
-    * @throws Exception
-    * @return Object
-    */
-   public Object getFromRS(ResultSet p_oRS) throws Exception
-   { return null;
-   } //________________________________
+	/**
+	 * List of fields for select statement - provided only to avoid time
+	 * consuming 'select *' statements
+	 * 
+	 * @return String - a Comma separated list of fields
+	 */
+	protected String getSelectFields() {
+		return "uid,sequence_name,last_used_uid";
+	} // ________________________________
 
- /**
-  * Index of the 'select for update' statement in the list of PreparedStatement
-  * objects for this DAO
-  */
-  public static final int  PS_GET_SEQ_4_UPD    = 0;
-  /**
-   * Index of the 'update' statement in the list of PreparedStatement
-   * objects for this DAO
-   */
-  public static final int  PS_UPDATE_LAST_USED = 1;
+	// -------------------------------------------------------------
+	// Column constants
+	// -------------------------------------------------------------
+	private static int s_iFld = 0;
 
-  private static final int  PS_MAX          = 10;
+	/**
+	 * Column index for field representing the UID of this table row
+	 */
+	public static final int UID = s_iFld++;
 
-  /**
-   * Obtain a prepared statement for this DAO from the list of available PStmts
-   * <p>Uses lazy instantiation of requested objects</p>
-   * @param p_i int - Index of PreparedStatement object to obtain
-   * @throws Exception - If an invalid index is passed or there are problems
-   * during the prepareStatement() invocation
-   * @return PreparedStatement
-   */
-  public PreparedStatement getPS (int p_i) throws Exception
-  { try
-    { switch (p_i)
-      { case PS_GET_SEQ_4_UPD:    return getSeq4Upd(p_i);
-        case PS_UPDATE_LAST_USED: return updateLastUsed(p_i);
-      }
-      ;
-      throw new Exception("Invalid Index "+p_i);
-    }
-    catch (Exception e)
-    { m_oLogger.error("Request for Prepared Statement Failed",e);
-      throw e;
-    }
-  } //__________________________________
+	/**
+	 * Column index for field representing the sequence name of this row
+	 * 
+	 * @see DoiUidTable#SEQUENCE_OBJ
+	 * @see DoiUidTable#SEQUENCE_BATCH
+	 */
+	public static final int SEQ_NAME = s_iFld++;
 
-  private PreparedStatement getSeq4Upd(int p_i) throws Exception
-  { if (null == m_oaPS[p_i])
-    { StringBuffer sb = new StringBuffer(getSelectStatement())
-          .append(" where ").append(getFldName(SEQ_NAME))
-          .append(" = ? for update");
-      m_oaPS[p_i] = getConn().prepareStatement(sb.toString());
-    }
-    return m_oaPS[p_i];
-  } //__________________________________
+	/**
+	 * Column index for field representing the last used UID number for this
+	 * particular sequence name
+	 */
+	public static final int LAST_USED_UID = s_iFld++;
 
-  private PreparedStatement updateLastUsed(int p_i) throws Exception
-  { if (null == m_oaPS[p_i])
-    { StringBuffer sb = new StringBuffer("update ").append(m_sTableName)
-          .append(" set ").append(getFldName(LAST_USED_UID)).append(" = ?")
-          .append(" where ").append(getFldName(SEQ_NAME)).append(" = ?")
-      ;
-      m_oaPS[p_i] = getConn().prepareStatement(sb.toString());
-    }
-    return m_oaPS[p_i];
-  } //__________________________________
+	/**
+	 * This method is supplied to comply with the parent class but it should
+	 * NEVER be used
+	 * 
+	 * @param p_PS
+	 *            PreparedStatement
+	 * @param p_o
+	 *            Object
+	 * @throws Exception -
+	 *             This will ALWAYS throw an Exception - Inserts to this table
+	 *             class should be handled ONLY by the Rosetta Administrator
+	 * @return int - It will never return a value
+	 */
+	public int setInsValues(PreparedStatement p_PS, Object p_o)
+			throws Exception {
+		String sErr = "No Inserts to UID table";
+		m_oLogger.error(sErr);
+		throw new Exception(sErr);
+	} // ________________________________
 
-  /**
-   * This is an exception to the standard behaviour of derived classes that
-   * extend the SqlDbTable abstract class
-   * <p>This method is called by the PersistHandler and BatchHandler EJBs
-   * and makes their life easier when they need to obtain UID chunks</p>
-   * <p>These EJBs rely on this table to ensure no duplicate UIDs across all of
-   * Rosetta</p>
-   * <p>It could also be invoked from a different context, provided that the
-   * Rosetta Administrators have added a row with a unique sequence name to
-   * the underlying SQL table that holds the last used UIDs for all numbering
-   * sequences</p>
-   * @param p_sSeqName String - Key to the sequence name to get the chunk from
-   * @param p_iQuids int - Number of UIDs to return
-   * @throws Exception
-   * @return long - First UID in the chunk assigned by this method
-   */
-  public long getUidChunk(String p_sSeqName, int p_iQuids) throws Exception
-  {
-    try
-    { PreparedStatement PS = getPS(DaoUidTable.PS_GET_SEQ_4_UPD);
-      PS.setString(1,p_sSeqName);
-      ResultSet rs = getConn().execQueryWait(PS,30);
+	/**
+	 * Provided for compatibility - Never used - Will always return null
+	 * 
+	 * @param p_oRS
+	 *            ResultSet
+	 * @throws Exception
+	 * @return Object
+	 */
+	public Object getFromRS(ResultSet p_oRS) throws Exception {
+		return null;
+	} // ________________________________
 
-      boolean bOK=false;
-      try 
-      { if (rs.next())
-    	  bOK = true; 
-      }
-      catch (Exception e1) { getConn().rollback(); }
-      if (! bOK)  throw new Exception("Select FAILED jbossEsb.getChunk()");
+	/**
+	 * Index of the 'select for update' statement in the list of
+	 * PreparedStatement objects for this DAO
+	 */
+	public static final int PS_GET_SEQ_4_UPD = 0;
 
-      int iSqlFld = 1+DaoUidTable.LAST_USED_UID;
-      long lUid = rs.getLong(iSqlFld);
-      if (lUid < 1) lUid  = 1;
-      long lNewLast = lUid + p_iQuids;
+	/**
+	 * Index of the 'update' statement in the list of PreparedStatement objects
+	 * for this DAO
+	 */
+	public static final int PS_UPDATE_LAST_USED = 1;
 
-      PS = getPS(DaoUidTable.PS_UPDATE_LAST_USED);
-      PS.setLong  (1,lNewLast);
-      PS.setString(2,p_sSeqName);
-      getConn().execUpdWait(PS,10);
+	private static final int PS_MAX = 10;
 
-      getConn().commit();
+	/**
+	 * Obtain a prepared statement for this DAO from the list of available
+	 * PStmts
+	 * <p>
+	 * Uses lazy instantiation of requested objects
+	 * </p>
+	 * 
+	 * @param p_i
+	 *            int - Index of PreparedStatement object to obtain
+	 * @throws Exception -
+	 *             If an invalid index is passed or there are problems during
+	 *             the prepareStatement() invocation
+	 * @return PreparedStatement
+	 */
+	public PreparedStatement getPS(int p_i) throws Exception {
+		try {
+			switch (p_i) {
+			case PS_GET_SEQ_4_UPD:
+				return getSeq4Upd(p_i);
+			case PS_UPDATE_LAST_USED:
+				return updateLastUsed(p_i);
+			}
+			;
+			throw new Exception("Invalid Index " + p_i);
+		} catch (Exception e) {
+			m_oLogger.error("Request for Prepared Statement Failed", e);
+			throw e;
+		}
+	} // __________________________________
 
-      return lUid;
-    }
-    catch (Exception e)
-    { m_oLogger.error(e.getMessage());
-      throw e;
-    }
-  } //__________________________________
-} //____________________________________________________________________________
+	private PreparedStatement getSeq4Upd(int p_i) throws Exception {
+		if (null == m_oaPS[p_i]) {
+			StringBuffer sb = new StringBuffer(getSelectStatement()).append(
+					" where ").append(getFldName(SEQ_NAME)).append(
+					" = ? for update");
+			m_oaPS[p_i] = getConn().prepareStatement(sb.toString());
+		}
+		return m_oaPS[p_i];
+	} // __________________________________
+
+	private PreparedStatement updateLastUsed(int p_i) throws Exception {
+		if (null == m_oaPS[p_i]) {
+			StringBuffer sb = new StringBuffer("update ").append(m_sTableName)
+					.append(" set ").append(getFldName(LAST_USED_UID)).append(
+							" = ?").append(" where ").append(
+							getFldName(SEQ_NAME)).append(" = ?");
+			m_oaPS[p_i] = getConn().prepareStatement(sb.toString());
+		}
+		return m_oaPS[p_i];
+	} // __________________________________
+
+	/**
+	 * This is an exception to the standard behaviour of derived classes that
+	 * extend the SqlDbTable abstract class
+	 * <p>
+	 * This method is called by the PersistHandler and BatchHandler EJBs and
+	 * makes their life easier when they need to obtain UID chunks
+	 * </p>
+	 * <p>
+	 * These EJBs rely on this table to ensure no duplicate UIDs across all of
+	 * Rosetta
+	 * </p>
+	 * <p>
+	 * It could also be invoked from a different context, provided that the
+	 * Rosetta Administrators have added a row with a unique sequence name to
+	 * the underlying SQL table that holds the last used UIDs for all numbering
+	 * sequences
+	 * </p>
+	 * 
+	 * @param p_sSeqName
+	 *            String - Key to the sequence name to get the chunk from
+	 * @param p_iQuids
+	 *            int - Number of UIDs to return
+	 * @throws Exception
+	 * @return long - First UID in the chunk assigned by this method
+	 */
+	public long getUidChunk(String p_sSeqName, int p_iQuids) throws Exception {
+		try {
+			PreparedStatement PS = getPS(DaoUidTable.PS_GET_SEQ_4_UPD);
+			PS.setString(1, p_sSeqName);
+			ResultSet rs = getConn().execQueryWait(PS, 30);
+
+			boolean bOK = false;
+			try {
+				if (rs.next())
+					bOK = true;
+			} catch (Exception e1) {
+				getConn().rollback();
+			}
+			if (!bOK)
+				throw new Exception("Select FAILED jbossEsb.getChunk()");
+
+			int iSqlFld = 1 + DaoUidTable.LAST_USED_UID;
+			long lUid = rs.getLong(iSqlFld);
+			if (lUid < 1)
+				lUid = 1;
+			long lNewLast = lUid + p_iQuids;
+
+			PS = getPS(DaoUidTable.PS_UPDATE_LAST_USED);
+			PS.setLong(1, lNewLast);
+			PS.setString(2, p_sSeqName);
+			getConn().execUpdWait(PS, 10);
+
+			getConn().commit();
+
+			return lUid;
+		} catch (Exception e) {
+			m_oLogger.error(e.getMessage());
+			throw e;
+		}
+	} // __________________________________
+} // ____________________________________________________________________________

Modified: labs/jbossesb/trunk/product/core/services/tests/build.xml
===================================================================
--- labs/jbossesb/trunk/product/core/services/tests/build.xml	2006-08-09 14:14:32 UTC (rev 5637)
+++ labs/jbossesb/trunk/product/core/services/tests/build.xml	2006-08-09 14:53:04 UTC (rev 5638)
@@ -67,16 +67,6 @@
 	    <property name="org.jboss.esb.module.tests.coverage.dir" value="${org.jboss.esb.internal.dest}/tests/coverage/services"/>
         <property name="org.jboss.esb.module.classes.instr.dir" value="${org.jboss.esb.module.tests.coverage.dir}/instr" />
 
-		<!-- Instrument the code for code coverage - using emma... -->
-    	<delete dir="${org.jboss.esb.module.tests.coverage.dir}" />
-	    <mkdir dir="${org.jboss.esb.module.tests.coverage.dir}" />
-    	<!--
-	    <emma>
-			<instr 	instrpath="${org.jboss.esb.module.classes.dir}" 
-					destdir="${org.jboss.esb.module.classes.instr.dir}" 
-					metadatafile="${org.jboss.esb.module.tests.coverage.dir}/coverage.emma" />
-	    </emma>        
-        -->
     	<!-- Run the tests -->
         <antcall target="org.jboss.esb.services.internal.test.exec"/>        
 
@@ -89,6 +79,19 @@
 		        <html outfile="${org.jboss.esb.module.tests.coverage.dir}/index.html" depth="method" columns="name,line,class,method,block"/>
 			</report>
 	    </emma> -->
+
+    	<!-- Jar up the instrumented code = plus the uninstrumented interfaces etc from the uninstrumented binaries. -->
+    	<delete dir="${org.jboss.esb.module.tests.coverage.dir}" />
+	    <mkdir dir="${org.jboss.esb.module.tests.coverage.dir}" />
+	    <emma>
+			<instr 	instrpath="${org.jboss.esb.module.classes.dir}" 
+					destdir="${org.jboss.esb.module.classes.instr.dir}" 
+					metadatafile="${org.jboss.esb.module.tests.coverage.dir}/coverage.emma" />
+	    </emma>        
+        <jar destfile="${org.jboss.esb.internal.dest}/tests/coverage/jbossesb-services.jar">
+        	<fileset dir="${org.jboss.esb.module.classes.dir}" />
+        	<fileset dir="${org.jboss.esb.module.classes.instr.dir}" />
+        </jar>
     </target>
 
     <!-- ====================================================================== -->
@@ -107,7 +110,7 @@
             </batchtest>
             <classpath>
         		<!-- using instrumented code for code coverage -->
-                <pathelement location="${org.jboss.esb.module.classes.instr.dir}"/>
+                <!-- pathelement location="${org.jboss.esb.module.classes.instr.dir}"/ -->
                 <pathelement location="${org.jboss.esb.tests.classes.dir}"/> 
             	<!-- Need the tests src folder because there may be non-compiled test resources -->
                 <pathelement location="${org.jboss.esb.module.tests.src.dir}"/>




More information about the jboss-svn-commits mailing list