[jboss-svn-commits] JBL Code SVN: r5292 - in labs/jbossesb/trunk: . product product/core/common/src/org/jboss/soa/esb/helpers product/core/common/src/org/jboss/soa/esb/notification product/core/common/tests product/core/common/tests/src/org/jboss/soa/esb product/core/common/tests/src/org/jboss/soa/esb/helpers product/core/listeners/tests product/core/processors/src/org/jboss/soa/esb/processors product/core/processors/tests product/core/processors/tests/src/org/jboss/soa/esb/processors/tests product/core/services/src/org/jboss/soa/esb/internal/core/objectstore product/core/services/src/org/jboss/soa/esb/services product/core/services/src/org/jboss/soa/esb/services/EJB product/core/services/tests product/core/services/tests/src/org/jboss/soa/esb/services/tests/notification product/lib/ext

jboss-svn-commits at lists.jboss.org jboss-svn-commits at lists.jboss.org
Wed Jul 26 10:00:24 EDT 2006


Author: tfennelly
Date: 2006-07-26 09:56:35 -0400 (Wed, 26 Jul 2006)
New Revision: 5292

Added:
   labs/jbossesb/trunk/ant.bat
   labs/jbossesb/trunk/product/ant.bat
   labs/jbossesb/trunk/product/core/common/tests/src/org/jboss/soa/esb/StreamUtils.java
   labs/jbossesb/trunk/product/core/common/tests/src/org/jboss/soa/esb/StringUtils.java
   labs/jbossesb/trunk/product/core/common/tests/src/org/jboss/soa/esb/helpers/
   labs/jbossesb/trunk/product/core/common/tests/src/org/jboss/soa/esb/helpers/DomElementUnitTest.java
   labs/jbossesb/trunk/product/core/common/tests/src/org/jboss/soa/esb/helpers/expected_01.xml
   labs/jbossesb/trunk/product/core/common/tests/src/org/jboss/soa/esb/helpers/expected_02.xml
   labs/jbossesb/trunk/product/core/common/tests/src/org/jboss/soa/esb/helpers/expected_03.xml
   labs/jbossesb/trunk/product/core/common/tests/src/org/jboss/soa/esb/helpers/testfile1.xml
   labs/jbossesb/trunk/product/core/common/tests/src/org/jboss/soa/esb/helpers/testfile2.xml
   labs/jbossesb/trunk/product/core/common/tests/src/org/jboss/soa/esb/helpers/testfile3.xml
   labs/jbossesb/trunk/product/core/processors/src/org/jboss/soa/esb/processors/Zap.java
   labs/jbossesb/trunk/product/core/services/src/org/jboss/soa/esb/services/Zap.java
   labs/jbossesb/trunk/product/lib/ext/emma.jar
   labs/jbossesb/trunk/product/lib/ext/emma_ant.jar
Modified:
   labs/jbossesb/trunk/product/core/common/src/org/jboss/soa/esb/helpers/DomElement.java
   labs/jbossesb/trunk/product/core/common/src/org/jboss/soa/esb/notification/MacroExpander.java
   labs/jbossesb/trunk/product/core/common/src/org/jboss/soa/esb/notification/NotifyUtil.java
   labs/jbossesb/trunk/product/core/common/tests/build.xml
   labs/jbossesb/trunk/product/core/listeners/tests/build.xml
   labs/jbossesb/trunk/product/core/processors/tests/build.xml
   labs/jbossesb/trunk/product/core/processors/tests/src/org/jboss/soa/esb/processors/tests/DummyUnitTest.java
   labs/jbossesb/trunk/product/core/services/src/org/jboss/soa/esb/internal/core/objectstore/BobjStore.java
   labs/jbossesb/trunk/product/core/services/src/org/jboss/soa/esb/services/EJB/JbossEsbNotificationHandler.java
   labs/jbossesb/trunk/product/core/services/src/org/jboss/soa/esb/services/EJB/JbossEsbNotificationHandlerLocalHome.java
   labs/jbossesb/trunk/product/core/services/src/org/jboss/soa/esb/services/EJB/JbossEsbPersistHandler.java
   labs/jbossesb/trunk/product/core/services/src/org/jboss/soa/esb/services/EJB/JbossEsbPersistHandlerLocalHome.java
   labs/jbossesb/trunk/product/core/services/tests/build.xml
   labs/jbossesb/trunk/product/core/services/tests/src/org/jboss/soa/esb/services/tests/notification/NotificationFuncTest.java
Log:
Added EMMA code coverage for unit and functional tests on all modules.

Also added a some unit tests on commons... more to follow!!

Added: labs/jbossesb/trunk/ant.bat
===================================================================
--- labs/jbossesb/trunk/ant.bat	2006-07-26 13:43:12 UTC (rev 5291)
+++ labs/jbossesb/trunk/ant.bat	2006-07-26 13:56:35 UTC (rev 5292)
@@ -0,0 +1,18 @@
+ at echo off
+
+set JAVA_HOME=C:\Program Files\Java\jdk1.5.0_07
+set ANT_HOME=H:\apache-ant-1.6.5
+set JBOSS_HOME=H:\jboss-4.0.4.GA
+set XDOCLET_HOME=H:\xdoclet-1.2.3
+
+set ANT_CMD_LINE_ARGS=%1
+if ""%1""=="""" goto doneStart
+shift
+:setupArgs
+if ""%1""=="""" goto doneStart
+set ANT_CMD_LINE_ARGS=%ANT_CMD_LINE_ARGS% %1
+shift
+goto setupArgs
+:doneStart
+%ANT_HOME%\bin\ant %ANT_CMD_LINE_ARGS%
+

Added: labs/jbossesb/trunk/product/ant.bat
===================================================================
--- labs/jbossesb/trunk/product/ant.bat	2006-07-26 13:43:12 UTC (rev 5291)
+++ labs/jbossesb/trunk/product/ant.bat	2006-07-26 13:56:35 UTC (rev 5292)
@@ -0,0 +1,18 @@
+ at echo off
+
+set JAVA_HOME=C:\Program Files\Java\jdk1.5.0_07
+set ANT_HOME=H:\apache-ant-1.6.5
+set JBOSS_HOME=H:\jboss-4.0.4.GA
+set XDOCLET_HOME=H:\xdoclet-1.2.3
+
+set ANT_CMD_LINE_ARGS=%1
+if ""%1""=="""" goto doneStart
+shift
+:setupArgs
+if ""%1""=="""" goto doneStart
+set ANT_CMD_LINE_ARGS=%ANT_CMD_LINE_ARGS% %1
+shift
+goto setupArgs
+:doneStart
+%ANT_HOME%\bin\ant %ANT_CMD_LINE_ARGS%
+

Modified: labs/jbossesb/trunk/product/core/common/src/org/jboss/soa/esb/helpers/DomElement.java
===================================================================
--- labs/jbossesb/trunk/product/core/common/src/org/jboss/soa/esb/helpers/DomElement.java	2006-07-26 13:43:12 UTC (rev 5291)
+++ labs/jbossesb/trunk/product/core/common/src/org/jboss/soa/esb/helpers/DomElement.java	2006-07-26 13:56:35 UTC (rev 5292)
@@ -1,326 +1,303 @@
 /*
-* 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.helpers;
 
 import java.io.*;
 import java.util.*;
 import org.w3c.dom.*;
+import org.xml.sax.SAXException;
+
 import javax.xml.parsers.*;
 import javax.xml.transform.*;
 import javax.xml.transform.dom.*;
 import javax.xml.transform.stream.*;
 
-public class DomElement
-{
-  private static final String s_sLS = System.getProperty("line.separator");
-  private static final transient String s_sCharset = "ISO-8859-1";
-  private static final transient String s_sEncoding
-      = "<?xml version=\"1.0\" encoding=\"ISO-8859-1\"?>";
+public class DomElement {
+	protected static final String LINE_BREAK = System.getProperty("line.separator");
 
-  private transient static DocumentBuilder s_oDB;
-  private transient static Transformer      s_tf;
-  private transient Element     m_oElem;
-  private DomElement			m_oDad;
-  public  DomElement getDad() 	{ return m_oDad; }
+	private static final transient String s_sCharset = "ISO-8859-1";
 
-  static
-  { try
-    {
-      s_oDB = DocumentBuilderFactory.newInstance().newDocumentBuilder();
-      s_tf  = TransformerFactory.newInstance().newTransformer();
-      s_tf.setOutputProperty(OutputKeys.OMIT_XML_DECLARATION,"yes");
-      s_tf.setOutputProperty(OutputKeys.INDENT,"no");
-      s_tf.setOutputProperty(OutputKeys.ENCODING, s_sCharset);
-    }
-    catch (Exception e) {}
-  };
+	private static final transient String s_sEncoding = "<?xml version=\"1.0\" encoding=\"ISO-8859-1\"?>";
 
-  private DomElement() {}
+	private transient static DocumentBuilder s_oDocumentBuilder;
 
-  public DomElement(Element p_oE)
-  { this();
-    Document oDoc = null;
-    synchronized (s_oDB) {  oDoc = s_oDB.newDocument(); }
-    Node oNew = oDoc.importNode(p_oE.cloneNode(true),true);
-    m_oElem = (Element)oDoc.appendChild(oNew);
-  } //__________________________________
+	private transient static Transformer s_Transformer;
 
-  public DomElement(String p_sName) { this (p_sName,null); }
+	private transient Element m_oRootW3CElement;
 
-  /**
-   * Construct a new DomElement object by cloning arg 1
-   * <p>Cloning makes it safe to work on the new object without altering the
-   * contents of the argument
-   * </p>
-   * @param p_oP DomElement
-   * @throws Exception
-   */
-  protected DomElement(DomElement p_oP) throws Exception
-    {m_oElem = p_oP.cloneObj().m_oElem; }
+	private DomElement m_oParentDomElement;
 
-  private DomElement(String p_sName,DomElement p_oDad)
-  { this();
-    Document oDoc = null;
-    if (null == p_oDad)
-    { synchronized(s_oDB) { oDoc  = s_oDB.newDocument(); }
-      m_oElem = (Element)oDoc.appendChild(oDoc.createElement(p_sName));
-    }
-    else
-    { m_oDad	= p_oDad;
-      oDoc  = p_oDad.m_oElem.getOwnerDocument();
-      m_oElem = (Element)p_oDad.m_oElem.appendChild(oDoc.createElement(p_sName));
-    }
-  } //__________________________________
+	public DomElement getDad() {
+		return m_oParentDomElement;
+	}
 
-  public static DomElement fromInputStream(InputStream p_oIS) throws Exception
-  { Document oDoc = null;
-    synchronized(s_oDB) { oDoc = s_oDB.parse(p_oIS); }
-    DomElement oRet = new DomElement();
-    oRet.m_oElem  = oDoc.getDocumentElement();
-    return oRet;
-  } //__________________________________
+	static {
+		try {
+			s_oDocumentBuilder = DocumentBuilderFactory.newInstance().newDocumentBuilder();
+			s_Transformer = TransformerFactory.newInstance().newTransformer();
+			s_Transformer.setOutputProperty(OutputKeys.OMIT_XML_DECLARATION, "yes");
+			s_Transformer.setOutputProperty(OutputKeys.INDENT, "no");
+			s_Transformer.setOutputProperty(OutputKeys.ENCODING, s_sCharset);
+		} catch (Exception e) {
+		}
+	};
 
-  public static DomElement fromURL(String p_sFname) throws Exception
-  { Document oDoc = null;
-    synchronized(s_oDB) { oDoc = s_oDB.parse(p_sFname); }
-    DomElement oRet = new DomElement();
-    oRet.m_oElem  = oDoc.getDocumentElement();
-    return oRet;
-  } //__________________________________
+	private DomElement() {
+	}
 
-  public static DomElement fromXml(String p_s) throws Exception
-  { Document oDoc = null;
-    StringBuffer sb = new StringBuffer(s_sEncoding).append(p_s);
-    InputStream oIS = new ByteArrayInputStream (sb.toString().getBytes(s_sCharset));
-    synchronized(s_oDB) { oDoc = s_oDB.parse(oIS); }
-    DomElement oRet = new DomElement();
-    oRet.m_oElem  = oDoc.getDocumentElement();
-    return oRet;
-  } //__________________________________
+	protected DomElement(Element p_oE) {
+		this();
+		Document oDoc = null;
+		synchronized (s_oDocumentBuilder) {
+			oDoc = s_oDocumentBuilder.newDocument();
+		}
+		Node oNew = oDoc.importNode(p_oE.cloneNode(true), true);
+		m_oRootW3CElement = (Element) oDoc.appendChild(oNew);
+	} // __________________________________
 
-  public String toString()
-  { return toXml().toString()
-	.replaceAll(s_sLS,"&#10;")
-	.replaceAll("\t","")
-	+s_sLS;
-  } //________________________________
+	public DomElement(String p_sName) {
+		this(p_sName, null);
+	}
 
-  public ByteArrayOutputStream toXml()
-  { Document oDoc = null;
-    synchronized(s_oDB) { oDoc = s_oDB.newDocument(); }
-    oDoc.appendChild(oDoc.importNode(m_oElem,true));
-    oDoc.normalize();
-    DOMSource src = new DOMSource(oDoc);
+	/**
+	 * Construct a new DomElement object by cloning arg 1
+	 * <p>
+	 * Cloning makes it safe to work on the new object without altering the
+	 * contents of the argument
+	 * </p>
+	 * 
+	 * @param p_oP
+	 *            DomElement
+	 * @throws Exception
+	 */
+	protected DomElement(DomElement p_oP) throws Exception {
+		m_oRootW3CElement = p_oP.cloneObj().m_oRootW3CElement;
+	}
 
-    ByteArrayOutputStream oStrm = new ByteArrayOutputStream(5000);
-    StreamResult res = new StreamResult(oStrm);
+	private DomElement(String p_sName, DomElement p_oParentDomElement) {
+		this();
+		Document oW3CDoc = null;
+		if (null == p_oParentDomElement) {
+			synchronized (s_oDocumentBuilder) {
+				oW3CDoc = s_oDocumentBuilder.newDocument();
+			}
+			m_oRootW3CElement = (Element) oW3CDoc.appendChild(oW3CDoc.createElement(p_sName));
+		} else {
+			m_oParentDomElement = p_oParentDomElement;
+			oW3CDoc = p_oParentDomElement.m_oRootW3CElement.getOwnerDocument();
+			m_oRootW3CElement = (Element) p_oParentDomElement.m_oRootW3CElement.appendChild(oW3CDoc
+					.createElement(p_sName));
+		}
+	} // __________________________________
 
-    try
-    { synchronized (s_tf) { s_tf.transform(src,res); }
-    }
-    catch (Exception e)
-    { try { oStrm.write("ERROR Dom3Element.toXml()".getBytes()); }
-      catch (Exception e1) {}
-    }
-    return oStrm;
-  } //__________________________________
+	public static DomElement fromInputStream(InputStream p_oIS) throws SAXException, IOException {
+		Document oDoc = null;
+		synchronized (s_oDocumentBuilder) {
+			oDoc = s_oDocumentBuilder.parse(p_oIS);
+		}
+		DomElement oRet = new DomElement();
+		oRet.m_oRootW3CElement = oDoc.getDocumentElement();
+		return oRet;
+	} // __________________________________
 
-//_________ GETTERS ____________________________________________________________
+	public static DomElement fromXml(String p_xmlString) throws SAXException, IOException {
+		// TF: Modified this constructor to use the fromInputStream method.
 
-  public Element getDomElement() { return m_oElem; }
+		if(p_xmlString == null || p_xmlString.trim().equals("")) {
+			throw new IllegalArgumentException("Null or empty 'p_xmlString' arg in call.");
+		}
+		
+		InputStream oIS = new ByteArrayInputStream(p_xmlString.getBytes(s_sCharset));
 
-  public String getName() { return m_oElem.getNodeName(); }
+		return fromInputStream(oIS);
+	} // __________________________________
 
-  public String[] getAttrKeys()
-  { NamedNodeMap NM = m_oElem.getAttributes();
-    String[] saRet = new String[NM.getLength()];
-    for (int i1=0; i1<saRet.length;i1++)
-      saRet[i1] = NM.item(i1).getNodeName();
-    return saRet;
-  } //__________________________________
+	public String toString() {
+		return toXml().toString().replaceAll(LINE_BREAK, "&#10;").replaceAll("\t",
+				"")
+				+ LINE_BREAK;
+	} // ________________________________
 
-  public String getAttr(String p_sKey)
-  { if (! m_oElem.hasAttribute(p_sKey)) return null;
-    return m_oElem.getAttribute(p_sKey);
-  } //__________________________________
+	public ByteArrayOutputStream toXml() {
+		Document oDoc = null;
+		synchronized (s_oDocumentBuilder) {
+			oDoc = s_oDocumentBuilder.newDocument();
+		}
+		oDoc.appendChild(oDoc.importNode(m_oRootW3CElement, true));
+		oDoc.normalize();
+		DOMSource src = new DOMSource(oDoc);
 
-  public String getFirstTextChild (String p_sKey)
-  { NodeList NL = m_oElem.getElementsByTagName(p_sKey);
-    StringBuffer  sb = new StringBuffer(100);
-    if (NL.getLength()>0)
-    { Node nCurr = NL.item(0).getFirstChild();
-      sb.setLength(0);
-      while (null != nCurr)
-      { if (nCurr instanceof Text) sb.append(nCurr.getNodeValue());
-	nCurr = nCurr.getNextSibling();
-      }
-      return sb.toString();
-    }
-    return null;
-  } //__________________________________
+		ByteArrayOutputStream oStrm = new ByteArrayOutputStream(5000);
+		StreamResult res = new StreamResult(oStrm);
 
-  public static String getTextValue (Node p_n)
-  { StringBuffer sb = new StringBuffer();
-    Node nCurr = p_n.getFirstChild();
-    while (null != nCurr)
-    { if (nCurr instanceof Text) sb.append(nCurr.getNodeValue());
-      nCurr = nCurr.getNextSibling();
-    }
-    return sb.toString();
-  } //__________________________________
+		try {
+			synchronized (s_Transformer) {
+				s_Transformer.transform(src, res);
+			}
+		} catch (Exception e) {
+			try {
+				oStrm.write("ERROR Dom3Element.toXml()".getBytes());
+			} catch (Exception e1) {
+			}
+		}
+		return oStrm;
+	} // __________________________________
 
-  public String [] getTextChildren (String p_sKey)
-  { NodeList NL = m_oElem.getElementsByTagName(p_sKey);
-    List<String>  oL  = new ArrayList<String>();
-    for (int i1=0; i1<NL.getLength();i1++)
-      oL.add(getTextValue(NL.item(i1)));
-    String[] saRet  = new String[oL.size()];
-    oL.toArray(saRet);
-    return saRet;
-  } //__________________________________
+	// _________ GETTERS
+	// ____________________________________________________________
 
-  public DomElement [] getElementChildren (String p_sKey)
-  { DomElement oDE = null;
-	NodeList NL = m_oElem.getElementsByTagName(p_sKey);
-    List<DomElement>  oL  = new ArrayList<DomElement>();
-    for (int i1=0; i1<NL.getLength();i1++)
-    { Node nCurr  = NL.item(i1);
-      if (nCurr instanceof Element)
-      {	oL.add(oDE = new DomElement( (Element) nCurr));
-      	oDE.m_oDad = this;
-      }
-    }
-    DomElement[] oaRet  = new DomElement[oL.size()];
-    oL.toArray(oaRet);
-    return oaRet;
-  } //__________________________________
+	public Element getDomElement() {
+		return m_oRootW3CElement;
+	}
 
-  public DomElement getFirstElementChild (String p_sKey)
-  { DomElement oDE = null;
-	NodeList NL = m_oElem.getElementsByTagName(p_sKey);
-    for (int i1=0; i1<NL.getLength();i1++)
-    { Node nCurr  = NL.item(i1);
-      if (nCurr instanceof Element)
-      {	oDE = new DomElement( (Element) nCurr);
-      	oDE.m_oDad = this;
-    	return oDE;
-      }
-    }
-    return null;
-  } //__________________________________
+	public String getName() {
+		return m_oRootW3CElement.getNodeName();
+	}
 
-  public DomElement [] getAllElemChildren ()
-  { DomElement oDE = null;
-  	List<DomElement>  oL  = new ArrayList<DomElement>();
-    Node nCurr = m_oElem.getFirstChild();
-    while (null != nCurr)
-    { if (nCurr instanceof Element)
-      {	oL.add(oDE = new DomElement( (Element) nCurr));
-      	oDE.m_oDad = this;
-      }
-      nCurr = nCurr.getNextSibling();
-    }
-    DomElement[] oaRet  = new DomElement[oL.size()];
-    oL.toArray(oaRet);
-    return oaRet;
-  } //__________________________________
+	public String[] getAttrKeys() {
+		NamedNodeMap NM = m_oRootW3CElement.getAttributes();
+		String[] saRet = new String[NM.getLength()];
+		for (int i1 = 0; i1 < saRet.length; i1++)
+			saRet[i1] = NM.item(i1).getNodeName();
+		return saRet;
+	} // __________________________________
 
-//_________ SETTERS ____________________________________________________________
+	public String getAttr(String p_sAttribName) {
+		if (!m_oRootW3CElement.hasAttribute(p_sAttribName))
+			return null;
+		return m_oRootW3CElement.getAttribute(p_sAttribName);
+	} // __________________________________
 
-  public void setAttr(String p_sKey,String p_sVal)
-  { if (null==p_sKey)     return;
-    m_oElem.removeAttribute(p_sKey);
-    if (null!=p_sVal) m_oElem.setAttribute(p_sKey,p_sVal);
-  } //__________________________________
+	public static String getTextValue(Node p_Node) {
+		StringBuffer sb = new StringBuffer();
+		Node nCurr = p_Node.getFirstChild();
+		while (null != nCurr) {
+			if (nCurr instanceof Text)
+				sb.append(nCurr.getNodeValue());
+			nCurr = nCurr.getNextSibling();
+		}
+		return sb.toString();
+	} // __________________________________
 
-  public void setAttributes(Map p_oM)
-  { if (null==p_oM) return;
-    for (Iterator II=p_oM.keySet().iterator(); II.hasNext(); )
-    { String sKey = II.next().toString();
-      setAttr(sKey, p_oM.get(sKey).toString());
-    }
-  } //__________________________________
+	public String[] getTextChildren(String p_sElementName) {
+		NodeList NL = getElementNodeList(p_sElementName);
+		List<String> oL = new ArrayList<String>();
+		for (int i1 = 0; i1 < NL.getLength(); i1++)
+			oL.add(getTextValue(NL.item(i1)));
+		String[] saRet = new String[oL.size()];
+		oL.toArray(saRet);
+		return saRet;
+	} // __________________________________
 
-  public void addTextChild (String p_sKey, String p_sVal)
-  { if (null==p_sKey || null==p_sVal)   return;
-    DomElement oNew = new DomElement(p_sKey,this);
-    oNew.m_oElem.appendChild(m_oElem.getOwnerDocument().createTextNode(p_sVal));
-  } //__________________________________
+	public DomElement[] getElementChildren(String p_sElementName) {
+		DomElement oDE = null;
+		
+		NodeList NL = getElementNodeList(p_sElementName);
+		List<DomElement> oL = new ArrayList<DomElement>();
 
-  public void addTextChildren (String p_sKey, String[] p_saVal)
-  { if (null==p_sKey || null==p_saVal)   return;
-    for (int i1=0; i1<p_saVal.length;i1++)
-      addTextChild(p_sKey,p_saVal[i1]);
-  } //__________________________________
+		for (int i1 = 0; i1 < NL.getLength(); i1++) {
+			Node nCurr = NL.item(i1);
+			if (nCurr instanceof Element) {
+				oL.add(oDE = new DomElement((Element) nCurr));
+				oDE.m_oParentDomElement = this;
+			}
+		}
+		DomElement[] oaRet = new DomElement[oL.size()];
+		oL.toArray(oaRet);
+		return oaRet;
+	} // __________________________________
 
-  public void addElemChild (DomElement p_oE)
-  { p_oE.m_oDad = this;
-	Document oDoc = m_oElem.getOwnerDocument();
-    m_oElem.appendChild(oDoc.importNode(p_oE.m_oElem,true));
-  } //__________________________________
+	public DomElement getFirstElementChild(String p_sElementName) {
+		DomElement[] children = getElementChildren(p_sElementName);
 
-  public DomElement newElemChild (String p_sKey)
-  {
-	DomElement oNew = new DomElement(p_sKey,this);
-	oNew.m_oDad = this;
-	return oNew;
-  } //__________________________________
+		if(children != null && children.length > 0) {
+			return children[0];
+		} else {		
+			return null;
+		}
+	} // __________________________________
 
-  public void rmvChildsByName (String p_sKey)
-  { NodeList NL = m_oElem.getElementsByTagName(p_sKey);
-    for (int i1=0; i1<NL.getLength();i1++)
-      m_oElem.removeChild(NL.item(i1));
-  } //__________________________________
+	/**
+	 * Get a nodelist for the specified element name from the associated Document.
+	 * @param p_sElementName Element tag name.
+	 * @return Nodelist.
+	 */
+	private NodeList getElementNodeList(String p_sElementName) {
+		// TF: Modified the following line to allow the document root element be included in the lookup.. 
+		return m_oRootW3CElement.getOwnerDocument().getElementsByTagName(p_sElementName);
+	}
 
-//_________ UTILITIES / HELPERS_________________________________________________
+	public DomElement[] getAllElemChildren() {
+		DomElement oDE = null;
+		List<DomElement> oL = new ArrayList<DomElement>();
+		Node nCurr = m_oRootW3CElement.getFirstChild();
+		
+		while (null != nCurr) {
+			if (nCurr instanceof Element) {
+				oL.add(oDE = new DomElement((Element) nCurr));
+				oDE.m_oParentDomElement = this;
+			}
+			nCurr = nCurr.getNextSibling();
+		}
+		DomElement[] oaRet = new DomElement[oL.size()];
+		oL.toArray(oaRet);
+		return oaRet;
+	} // __________________________________
 
+	// _________ SETTERS
+	// ____________________________________________________________
 
-  public DomElement cloneObj() throws Exception
-  { return DomElement.fromXml(this.toString());
-  } //__________________________________
+	public void setAttr(String p_sAttribName, String p_sAttribValue) {
+		if (null == p_sAttribName) {
+			// REVIEW: Shouldn't this throw an IllegalArgumentException???
+			return;
+		}
+		m_oRootW3CElement.removeAttribute(p_sAttribName);
+		if (null != p_sAttribValue) {
+			m_oRootW3CElement.setAttribute(p_sAttribName, p_sAttribValue);
+		}
+	} // __________________________________
 
-  public void dump (OutputStream p_OS)
-  { StringBuffer sb = new StringBuffer(toXml().toString());
-    int iFrom = 0;
-    while (iFrom < sb.length())
-    { iFrom = sb.indexOf(">",iFrom);
-      if (iFrom < 0)      break;
-      for (int i1=1+iFrom; i1<sb.length();i1++)
-      { char cCurr = sb.charAt(i1);
-	if (Character.isWhitespace(cCurr))      continue;
-	if (Character.getType(cCurr) == Character.DIRECTIONALITY_WHITESPACE)
-					       continue;
-	if ('<' == cCurr) { sb.replace(1+iFrom,i1,"\n");  iFrom++; }
-	break;
-      }
-      iFrom++;
-    }
+	public void addElemChild(DomElement p_oE) {
+		p_oE.m_oParentDomElement = this;
+		Document oDoc = m_oRootW3CElement.getOwnerDocument();
+		m_oRootW3CElement.appendChild(oDoc.importNode(p_oE.m_oRootW3CElement, true));
+	} // __________________________________
 
-    try
-    { p_OS.write(sb.toString().getBytes(s_sCharset));
-      p_OS.write(s_sLS.getBytes());
-    }
-    catch (Exception e) {}
-  } //__________________________________
+	public void rmvChildsByName(String p_sTagName) {
+		NodeList NL = m_oRootW3CElement.getElementsByTagName(p_sTagName);
+		for (int i1 = 0; i1 < NL.getLength(); i1++)
+			m_oRootW3CElement.removeChild(NL.item(i1));
+	} // __________________________________
 
-} //____________________________________________________________________________
+	// _________ UTILITIES /
+	// HELPERS_________________________________________________
+
+	public DomElement cloneObj() throws SAXException, IOException {
+		// REVIEW: This must be a performance killer - surely the 
+		// associated DOM can be cloned Vs serialising to a string and parsing
+		// from scratch again!!!
+		return DomElement.fromXml(this.toString());
+	} // __________________________________
+	
+} // ____________________________________________________________________________

Modified: labs/jbossesb/trunk/product/core/common/src/org/jboss/soa/esb/notification/MacroExpander.java
===================================================================
--- labs/jbossesb/trunk/product/core/common/src/org/jboss/soa/esb/notification/MacroExpander.java	2006-07-26 13:43:12 UTC (rev 5291)
+++ labs/jbossesb/trunk/product/core/common/src/org/jboss/soa/esb/notification/MacroExpander.java	2006-07-26 13:56:35 UTC (rev 5292)
@@ -1,73 +1,75 @@
 /*
-* 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.notification;
 
 import java.util.*;
 
 import org.jboss.soa.esb.helpers.*;
 
-public class MacroExpander
-{
-  private static final String CTX_PREFIX    = "@@ctx@@";
-  public static final String CTX_BATCH_UID  = CTX_PREFIX+"batchUid";
-  public static final String CTX_BATCH_NUM  = CTX_PREFIX+"batchNum";
-  public static final String CTX_INPUT_FILE = CTX_PREFIX+"inputFile";
-  public static final String CTX_POST_FILE  = CTX_PREFIX+"postFile";
+public class MacroExpander {
+	private static final String CTX_PREFIX = "@@ctx@@";
 
-  private static final String[] s_saMacros =
-      {CTX_BATCH_UID, CTX_BATCH_NUM ,CTX_INPUT_FILE, CTX_POST_FILE };
+	public static final String CTX_BATCH_UID = CTX_PREFIX + "batchUid";
 
+	public static final String CTX_BATCH_NUM = CTX_PREFIX + "batchNum";
 
-  public void replaceMacros(DomElement p_oParm, Map p_oMap)
-  {
-    String[] saAtt = p_oParm.getAttrKeys();
-    for (int i1 = 0; i1 < saAtt.length; i1++)
-    {
-      String sKey = saAtt[i1];
-      String sVal = p_oParm.getAttr(sKey);
+	public static final String CTX_INPUT_FILE = CTX_PREFIX + "inputFile";
 
-      boolean bSubst = false;
-      int iWh = 0;
-      int iPos = 0;
-      while (0 <= (iPos = sVal.indexOf(CTX_PREFIX, iWh)))
-      {
-        String sRest = sVal.substring(iPos);
-        for (int i2 = 0; i2 < s_saMacros.length; i2++)
-        {
-          String sMac = s_saMacros[i2];
-          if (!sRest.startsWith(sMac))continue;
-          Object oRpl = (null != p_oMap) ? p_oMap.get(sMac) : null;
-          if (null == oRpl)continue;
-          bSubst = true;
-          sVal = sVal.substring(0, iPos)
-              + oRpl.toString() + sVal.substring(iPos + sMac.length());
-        }
-      }
-      if (bSubst) p_oParm.setAttr(sKey, sVal);
-    }
-    DomElement[] oaChilds = p_oParm.getAllElemChildren();
-    for (int i1 = 0; i1 < oaChilds.length; i1++)
-      replaceMacros(oaChilds[i1], p_oMap);
-  } //_________________________
+	public static final String CTX_POST_FILE = CTX_PREFIX + "postFile";
+
+	private static final String[] s_saMacros = { CTX_BATCH_UID, CTX_BATCH_NUM,
+			CTX_INPUT_FILE, CTX_POST_FILE };
+
+	public static void replaceMacros(DomElement p_oParm, Map p_oMap) {
+		String[] saAtt = p_oParm.getAttrKeys();
+		
+		for (int i1 = 0; i1 < saAtt.length; i1++) {
+			String sKey = saAtt[i1];
+			String sVal = p_oParm.getAttr(sKey);
+			boolean bSubst = false;
+			int iWh = 0;
+			int iPos = 0;
+
+			while (0 <= (iPos = sVal.indexOf(CTX_PREFIX, iWh))) {
+				String sRest = sVal.substring(iPos);
+				for (int i2 = 0; i2 < s_saMacros.length; i2++) {
+					String sMac = s_saMacros[i2];
+					if (!sRest.startsWith(sMac))
+						continue;
+					Object oRpl = (null != p_oMap) ? p_oMap.get(sMac) : null;
+					if (null == oRpl)
+						continue;
+					bSubst = true;
+					sVal = sVal.substring(0, iPos) + oRpl.toString()
+							+ sVal.substring(iPos + sMac.length());
+				}
+			}
+			if (bSubst)
+				p_oParm.setAttr(sKey, sVal);
+		}
+		DomElement[] oaChilds = p_oParm.getAllElemChildren();
+		for (int i1 = 0; i1 < oaChilds.length; i1++) {
+			replaceMacros(oaChilds[i1], p_oMap);
+		}
+	} // _________________________
 }

Modified: labs/jbossesb/trunk/product/core/common/src/org/jboss/soa/esb/notification/NotifyUtil.java
===================================================================
--- labs/jbossesb/trunk/product/core/common/src/org/jboss/soa/esb/notification/NotifyUtil.java	2006-07-26 13:43:12 UTC (rev 5291)
+++ labs/jbossesb/trunk/product/core/common/src/org/jboss/soa/esb/notification/NotifyUtil.java	2006-07-26 13:56:35 UTC (rev 5292)
@@ -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.notification;
 
 import java.io.*;
@@ -29,52 +28,53 @@
 import org.jboss.soa.esb.helpers.*;
 import org.jboss.soa.esb.services.*;
 
-public class NotifyUtil
-{
+public class NotifyUtil {
 
-  public static void notifyOK(InotificationHandler p_oNH, DomElement p_oParent
-                       , Object p_o, Map p_oCtx)
-  { try
-    { String sMsg = p_o.toString();
-      DomElement[] oaP = p_oParent.getElementChildren(NotificationList.ELEMENT);
-      for (int i1=0; i1<oaP.length;i1++)
-      { NotificationList oCurr = new NotificationList(oaP[i1]);
-        if (! oCurr.isOK())    continue;
-        DomElement oCpy = oaP[i1].cloneObj();
-        new MacroExpander().replaceMacros(oCpy, p_oCtx);
-        p_oNH.sendNotifications(oCpy,sMsg);
-      }
-    }
-    catch (Exception e)
-    {
-      e.printStackTrace(System.out);
-    }
-  } //__________________________________
+	public static void notifyOK(InotificationHandler p_oNH,
+			DomElement p_oParent, Object p_o, Map p_oCtx) {
+		try {
+			String sMsg = p_o.toString();
+			DomElement[] oaP = p_oParent
+					.getElementChildren(NotificationList.ELEMENT);
+			for (int i1 = 0; i1 < oaP.length; i1++) {
+				NotificationList oCurr = new NotificationList(oaP[i1]);
+				if (!oCurr.isOK())
+					continue;
+				DomElement oCpy = oaP[i1].cloneObj();
+				MacroExpander.replaceMacros(oCpy, p_oCtx);
+				p_oNH.sendNotifications(oCpy, sMsg);
+			}
+		} catch (Exception e) {
+			e.printStackTrace(System.out);
+		}
+	} // __________________________________
 
-  public static void notifyError(InotificationHandler p_oNH, DomElement p_oParent
-                          , Object p_o, Map p_oCtx, Exception p_e)
-  { ByteArrayOutputStream oBO = new ByteArrayOutputStream();
-    PrintStream oPS = new PrintStream(oBO);
-    try
-    { oPS.println(p_o.toString());
-      if (null != p_e) p_e.printStackTrace(oPS);
-      oPS.close();
+	public static void notifyError(InotificationHandler p_oNH,
+			DomElement p_oParent, Object p_o, Map p_oCtx, Exception p_e) {
+		ByteArrayOutputStream oBO = new ByteArrayOutputStream();
+		PrintStream oPS = new PrintStream(oBO);
+		try {
+			oPS.println(p_o.toString());
+			if (null != p_e)
+				p_e.printStackTrace(oPS);
+			oPS.close();
 
-      String sMsg = oBO.toString();
-      DomElement[] oaP = p_oParent.getElementChildren(NotificationList.ELEMENT);
-      //      if (oaP.length<1)    //  Uncomment this line to send only to the list
-      p_oNH.sendNotifications(sMsg);
-      for (int i1=0; i1<oaP.length;i1++)
-      { NotificationList oCurr = new NotificationList(oaP[i1]);
-        if (! oCurr.isErr())    continue;
-        new MacroExpander().replaceMacros(oaP[i1], p_oCtx);
-        p_oNH.sendNotifications(oaP[i1],sMsg);
-      }
-    }
-    catch (Exception e)
-    {
-      e.printStackTrace(System.out);
-    }
-  } //__________________________________
+			String sMsg = oBO.toString();
+			DomElement[] oaP = p_oParent
+					.getElementChildren(NotificationList.ELEMENT);
+			// if (oaP.length<1) // Uncomment this line to send only to the list
+			p_oNH.sendNotifications(sMsg);
+			for (int i1 = 0; i1 < oaP.length; i1++) {
+				NotificationList oCurr = new NotificationList(oaP[i1]);
+				if (!oCurr.isErr()) {
+					continue;
+				}
+				MacroExpander.replaceMacros(oaP[i1], p_oCtx);
+				p_oNH.sendNotifications(oaP[i1], sMsg);
+			}
+		} catch (Exception e) {
+			e.printStackTrace(System.out);
+		}
+	} // __________________________________
 
-} //____________________________________________________________________________
+} // ____________________________________________________________________________

Modified: labs/jbossesb/trunk/product/core/common/tests/build.xml
===================================================================
--- labs/jbossesb/trunk/product/core/common/tests/build.xml	2006-07-26 13:43:12 UTC (rev 5291)
+++ labs/jbossesb/trunk/product/core/common/tests/build.xml	2006-07-26 13:56:35 UTC (rev 5292)
@@ -1,10 +1,11 @@
 <?xml version="1.0"?>
 <project name="build.common.tests" default="org.jboss.esb.common.tests.compile" basedir=".">
 
+    <property name="org.jboss.esb.module.src.dir" value="../src"/>
+    <property name="org.jboss.esb.module.classes.dir" value="${org.jboss.esb.internal.dest}/classes/common"/>
+    <property name="org.jboss.esb.module.tests.src.dir" value="${basedir}/src"/>
     <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.core.classes.dir" value="${org.jboss.esb.internal.dest}/classes/common"/>
-    <property name="org.jboss.esb.tests.src.dir" value="${basedir}/src"/>
     <property name="org.jboss.esb.root.dir" value="../.."/>
     <property environment="env"/>
 
@@ -15,8 +16,8 @@
 
     <path id="org.jboss.esb.tests.base.classpath">
         <fileset dir="../${org.jboss.esb.ext.lib.dir}"
-                 includes="activation.jar jbossall-client.jar log4j.jar mail.jar junit.jar"/>
-        <pathelement location="${org.jboss.esb.core.classes.dir}"/>
+                 includes="activation.jar jbossall-client.jar log4j.jar mail.jar junit.jar emma.jar emma_ant.jar"/>
+        <pathelement location="${org.jboss.esb.module.classes.dir}"/>
     </path>
 
     <target name="org.jboss.esb.tests.init">
@@ -42,68 +43,68 @@
                 debug="${org.jboss.esb.debug}"
                 optimize="${org.jboss.esb.optimize}"
                 >
-            <src path="${org.jboss.esb.tests.src.dir}"/>
+            <src path="${org.jboss.esb.module.tests.src.dir}"/>
         </javac>
 
     </target>
 
+	<taskdef resource="emma_ant.properties" classpathref="org.jboss.esb.tests.base.classpath" />
 
-    <!-- ====================================================================== -->
+	<!-- ====================================================================== -->
     <!--                             T E S T                                    -->
     <!-- ====================================================================== -->
     <target name="org.jboss.esb.common.internal.test">
-        <antcall target="org.jboss.esb.common.internal.test.unit"/>
-        <antcall target="org.jboss.esb.common.internal.test.functional"/>
-    </target>
+	    <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}" />
+	    <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>        
 
-    <!-- ====================================================================== -->
-    <!--                       U N I T   T E S T S                              -->
-    <!-- ====================================================================== -->
-    <target name="org.jboss.esb.common.internal.test.unit">
-        <echo message="Running tests for module"/>
-        <junit printsummary="yes" haltonerror="yes" haltonfailure="yes" showoutput="no" fork="true">
-            <formatter type="plain" usefile="false"/>
-            <formatter type="xml"/>
-            <batchtest todir="${org.jboss.esb.tests.report.dir}">
-                <fileset dir="${org.jboss.esb.tests.classes.dir}">
-                    <include name="**/**/common/**/**UnitTest.class"/>
-                </fileset>
-            </batchtest>
-            <classpath>
-                <path refid="org.jboss.esb.tests.base.classpath"/>
-                <pathelement location="${org.jboss.esb.core.classes.dir}"/>
-                <pathelement location="${org.jboss.esb.tests.classes.dir}"/>
-            </classpath>
-        </junit>
-        <junitreport>
-            <fileset dir="${org.jboss.esb.tests.report.dir}">
-                <include name="*.xml"/>
-            </fileset>
-            <report format="frames" todir="${org.jboss.esb.tests.report.dir}"/>
-            <report format="noframes" todir="${org.jboss.esb.tests.report.dir}"/>
-        </junitreport>
+    	<!-- Run the tests -->
+        <antcall target="org.jboss.esb.services.internal.test.exec"/>        
+
+    	<!-- Generate the coverage report -->
+	    <emma>
+			<report sourcepath="${org.jboss.esb.module.src.dir}" sort="+block,+name,+method,+class" metrics="method:70,block:80,line:80,class:100">
+		        <fileset dir="${org.jboss.esb.module.tests.coverage.dir}" >
+					<include name="*.emma" />
+		        </fileset>
+		        <html outfile="${org.jboss.esb.module.tests.coverage.dir}/index.html" depth="method" columns="name,line,class,method,block"/>
+			</report>
+	    </emma>
     </target>
 
-
     <!-- ====================================================================== -->
-    <!--                 F U NC T I O N A L   T E S T S                         -->
+    <!--         U N I T   A N D   F U N C T I O N A L   T E S T S              -->
     <!-- ====================================================================== -->
-    <target name="org.jboss.esb.common.internal.test.functional">
+    <target name="org.jboss.esb.services.internal.test.exec">
         <echo message="Running tests for module"/>
         <junit printsummary="yes" haltonerror="yes" haltonfailure="yes" showoutput="no" fork="true">
             <formatter type="plain" usefile="false"/>
             <formatter type="xml"/>
             <batchtest todir="${org.jboss.esb.tests.report.dir}">
-                <fileset dir="${org.jboss.esb.tests.classes.dir}">
-                    <include name="**/**/common/**/**FuncTest.class"/>
+                <fileset dir="${org.jboss.esb.module.tests.src.dir}">
+                    <include name="**/**UnitTest.java"/>
+                    <include name="**/**FuncTest.java"/>
                 </fileset>
             </batchtest>
             <classpath>
+        		<!-- using instrumented code for code coverage -->
+                <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}"/>
                 <path refid="org.jboss.esb.tests.base.classpath"/>
-                <pathelement location="${org.jboss.esb.core.classes.dir}"/>
-                <pathelement location="${org.jboss.esb.tests.classes.dir}"/>
             </classpath>
+			<!-- emma jvm args -->
+			<jvmarg value="-Demma.coverage.out.file=${org.jboss.esb.module.tests.coverage.dir}/coverage.emma" />
+			<jvmarg value="-Demma.coverage.out.merge=true" />
         </junit>
         <junitreport>
             <fileset dir="${org.jboss.esb.tests.report.dir}">
@@ -113,5 +114,4 @@
             <report format="noframes" todir="${org.jboss.esb.tests.report.dir}"/>
         </junitreport>
     </target>
-
 </project>

Added: labs/jbossesb/trunk/product/core/common/tests/src/org/jboss/soa/esb/StreamUtils.java
===================================================================
--- labs/jbossesb/trunk/product/core/common/tests/src/org/jboss/soa/esb/StreamUtils.java	2006-07-26 13:43:12 UTC (rev 5291)
+++ labs/jbossesb/trunk/product/core/common/tests/src/org/jboss/soa/esb/StreamUtils.java	2006-07-26 13:56:35 UTC (rev 5292)
@@ -0,0 +1,57 @@
+/*
+ * 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;
+
+import java.io.ByteArrayOutputStream;
+import java.io.IOException;
+import java.io.InputStream;
+
+import junit.framework.TestCase;
+
+/**
+ * Stream handling utilities for testing.
+ * @author <a href="mailto:tom.fennelly at jboss.com">tom.fennelly at jboss.com</a>
+ */
+public class StreamUtils {
+
+	/**
+	 * Read the supplied InputStream and return as an array of bytes.
+	 * @param stream The stream to read.
+	 * @return The stream contents in an array of bytes.
+	 */
+	public static byte[] readStream(InputStream stream) {
+		ByteArrayOutputStream outBuffer = new ByteArrayOutputStream();
+		byte[] buffer = new byte[256];
+		int readCount = 0;
+		
+		try {
+			while((readCount = stream.read(buffer)) != -1) {
+				outBuffer.write(buffer, 0, readCount);
+			}
+		} catch (IOException e) {
+			e.printStackTrace();
+			TestCase.fail("Error reading input stream - See above stack trace.");
+		}		
+		
+		return outBuffer.toByteArray();
+	}
+}

Added: labs/jbossesb/trunk/product/core/common/tests/src/org/jboss/soa/esb/StringUtils.java
===================================================================
--- labs/jbossesb/trunk/product/core/common/tests/src/org/jboss/soa/esb/StringUtils.java	2006-07-26 13:43:12 UTC (rev 5291)
+++ labs/jbossesb/trunk/product/core/common/tests/src/org/jboss/soa/esb/StringUtils.java	2006-07-26 13:56:35 UTC (rev 5292)
@@ -0,0 +1,70 @@
+/*
+ * 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;
+
+/**
+ * Utility methods for string manipulation and testing.
+ * @author <a href="mailto:tom.fennelly at jboss.com">tom.fennelly at jboss.com</a>
+ */
+public class StringUtils {
+
+	/**
+	 * Compare the supplied strings, ignoring line break characters.
+	 * @param string1 The 1st string.
+	 * @param string2 The 2nd string.
+	 * @param ignorecase True if a case insensitive comparison is to
+	 * be performed, otherwise false. 
+	 * @return True if the strings are equal, otherwise false.
+	 */
+	public static boolean equalsIgnoreLinebreaks(String string1, String string2, boolean ignorecase) {
+		string1 = removeChar(string1, '\r');
+		string1 = removeChar(string1, '\n');
+		string2 = removeChar(string2, '\r');
+		string2 = removeChar(string2, '\n');
+
+		if(ignorecase) {
+			return string1.equalsIgnoreCase(string2);
+		} else {
+			return string1.equals(string2);
+		}
+	}
+	
+	/**
+	 * Delete all instances of the specified character from the supplied string.
+	 * @param string The string to be opperated on.
+	 * @param character The character to be removed.
+	 */
+	public static String removeChar(String string, char character) {
+		StringBuffer stringBuf = new StringBuffer(string);
+		int index = 0;
+		
+		while(index < stringBuf.length()) {
+			if(stringBuf.charAt(index) == character) {
+				stringBuf.deleteCharAt(index);
+			} else {
+				index++;
+			}
+		}
+		
+		return stringBuf.toString();
+	}
+}

Added: labs/jbossesb/trunk/product/core/common/tests/src/org/jboss/soa/esb/helpers/DomElementUnitTest.java
===================================================================
--- labs/jbossesb/trunk/product/core/common/tests/src/org/jboss/soa/esb/helpers/DomElementUnitTest.java	2006-07-26 13:43:12 UTC (rev 5291)
+++ labs/jbossesb/trunk/product/core/common/tests/src/org/jboss/soa/esb/helpers/DomElementUnitTest.java	2006-07-26 13:56:35 UTC (rev 5292)
@@ -0,0 +1,260 @@
+/*
+ * 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.helpers;
+
+import java.io.ByteArrayOutputStream;
+import java.io.IOException;
+import java.util.Arrays;
+
+import org.jboss.soa.esb.StreamUtils;
+import org.jboss.soa.esb.StringUtils;
+import org.jboss.soa.esb.common.tests.BaseTest;
+import org.xml.sax.SAXException;
+
+/**
+ * Unit tests for the DomElement class.
+ * @author <a href="mailto:tom.fennelly at jboss.com">tom.fennelly at jboss.com</a>
+ */
+public class DomElementUnitTest extends BaseTest {
+
+	public void test_fromInputStream_args() throws SAXException, IOException {
+		try {
+			DomElement.fromInputStream(null);
+			fail("Expected IllegalArgumentException on null stream.");
+		} catch(IllegalArgumentException e) {
+			// Expected
+		}
+	}
+	
+	public void test_fromInputStream_and_toXML() throws SAXException, IOException {
+		DomElement domElement = DomElement.fromInputStream(getClass().getResourceAsStream("testfile1.xml"));
+		ByteArrayOutputStream output;
+		byte[] expected = StreamUtils.readStream(getClass().getResourceAsStream("expected_01.xml"));
+		
+		// Create the DomElement from a Stream.  Then...
+		// Dump the XML to a buffer and compare it with the expected - checking that the
+		// Created DomElement DOM is the same as what was supplied in the stream.  Also
+		// tests the toXML method.  If this fails, either fromInputStream is not working correctly
+		// or the toXML method is not serialising correctly.
+		output = domElement.toXml();
+		assertTrue("DomElement creation from a stream failed, or, DomElement toXML failed - failed to produce the same XML.", 
+				StringUtils.equalsIgnoreLinebreaks(new String(expected), output.toString(), false));
+	}
+
+	public void test_fromXML_args() throws SAXException, IOException {		
+		try {
+			DomElement.fromXml(null);
+			fail("Expected IllegalArgumentException on null String.");
+		} catch(IllegalArgumentException e) {
+			// Expected
+		}
+		try {
+			DomElement.fromXml(" ");
+			fail("Expected IllegalArgumentException on null String.");
+		} catch(IllegalArgumentException e) {
+			// Expected
+		}
+	}
+
+	public void test_fromXML_and_toXML() throws SAXException, IOException {
+		byte[] source = StreamUtils.readStream(getClass().getResourceAsStream("expected_01.xml"));
+		DomElement domElement = DomElement.fromXml(new String(source));
+		ByteArrayOutputStream output;
+		byte[] expected = source;
+		
+		// Create the DomElement from a String.  Then...
+		// Dump the XML to a buffer and compare it with the expected - checking that the
+		// Created DomElement DOM is the same as what was supplied in the stream.  Also
+		// tests the toXML method.  If this fails, either fromInputStream is not working correctly
+		// or the toXML method is not serialising correctly.
+		output = domElement.toXml();
+		assertTrue("DomElement creation from a String failed, or, DomElement toXML failed - failed to produce the same XML.", 
+				StringUtils.equalsIgnoreLinebreaks(new String(expected), output.toString(), false));
+	}
+
+	public void test_Constructor_W3CElement() throws SAXException, IOException {
+		DomElement domElement = DomElement.fromInputStream(getClass().getResourceAsStream("testfile1.xml"));
+		ByteArrayOutputStream output;
+		byte[] expected = StreamUtils.readStream(getClass().getResourceAsStream("expected_01.xml"));
+		
+		// Create a new DomElement from an existing one and compare it with the expected.
+		domElement = new DomElement(domElement.getDomElement());
+		assertTrue("DomElement creation from a stream failed, or, DomElement(Element) Constructor failed - failed to produce the same XML.", 
+				StringUtils.equalsIgnoreLinebreaks(new String(expected), new String(domElement.toXml().toByteArray()), false));
+	}
+
+	public void test_Constructor_String_withoutparent() throws SAXException, IOException {
+		// Create a new DomElement from without a parent DomElement.
+		DomElement domElement = new DomElement("newDomElement");
+		
+		assertEquals("New DomElement invalid.", "<newDomElement/>" + DomElement.LINE_BREAK, domElement.toString());
+	}
+	
+	public void test_getName() {
+		DomElement domElement = new DomElement("newDomElement");
+		assertEquals("getName returned invalid data.", "newDomElement", domElement.getName());
+	}
+	
+	public void test_getAttrKeys_hasnokeys() throws SAXException, IOException {
+		DomElement domElement = new DomElement("newDomElement");
+		String[] expected = new String[] {};
+		String[] actual = domElement.getAttrKeys();
+		
+		assertTrue("invalid attribute name list", Arrays.equals(expected, actual));
+	}
+	
+	public void test_getAttrKeys_haskeys() throws SAXException, IOException {
+		DomElement domElement = DomElement.fromInputStream(getClass().getResourceAsStream("testfile2.xml"));
+		String[] expected = new String[] {"attrib1", "attrib2", "attrib3"};
+		String[] actual = domElement.getAttrKeys();
+		
+		assertTrue("invalid attribute name list", Arrays.equals(expected, actual));
+	}
+	
+	public void test_getAttr() throws SAXException, IOException {
+		DomElement domElement = DomElement.fromInputStream(getClass().getResourceAsStream("testfile2.xml"));
+		
+		assertEquals("invalid attribute value", "value2", domElement.getAttr("attrib2"));
+		assertEquals("invalid attribute value", null, domElement.getAttr("attribXX"));
+	}
+	
+	public void test_getTextChildren() throws SAXException, IOException {
+		// This test also tests the static method getTextValue. 
+		DomElement domElement = DomElement.fromInputStream(getClass().getResourceAsStream("testfile3.xml"));
+		
+		// REVIEW: These tests capture the current behavior of the getTextChildren method.  I'm not convinced this behavior is correct!!
+		// I think perhaps this method should not be depending on getTextValue because getTextValue
+		// concatentates the child text nodes.
+		assertTrue("invalid Text Children list", 
+				Arrays.equals(new String[] {"Some root text... and some more root text..."}, domElement.getTextChildren("root")));
+		assertTrue("invalid Text Children list", 
+				Arrays.equals(new String[] {"", "Some nested text..."}, domElement.getTextChildren("el")));
+	}
+
+	public void test_getElementChildren() throws SAXException, IOException {
+		DomElement domElement = DomElement.fromInputStream(getClass().getResourceAsStream("testfile3.xml"));
+		DomElement[] domElements;
+
+		// Test the root element - of which there's only 1...
+		domElements = domElement.getElementChildren("root");
+		assertEquals("Wrong number of DomElement ElementChildren.", 1, domElements.length);
+		String expected = new String(StreamUtils.readStream(getClass().getResourceAsStream("expected_03.xml"))).trim();
+		assertEquals("Wrong DomElement ElementChild value.", expected, domElements[0].toString().trim());
+
+		// Test the nested <el> elements - of which there are 2...
+		domElements = domElement.getElementChildren("el");
+		assertEquals("Wrong number of DomElement ElementChildren.", 2, domElements.length);
+		assertEquals("Wrong DomElement ElementChild value.", "<el index=\"1\"/>", domElements[0].toString().trim());
+		assertEquals("Wrong DomElement ElementChild value.", "<el index=\"2\">Some nested text...</el>", domElements[1].toString().trim());
+
+		// Test for a non-existant element...
+		domElements = domElement.getElementChildren("xxxx");
+		assertEquals("Wrong number of DomElement ElementChildren.", 0, domElements.length);
+	}
+	
+	public void test_getFirstElementChild() throws SAXException, IOException {
+		DomElement domElement = DomElement.fromInputStream(getClass().getResourceAsStream("testfile3.xml"));
+		
+		// Test the root element - of which there's only 1...
+		domElement = domElement.getFirstElementChild("root");
+		String expected = new String(StreamUtils.readStream(getClass().getResourceAsStream("expected_03.xml"))).trim();
+		assertEquals("Wrong DomElement ElementChild value.", expected, domElement.toString().trim());
+
+		// Test the nested <el> elements - of which there are 2...
+		domElement = domElement.getFirstElementChild("el");
+		assertEquals("Wrong DomElement ElementChild value.", "<el index=\"1\"/>", domElement.toString().trim());
+
+		// Test for a non-existant element...
+		domElement = domElement.getFirstElementChild("xxxx");
+		assertEquals("Expected null DomElement ElementChildren for non-existant element.", null, domElement);
+	}
+
+	public void test_getAllElemChildren() throws SAXException, IOException {
+		DomElement domElement = DomElement.fromInputStream(getClass().getResourceAsStream("testfile3.xml"));
+		DomElement[] domElements;
+
+		domElements = domElement.getAllElemChildren();
+		assertEquals("Wrong number of DomElement ElementChildren.", 2, domElements.length);
+		assertEquals("Wrong DomElement ElementChild value.", "<el index=\"1\"/>", domElements[0].toString().trim());
+		assertEquals("Wrong DomElement ElementChild value.", "<el index=\"2\">Some nested text...</el>", domElements[1].toString().trim());
+
+		// REVIEW: Note, this method only returns DomElement instances for the child elements
+		// of the document root node. Comparing this to the behaviour of getFirstElementChild
+		// would seem to demonstrate an inconsitency???  To be consistent, I would expect this method 
+		// to return a list of 3 DomElement instances - the <root> and 2 <el> elements.
+	}
+	
+	public void test_setAttr() throws SAXException, IOException {
+		DomElement domElement = new DomElement("newDomElement");
+		
+		domElement.setAttr("attrib1", "value1");
+		assertEquals("value1", domElement.getAttr("attrib1"));
+
+		// A null value removes the attribute.
+		domElement.setAttr("attrib1", null);
+		assertEquals(null, domElement.getAttr("attrib1"));
+
+		// null attrib name currently just causes the method to return???
+		domElement.setAttr(null, null);
+	}
+	
+	public void test_addElemChild() throws SAXException, IOException {
+		DomElement domElement1 = new DomElement("newDomElement");
+		DomElement domElementX = new DomElement("X");
+		DomElement domElementY1 = new DomElement("Y1");
+		DomElement domElementY2 = new DomElement("Y2");
+		
+		domElement1.addElemChild(domElementX);
+		domElement1.addElemChild(domElementY1);
+		domElementX.addElemChild(domElementY2);
+		assertEquals("<newDomElement><X/><Y1/></newDomElement>", domElement1.toString().trim());
+		// REVIEW: Note how Y2 wasn't added to X???
+	}
+	
+	public void test_rmvChildsByName() throws SAXException, IOException {
+		DomElement domElement1 = new DomElement("newDomElement");
+		DomElement domElementX = new DomElement("X");
+		DomElement domElementY1 = new DomElement("Y1");
+		DomElement domElementY2 = new DomElement("Y2");
+		
+		domElement1.addElemChild(domElementX);
+		domElement1.addElemChild(domElementY1);
+		domElementX.addElemChild(domElementY2);
+		assertEquals("<newDomElement><X/><Y1/></newDomElement>", domElement1.toString().trim());
+		domElement1.rmvChildsByName("Y1");
+		assertEquals("<newDomElement><X/></newDomElement>", domElement1.toString().trim());
+	}
+	
+	public void test_cloneObj() throws SAXException, IOException {
+		DomElement domElement1 = new DomElement("newDomElement");
+		DomElement domElementX = new DomElement("X");
+		DomElement domElementY = new DomElement("Y");
+		
+		domElement1.addElemChild(domElementX);
+		domElement1.addElemChild(domElementY);
+		
+		DomElement clone = domElement1.cloneObj();
+		
+		assertTrue("Clone should produce a completely different object", (domElement1 != clone));
+		assertEquals("Clone should produce the same XML", domElement1.toString(), clone.toString());
+	}
+}

Added: labs/jbossesb/trunk/product/core/common/tests/src/org/jboss/soa/esb/helpers/expected_01.xml
===================================================================
--- labs/jbossesb/trunk/product/core/common/tests/src/org/jboss/soa/esb/helpers/expected_01.xml	2006-07-26 13:43:12 UTC (rev 5291)
+++ labs/jbossesb/trunk/product/core/common/tests/src/org/jboss/soa/esb/helpers/expected_01.xml	2006-07-26 13:56:35 UTC (rev 5292)
@@ -0,0 +1,7 @@
+<test>
+	<el index="1"/>
+	<el index="2">
+		<el index="2.1"/>
+		And some text...
+	</el>
+</test>

Added: labs/jbossesb/trunk/product/core/common/tests/src/org/jboss/soa/esb/helpers/expected_02.xml
===================================================================
--- labs/jbossesb/trunk/product/core/common/tests/src/org/jboss/soa/esb/helpers/expected_02.xml	2006-07-26 13:43:12 UTC (rev 5291)
+++ labs/jbossesb/trunk/product/core/common/tests/src/org/jboss/soa/esb/helpers/expected_02.xml	2006-07-26 13:56:35 UTC (rev 5292)
@@ -0,0 +1 @@
+<test>&#10;<el index="1"/>&#10;<el index="2">&#10;<el index="2.1"/>&#10;And some text...&#10;</el>&#10;</test>
\ No newline at end of file

Added: labs/jbossesb/trunk/product/core/common/tests/src/org/jboss/soa/esb/helpers/expected_03.xml
===================================================================
--- labs/jbossesb/trunk/product/core/common/tests/src/org/jboss/soa/esb/helpers/expected_03.xml	2006-07-26 13:43:12 UTC (rev 5291)
+++ labs/jbossesb/trunk/product/core/common/tests/src/org/jboss/soa/esb/helpers/expected_03.xml	2006-07-26 13:56:35 UTC (rev 5292)
@@ -0,0 +1 @@
+<root><el index="1"/>Some root text...<el index="2">Some nested text...</el> and some more root text...</root>
\ No newline at end of file

Added: labs/jbossesb/trunk/product/core/common/tests/src/org/jboss/soa/esb/helpers/testfile1.xml
===================================================================
--- labs/jbossesb/trunk/product/core/common/tests/src/org/jboss/soa/esb/helpers/testfile1.xml	2006-07-26 13:43:12 UTC (rev 5291)
+++ labs/jbossesb/trunk/product/core/common/tests/src/org/jboss/soa/esb/helpers/testfile1.xml	2006-07-26 13:56:35 UTC (rev 5292)
@@ -0,0 +1,7 @@
+<test>
+	<el index="1"/>
+	<el index="2">
+		<el index="2.1"/>
+		And some text...
+	</el>
+</test>
\ No newline at end of file

Added: labs/jbossesb/trunk/product/core/common/tests/src/org/jboss/soa/esb/helpers/testfile2.xml
===================================================================
--- labs/jbossesb/trunk/product/core/common/tests/src/org/jboss/soa/esb/helpers/testfile2.xml	2006-07-26 13:43:12 UTC (rev 5291)
+++ labs/jbossesb/trunk/product/core/common/tests/src/org/jboss/soa/esb/helpers/testfile2.xml	2006-07-26 13:56:35 UTC (rev 5292)
@@ -0,0 +1 @@
+<test attrib1="value1" attrib2="value2" attrib3="valu3" />
\ No newline at end of file

Added: labs/jbossesb/trunk/product/core/common/tests/src/org/jboss/soa/esb/helpers/testfile3.xml
===================================================================
--- labs/jbossesb/trunk/product/core/common/tests/src/org/jboss/soa/esb/helpers/testfile3.xml	2006-07-26 13:43:12 UTC (rev 5291)
+++ labs/jbossesb/trunk/product/core/common/tests/src/org/jboss/soa/esb/helpers/testfile3.xml	2006-07-26 13:56:35 UTC (rev 5292)
@@ -0,0 +1 @@
+<root><el index="1"/>Some root text...<el index="2">Some nested text...</el> and some more root text...</root>
\ No newline at end of file

Modified: labs/jbossesb/trunk/product/core/listeners/tests/build.xml
===================================================================
--- labs/jbossesb/trunk/product/core/listeners/tests/build.xml	2006-07-26 13:43:12 UTC (rev 5291)
+++ labs/jbossesb/trunk/product/core/listeners/tests/build.xml	2006-07-26 13:56:35 UTC (rev 5292)
@@ -1,10 +1,11 @@
 <?xml version="1.0"?>
 <project name="build.listeners.tests" default="org.jboss.esb.listeners.tests.compile" basedir=".">
 
+    <property name="org.jboss.esb.module.src.dir" value="../src"/>
+    <property name="org.jboss.esb.module.classes.dir" value="${org.jboss.esb.internal.dest}/classes/listeners"/>
+    <property name="org.jboss.esb.module.tests.src.dir" value="${basedir}/src"/>
     <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.core.classes.dir" value="${org.jboss.esb.internal.dest}/classes"/>
-    <property name="org.jboss.esb.tests.src.dir" value="${basedir}/src"/>
     <property name="org.jboss.esb.root.dir" value="../.."/>
     <property environment="env"/>
 
@@ -15,8 +16,8 @@
 
     <path id="org.jboss.esb.tests.base.classpath">
         <fileset dir="../${org.jboss.esb.ext.lib.dir}"
-                 includes="activation.jar jbossall-client.jar log4j.jar mail.jar junit.jar"/>
-        <pathelement location="${org.jboss.esb.core.classes.dir}"/>
+                 includes="activation.jar jbossall-client.jar log4j.jar mail.jar junit.jar emma.jar emma_ant.jar"/>
+        <pathelement location="${org.jboss.esb.module.classes.dir}"/>
     </path>
 
     <target name="org.jboss.esb.tests.init">
@@ -42,68 +43,68 @@
                 debug="${org.jboss.esb.debug}"
                 optimize="${org.jboss.esb.optimize}"
                 >
-            <src path="${org.jboss.esb.tests.src.dir}"/>
+            <src path="${org.jboss.esb.module.tests.src.dir}"/>
         </javac>
 
     </target>
 
+	<taskdef resource="emma_ant.properties" classpathref="org.jboss.esb.tests.base.classpath" />
 
     <!-- ====================================================================== -->
     <!--                             T E S T                                    -->
     <!-- ====================================================================== -->
     <target name="org.jboss.esb.listeners.internal.test">
-        <antcall target="org.jboss.esb.listeners.internal.test.unit"/>
-        <antcall target="org.jboss.esb.listeners.internal.test.functional"/>
-    </target>
+	    <property name="org.jboss.esb.module.tests.coverage.dir" value="${org.jboss.esb.internal.dest}/tests/coverage/listeners"/>
+        <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"/>        
 
-    <!-- ====================================================================== -->
-    <!--                       U N I T   T E S T S                              -->
-    <!-- ====================================================================== -->
-    <target name="org.jboss.esb.listeners.internal.test.unit">
-        <echo message="Running tests for module"/>
-        <junit printsummary="yes" haltonerror="yes" haltonfailure="yes" showoutput="no" fork="true">
-            <formatter type="plain" usefile="false"/>
-            <formatter type="xml"/>
-            <batchtest todir="${org.jboss.esb.tests.report.dir}">
-                <fileset dir="${org.jboss.esb.tests.classes.dir}">
-                    <include name="**/**/listeners/**/**UnitTest.class"/>
-                </fileset>
-            </batchtest>
-            <classpath>
-                <path refid="org.jboss.esb.tests.base.classpath"/>
-                <pathelement location="${org.jboss.esb.core.classes.dir}"/>
-                <pathelement location="${org.jboss.esb.tests.classes.dir}"/>
-            </classpath>
-        </junit>
-        <junitreport>
-            <fileset dir="${org.jboss.esb.tests.report.dir}">
-                <include name="*.xml"/>
-            </fileset>
-            <report format="frames" todir="${org.jboss.esb.tests.report.dir}"/>
-            <report format="noframes" todir="${org.jboss.esb.tests.report.dir}"/>
-        </junitreport>
+    	<!-- Generate the coverage report -->
+	    <emma>
+			<report sourcepath="${org.jboss.esb.module.src.dir}" sort="+block,+name,+method,+class" metrics="method:70,block:80,line:80,class:100">
+		        <fileset dir="${org.jboss.esb.module.tests.coverage.dir}" >
+					<include name="*.emma" />
+		        </fileset>
+		        <html outfile="${org.jboss.esb.module.tests.coverage.dir}/index.html" depth="method" columns="name,line,class,method,block"/>
+			</report>
+	    </emma>
     </target>
 
-
     <!-- ====================================================================== -->
-    <!--                 F U NC T I O N A L   T E S T S                         -->
+    <!--         U N I T   A N D   F U N C T I O N A L   T E S T S              -->
     <!-- ====================================================================== -->
-    <target name="org.jboss.esb.listeners.internal.test.functional">
+    <target name="org.jboss.esb.services.internal.test.exec">
         <echo message="Running tests for module"/>
         <junit printsummary="yes" haltonerror="yes" haltonfailure="yes" showoutput="no" fork="true">
             <formatter type="plain" usefile="false"/>
             <formatter type="xml"/>
             <batchtest todir="${org.jboss.esb.tests.report.dir}">
-                <fileset dir="${org.jboss.esb.tests.classes.dir}">
-                    <include name="**/**/listeners/**/**FuncTest.class"/>
+                <fileset dir="${org.jboss.esb.module.tests.src.dir}">
+                    <include name="**/**UnitTest.java"/>
+                    <include name="**/**FuncTest.java"/>
                 </fileset>
             </batchtest>
             <classpath>
+        		<!-- using instrumented code for code coverage -->
+                <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}"/>
                 <path refid="org.jboss.esb.tests.base.classpath"/>
-                <pathelement location="${org.jboss.esb.core.classes.dir}"/>
-                <pathelement location="${org.jboss.esb.tests.classes.dir}"/>
             </classpath>
+			<!-- emma jvm args -->
+			<jvmarg value="-Demma.coverage.out.file=${org.jboss.esb.module.tests.coverage.dir}/coverage.emma" />
+			<jvmarg value="-Demma.coverage.out.merge=true" />
         </junit>
         <junitreport>
             <fileset dir="${org.jboss.esb.tests.report.dir}">
@@ -113,5 +114,4 @@
             <report format="noframes" todir="${org.jboss.esb.tests.report.dir}"/>
         </junitreport>
     </target>
-
 </project>

Added: labs/jbossesb/trunk/product/core/processors/src/org/jboss/soa/esb/processors/Zap.java
===================================================================
--- labs/jbossesb/trunk/product/core/processors/src/org/jboss/soa/esb/processors/Zap.java	2006-07-26 13:43:12 UTC (rev 5291)
+++ labs/jbossesb/trunk/product/core/processors/src/org/jboss/soa/esb/processors/Zap.java	2006-07-26 13:56:35 UTC (rev 5292)
@@ -0,0 +1,5 @@
+package org.jboss.soa.esb.processors;
+
+public class Zap {
+
+}

Modified: labs/jbossesb/trunk/product/core/processors/tests/build.xml
===================================================================
--- labs/jbossesb/trunk/product/core/processors/tests/build.xml	2006-07-26 13:43:12 UTC (rev 5291)
+++ labs/jbossesb/trunk/product/core/processors/tests/build.xml	2006-07-26 13:56:35 UTC (rev 5292)
@@ -1,10 +1,11 @@
 <?xml version="1.0"?>
 <project name="build.processors.tests" default="org.jboss.esb.processors.tests.compile" basedir=".">
 
+    <property name="org.jboss.esb.module.src.dir" value="../src"/>
+    <property name="org.jboss.esb.module.classes.dir" value="${org.jboss.esb.internal.dest}/classes/processors"/>
+    <property name="org.jboss.esb.module.tests.src.dir" value="${basedir}/src"/>
     <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.core.classes.dir" value="${org.jboss.esb.internal.dest}/classes"/>
-    <property name="org.jboss.esb.tests.src.dir" value="${basedir}/src"/>
     <property name="org.jboss.esb.root.dir" value="../.."/>
     <property environment="env"/>
 
@@ -15,8 +16,8 @@
 
     <path id="org.jboss.esb.tests.base.classpath">
         <fileset dir="../${org.jboss.esb.ext.lib.dir}"
-                 includes="activation.jar jbossall-client.jar log4j.jar mail.jar junit.jar"/>
-        <pathelement location="${org.jboss.esb.core.classes.dir}"/>
+                 includes="activation.jar jbossall-client.jar log4j.jar mail.jar junit.jar emma.jar emma_ant.jar"/>
+        <pathelement location="${org.jboss.esb.module.classes.dir}"/>
     </path>
 
     <target name="org.jboss.esb.tests.init">
@@ -42,68 +43,68 @@
                 debug="${org.jboss.esb.debug}"
                 optimize="${org.jboss.esb.optimize}"
                 >
-            <src path="${org.jboss.esb.tests.src.dir}"/>
+            <src path="${org.jboss.esb.module.tests.src.dir}"/>
         </javac>
 
     </target>
 
+	<taskdef resource="emma_ant.properties" classpathref="org.jboss.esb.tests.base.classpath" />
 
     <!-- ====================================================================== -->
     <!--                             T E S T                                    -->
     <!-- ====================================================================== -->
     <target name="org.jboss.esb.processors.internal.test">
-        <antcall target="org.jboss.esb.processors.internal.test.unit"/>
-        <antcall target="org.jboss.esb.processors.internal.test.functional"/>
-    </target>
+	    <property name="org.jboss.esb.module.tests.coverage.dir" value="${org.jboss.esb.internal.dest}/tests/coverage/processors"/>
+        <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>        
 
-    <!-- ====================================================================== -->
-    <!--                       U N I T   T E S T S                              -->
-    <!-- ====================================================================== -->
-    <target name="org.jboss.esb.processors.internal.test.unit">
-        <echo message="Running tests for module"/>
-        <junit printsummary="yes" haltonerror="yes" haltonfailure="yes" showoutput="no" fork="true">
-            <formatter type="plain" usefile="false"/>
-            <formatter type="xml"/>
-            <batchtest todir="${org.jboss.esb.tests.report.dir}">
-                <fileset dir="${org.jboss.esb.tests.classes.dir}">
-                    <include name="**/**/processors/**/**UnitTest.class"/>
-                </fileset>
-            </batchtest>
-            <classpath>
-                <path refid="org.jboss.esb.tests.base.classpath"/>
-                <pathelement location="${org.jboss.esb.core.classes.dir}"/>
-                <pathelement location="${org.jboss.esb.tests.classes.dir}"/>
-            </classpath>
-        </junit>
-        <junitreport>
-            <fileset dir="${org.jboss.esb.tests.report.dir}">
-                <include name="*.xml"/>
-            </fileset>
-            <report format="frames" todir="${org.jboss.esb.tests.report.dir}"/>
-            <report format="noframes" todir="${org.jboss.esb.tests.report.dir}"/>
-        </junitreport>
+    	<!-- Run the tests -->
+        <antcall target="org.jboss.esb.services.internal.test.exec"/>        
+
+    	<!-- Generate the coverage report -->
+	    <emma>
+			<report sourcepath="${org.jboss.esb.module.src.dir}" sort="+block,+name,+method,+class" metrics="method:70,block:80,line:80,class:100">
+		        <fileset dir="${org.jboss.esb.module.tests.coverage.dir}" >
+					<include name="*.emma" />
+		        </fileset>
+		        <html outfile="${org.jboss.esb.module.tests.coverage.dir}/index.html" depth="method" columns="name,line,class,method,block"/>
+			</report>
+	    </emma>
     </target>
 
-
     <!-- ====================================================================== -->
-    <!--                 F U NC T I O N A L   T E S T S                         -->
+    <!--         U N I T   A N D   F U N C T I O N A L   T E S T S              -->
     <!-- ====================================================================== -->
-    <target name="org.jboss.esb.processors.internal.test.functional">
+    <target name="org.jboss.esb.services.internal.test.exec">
         <echo message="Running tests for module"/>
         <junit printsummary="yes" haltonerror="yes" haltonfailure="yes" showoutput="no" fork="true">
             <formatter type="plain" usefile="false"/>
             <formatter type="xml"/>
             <batchtest todir="${org.jboss.esb.tests.report.dir}">
-                <fileset dir="${org.jboss.esb.tests.classes.dir}">
-                    <include name="**/**/processors/**/**FuncTest.class"/>
+                <fileset dir="${org.jboss.esb.module.tests.src.dir}">
+                    <include name="**/**UnitTest.java"/>
+                    <include name="**/**FuncTest.java"/>
                 </fileset>
             </batchtest>
             <classpath>
+        		<!-- using instrumented code for code coverage -->
+                <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}"/>
                 <path refid="org.jboss.esb.tests.base.classpath"/>
-                <pathelement location="${org.jboss.esb.core.classes.dir}"/>
-                <pathelement location="${org.jboss.esb.tests.classes.dir}"/>
             </classpath>
+			<!-- emma jvm args -->
+			<jvmarg value="-Demma.coverage.out.file=${org.jboss.esb.module.tests.coverage.dir}/coverage.emma" />
+			<jvmarg value="-Demma.coverage.out.merge=true" />
         </junit>
         <junitreport>
             <fileset dir="${org.jboss.esb.tests.report.dir}">
@@ -113,5 +114,4 @@
             <report format="noframes" todir="${org.jboss.esb.tests.report.dir}"/>
         </junitreport>
     </target>
-
 </project>

Modified: labs/jbossesb/trunk/product/core/processors/tests/src/org/jboss/soa/esb/processors/tests/DummyUnitTest.java
===================================================================
--- labs/jbossesb/trunk/product/core/processors/tests/src/org/jboss/soa/esb/processors/tests/DummyUnitTest.java	2006-07-26 13:43:12 UTC (rev 5291)
+++ labs/jbossesb/trunk/product/core/processors/tests/src/org/jboss/soa/esb/processors/tests/DummyUnitTest.java	2006-07-26 13:56:35 UTC (rev 5292)
@@ -22,6 +22,7 @@
 package org.jboss.soa.esb.processors.tests;
 
 import org.jboss.soa.esb.common.tests.BaseTest;
+import org.jboss.soa.esb.processors.Zap;
 
 /**
  * Dummy test file.
@@ -40,6 +41,7 @@
        log.info("****************************************************************");
        log.info("  Dummy unit test called. Replace this with module level tests");
        log.info("****************************************************************");
+       new Zap();
    }
 
 }

Modified: labs/jbossesb/trunk/product/core/services/src/org/jboss/soa/esb/internal/core/objectstore/BobjStore.java
===================================================================
--- labs/jbossesb/trunk/product/core/services/src/org/jboss/soa/esb/internal/core/objectstore/BobjStore.java	2006-07-26 13:43:12 UTC (rev 5291)
+++ labs/jbossesb/trunk/product/core/services/src/org/jboss/soa/esb/internal/core/objectstore/BobjStore.java	2006-07-26 13:56:35 UTC (rev 5292)
@@ -1,206 +1,267 @@
 /*
-* 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 java.net.URI;
 import java.util.*;
 
 import org.jboss.soa.esb.common.*;
 import org.jboss.soa.esb.helpers.*;
 import org.jboss.soa.esb.util.*;
 
-public class BobjStore
-{
-  private static String DATASRC_JNDI_NAME;
-  public  static void	setDataSourceJndi(String p_s){ DATASRC_JNDI_NAME = p_s; }
-  public  static String getDataSourceJndi() 		 { return DATASRC_JNDI_NAME; }
+public class BobjStore {
+	private static String DATASRC_JNDI_NAME;
 
-  private static String TBL_UIDS;
-  public  static void	setUidTableName(String p_s) { TBL_UIDS = p_s; }
-  public  static String getUidTableName() { return TBL_UIDS; }
+	public static void setDataSourceJndi(String p_s) {
+		DATASRC_JNDI_NAME = p_s;
+	}
 
-  private static String TBL_BATCHES;
-  public  static void	setBatchTableName(String p_s) { TBL_BATCHES = p_s; }
-  public  static String getBatchTableName() { return TBL_BATCHES; }
+	public static String getDataSourceJndi() {
+		return DATASRC_JNDI_NAME;
+	}
 
-  private static final Map<String,BobjStore> s_oStoreMap 
-  		= new HashMap<String,BobjStore>();
+	private static String TBL_UIDS;
 
-  static
-  {	try
-  	{	DomElement oConf = DomElement.fromURL(EsbSysProps.getObjStoreConfigFile());
-  		if (null!=oConf)
-  		{
-  		  setDataSourceJndi		(oConf.getAttr("dataSourceJndiName"));
-  		  setUidTableName		(oConf.getAttr("uidTable"));
-  		  setBatchTableName	(oConf.getAttr("batchTable"));
-  		  for (DomElement oCurr : oConf.getElementChildren("Class"))
-  		  {	String sClass = oCurr.getAttr("name");
-  			boolean bCrypt = "true".equalsIgnoreCase(oCurr.getAttr("encrypt"));
-  			
-			BobjStore oNew = new BobjStore
-  				(oCurr.getAttr("type")
-  				,oCurr.getAttr("table")
-  				,null
-  				,sClass.substring(1+sClass.lastIndexOf("."))
-  				,bCrypt
-  				);
+	public static void setUidTableName(String p_s) {
+		TBL_UIDS = p_s;
+	}
 
-  			for (DomElement oIcurr : oCurr.getElementChildren("Index"))
-  				oNew.addLocatorTable(oIcurr.getAttr("table"));
-  			s_oStoreMap.put(sClass,oNew);
-  		  }
-  		}
-  	}
-  	catch (Exception e)
-  	{	EsbUtil.getDefaultLogger(BobjStore.class).error("BobjStore configuration FAILED"
-  				,e);
-  	}
-	
-  };
-  
-  private   String  m_sSnapType , m_sSnapTbl    , m_sClass;
-  private	List<String> m_olLocators;
-  private   boolean m_bEncrypt=false;
+	public static String getUidTableName() {
+		return TBL_UIDS;
+	}
 
-  /**
-   * Snapshot type getter - The value assigned to this attribute will help if
-   * standard SQL queries are required to surf the Object Store's snapshot tables
-   * @return String - Value of snapshot type
-   * @see Istorable#getSnapType()
-   */
-  public String       getSnapType()     { return m_sSnapType; }
-  /**
-   * Snapshot tablename getter - The value assigned to this attribute is the
-   * name of the snapshot table for this object
-   * @return String - name of SQL table where snapshots of objects will be stored
-   * @see Istorable#getSnapTable()
-   */
-  public String       getSnapTable()    { return m_sSnapTbl; }
-  /**
-   * First locator tablename getter - Locator tables are also called index tables.
-   * @return String - name of SQL table where locators(0) will be stored
-   * @see Istorable#getLocatorTable()
-   * @see BusinessObject#getObjLocator()
-   */
-  public String       getLocatorTable() { return getLocatorTable(0); }
-  /**
-   * Obtain Nth locator table 
-   * @param p_n - Index for desired locator table
-   * @return String - name of Nth SQL table where  for objects will be stored
-   * @see BaseBusinessObject#locator(p_i)
-   */
-  public String       getLocatorTable(int p_n) 
-  	{ return (null==m_olLocators) ? null
-  			: (m_olLocators.size() <= p_n) ? null
-  			: m_olLocators.get(p_n); 
-  	}
+	private static String TBL_BATCHES;
 
-  /**
-   * Obtain all locator table names
-   * @return Names of all locator tables
-   */
-  public String[] allLocatorTables()
-	  {	return (null==m_olLocators) ? new String[] {}
-	  		: m_olLocators.toArray(new String[m_olLocators.size()]);
-	  }
-  /**
-   * Class suffix getter - Deprecated - Left here for backwards compatibility
-   * @return String - Class suffix
-   * @see Istorable#getLocatorTable()
-   * @see BusinessObject#getObjLocator()
-   */
-  public String       getClassSuffix()    { return m_sClass; }
-  /**
-   * Encryption requirement getter
-   * @return boolean - true if Objects stored using this descriptor have to be
-   * encrypted - decrypted at storage/retrieval time
-   */
-  public boolean isEncrypted() { return m_bEncrypt; }
+	public static void setBatchTableName(String p_s) {
+		TBL_BATCHES = p_s;
+	}
 
-  /**
-   * Constructor using all fields required by a BobjStore object
-   * @param p_sSnapType String - Snapshot type
-   * @param p_sSnapTbl String - Snapshot SQL tablename
-   * @param p_sLocTbl String - Locator SQL tablename (may be null - No locator table)
-   * @param p_sCls String - Class name excluding package prefix
-   * @param p_bCrypt boolean - Does data have to be encrypted in the snap table ?
-   * @see Istorable
-   * @see BusinessObject#classNm()
-   */
-  protected BobjStore (String p_sSnapType,String p_sSnapTbl, String p_sLocTbl
-                    ,String p_sCls, boolean p_bCrypt)
-  { m_sSnapType = p_sSnapType;
-    m_sSnapTbl  = p_sSnapTbl;
-    addLocatorTable(p_sLocTbl);
-    m_sClass    = p_sCls;
-    m_bEncrypt  = p_bCrypt;
-  } //________________________________
+	public static String getBatchTableName() {
+		return TBL_BATCHES;
+	}
 
-  private void addLocatorTable(String p_s)
-  {	if (EsbUtil.isNullString(p_s))		return;
-	if (null==m_olLocators)
-		m_olLocators = new ArrayList<String>();
-	m_olLocators.add(p_s);
-  } //________________________________
-  
-  /**
-   * Constructor for non encrypted BobjStore
-   * @param p_sSnapType String
-   * @param p_sSnapTbl String
-   * @param p_sLocTbl String
-   * @param p_sCls String
-   * @see BobjStore#BobjStore(String,String,String,String,boolean)
-   */
-  protected BobjStore (String p_sSnapType,String p_sSnapTbl, String p_sLocTbl
-                    ,String p_sCls)
-  { this(p_sSnapType,p_sSnapTbl,p_sLocTbl,p_sCls,false);
-  } //________________________________
+	private static final Map<String, BobjStore> s_oStoreMap = new HashMap<String, BobjStore>();
 
-  /**
-   * Get a BobjStore object that describes persistence details for objects of
-   * class &lt;arg 1&gt;
-   * @param p_sClassName Class to search for in descriptor table
-   * @return BobjStore - A descriptor that will provide persistence info
-   * @see JbossEsbPersistHandler
-   * @see BobjStore#getStore(BusinessObject)
-   */
-  public static BobjStore getStore (String p_sClassName)
-  { if (EsbUtil.isNullString(p_sClassName))  return null;
-  	return s_oStoreMap.get(p_sClassName);
-  } //__________________________________
+	static {
+		try {
+			URI objStoreConfig = URI.create(
+					EsbSysProps.getObjStoreConfigFile());
+			DomElement oConf = DomElement.fromInputStream(
+					objStoreConfig.toURL().openStream());
 
-  /**
-   * Get a BobjStore object that describes persistence details for
-   * BobjStdDTO &lt;arg 1&gt;
-   * @param p_sClassName BobjStdDTO for which we need an object store
-   * @return BobjStore - A descriptor that will provide persistence info
-   * @see JbossEsbPersistHandler
-   * @see BobjStore#getStore(String)
-   */
-  public static BobjStore getStore (BobjStdDTO p_oDto)
-  { if (null == p_oDto)		return null;
-  	return getStore(p_oDto.fullClassName());
-  } //__________________________________
+			if (null != oConf) {
+				setDataSourceJndi(oConf.getAttr("dataSourceJndiName"));
+				setUidTableName(oConf.getAttr("uidTable"));
+				setBatchTableName(oConf.getAttr("batchTable"));
+				for (DomElement oCurr : oConf.getElementChildren("Class")) {
+					String sClass = oCurr.getAttr("name");
+					boolean bCrypt = "true".equalsIgnoreCase(oCurr
+							.getAttr("encrypt"));
 
-} //____________________________________________________________________________
+					BobjStore oNew = new BobjStore(oCurr.getAttr("type"), oCurr
+							.getAttr("table"), null, sClass
+							.substring(1 + sClass.lastIndexOf(".")), bCrypt);
+
+					for (DomElement oIcurr : oCurr.getElementChildren("Index"))
+						oNew.addLocatorTable(oIcurr.getAttr("table"));
+					s_oStoreMap.put(sClass, oNew);
+				}
+			}
+		} catch (Exception e) {
+			EsbUtil.getDefaultLogger(BobjStore.class).error(
+					"BobjStore configuration FAILED", e);
+		}
+
+	};
+
+	private String m_sSnapType, m_sSnapTbl, m_sClass;
+
+	private List<String> m_olLocators;
+
+	private boolean m_bEncrypt = false;
+
+	/**
+	 * Snapshot type getter - The value assigned to this attribute will help if
+	 * standard SQL queries are required to surf the Object Store's snapshot
+	 * tables
+	 * 
+	 * @return String - Value of snapshot type
+	 * @see Istorable#getSnapType()
+	 */
+	public String getSnapType() {
+		return m_sSnapType;
+	}
+
+	/**
+	 * Snapshot tablename getter - The value assigned to this attribute is the
+	 * name of the snapshot table for this object
+	 * 
+	 * @return String - name of SQL table where snapshots of objects will be
+	 *         stored
+	 * @see Istorable#getSnapTable()
+	 */
+	public String getSnapTable() {
+		return m_sSnapTbl;
+	}
+
+	/**
+	 * First locator tablename getter - Locator tables are also called index
+	 * tables.
+	 * 
+	 * @return String - name of SQL table where locators(0) will be stored
+	 * @see Istorable#getLocatorTable()
+	 * @see BusinessObject#getObjLocator()
+	 */
+	public String getLocatorTable() {
+		return getLocatorTable(0);
+	}
+
+	/**
+	 * Obtain Nth locator table
+	 * 
+	 * @param p_n -
+	 *            Index for desired locator table
+	 * @return String - name of Nth SQL table where for objects will be stored
+	 * @see BaseBusinessObject#locator(p_i)
+	 */
+	public String getLocatorTable(int p_n) {
+		return (null == m_olLocators) ? null
+				: (m_olLocators.size() <= p_n) ? null : m_olLocators.get(p_n);
+	}
+
+	/**
+	 * Obtain all locator table names
+	 * 
+	 * @return Names of all locator tables
+	 */
+	public String[] allLocatorTables() {
+		return (null == m_olLocators) ? new String[] {} : m_olLocators
+				.toArray(new String[m_olLocators.size()]);
+	}
+
+	/**
+	 * Class suffix getter - Deprecated - Left here for backwards compatibility
+	 * 
+	 * @return String - Class suffix
+	 * @see Istorable#getLocatorTable()
+	 * @see BusinessObject#getObjLocator()
+	 */
+	public String getClassSuffix() {
+		return m_sClass;
+	}
+
+	/**
+	 * Encryption requirement getter
+	 * 
+	 * @return boolean - true if Objects stored using this descriptor have to be
+	 *         encrypted - decrypted at storage/retrieval time
+	 */
+	public boolean isEncrypted() {
+		return m_bEncrypt;
+	}
+
+	/**
+	 * Constructor using all fields required by a BobjStore object
+	 * 
+	 * @param p_sSnapType
+	 *            String - Snapshot type
+	 * @param p_sSnapTbl
+	 *            String - Snapshot SQL tablename
+	 * @param p_sLocTbl
+	 *            String - Locator SQL tablename (may be null - No locator
+	 *            table)
+	 * @param p_sCls
+	 *            String - Class name excluding package prefix
+	 * @param p_bCrypt
+	 *            boolean - Does data have to be encrypted in the snap table ?
+	 * @see Istorable
+	 * @see BusinessObject#classNm()
+	 */
+	protected BobjStore(String p_sSnapType, String p_sSnapTbl,
+			String p_sLocTbl, String p_sCls, boolean p_bCrypt) {
+		m_sSnapType = p_sSnapType;
+		m_sSnapTbl = p_sSnapTbl;
+		addLocatorTable(p_sLocTbl);
+		m_sClass = p_sCls;
+		m_bEncrypt = p_bCrypt;
+	} // ________________________________
+
+	private void addLocatorTable(String p_s) {
+		if (EsbUtil.isNullString(p_s))
+			return;
+		if (null == m_olLocators)
+			m_olLocators = new ArrayList<String>();
+		m_olLocators.add(p_s);
+	} // ________________________________
+
+	/**
+	 * Constructor for non encrypted BobjStore
+	 * 
+	 * @param p_sSnapType
+	 *            String
+	 * @param p_sSnapTbl
+	 *            String
+	 * @param p_sLocTbl
+	 *            String
+	 * @param p_sCls
+	 *            String
+	 * @see BobjStore#BobjStore(String,String,String,String,boolean)
+	 */
+	protected BobjStore(String p_sSnapType, String p_sSnapTbl,
+			String p_sLocTbl, String p_sCls) {
+		this(p_sSnapType, p_sSnapTbl, p_sLocTbl, p_sCls, false);
+	} // ________________________________
+
+	/**
+	 * Get a BobjStore object that describes persistence details for objects of
+	 * class &lt;arg 1&gt;
+	 * 
+	 * @param p_sClassName
+	 *            Class to search for in descriptor table
+	 * @return BobjStore - A descriptor that will provide persistence info
+	 * @see JbossEsbPersistHandler
+	 * @see BobjStore#getStore(BusinessObject)
+	 */
+	public static BobjStore getStore(String p_sClassName) {
+		if (EsbUtil.isNullString(p_sClassName))
+			return null;
+		return s_oStoreMap.get(p_sClassName);
+	} // __________________________________
+
+	/**
+	 * Get a BobjStore object that describes persistence details for BobjStdDTO
+	 * &lt;arg 1&gt;
+	 * 
+	 * @param p_sClassName
+	 *            BobjStdDTO for which we need an object store
+	 * @return BobjStore - A descriptor that will provide persistence info
+	 * @see JbossEsbPersistHandler
+	 * @see BobjStore#getStore(String)
+	 */
+	public static BobjStore getStore(BobjStdDTO p_oDto) {
+		if (null == p_oDto)
+			return null;
+		return getStore(p_oDto.fullClassName());
+	} // __________________________________
+
+} // ____________________________________________________________________________

Modified: labs/jbossesb/trunk/product/core/services/src/org/jboss/soa/esb/services/EJB/JbossEsbNotificationHandler.java
===================================================================
--- labs/jbossesb/trunk/product/core/services/src/org/jboss/soa/esb/services/EJB/JbossEsbNotificationHandler.java	2006-07-26 13:43:12 UTC (rev 5291)
+++ labs/jbossesb/trunk/product/core/services/src/org/jboss/soa/esb/services/EJB/JbossEsbNotificationHandler.java	2006-07-26 13:56:35 UTC (rev 5292)
@@ -5,7 +5,7 @@
 
 /**
  * Remote interface for JbossEsbNotificationHandler.
- * @xdoclet-generated at July 5 2006
+ * @xdoclet-generated at July 24 2006
  * @copyright The XDoclet Team
  * @author XDoclet
  * @version ${version}

Modified: labs/jbossesb/trunk/product/core/services/src/org/jboss/soa/esb/services/EJB/JbossEsbNotificationHandlerLocalHome.java
===================================================================
--- labs/jbossesb/trunk/product/core/services/src/org/jboss/soa/esb/services/EJB/JbossEsbNotificationHandlerLocalHome.java	2006-07-26 13:43:12 UTC (rev 5291)
+++ labs/jbossesb/trunk/product/core/services/src/org/jboss/soa/esb/services/EJB/JbossEsbNotificationHandlerLocalHome.java	2006-07-26 13:56:35 UTC (rev 5292)
@@ -5,7 +5,7 @@
 
 /**
  * Local home interface for JbossEsbNotificationHandler.
- * @xdoclet-generated at July 5 2006
+ * @xdoclet-generated at July 24 2006
  * @copyright The XDoclet Team
  * @author XDoclet
  * @version ${version}

Modified: labs/jbossesb/trunk/product/core/services/src/org/jboss/soa/esb/services/EJB/JbossEsbPersistHandler.java
===================================================================
--- labs/jbossesb/trunk/product/core/services/src/org/jboss/soa/esb/services/EJB/JbossEsbPersistHandler.java	2006-07-26 13:43:12 UTC (rev 5291)
+++ labs/jbossesb/trunk/product/core/services/src/org/jboss/soa/esb/services/EJB/JbossEsbPersistHandler.java	2006-07-26 13:56:35 UTC (rev 5292)
@@ -5,7 +5,7 @@
 
 /**
  * Remote interface for JbossEsbPersistHandler.
- * @xdoclet-generated at July 12 2006
+ * @xdoclet-generated at July 24 2006
  * @copyright The XDoclet Team
  * @author XDoclet
  * @version ${version}

Modified: labs/jbossesb/trunk/product/core/services/src/org/jboss/soa/esb/services/EJB/JbossEsbPersistHandlerLocalHome.java
===================================================================
--- labs/jbossesb/trunk/product/core/services/src/org/jboss/soa/esb/services/EJB/JbossEsbPersistHandlerLocalHome.java	2006-07-26 13:43:12 UTC (rev 5291)
+++ labs/jbossesb/trunk/product/core/services/src/org/jboss/soa/esb/services/EJB/JbossEsbPersistHandlerLocalHome.java	2006-07-26 13:56:35 UTC (rev 5292)
@@ -5,7 +5,7 @@
 
 /**
  * Local home interface for JbossEsbPersistHandler.
- * @xdoclet-generated at July 12 2006
+ * @xdoclet-generated at July 24 2006
  * @copyright The XDoclet Team
  * @author XDoclet
  * @version ${version}

Added: labs/jbossesb/trunk/product/core/services/src/org/jboss/soa/esb/services/Zap.java
===================================================================
--- labs/jbossesb/trunk/product/core/services/src/org/jboss/soa/esb/services/Zap.java	2006-07-26 13:43:12 UTC (rev 5291)
+++ labs/jbossesb/trunk/product/core/services/src/org/jboss/soa/esb/services/Zap.java	2006-07-26 13:56:35 UTC (rev 5292)
@@ -0,0 +1,5 @@
+package org.jboss.soa.esb.services;
+
+public class Zap {
+
+}

Modified: labs/jbossesb/trunk/product/core/services/tests/build.xml
===================================================================
--- labs/jbossesb/trunk/product/core/services/tests/build.xml	2006-07-26 13:43:12 UTC (rev 5291)
+++ labs/jbossesb/trunk/product/core/services/tests/build.xml	2006-07-26 13:56:35 UTC (rev 5292)
@@ -1,10 +1,11 @@
 <?xml version="1.0"?>
 <project name="build.services.tests" default="org.jboss.esb.services.tests.compile" basedir=".">
 
+    <property name="org.jboss.esb.module.src.dir" value="../src"/>
+    <property name="org.jboss.esb.module.classes.dir" value="${org.jboss.esb.internal.dest}/classes/services"/>
+    <property name="org.jboss.esb.module.tests.src.dir" value="${basedir}/src"/>
     <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.core.classes.dir" value="${org.jboss.esb.internal.dest}/classes"/>
-    <property name="org.jboss.esb.tests.src.dir" value="${basedir}/src"/>
     <property name="org.jboss.esb.root.dir" value="../.."/>
     <property environment="env"/>
 
@@ -13,16 +14,12 @@
         <equals arg1="${org.jboss.esb.frominstall}" arg2="yes"/>
     </condition>
 
-
-
-
     <path id="org.jboss.esb.tests.base.classpath">
         <fileset dir="../${org.jboss.esb.ext.lib.dir}"
-                 includes="activation.jar jbossall-client.jar log4j.jar mail.jar junit.jar"/>
+                 includes="activation.jar jbossall-client.jar log4j.jar mail.jar junit.jar emma.jar emma_ant.jar"/>
 
-        <pathelement location="${org.jboss.esb.core.classes.dir}/common"/>
-        <pathelement location="${org.jboss.esb.core.classes.dir}/services"/>
-
+        <pathelement location="${org.jboss.esb.module.classes.dir}"/>
+        <pathelement location="${org.jboss.esb.internal.dest}/classes/common"/>
     </path>
 
     <target name="org.jboss.esb.tests.init">
@@ -48,68 +45,68 @@
                 debug="${org.jboss.esb.debug}"
                 optimize="${org.jboss.esb.optimize}"
                 >
-            <src path="${org.jboss.esb.tests.src.dir}"/>
+            <src path="${org.jboss.esb.module.tests.src.dir}"/>
         </javac>
 
     </target>
 
+	<taskdef resource="emma_ant.properties" classpathref="org.jboss.esb.tests.base.classpath" />
 
     <!-- ====================================================================== -->
     <!--                             T E S T                                    -->
     <!-- ====================================================================== -->
     <target name="org.jboss.esb.services.internal.test">
-        <antcall target="org.jboss.esb.services.internal.test.unit"/>        
-        <antcall target="org.jboss.esb.services.internal.test.functional"/>
-    </target>
+	    <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>        
 
-    <!-- ====================================================================== -->
-    <!--                       U N I T   T E S T S                              -->
-    <!-- ====================================================================== -->
-    <target name="org.jboss.esb.services.internal.test.unit">
-        <echo message="Running tests for module"/>
-        <junit printsummary="yes" haltonerror="yes" haltonfailure="yes" showoutput="no" fork="true">
-            <formatter type="plain" usefile="false"/>
-            <formatter type="xml"/>
-            <batchtest todir="${org.jboss.esb.tests.report.dir}">
-                <fileset dir="${org.jboss.esb.tests.classes.dir}">
-                    <include name="**/**/services/**/**UnitTest.class"/>
-                </fileset>
-            </batchtest>
-            <classpath>
-                <path refid="org.jboss.esb.tests.base.classpath"/>
-                <pathelement location="${org.jboss.esb.core.classes.dir}"/>
-                <pathelement location="${org.jboss.esb.tests.classes.dir}"/>
-            </classpath>
-        </junit>
-        <junitreport>
-            <fileset dir="${org.jboss.esb.tests.report.dir}">
-                <include name="*.xml"/>
-            </fileset>
-            <report format="frames" todir="${org.jboss.esb.tests.report.dir}"/>
-            <report format="noframes" todir="${org.jboss.esb.tests.report.dir}"/>
-        </junitreport>
+    	<!-- Run the tests -->
+        <antcall target="org.jboss.esb.services.internal.test.exec"/>        
+
+    	<!-- Generate the coverage report -->
+	    <emma>
+			<report sourcepath="${org.jboss.esb.module.src.dir}" sort="+block,+name,+method,+class" metrics="method:70,block:80,line:80,class:100">
+		        <fileset dir="${org.jboss.esb.module.tests.coverage.dir}" >
+					<include name="*.emma" />
+		        </fileset>
+		        <html outfile="${org.jboss.esb.module.tests.coverage.dir}/index.html" depth="method" columns="name,line,class,method,block"/>
+			</report>
+	    </emma>
     </target>
 
-
     <!-- ====================================================================== -->
-    <!--                 F U NC T I O N A L   T E S T S                         -->
+    <!--         U N I T   A N D   F U N C T I O N A L   T E S T S              -->
     <!-- ====================================================================== -->
-    <target name="org.jboss.esb.services.internal.test.functional">
+    <target name="org.jboss.esb.services.internal.test.exec">
         <echo message="Running tests for module"/>
         <junit printsummary="yes" haltonerror="yes" haltonfailure="yes" showoutput="no" fork="true">
             <formatter type="plain" usefile="false"/>
             <formatter type="xml"/>
             <batchtest todir="${org.jboss.esb.tests.report.dir}">
-                <fileset dir="${org.jboss.esb.tests.classes.dir}">
-                    <include name="**/**/services/**/**FuncTest.class"/>
+                <fileset dir="${org.jboss.esb.module.tests.src.dir}">
+                    <include name="**/**UnitTest.java"/>
+                    <include name="**/**FuncTest.java"/>
                 </fileset>
             </batchtest>
             <classpath>
-                <path refid="org.jboss.esb.tests.base.classpath"/>
-                <pathelement location="${org.jboss.esb.core.classes.dir}"/>
+        		<!-- using instrumented code for code coverage -->
+                <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}"/>
+                <path refid="org.jboss.esb.tests.base.classpath"/>
             </classpath>
+			<!-- emma jvm args -->
+			<jvmarg value="-Demma.coverage.out.file=${org.jboss.esb.module.tests.coverage.dir}/coverage.emma" />
+			<jvmarg value="-Demma.coverage.out.merge=true" />
         </junit>
         <junitreport>
             <fileset dir="${org.jboss.esb.tests.report.dir}">
@@ -119,5 +116,4 @@
             <report format="noframes" todir="${org.jboss.esb.tests.report.dir}"/>
         </junitreport>
     </target>
-
 </project>

Modified: labs/jbossesb/trunk/product/core/services/tests/src/org/jboss/soa/esb/services/tests/notification/NotificationFuncTest.java
===================================================================
--- labs/jbossesb/trunk/product/core/services/tests/src/org/jboss/soa/esb/services/tests/notification/NotificationFuncTest.java	2006-07-26 13:43:12 UTC (rev 5291)
+++ labs/jbossesb/trunk/product/core/services/tests/src/org/jboss/soa/esb/services/tests/notification/NotificationFuncTest.java	2006-07-26 13:56:35 UTC (rev 5292)
@@ -29,7 +29,8 @@
 import org.jboss.soa.esb.helpers.*;
 import org.jboss.soa.esb.helpers.persist.SimpleDataSource;
 import org.jboss.soa.esb.notification.*;
-import org.jboss.soa.esb.services.*;
+import org.jboss.soa.esb.services.InotificationHandler;
+import org.jboss.soa.esb.services.Zap;
 
 // DON'T FORGET !!
 // The Rosetta Application server has to be up and running 
@@ -49,6 +50,7 @@
         log.info("*******************************************");
         log.info("Requires Implementation");
         log.info("*******************************************");
+        new Zap();
     }
 
     /*

Added: labs/jbossesb/trunk/product/lib/ext/emma.jar
===================================================================
(Binary files differ)


Property changes on: labs/jbossesb/trunk/product/lib/ext/emma.jar
___________________________________________________________________
Name: svn:mime-type
   + application/octet-stream

Added: labs/jbossesb/trunk/product/lib/ext/emma_ant.jar
===================================================================
(Binary files differ)


Property changes on: labs/jbossesb/trunk/product/lib/ext/emma_ant.jar
___________________________________________________________________
Name: svn:mime-type
   + application/octet-stream




More information about the jboss-svn-commits mailing list