[jboss-svn-commits] JBL Code SVN: r7561 - in labs/jbossesb/trunk: product/console/resources/WEB-INF product/console/resources/WEB-INF/classes product/console/src/org/jboss/soa/esb/admin/console/contract product/console/src/org/jboss/soa/esb/admin/console/transform/flow product/console/view/contract product/console/view/transform product/core/listeners/src/org/jboss/soa/esb/actions/converters product/core/listeners/src/org/jboss/soa/esb/listeners/message product/core/listeners/tests/src product/core/listeners/tests/src/org/jboss/soa/esb/actions product/core/listeners/tests/src/org/jboss/soa/esb/actions/converters product/lib/ext qa qa/junit/src qa/junit/src/org/jboss/soa/esb/actions

jboss-svn-commits at lists.jboss.org jboss-svn-commits at lists.jboss.org
Mon Nov 13 07:32:09 EST 2006


Author: tfennelly
Date: 2006-11-13 07:31:38 -0500 (Mon, 13 Nov 2006)
New Revision: 7561

Added:
   labs/jbossesb/trunk/product/console/view/transform/smooks-config.xhtml
   labs/jbossesb/trunk/product/core/listeners/tests/src/org/jboss/soa/esb/actions/converters/SmooksTransformerUnitTest.java
   labs/jbossesb/trunk/product/core/listeners/tests/src/org/jboss/soa/esb/actions/converters/smooks-test.cdrl
   labs/jbossesb/trunk/product/lib/ext/milyn-commons-0.8-SNAPSHOT.jar
   labs/jbossesb/trunk/qa/junit/src/org/jboss/soa/esb/actions/SmooksTransformerConfig.xml
   labs/jbossesb/trunk/qa/junit/src/org/jboss/soa/esb/actions/SmooksTransformerTest.java
   labs/jbossesb/trunk/qa/junit/src/org/jboss/soa/esb/actions/smooks-test.cdrl
   labs/jbossesb/trunk/qa/junit/src/smooks-cdr.lst
Removed:
   labs/jbossesb/trunk/product/console/resources/WEB-INF/classes/.gpd.pageflow.jpdl.xml
   labs/jbossesb/trunk/product/console/resources/WEB-INF/classes/pageflow.jpdl.xml
   labs/jbossesb/trunk/product/console/resources/WEB-INF/classes/xxx_persistence.xml
   labs/jbossesb/trunk/product/console/view/transform/list-resources-as-smooks-config.xhtml
   labs/jbossesb/trunk/product/console/view/transform/smooks.xhtml
   labs/jbossesb/trunk/product/core/listeners/tests/src/org/jboss/soa/esb/actions/SmooksTransformerUnitTest.java
   labs/jbossesb/trunk/product/core/listeners/tests/src/org/jboss/soa/esb/actions/smooks-test.cdrl
   labs/jbossesb/trunk/product/lib/ext/milyn-commons-0.7.jar
   labs/jbossesb/trunk/qa/qatests.log
Modified:
   labs/jbossesb/trunk/product/console/resources/WEB-INF/components.xml
   labs/jbossesb/trunk/product/console/resources/WEB-INF/faces-config.xml
   labs/jbossesb/trunk/product/console/resources/WEB-INF/pages.xml
   labs/jbossesb/trunk/product/console/src/org/jboss/soa/esb/admin/console/contract/ManageContracts.java
   labs/jbossesb/trunk/product/console/src/org/jboss/soa/esb/admin/console/transform/flow/SelectMessageFlow.java
   labs/jbossesb/trunk/product/console/view/contract/template.xhtml
   labs/jbossesb/trunk/product/console/view/transform/add-resource-parameter.xhtml
   labs/jbossesb/trunk/product/console/view/transform/list-resources.xhtml
   labs/jbossesb/trunk/product/console/view/transform/new-trans-resource-create.xhtml
   labs/jbossesb/trunk/product/console/view/transform/new-trans-resource-target.xhtml
   labs/jbossesb/trunk/product/console/view/transform/select-message-flow-from-epr.xhtml
   labs/jbossesb/trunk/product/console/view/transform/select-message-flow-from-type.xhtml
   labs/jbossesb/trunk/product/console/view/transform/select-message-flow-to-epr.xhtml
   labs/jbossesb/trunk/product/console/view/transform/select-message-flow-to-type.xhtml
   labs/jbossesb/trunk/product/console/view/transform/template.xhtml
   labs/jbossesb/trunk/product/console/view/transform/view-resource.xhtml
   labs/jbossesb/trunk/product/core/listeners/src/org/jboss/soa/esb/actions/converters/SmooksTransformer.java
   labs/jbossesb/trunk/product/core/listeners/src/org/jboss/soa/esb/listeners/message/ActionProcessingPipeline.java
   labs/jbossesb/trunk/product/core/listeners/tests/src/smooks-cdr.lst
   labs/jbossesb/trunk/product/lib/ext/milyn-smooks-core-0.8-SNAPSHOT.jar
Log:
Removed use of jpdl on a nexted conversation because it seemed to be causing intermittent "no active conversation" problems.

Added some QA tests.

Deleted: labs/jbossesb/trunk/product/console/resources/WEB-INF/classes/.gpd.pageflow.jpdl.xml
===================================================================
--- labs/jbossesb/trunk/product/console/resources/WEB-INF/classes/.gpd.pageflow.jpdl.xml	2006-11-12 21:53:07 UTC (rev 7560)
+++ labs/jbossesb/trunk/product/console/resources/WEB-INF/classes/.gpd.pageflow.jpdl.xml	2006-11-13 12:31:38 UTC (rev 7561)
@@ -1,3 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-
-<pageflow-diagram />
\ No newline at end of file

Deleted: labs/jbossesb/trunk/product/console/resources/WEB-INF/classes/pageflow.jpdl.xml
===================================================================
--- labs/jbossesb/trunk/product/console/resources/WEB-INF/classes/pageflow.jpdl.xml	2006-11-12 21:53:07 UTC (rev 7560)
+++ labs/jbossesb/trunk/product/console/resources/WEB-INF/classes/pageflow.jpdl.xml	2006-11-13 12:31:38 UTC (rev 7561)
@@ -1,47 +0,0 @@
-<pageflow-definition name="selectMessageFlow">
-   
-   <start-page name="from-epr" view-id="/transform/select-message-flow-from-epr.xhtml">
-      <redirect/>
-      <transition name="next" to="assertDisplayFromType" />
-      <transition name="cancel" to="cancelSelection" />
-   </start-page>
-   
-   <decision name="assertDisplayFromType" expression="#{messageFlowSelect.fromEPRSelected}">
-      <transition name="true" to="from-type"/>
-      <transition name="false" to="to-epr"/>
-   </decision>
-
-   <page name="from-type" view-id="/transform/select-message-flow-from-type.xhtml">
-      <redirect/>
-      <transition name="next" to="to-epr" />
-      <transition name="cancel" to="cancelSelection" />
-   </page>
-
-   <page name="to-epr" view-id="/transform/select-message-flow-to-epr.xhtml">
-      <redirect/>
-      <transition name="next" to="assertDisplayToType" />
-      <transition name="cancel" to="cancelSelection" />
-   </page>
-   
-   <decision name="assertDisplayToType" expression="#{messageFlowSelect.toEPRSelected}">
-      <transition name="true" to="to-type"/>
-      <transition name="false" to="finish"/>
-   </decision>
-
-   <page name="to-type" view-id="/transform/select-message-flow-to-type.xhtml">
-      <redirect/>
-      <transition name="next" to="finish" />
-      <transition name="cancel" to="cancelSelection" />
-   </page>
-
-   <page name="cancelSelection" view-id="/home.xhtml">
-      <redirect/>
-      <end-conversation />
-   </page>
-
-   <page name="finish" view-id="/transform/select-message-flow-finish.xhtml">
-      <redirect/>
-      <end-conversation />
-   </page>
-   
-</pageflow-definition>
\ No newline at end of file

Deleted: labs/jbossesb/trunk/product/console/resources/WEB-INF/classes/xxx_persistence.xml
===================================================================
--- labs/jbossesb/trunk/product/console/resources/WEB-INF/classes/xxx_persistence.xml	2006-11-12 21:53:07 UTC (rev 7560)
+++ labs/jbossesb/trunk/product/console/resources/WEB-INF/classes/xxx_persistence.xml	2006-11-13 12:31:38 UTC (rev 7561)
@@ -1,24 +0,0 @@
-<persistence>
-   <persistence-unit name="esbDatabase">
-      <provider>org.hibernate.ejb.HibernatePersistence</provider>
-      <jta-data-source>java:/JBossESBDS</jta-data-source>
-      
-	  <class>org.jboss.soa.esb.admin.console.EPR</class>
-	  <class>org.jboss.soa.esb.admin.console.contract.MessageContract</class>
-	  <class>org.jboss.soa.esb.admin.console.transform.TransformationResource</class>
-      
-      <properties>
-         <property name="hibernate.hbm2ddl.auto" value="update"/>
-         <property name="hibernate.show_sql" value="true"/>
-		 <property name="hibernate.dialect" value="org.hibernate.dialect.PostgreSQLDialect" />
-
-         <property name="hibernate.connection.driver_class" value="org.hibernate.cache.HashtableCacheProvider"/>
-         <property name="hibernate.connection.username" value="postgres"/>
-         <property name="hibernate.connection.password" value="password"/>
-         <property name="hibernate.connection.url" value="jdbc:postgresql://localhost:5432/jbossesb"/>
-         
-         <property name="jboss.entity.manager.factory.jndi.name" value="java:/jbossEsbEntityManagerFactory"/>
-         <property name="jboss.entity.manager.jndi.name" value="java:/jbossEsbEntityManager"/>
-      </properties>
-   </persistence-unit>
-</persistence>

Modified: labs/jbossesb/trunk/product/console/resources/WEB-INF/components.xml
===================================================================
--- labs/jbossesb/trunk/product/console/resources/WEB-INF/components.xml	2006-11-12 21:53:07 UTC (rev 7560)
+++ labs/jbossesb/trunk/product/console/resources/WEB-INF/components.xml	2006-11-13 12:31:38 UTC (rev 7561)
@@ -9,10 +9,6 @@
     <component name="org.jboss.seam.core.manager">
         <property name="conversationTimeout">120000</property>
     </component>
-
-    <component class="org.jboss.seam.core.Jbpm">
-        <property name="pageflowDefinitions">pageflow.jpdl.xml</property>
-    </component>
     
     <!-- Bootstrap Hibernate -->
     <component name="esbDatabase" 

Modified: labs/jbossesb/trunk/product/console/resources/WEB-INF/faces-config.xml
===================================================================
--- labs/jbossesb/trunk/product/console/resources/WEB-INF/faces-config.xml	2006-11-12 21:53:07 UTC (rev 7560)
+++ labs/jbossesb/trunk/product/console/resources/WEB-INF/faces-config.xml	2006-11-13 12:31:38 UTC (rev 7561)
@@ -86,8 +86,8 @@
         </navigation-case>
 
         <navigation-case>
-            <from-outcome>list-resources-as-smooks-config</from-outcome>
-            <to-view-id>/transform/list-resources-as-smooks-config.xhtml</to-view-id>
+            <from-outcome>smooks-config</from-outcome>
+            <to-view-id>/transform/smooks-config.xhtml</to-view-id>
             <redirect />
         </navigation-case>
 

Modified: labs/jbossesb/trunk/product/console/resources/WEB-INF/pages.xml
===================================================================
--- labs/jbossesb/trunk/product/console/resources/WEB-INF/pages.xml	2006-11-12 21:53:07 UTC (rev 7560)
+++ labs/jbossesb/trunk/product/console/resources/WEB-INF/pages.xml	2006-11-13 12:31:38 UTC (rev 7561)
@@ -1,3 +1,7 @@
 <pages>
-	<page view-id="/transform/select-message-flow-from-epr.xhtml" action="#{messageFlowSelect.startSelection}"/>
+	<!-- Make sure that the Message Flow gets initialised... -->
+	<page view-id="/transform/select-message-flow-from-epr.xhtml" action="#{messageFlowSelect.initialise}"/>
+
+	<!-- Support GET requests for the configuration data i.e. the ESB reading the configurations... -->
+	<page view-id="/transform/smooks-config.xhtml" action="#{listAllResources.list}"/>
 </pages>
\ No newline at end of file

Modified: labs/jbossesb/trunk/product/console/src/org/jboss/soa/esb/admin/console/contract/ManageContracts.java
===================================================================
--- labs/jbossesb/trunk/product/console/src/org/jboss/soa/esb/admin/console/contract/ManageContracts.java	2006-11-12 21:53:07 UTC (rev 7560)
+++ labs/jbossesb/trunk/product/console/src/org/jboss/soa/esb/admin/console/contract/ManageContracts.java	2006-11-13 12:31:38 UTC (rev 7561)
@@ -71,22 +71,23 @@
 	/**
 	 * Get the {@link MessageContract} list factory method.
 	 */
-	@Factory("contracts")
-	public void findMessageContracts() {
+	public void readContracts() {
 		contracts = esbDatabase.createQuery("from MessageContract order by epr").list();
 	}
 	
 	@Begin(join=true)
 	public String list() {
+		readContracts();
 		return "list-message-contracts";
 	}
 	
 	public String deleteContract() {
 		selectedContract = contracts.get(contractIndex);
 		esbDatabase.delete(selectedContract);
+
+		// Re-read te contracts...
+		readContracts();
 		
-		findMessageContracts();
-		
 		return "list-message-contracts";
 	}
 

Modified: labs/jbossesb/trunk/product/console/src/org/jboss/soa/esb/admin/console/transform/flow/SelectMessageFlow.java
===================================================================
--- labs/jbossesb/trunk/product/console/src/org/jboss/soa/esb/admin/console/transform/flow/SelectMessageFlow.java	2006-11-12 21:53:07 UTC (rev 7560)
+++ labs/jbossesb/trunk/product/console/src/org/jboss/soa/esb/admin/console/transform/flow/SelectMessageFlow.java	2006-11-13 12:31:38 UTC (rev 7561)
@@ -21,20 +21,13 @@
 
 package org.jboss.soa.esb.admin.console.transform.flow;
 
-import static org.jboss.seam.ScopeType.CONVERSATION;
 import static org.jboss.seam.ScopeType.SESSION;
 
 import java.io.Serializable;
 import java.util.List;
 
-import javax.ejb.Remove;
-
 import org.hibernate.Session;
-import org.jboss.seam.annotations.Begin;
-import org.jboss.seam.annotations.Conversational;
 import org.jboss.seam.annotations.Create;
-import org.jboss.seam.annotations.Destroy;
-import org.jboss.seam.annotations.End;
 import org.jboss.seam.annotations.In;
 import org.jboss.seam.annotations.Name;
 import org.jboss.seam.annotations.Out;
@@ -43,7 +36,6 @@
 import org.jboss.seam.annotations.datamodel.DataModelSelectionIndex;
 import org.jboss.seam.contexts.Contexts;
 import org.jboss.soa.esb.admin.console.EPR;
-import org.jboss.soa.esb.admin.console.SeamUtils;
 import org.jboss.soa.esb.admin.console.contract.MessageContract;
 
 /**
@@ -51,8 +43,7 @@
  * @author <a href="mailto:tom.fennelly at jboss.com">tom.fennelly at jboss.com</a>
  */
 @Name("messageFlowSelect")
- at Scope(CONVERSATION)
- at Conversational(ifNotBegunOutcome="select-message-flow")
+ at Scope(SESSION)
 public class SelectMessageFlow implements Serializable {
 
 	@In(create=true)
@@ -80,22 +71,58 @@
 	   
 	@In(required=false) @Out(scope=SESSION)
 	private MessageFlow messageFlow;
+
+	/**
+	 * Initialise all the component members.
+	 */
+	public void initialise() {
+		if(messageFlow == null || !isMessageFlowSelected()) {
+			messageFlow = new MessageFlow();
+			Contexts.getSessionContext().set(MessageFlow.class.getName(), "set");
 	
-	public void startSelection() {		
+			fromEPRs = esbDatabase.createQuery("from EPR order by uri").list();
+			toEPRs = esbDatabase.createQuery("from EPR order by uri").list();
+		}
 	}
 
-	/*
-	 * Begin the select message flow pageflow conversation.
+	/**
+	 * Reinitialise all the component members.
 	 */
-	@Create
-	@Begin(pageflow="selectMessageFlow", nested=true)
-	public void begin() {
-		messageFlow = new MessageFlow();
-		Contexts.getSessionContext().set(MessageFlow.class.getName(), "set");
-
-		fromEPRs = esbDatabase.createQuery("from EPR order by uri").list();
-		toEPRs = esbDatabase.createQuery("from EPR order by uri").list();
+	public void reinitialise() {
+		messageFlow = null;
+		initialise();
 	}
+	
+	public String showFromEPRs() {
+		reinitialise();
+		return "select-message-flow-from-epr";
+	}
+	
+	public String showFromTypes() {
+		if(messageFlow.getFromEPR() == null) {
+			// Skip straight to the "To EPRs" form...
+			return "select-message-flow-to-epr";
+		}
+		
+		return "select-message-flow-from-type";
+	}
+	
+	public String showToEPRs() {
+		return "select-message-flow-to-epr";
+	}
+	
+	public String showToTypes() {
+		if(messageFlow.getToEPR() == null) {
+			// Skip straight to the "Finish"...
+			return "select-message-flow-finish";
+		}
+		
+		return "select-message-flow-to-type";
+	}
+	
+	public String showFinish() {
+		return "select-message-flow-finish";
+	}
 
 	/**
 	 * Select the "from" {@link EPR} action listener method.
@@ -141,23 +168,17 @@
 		messageFlow.setToMessageType(toMessageTypes.get(toMessageTypeIndex));
 	}
 
-	public void next() {		
-	}
-
-	@End
-	public void cancel() {
-		messageFlow = null;
+	/**
+	 * Cancel
+	 * @return
+	 */
+	public String cancel() {
+		messageFlow = new MessageFlow();
 		Contexts.getSessionContext().set(MessageFlow.class.getName(), "notset");
+		
+		return "home";
 	}
 	
-	public boolean isFromEPRSelected() {
-		return (messageFlow.getFromEPR() != null);
-	}
-	
-	public boolean isToEPRSelected() {
-		return (messageFlow.getToEPR() != null);
-	}
-	
 	/**
 	 * Is the {@link MessageFlow} selected on the current session.
 	 * @return True if the {@link MessageFlow} is selected on the current session, otherwise false.

Modified: labs/jbossesb/trunk/product/console/view/contract/template.xhtml
===================================================================
--- labs/jbossesb/trunk/product/console/view/contract/template.xhtml	2006-11-12 21:53:07 UTC (rev 7560)
+++ labs/jbossesb/trunk/product/console/view/contract/template.xhtml	2006-11-13 12:31:38 UTC (rev 7561)
@@ -42,7 +42,7 @@
 	</div>
 	<div id="container">
 		<div id="sidebar">
-			<b><h:outputLink value="../home.jsf"><f:verbatim>Home</f:verbatim></h:outputLink></b>
+			<b><h:form><h:commandButton value="Home" action="/home.xhtml" /></h:form></b>
 			<p/>
 			<ui:insert name="sidebar"/>
 		</div>

Modified: labs/jbossesb/trunk/product/console/view/transform/add-resource-parameter.xhtml
===================================================================
--- labs/jbossesb/trunk/product/console/view/transform/add-resource-parameter.xhtml	2006-11-12 21:53:07 UTC (rev 7560)
+++ labs/jbossesb/trunk/product/console/view/transform/add-resource-parameter.xhtml	2006-11-13 12:31:38 UTC (rev 7561)
@@ -51,7 +51,7 @@
 
 <!-- sidebar -->
 <ui:define name="sidebar">
-	<b><h:outputLink value="select-message-flow-from-epr.jsf"><f:verbatim>Set Message Flow</f:verbatim></h:outputLink></b>
+	<b><h:form><h:commandButton value="Set Message Flow" action="#{messageFlowSelect.showFromEPRs}" /></h:form></b>
 	<p/>
 	<h1>Create Transformation/Analysis Configuration</h1>
 	Create a message transformation/analysis configuration for the chosen Message Flow.

Deleted: labs/jbossesb/trunk/product/console/view/transform/list-resources-as-smooks-config.xhtml
===================================================================
--- labs/jbossesb/trunk/product/console/view/transform/list-resources-as-smooks-config.xhtml	2006-11-12 21:53:07 UTC (rev 7560)
+++ labs/jbossesb/trunk/product/console/view/transform/list-resources-as-smooks-config.xhtml	2006-11-13 12:31:38 UTC (rev 7561)
@@ -1,10 +0,0 @@
-<?xml version="1.0"?>
-<!DOCTYPE smooks-resource-list PUBLIC "-//MILYN//DTD SMOOKS 1.0//EN" "http://www.milyn.org/dtd/smooksres-list-1.0.dtd">
-
-<smooks-resource-list xmlns:f="http://java.sun.com/jsf/core" xmlns:h="http://java.sun.com/jsf/html">
-						
-	<h:outputText value="#{allResourceConfigs}" escape="false">
-		<f:converter converterId="SmooksResourceListConverter"/>
-	</h:outputText>
-
-</smooks-resource-list>

Modified: labs/jbossesb/trunk/product/console/view/transform/list-resources.xhtml
===================================================================
--- labs/jbossesb/trunk/product/console/view/transform/list-resources.xhtml	2006-11-12 21:53:07 UTC (rev 7560)
+++ labs/jbossesb/trunk/product/console/view/transform/list-resources.xhtml	2006-11-13 12:31:38 UTC (rev 7561)
@@ -54,7 +54,7 @@
 
 <!-- sidebar -->
 <ui:define name="sidebar">
-	<b><h:outputLink value="select-message-flow-from-epr.jsf"><f:verbatim>Set Message Flow</f:verbatim></h:outputLink></b>
+	<b><h:form><h:commandButton value="Set Message Flow" action="#{messageFlowSelect.showFromEPRs}" /></h:form></b>
 	<p/>
 </ui:define>
 

Modified: labs/jbossesb/trunk/product/console/view/transform/new-trans-resource-create.xhtml
===================================================================
--- labs/jbossesb/trunk/product/console/view/transform/new-trans-resource-create.xhtml	2006-11-12 21:53:07 UTC (rev 7560)
+++ labs/jbossesb/trunk/product/console/view/transform/new-trans-resource-create.xhtml	2006-11-13 12:31:38 UTC (rev 7561)
@@ -23,9 +23,9 @@
 				</div>
 				<div class="section">
 					<div class="entry">
-						<div class="label"><h:outputLabel for="Resource">Resource:</h:outputLabel></div>
+						<div class="label"><h:outputLabel for="Resource">Applied Resource:</h:outputLabel></div>
 						<div class="input">
-							<h:inputText id="Resource" value="#{transResource.path}" />
+							<h:inputText id="Resource" value="#{transResource.path}" size="100" />
 							<br/><span class="errors"><h:message for="Resource" /></span>
 						</div>
 					</div>
@@ -79,7 +79,7 @@
 
 <!-- sidebar -->
 <ui:define name="sidebar">
-	<b><h:outputLink value="select-message-flow-from-epr.jsf"><f:verbatim>Set Message Flow</f:verbatim></h:outputLink></b>
+	<b><h:form><h:commandButton value="Set Message Flow" action="#{messageFlowSelect.showFromEPRs}" /></h:form></b>
 	<p/>
 	<h1>Create Transformation/Analysis Configuration</h1>
 	Create a message transformation/analysis configuration for the chosen Message Flow.

Modified: labs/jbossesb/trunk/product/console/view/transform/new-trans-resource-target.xhtml
===================================================================
--- labs/jbossesb/trunk/product/console/view/transform/new-trans-resource-target.xhtml	2006-11-12 21:53:07 UTC (rev 7560)
+++ labs/jbossesb/trunk/product/console/view/transform/new-trans-resource-target.xhtml	2006-11-13 12:31:38 UTC (rev 7561)
@@ -70,7 +70,7 @@
 
 <!-- sidebar -->
 <ui:define name="sidebar">
-	<b><h:outputLink value="select-message-flow-from-epr.jsf"><f:verbatim>Set Message Flow</f:verbatim></h:outputLink></b>
+	<b><h:form><h:commandButton value="Set Message Flow" action="#{messageFlowSelect.showFromEPRs}" /></h:form></b>
 	<p/>
 	<h1>Create Transformation/Analysis Configuration</h1>
 	Create a message transformation/analysis configuration for the chosen Message Flow.

Modified: labs/jbossesb/trunk/product/console/view/transform/select-message-flow-from-epr.xhtml
===================================================================
--- labs/jbossesb/trunk/product/console/view/transform/select-message-flow-from-epr.xhtml	2006-11-12 21:53:07 UTC (rev 7560)
+++ labs/jbossesb/trunk/product/console/view/transform/select-message-flow-from-epr.xhtml	2006-11-13 12:31:38 UTC (rev 7561)
@@ -34,10 +34,10 @@
 		</div>
 
 		<div class="section">
-			<h:commandButton value="Continue..." action="next" class="button" />
+			<h:commandButton value="Continue..." action="#{messageFlowSelect.showFromTypes}" class="button" />
 		</div>
 		<div class="section">
-			<h:commandButton value="Cancel" action="cancel" class="button" />
+			<h:commandButton value="Cancel" action="#{messageFlowSelect.cancel}" class="button" />
 		</div>
 
 	</h:form>

Modified: labs/jbossesb/trunk/product/console/view/transform/select-message-flow-from-type.xhtml
===================================================================
--- labs/jbossesb/trunk/product/console/view/transform/select-message-flow-from-type.xhtml	2006-11-12 21:53:07 UTC (rev 7560)
+++ labs/jbossesb/trunk/product/console/view/transform/select-message-flow-from-type.xhtml	2006-11-13 12:31:38 UTC (rev 7561)
@@ -9,7 +9,7 @@
 <!-- content -->
 <ui:define name="content">
 	<h:form>
-		<h2>Select Message Flow : <i>Message Contract (<b>From</b>)...</i></h2>
+		<h2>Select Message Flow : <i>Message <u>From</u>...</i></h2>
 		
 		<div class="section">
 		    <f:verbatim rendered="#{fromMessageTypes != null and fromMessageTypes.rowCount==0}">
@@ -31,10 +31,10 @@
 		</div>
 
 		<div class="section">
-			<h:commandButton value="Continue..." action="next" class="button" />
+			<h:commandButton value="Continue..." action="#{messageFlowSelect.showToEPRs}" class="button" />
 		</div>
 		<div class="section">
-			<h:commandButton value="Cancel" action="cancel" class="button" />
+			<h:commandButton value="Cancel" action="#{messageFlowSelect.cancel}" class="button" />
 		</div>
 
 	</h:form>

Modified: labs/jbossesb/trunk/product/console/view/transform/select-message-flow-to-epr.xhtml
===================================================================
--- labs/jbossesb/trunk/product/console/view/transform/select-message-flow-to-epr.xhtml	2006-11-12 21:53:07 UTC (rev 7560)
+++ labs/jbossesb/trunk/product/console/view/transform/select-message-flow-to-epr.xhtml	2006-11-13 12:31:38 UTC (rev 7561)
@@ -26,11 +26,12 @@
 		</div>
 
 		<div class="section">
-			<h:commandButton value="Continue..." action="next" class="button" />
+			<h:commandButton value="Continue..." action="#{messageFlowSelect.showToTypes}" class="button" />
 		</div>
 		<div class="section">
-			<h:commandButton value="Cancel" action="cancel" class="button" />
+			<h:commandButton value="Cancel" action="#{messageFlowSelect.cancel}" class="button" />
 		</div>
+
 	</h:form>
 </ui:define>
 

Modified: labs/jbossesb/trunk/product/console/view/transform/select-message-flow-to-type.xhtml
===================================================================
--- labs/jbossesb/trunk/product/console/view/transform/select-message-flow-to-type.xhtml	2006-11-12 21:53:07 UTC (rev 7560)
+++ labs/jbossesb/trunk/product/console/view/transform/select-message-flow-to-type.xhtml	2006-11-13 12:31:38 UTC (rev 7561)
@@ -9,7 +9,7 @@
 <!-- content -->
 <ui:define name="content">
 	<h:form>
-		<h2>Select Message Flow : <i>Message Contract (<b>To</b>)...</i></h2>
+		<h2>Select Message Flow : <i>Message <u>To</u>...</i></h2>
 		
 		<div class="section">
 		    <f:verbatim rendered="#{toMessageTypes != null and toMessageTypes.rowCount==0}">
@@ -31,10 +31,10 @@
 		</div>
 
 		<div class="section">
-			<h:commandButton value="Continue..." action="next" class="button" />
+			<h:commandButton value="Continue..." action="#{messageFlowSelect.showFinish}" class="button" />
 		</div>
 		<div class="section">
-			<h:commandButton value="Cancel" action="cancel" class="button" />
+			<h:commandButton value="Cancel" action="#{messageFlowSelect.cancel}" class="button" />
 		</div>
 
 	</h:form>

Added: labs/jbossesb/trunk/product/console/view/transform/smooks-config.xhtml
===================================================================
--- labs/jbossesb/trunk/product/console/view/transform/smooks-config.xhtml	2006-11-12 21:53:07 UTC (rev 7560)
+++ labs/jbossesb/trunk/product/console/view/transform/smooks-config.xhtml	2006-11-13 12:31:38 UTC (rev 7561)
@@ -0,0 +1,10 @@
+<?xml version="1.0"?>
+<!DOCTYPE smooks-resource-list PUBLIC "-//MILYN//DTD SMOOKS 1.0//EN" "http://www.milyn.org/dtd/smooksres-list-1.0.dtd">
+
+<smooks-resource-list xmlns:f="http://java.sun.com/jsf/core" xmlns:h="http://java.sun.com/jsf/html">
+						
+	<h:outputText value="#{allResourceConfigs}" escape="false">
+		<f:converter converterId="SmooksResourceListConverter"/>
+	</h:outputText>
+
+</smooks-resource-list>

Deleted: labs/jbossesb/trunk/product/console/view/transform/smooks.xhtml
===================================================================
--- labs/jbossesb/trunk/product/console/view/transform/smooks.xhtml	2006-11-12 21:53:07 UTC (rev 7560)
+++ labs/jbossesb/trunk/product/console/view/transform/smooks.xhtml	2006-11-13 12:31:38 UTC (rev 7561)
@@ -1,18 +0,0 @@
-<!DOCTYPE composition PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
-<ui:composition xmlns="http://www.w3.org/1999/xhtml"
-                xmlns:ui="http://java.sun.com/jsf/facelets"
-                xmlns:h="http://java.sun.com/jsf/html"
-                xmlns:f="http://java.sun.com/jsf/core"
-				xmlns:s="http://jboss.com/products/seam/taglib"
-                template="template.xhtml">
-
-<!-- content -->
-<ui:define name="content">
-	<s:link action="#{listAllResources.list}" value="List Smooks Resources" />
-</ui:define>
-
-<!-- sidebar -->
-<ui:define name="sidebar">
-</ui:define>
-
-</ui:composition>

Modified: labs/jbossesb/trunk/product/console/view/transform/template.xhtml
===================================================================
--- labs/jbossesb/trunk/product/console/view/transform/template.xhtml	2006-11-12 21:53:07 UTC (rev 7560)
+++ labs/jbossesb/trunk/product/console/view/transform/template.xhtml	2006-11-13 12:31:38 UTC (rev 7561)
@@ -42,7 +42,7 @@
 	</div>
 	<div id="container">
 		<div id="sidebar">
-			<b><h:outputLink value="../home.jsf"><f:verbatim>Home</f:verbatim></h:outputLink></b>
+			<b><h:form><h:commandButton value="Home" action="/home.xhtml" /></h:form></b>
 			<p/>
 			<ui:insert name="sidebar"/>
 		</div>

Modified: labs/jbossesb/trunk/product/console/view/transform/view-resource.xhtml
===================================================================
--- labs/jbossesb/trunk/product/console/view/transform/view-resource.xhtml	2006-11-12 21:53:07 UTC (rev 7560)
+++ labs/jbossesb/trunk/product/console/view/transform/view-resource.xhtml	2006-11-13 12:31:38 UTC (rev 7561)
@@ -63,8 +63,8 @@
 
 <!-- sidebar -->
 <ui:define name="sidebar">
-			<b><h:outputLink value="select-message-flow-from-epr.jsf"><f:verbatim>Set Message Flow</f:verbatim></h:outputLink></b>
-			<p/>
+	<b><h:form><h:commandButton value="Set Message Flow" action="#{messageFlowSelect.showFromEPRs}" /></h:form></b>
+	<p/>
 </ui:define>
 
 </ui:composition>
\ No newline at end of file

Modified: labs/jbossesb/trunk/product/core/listeners/src/org/jboss/soa/esb/actions/converters/SmooksTransformer.java
===================================================================
--- labs/jbossesb/trunk/product/core/listeners/src/org/jboss/soa/esb/actions/converters/SmooksTransformer.java	2006-11-12 21:53:07 UTC (rev 7560)
+++ labs/jbossesb/trunk/product/core/listeners/src/org/jboss/soa/esb/actions/converters/SmooksTransformer.java	2006-11-13 12:31:38 UTC (rev 7561)
@@ -27,7 +27,9 @@
 import java.io.InputStream;
 import java.io.InputStreamReader;
 import java.io.Serializable;
-import java.io.UnsupportedEncodingException;
+import java.net.URISyntaxException;
+import java.util.ArrayList;
+import java.util.Arrays;
 import java.util.List;
 
 import org.apache.log4j.Logger;
@@ -35,11 +37,16 @@
 import org.jboss.soa.esb.actions.ActionProcessingException;
 import org.jboss.soa.esb.actions.ActionProcessor;
 import org.jboss.soa.esb.actions.ActionUtils;
+import org.jboss.soa.esb.addressing.Call;
+import org.jboss.soa.esb.addressing.EPR;
+import org.jboss.soa.esb.helpers.ConfigTree;
 import org.jboss.soa.esb.helpers.KeyValuePair;
+import org.jboss.soa.esb.message.Header;
 import org.jboss.soa.esb.message.Message;
 import org.jboss.soa.esb.services.transform.TransformationException;
 import org.jboss.soa.esb.services.transform.TransformationService;
 import org.milyn.SmooksStandalone;
+import org.milyn.device.ident.UnknownDeviceException;
 
 /**
  * Smooks Transformer.
@@ -47,18 +54,6 @@
  * This processor hooks the <a href="http://milyn.codehaus.org/Smooks">Milyn Smooks</a>
  * XML Transformation/Processing Engine into a message processing pipeline to support
  * XML message transformations.  
- * <p/>
- * Sample Action Configuration:
- * <pre>
- * &lt;Action name="Order_Xml-FROM_Acme-TO_AcmePartner" processor="SmooksTransformer"&gt;
- *     &lt;property name="message-type" value="Order" /&gt; &lt;!-- REQUIRED. --&gt;
- *     &lt;property name="message-from" value="Acme" /&gt; &lt;!-- REQUIRED. --&gt;
- *     &lt;property name="message-to" value="AcmePartner" /&gt; &lt;!-- REQUIRED. --&gt;
- *     &lt;property name="message-encoding" value="UTF-8" /&gt; &lt;!-- OPTIONAL. Default "UTF-8" --&gt;
- * &lt;/Action&gt;
- * </pre>
- * Eventually, all the message properties defined on the action will come from the message metadata.  This will
- * happen once we have a proper "normalized" message format with message headers etc.
  * 
  * @author <a href="mailto:tom.fennelly at jboss.com">tom.fennelly at jboss.com</a>
  * @since Version 4.0
@@ -66,62 +61,59 @@
 
 public class SmooksTransformer implements TransformationService, ActionProcessor {
 
+	public static final String FROM_EPR = "from-epr";
+	public static final String FROM_TYPE = "from-type";
+	public static final String TO_EPR = "to-epr";
+	public static final String TO_TYPE = "to-type";
+	
     private static Logger logger = Logger.getLogger(SmooksTransformer.class);
     private static final String SMOOKS_CDR_LST = "smooks-cdr.lst";
     private static SmooksStandalone smooks;
-    private String messageType;
-    private String messageFrom;
-    private String messageTo;
-    private String messageEnc;
-    private String messageUseragent;
-    private String cpPrefix;
+    private String defaultMessageFromType;
+    private String defaultMessageFromEPR;
+    private String defaultMessageToType;
+    private String defaultMessageToEPR;
     
     /**
      * Public constructor.
      * @param actionName Action name.
-     * @param properties Action Properties.
+     * @param propertiesTree Action Properties.
      * @throws ConfigurationException 
      * @throws ConfigurationException Action not properly configured.
      */
-	public SmooksTransformer(String name, List<KeyValuePair> properties) throws ConfigurationException {
-        messageType = KeyValuePair.getValue("message-type", properties);
-        if(messageType == null || messageType.equals("")) {
-            throw new ConfigurationException("Action configuration 'message-type' not specified.");
-        }
-        messageFrom = KeyValuePair.getValue("message-from", properties);
-        if(messageFrom == null || messageFrom.equals("")) {
-            throw new ConfigurationException("Action configuration 'message-from' not specified.");
-        }
-        messageTo = KeyValuePair.getValue("message-to", properties);
-        if(messageTo == null || messageTo.equals("")) {
-            throw new ConfigurationException("Action configuration 'message-to' not specified.");
-        }
-        messageEnc = KeyValuePair.getValue("message-encoding", properties, "UTF-8");
-        // Test the configured encoding
-        try {
-            "astring".getBytes(messageEnc);
-        } catch (UnsupportedEncodingException e) {
-            throw new ConfigurationException("Invalid character encoding [" + messageEnc + "] on action configuration [" + name + "].", e);
-        }
+	public SmooksTransformer(String name, ConfigTree propertiesTree) throws ConfigurationException {
+		this(propertiesTree);
+	}
+    
+    /**
+     * Public constructor.
+     * @param propertiesTree Action Properties.
+     * @throws ConfigurationException 
+     * @throws ConfigurationException Action not properly configured.
+     */
+	public SmooksTransformer(ConfigTree propertiesTree) throws ConfigurationException {
+		List<KeyValuePair> properties = propertiesTree.attributesAsList();
 
-        // The "cpPrefix" property is "private" and only here in order to make unit testing easier.
-        // It allows us to force a "bad" config location for the smooks-cdr.lst file....
-        cpPrefix = KeyValuePair.getValue("smooks-cdr.list-classpath-prefix", properties, "/");
-        if(!cpPrefix.startsWith("/")) {
-            cpPrefix = "/" + cpPrefix;
+		defaultMessageFromType = KeyValuePair.getValue(FROM_TYPE, properties);
+		if(defaultMessageFromType != null && defaultMessageFromType.trim().equals("")) {
+			throw new ConfigurationException("Empty '" + FROM_TYPE + "' config attribute supplied.");
+		}
+		defaultMessageToType = KeyValuePair.getValue(TO_TYPE, properties);
+		if(defaultMessageToType != null && defaultMessageToType.trim().equals("")) {
+			throw new ConfigurationException("Empty '" + TO_TYPE + "' config attribute supplied.");
+		}
+		defaultMessageFromEPR = KeyValuePair.getValue(FROM_EPR, properties);
+		if(defaultMessageFromEPR != null && defaultMessageFromEPR.trim().equals("")) {
+			throw new ConfigurationException("Empty '" + FROM_EPR + "' config attribute supplied.");
+		}
+		defaultMessageToEPR = KeyValuePair.getValue(TO_EPR, properties);
+		if(defaultMessageToEPR != null && defaultMessageToEPR.trim().equals("")) {
+			throw new ConfigurationException("Empty '" + TO_EPR + "' config attribute supplied.");
+		}
+        
+        if(smooks == null) {
+        	initSmooks(properties);
         }
-        
-        initSmooks();
-        
-        // In the context of the ESB, the Smooks useragent will be defined by the message "type", where it's 
-        // coming "from" and where it's going "to"...
-        messageUseragent = messageType + "-" + messageFrom + "-" + messageTo;
-        // Register the message metadata as "profiles" within the Smooks context.  These profiles ("type",
-        // "from" and "to") should expand out inside Smooks based on subprofiles that are
-        // statically configured against these profiles in the device-profiles.xml file.  This is a bit 
-        // of a hack but is fine for now just to get the ball rolling...
-        smooks.registerUseragent(messageUseragent, new String[] {"type:" + messageType, "from:" + messageFrom, "to:" + messageTo});
-        // TODO: Recurcively expand out the profiles supplied here using smooks.getContext().getProfileStore().  Do this inside SmooksStandalone
 	}
 
 	/* (non-Javadoc)
@@ -139,41 +131,220 @@
      * @see org.jboss.soa.esb.actions.ActionProcessor#process(java.lang.Object)
      */
     public Message process(Message message) throws ActionProcessingException {
-    	Object oCurr = ActionUtils.getTaskObject(message);
+    	Object payload = ActionUtils.getTaskObject(message);
+    	
     	try {
-	        if(oCurr instanceof String) {
+	        if(payload instanceof String) {
 	            byte[] messageBytes = null;
 	            String transformedMessage;
+	        	String messageUseragent;
 	            
-	            try {
-	                messageBytes = ((String)oCurr).getBytes(messageEnc);
-	            } catch (UnsupportedEncodingException e) {
-	                // Can't happen - encoding was already tested in the constructor.
-	            }
+	            // Register the message useragent with Smooks (if not already registered)...
+	        	messageUseragent = registerMessageUseragent(message);
 	            
-	            // TODO: Cater for more message input types e.g. InputStream, DOM Document...
-	            // TODO: Cater for more message output types e.g. InputStream, DOM Document...
+                messageBytes = ((String)payload).getBytes("UTF-8");
 	
 	            long start = System.currentTimeMillis();
 	            transformedMessage = smooks.filterAndSerialize(messageUseragent, new ByteArrayInputStream(messageBytes));
 	            if(logger.isDebugEnabled()) {
 	            	long timeTaken = System.currentTimeMillis() - start;
 	            	logger.debug("Transformed message for useragent [" + messageUseragent + "]. Time taken: " 
-	            			+ timeTaken + ".  Message in:\n[" + oCurr.toString()+ "].  \nMessage out:\n[" + transformedMessage + "].");
+	            			+ timeTaken + ".  Message in:\n[" + payload.toString()+ "].  \nMessage out:\n[" + transformedMessage + "].");
 	            }
 	            ActionUtils.setTaskObject(message,transformedMessage);
 	        } else {
-	        	String sClass = (null==oCurr) ? "<null>" : oCurr.getClass().getName();
+	        	String sClass = (null==payload) ? "<null>" : payload.getClass().getName();
 	            logger.warn("String message types only supported.  Input message was [" 
 	            		+ sClass + "].  Returning message untransformed.");
 	        }
     	} catch(Throwable thrown) {
     		throw new ActionProcessingException("Message transformation failed.", thrown);
     	}
+        
+        // TODO: Cater for more message input types e.g. InputStream, DOM Document...
+        // TODO: Cater for more message output types e.g. InputStream, DOM Document...
+    	
     	return message;
     }
 
-    /* (non-Javadoc)
+	/**
+	 * Register the Message Flow as a useragent within Smooks.
+	 * @param message The message.
+	 * @return The Smooks "usragent" string that uniquely identifies the message flow associated
+	 * with the message.
+	 * @throws ActionProcessingException Failed to register the message flow for the message.
+	 */
+	private String registerMessageUseragent(Message message) throws ActionProcessingException {
+		String messageUseragent;
+    	String messageFromType;
+        String messageFrom;
+        String messageToType;
+        String messageTo;
+
+        // Get the routing info from the message/configuration (mandatory)...
+        messageFrom = getFromEPR(message);
+        if(messageFrom == null) {
+			throw new ActionProcessingException("'from-epr' address not set on message/configuration.");
+        }
+        messageTo = getToEPR(message);
+        if(messageTo == null) {
+			throw new ActionProcessingException("'to-epr' address not set on message/configuration.");
+        }
+        
+        // Get the message typing info from the message/configuration (optional)...
+		messageFromType = (String)message.getProperties().getProperty(FROM_TYPE, defaultMessageFromType);
+		messageToType = (String)message.getProperties().getProperty(TO_TYPE, defaultMessageToType);
+		
+		// Construct the message useragent string for use with Smooks.  This is basically the 
+		// name of the Message Flow on which transformations are to be performed...
+        messageUseragent = getMessageUseragentString(messageFromType, messageFrom, messageToType, messageTo);
+        
+        // Register this message flow if it isn't already registered...
+        try {
+        	smooks.getSession(messageUseragent);
+        } catch(UnknownDeviceException e) {
+        	String[] profiles = getMessageUseragentProfiles(messageFromType, messageFrom, messageToType, messageTo);
+        	
+	        // Register the message flow within the Smooks context....
+        	logger.info("Registering message-flow useragent: [" + messageUseragent + "].  Profiles: [" + Arrays.asList(profiles) + "]");
+	        smooks.registerUseragent(messageUseragent, profiles);
+        }
+        
+		return messageUseragent;
+	}
+
+	/**
+	 * Get the "From" EPR address from the message.
+	 * <p/>
+	 * Returns the default "from-epr" (from the action configurations) if not set on the message.
+	 * @param message The message.
+	 * @throws ActionProcessingException 
+	 */
+	private String getFromEPR(Message message) throws ActionProcessingException {
+		try {
+			Header header = message.getHeader();
+	        if(header == null) {
+	        	return defaultMessageFromEPR;
+	        }
+	        Call call = header.getCall();
+	        if(call == null) {
+	        	return defaultMessageFromEPR;
+	        }
+	        EPR from = call.getFrom();
+	        if(from == null) {
+	        	return defaultMessageFromEPR;
+	        }
+	        if(from.getAddr() == null) {
+	        	return defaultMessageFromEPR;
+	        }
+	        String eprAddress = from.getAddr().getAddress();
+	        if(eprAddress == null || eprAddress.trim().equals("")) {
+	        	return defaultMessageFromEPR;
+	        }
+	        
+	        return eprAddress;
+		} catch (Throwable thrown) {
+			throw new ActionProcessingException("Message validation failure.", thrown);
+		}
+	}
+
+	/**
+	 * Get the "To" EPR address from the message.
+	 * <p/>
+	 * Returns the default "to-epr" (from the action configurations) if not set on the message.
+	 * @param message The message.
+	 * @throws ActionProcessingException 
+	 */
+	private String getToEPR(Message message) throws ActionProcessingException {
+		try {
+			Header header = message.getHeader();
+	        if(header == null) {
+	        	return defaultMessageToEPR;
+	        }
+	        Call call = header.getCall();
+	        if(call == null) {
+	        	return defaultMessageToEPR;
+	        }
+	        EPR to = call.getTo();
+	        if(to == null) {
+	        	return defaultMessageToEPR;
+	        }
+	        if(to.getAddr() == null) {
+	        	return defaultMessageToEPR;
+	        }
+	        String eprAddress = to.getAddr().getAddress();
+	        if(eprAddress == null || eprAddress.trim().equals("")) {
+	        	return defaultMessageToEPR;
+	        }
+	        
+	        return eprAddress;
+		} catch (Throwable thrown) {
+			throw new ActionProcessingException("Message validation failure.", thrown);
+		}
+	}
+
+    /**
+     * Get the profile list based on the supplied message flow properties.
+	 * @param messageFromType The type string for the message source.
+	 * @param messageFrom The EPR string for the message source.
+	 * @param messageToType The type string for the message target.
+	 * @param messageTo The EPR srting for the message target.
+	 * @return The list of profiles.
+	 */
+	protected static String[] getMessageUseragentProfiles(String messageFromType, String messageFrom, String messageToType, String messageTo) {
+		List<String> profiles = new ArrayList<String>();
+		String[] profileArray;
+		
+		if(messageFromType != null) {
+			profiles.add(FROM_TYPE + ":" + messageFromType);
+		}
+		if(messageFrom != null) {
+			profiles.add(FROM_EPR + ":" + messageFrom);
+		}
+		if(messageToType != null) {
+			profiles.add(TO_TYPE + ":" + messageToType);
+		}
+		if(messageTo != null) {
+			profiles.add(TO_EPR + ":" + messageTo);
+		}
+		
+		profileArray = new String[profiles.size()];
+		profiles.toArray(profileArray);
+
+		return profileArray;
+	}
+
+	/**
+	 * Construct the Smooks useragent string based on the supplied message flow properties.
+	 * @param messageFromType The type string for the message source.
+	 * @param messageFrom The EPR string for the message source.
+	 * @param messageToType The type string for the message target.
+	 * @param messageTo The EPR srting for the message target.
+	 * @return Smooks useragent string for the message flow.
+	 */
+	protected static String getMessageUseragentString(String messageFromType, String messageFrom, String messageToType, String messageTo) {
+		StringBuffer string = new StringBuffer();
+		
+		if(messageFromType != null) {
+			string.append(FROM_TYPE + ":" + messageFromType);
+			string.append((messageFrom!=null || messageToType!=null || messageTo!=null?":":""));
+		}
+		if(messageFrom != null) {
+			string.append(FROM_EPR + ":" + messageFrom);
+			string.append((messageToType!=null || messageTo!=null?":":""));
+		}
+		if(messageToType != null) {
+			string.append(TO_TYPE + ":" + messageToType);
+			string.append((messageTo!=null?":":""));
+		}
+		if(messageTo != null) {
+			string.append(TO_EPR + ":" + messageTo);
+		}
+		
+		return string.toString();
+	}
+
+	/* (non-Javadoc)
      * @see org.jboss.soa.esb.actions.ActionProcessor#getOkNotification(java.lang.Object)
      */
     public Serializable getOkNotification(Message message) {
@@ -192,21 +363,28 @@
      * <p/>
      * We may need to write a Smooks Container implementation specifically for JBossESB's needs.  SmooksStandalone is
      * fine for a start though.
+     * @param properties Action configuration properties.
      * @throws ConfigurationException Failed to load Smooks configurations.
      */
-    protected void initSmooks() throws ConfigurationException {
+    protected void initSmooks(List<KeyValuePair> properties) throws ConfigurationException {
         synchronized (SmooksTransformer.class) {
             if(smooks == null) {
-                InputStream configListStream = getClass().getResourceAsStream(cpPrefix + SMOOKS_CDR_LST);
+                String cpPrefix;
+
+                // The "cpPrefix" property is "private" and only here in order to make unit testing easier.
+                // It allows us to force a "bad" config location for the smooks-cdr.lst file....
+                cpPrefix = KeyValuePair.getValue("smooks-cdr.list-classpath-prefix", properties, "/");
+                if(!cpPrefix.startsWith("/")) {
+                    cpPrefix = "/" + cpPrefix;
+                }
+            	
+            	InputStream configListStream = getClass().getResourceAsStream(cpPrefix + SMOOKS_CDR_LST);
                 
                 if(configListStream == null) {
                     throw new ConfigurationException("Failed to locate Smooks configuration list file [" + SMOOKS_CDR_LST + "].  The folder containing this file must be located at " + cpPrefix + " relative to the root of the classpath.");
                 }
            
-                // TODO:  There's a potential issue here if two SmooksTransformer action configs specify and require
-                // different encodings.   This is because they're all sharing the same static SmooksStandalone instance!!
-                // This should eventually be solveable by creating a proper Smooks container impl for the ESB.
-                smooks = new SmooksStandalone(messageEnc);
+                smooks = new SmooksStandalone("UTF-8");
                 
                 try {
                     BufferedReader configReader = new BufferedReader(new InputStreamReader(configListStream));

Modified: labs/jbossesb/trunk/product/core/listeners/src/org/jboss/soa/esb/listeners/message/ActionProcessingPipeline.java
===================================================================
--- labs/jbossesb/trunk/product/core/listeners/src/org/jboss/soa/esb/listeners/message/ActionProcessingPipeline.java	2006-11-12 21:53:07 UTC (rev 7560)
+++ labs/jbossesb/trunk/product/core/listeners/src/org/jboss/soa/esb/listeners/message/ActionProcessingPipeline.java	2006-11-13 12:31:38 UTC (rev 7561)
@@ -21,6 +21,7 @@
  */
 public class ActionProcessingPipeline implements Runnable 
 {    
+	private boolean processingComplete = false;
          
     /**
      * public constructor
@@ -121,7 +122,10 @@
     	{	_logger.error(prematureTermination("method not found"),e); } 
         catch(IllegalAccessException e)
     	{	_logger.error(prematureTermination("unable to access method"),e); } 
-        catch (IllegalArgumentException e) {}
+        catch (IllegalArgumentException e) {
+        } finally {
+        	processingComplete = true;
+        }
     }
     
     protected String prematureTermination(String s)
@@ -196,5 +200,12 @@
     protected Object		_currentProcessor;
 	protected Message		_message;
 	protected ConfigTree	_config;
-	protected Logger		_logger = Logger.getLogger(this.getClass());		
+	protected Logger		_logger = Logger.getLogger(this.getClass());
+
+	/**
+	 * @return Returns the processingComplete.
+	 */
+	public boolean isProcessingComplete() {
+		return processingComplete;
+	}		
 }

Deleted: labs/jbossesb/trunk/product/core/listeners/tests/src/org/jboss/soa/esb/actions/SmooksTransformerUnitTest.java
===================================================================
--- labs/jbossesb/trunk/product/core/listeners/tests/src/org/jboss/soa/esb/actions/SmooksTransformerUnitTest.java	2006-11-12 21:53:07 UTC (rev 7560)
+++ labs/jbossesb/trunk/product/core/listeners/tests/src/org/jboss/soa/esb/actions/SmooksTransformerUnitTest.java	2006-11-13 12:31:38 UTC (rev 7561)
@@ -1,110 +0,0 @@
-/*
- * 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.actions;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import junit.framework.TestCase;
-
-import org.jboss.soa.esb.ConfigurationException;
-import org.jboss.soa.esb.actions.converters.SmooksTransformer;
-import org.jboss.soa.esb.helpers.KeyValuePair;
-import org.jboss.soa.esb.message.Message;
-import org.jboss.soa.esb.message.format.MessageFactory;
-
-/**
- * SmooksTransformer unit tests.
- * @author <a href="mailto:tom.fennelly at jboss.com">tom.fennelly at jboss.com</a>
- * @since Version 4.0
- */
-public class SmooksTransformerUnitTest extends TestCase {
-
-    @Override
-    protected void setUp() throws Exception {
-        SmooksTransformer.reset();
-    }
-
-    public void test_bad_config() {
-        List<KeyValuePair> properties = new ArrayList<KeyValuePair>();
-
-        // Should get exceptions where required configs are missing...
-        assertConfigException(properties, "Action configuration 'message-type' not specified");
-        properties.add(new KeyValuePair("message-type", "111"));
-        assertConfigException(properties, "Action configuration 'message-from' not specified");
-        properties.add(new KeyValuePair("message-from", "AAA"));
-        assertConfigException(properties, "Action configuration 'message-to' not specified");
-        properties.add(new KeyValuePair("message-to", "BBB"));
-
-        // Should get an exception where the smooks-cdr.lst file is missing....
-        properties.add(new KeyValuePair("smooks-cdr.list-classpath-prefix", "/some/bad/cp/location/"));
-        assertConfigException(properties, "Failed to locate Smooks configuration list file [smooks-cdr.lst].  The folder containing this file must be located at");
-    }
-
-    public void test_trans() throws ActionProcessingException, ConfigurationException {
-        String stringMessage;
-        String transRes;
-        
-        // Very basic test!  Just illustrates profile based resource selection.
-        // Read the smooks-test.cdrl config file in this package!! 
-
-        // Initialise the acme order message...
-        stringMessage = "<a><ddd>value</ddd></a>";
-        
-        // Transform the order message going to "AcmePartner1"...
-        transRes = transform(stringMessage, "Acme-Order-XML", "Acme", "AcmePartner1");
-        assertEquals("<x><b>value</b></x>", transRes);
-        
-        // Transform the order message going to "AcmePartner2"...
-        transRes = transform(stringMessage, "Acme-Order-XML", "Acme", "AcmePartner2");
-        assertEquals("<x><c>value</c></x>", transRes);
-    }
-    
-    private String transform(String stringMessage, String type, String from, String to) throws ActionProcessingException, ConfigurationException {
-        List<KeyValuePair> properties = new ArrayList<KeyValuePair>();
-
-        // Set the message properties in order to trigger the appropriate transformations
-        // on the message...
-        properties.add(new KeyValuePair("message-type", type));
-        properties.add(new KeyValuePair("message-from", from));
-        properties.add(new KeyValuePair("message-to", to));
-
-        // The smooks-cdr.lst and device-profile.xml files are located in the root of the 
-        // test src folder...
-        SmooksTransformer transformer = new SmooksTransformer("trans", properties);
-        
-        Message oMsg = MessageFactory.getInstance().getMessage();
-        ActionUtils.setTaskObject(oMsg,stringMessage);
-        oMsg = transformer.process(oMsg);
-        return (String) ActionUtils.getTaskObject(oMsg);
-    }
-
-    private void assertConfigException(List<KeyValuePair> properties, String expectedException) {
-        try {
-            new SmooksTransformer("trans", properties);
-            fail("Expected ConfigurationException: [" + expectedException + "...]");
-        } catch(ConfigurationException e) {
-            assertTrue("Expected exception message to start with [" + expectedException + "]. Was [" + e.getMessage() + "]", e.getMessage().startsWith(expectedException));
-        }
-    }
-}

Added: labs/jbossesb/trunk/product/core/listeners/tests/src/org/jboss/soa/esb/actions/converters/SmooksTransformerUnitTest.java
===================================================================
--- labs/jbossesb/trunk/product/core/listeners/tests/src/org/jboss/soa/esb/actions/converters/SmooksTransformerUnitTest.java	2006-11-12 21:53:07 UTC (rev 7560)
+++ labs/jbossesb/trunk/product/core/listeners/tests/src/org/jboss/soa/esb/actions/converters/SmooksTransformerUnitTest.java	2006-11-13 12:31:38 UTC (rev 7561)
@@ -0,0 +1,126 @@
+/*
+ * 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.actions.converters;
+
+import java.net.URISyntaxException;
+
+import junit.framework.TestCase;
+
+import org.jboss.soa.esb.ConfigurationException;
+import org.jboss.soa.esb.actions.ActionProcessingException;
+import org.jboss.soa.esb.actions.ActionUtils;
+import org.jboss.soa.esb.actions.converters.SmooksTransformer;
+import org.jboss.soa.esb.addressing.Call;
+import org.jboss.soa.esb.addressing.EPR;
+import org.jboss.soa.esb.addressing.PortReference;
+import org.jboss.soa.esb.helpers.ConfigTree;
+import org.jboss.soa.esb.message.Header;
+import org.jboss.soa.esb.message.Message;
+import org.jboss.soa.esb.message.format.MessageFactory;
+
+/**
+ * SmooksTransformer unit tests.
+ * @author <a href="mailto:tom.fennelly at jboss.com">tom.fennelly at jboss.com</a>
+ * @since Version 4.0
+ */
+public class SmooksTransformerUnitTest extends TestCase {
+
+    @Override
+    protected void setUp() throws Exception {
+        SmooksTransformer.reset();
+    }
+
+    public void test_bad_config() {
+    	ConfigTree properties = new ConfigTree("name");
+
+        // Should get exceptions where message type configs are specified but empty...
+        properties.setAttribute(SmooksTransformer.FROM_TYPE, " ");
+        assertConfigException(properties, "Empty '" + SmooksTransformer.FROM_TYPE + "' config attribute supplied.");
+        properties.setAttribute(SmooksTransformer.FROM_TYPE, "x");
+        properties.setAttribute(SmooksTransformer.TO_TYPE, " ");
+        assertConfigException(properties, "Empty '" + SmooksTransformer.TO_TYPE + "' config attribute supplied.");
+    }
+
+    public void test_trans() throws ActionProcessingException, ConfigurationException, URISyntaxException {
+        String stringMessage;
+        String transRes;
+        
+        // Very basic test!  Just illustrates profile based resource selection.
+        // Read the smooks-test.cdrl config file in this package!! 
+
+        // Initialise the acme order message...
+        stringMessage = "<a><ddd>value</ddd></a>";
+        
+        // Transform the order message going to "AcmePartner1"...
+        transRes = transform(stringMessage, "Acme-Order-XML", "Acme", "AcmePartner1", "Partner1-Order-XML");
+        assertEquals("<x><b>value</b></x>", transRes);
+        
+        // Transform the order message going to "AcmePartner2"...
+        transRes = transform(stringMessage, "Acme-Order-XML", "Acme", "AcmePartner2", "Partner2-Order-XML");
+        assertEquals("<x><c>value</c></x>", transRes);
+    }
+    
+    private String transform(String stringMessage, String fromType, String from, String to, String toType) throws ActionProcessingException, ConfigurationException, URISyntaxException {
+        Message oMsg = MessageFactory.getInstance().getMessage();
+        ConfigTree properties = new ConfigTree("name");
+
+        // Set the message properties in order to trigger the appropriate transformations
+        // on the message...
+        properties.setAttribute(SmooksTransformer.FROM_TYPE, fromType);
+        properties.setAttribute(SmooksTransformer.TO_TYPE, toType);
+        
+        Call call = new Call();
+        EPR fromEPR = new EPR();
+        EPR toEPR = new EPR();
+        PortReference fromAddr = new PortReference();
+        PortReference toAddr = new PortReference();
+        
+        oMsg.getHeader().setCall(call);
+
+        call.setFrom(fromEPR);
+        fromEPR.setAddr(fromAddr);
+        fromAddr.setAddress(from);
+
+        call.setTo(toEPR);
+        toEPR.setAddr(toAddr);
+        toAddr.setAddress(to);
+
+        // The smooks-cdr.lst and device-profile.xml files are located in the root of the 
+        // test src folder.  You need to look at these to see how this works...
+        SmooksTransformer transformer = new SmooksTransformer(properties);
+        
+        ActionUtils.setTaskObject(oMsg, stringMessage);
+        oMsg = transformer.process(oMsg);
+        
+        return (String) ActionUtils.getTaskObject(oMsg);
+    }
+
+    private void assertConfigException(ConfigTree properties, String expectedException) {
+        try {
+            new SmooksTransformer("trans", properties);
+            fail("Expected ConfigurationException: [" + expectedException + "...]");
+        } catch(ConfigurationException e) {
+            assertTrue("Expected exception message to start with [" + expectedException + "]. Was [" + e.getMessage() + "]", e.getMessage().startsWith(expectedException));
+        }
+    }
+}

Added: labs/jbossesb/trunk/product/core/listeners/tests/src/org/jboss/soa/esb/actions/converters/smooks-test.cdrl
===================================================================
--- labs/jbossesb/trunk/product/core/listeners/tests/src/org/jboss/soa/esb/actions/converters/smooks-test.cdrl	2006-11-12 21:53:07 UTC (rev 7560)
+++ labs/jbossesb/trunk/product/core/listeners/tests/src/org/jboss/soa/esb/actions/converters/smooks-test.cdrl	2006-11-13 12:31:38 UTC (rev 7561)
@@ -0,0 +1,28 @@
+<?xml version='1.0'?>
+<!DOCTYPE smooks-resource-list PUBLIC '-//MILYN//DTD SMOOKS 1.0//EN' 'http://milyn.org/dtd/smooksres-list-1.0.dtd'>
+
+<smooks-resource-list>
+
+	<!-- 
+		"Acme-Order-XML" messages going from "Acme" to "AcmePartner1" 
+	-->
+	<smooks-resource useragent="from-type:Acme-Order-XML AND from-epr:Acme AND to-type:Partner1-Order-XML AND to-epr:AcmePartner1" selector="ddd" path="org.milyn.cdres.trans.RenameElementTU">
+		<param name="replacementElement">b</param>
+	</smooks-resource>
+
+	<!-- 
+		"Acme-Order-XML" messages going from "Acme" to "AcmePartner2" 
+	-->
+	<smooks-resource useragent="from-type:Acme-Order-XML AND from-epr:Acme AND to-type:Partner2-Order-XML AND to-epr:AcmePartner2" selector="ddd" path="org.milyn.cdres.trans.RenameElementTU">
+		<param name="replacementElement">c</param>
+	</smooks-resource>
+
+	<!-- 
+		"Acme-Order-XML" messages going from "Acme" to anywhere
+	-->
+	<smooks-resource useragent="from-type:Acme-Order-XML AND from-epr:Acme" selector="a" path="org.milyn.cdres.trans.RenameElementTU">
+		<param name="replacementElement">x</param>
+	</smooks-resource>
+
+</smooks-resource-list>
+

Deleted: labs/jbossesb/trunk/product/core/listeners/tests/src/org/jboss/soa/esb/actions/smooks-test.cdrl
===================================================================
--- labs/jbossesb/trunk/product/core/listeners/tests/src/org/jboss/soa/esb/actions/smooks-test.cdrl	2006-11-12 21:53:07 UTC (rev 7560)
+++ labs/jbossesb/trunk/product/core/listeners/tests/src/org/jboss/soa/esb/actions/smooks-test.cdrl	2006-11-13 12:31:38 UTC (rev 7561)
@@ -1,28 +0,0 @@
-<?xml version='1.0'?>
-<!DOCTYPE smooks-resource-list PUBLIC '-//MILYN//DTD SMOOKS 1.0//EN' 'http://milyn.org/dtd/smooksres-list-1.0.dtd'>
-
-<smooks-resource-list>
-
-	<!-- 
-		"Acme-Order-XML" messages going from "Acme" to "AcmePartner1" 
-	-->
-	<smooks-resource useragent="type:Acme-Order-XML AND from:Acme AND to:AcmePartner1" selector="ddd" path="org.milyn.cdres.trans.RenameElementTU">
-		<param name="replacementElement">b</param>
-	</smooks-resource>
-
-	<!-- 
-		"Acme-Order-XML" messages going from "Acme" to "AcmePartner2" 
-	-->
-	<smooks-resource useragent="type:Acme-Order-XML AND from:Acme AND to:AcmePartner2" selector="ddd" path="org.milyn.cdres.trans.RenameElementTU">
-		<param name="replacementElement">c</param>
-	</smooks-resource>
-
-	<!-- 
-		"Acme-Order-XML" messages going from "Acme" to anywhere
-	-->
-	<smooks-resource useragent="type:Acme-Order-XML AND from:Acme" selector="a" path="org.milyn.cdres.trans.RenameElementTU">
-		<param name="replacementElement">x</param>
-	</smooks-resource>
-
-</smooks-resource-list>
-

Modified: labs/jbossesb/trunk/product/core/listeners/tests/src/smooks-cdr.lst
===================================================================
--- labs/jbossesb/trunk/product/core/listeners/tests/src/smooks-cdr.lst	2006-11-12 21:53:07 UTC (rev 7560)
+++ labs/jbossesb/trunk/product/core/listeners/tests/src/smooks-cdr.lst	2006-11-13 12:31:38 UTC (rev 7561)
@@ -1 +1 @@
-/org/jboss/soa/esb/actions/smooks-test.cdrl
\ No newline at end of file
+classpath:/org/jboss/soa/esb/actions/converters/smooks-test.cdrl

Deleted: labs/jbossesb/trunk/product/lib/ext/milyn-commons-0.7.jar
===================================================================
(Binary files differ)

Added: labs/jbossesb/trunk/product/lib/ext/milyn-commons-0.8-SNAPSHOT.jar
===================================================================
(Binary files differ)


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

Modified: labs/jbossesb/trunk/product/lib/ext/milyn-smooks-core-0.8-SNAPSHOT.jar
===================================================================
(Binary files differ)

Added: labs/jbossesb/trunk/qa/junit/src/org/jboss/soa/esb/actions/SmooksTransformerConfig.xml
===================================================================
--- labs/jbossesb/trunk/qa/junit/src/org/jboss/soa/esb/actions/SmooksTransformerConfig.xml	2006-11-12 21:53:07 UTC (rev 7560)
+++ labs/jbossesb/trunk/qa/junit/src/org/jboss/soa/esb/actions/SmooksTransformerConfig.xml	2006-11-13 12:31:38 UTC (rev 7561)
@@ -0,0 +1,32 @@
+<!-- 
+/*
+ * 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.
+ */ 
+ -->
+
+<SmooksTransformerTest>
+	<action class="org.jboss.soa.esb.actions.converters.SmooksTransformer" 
+		from-type="Acme-Order-XML"
+		from-epr="Acme"
+		to-type="Partner2-Order-XML"
+		to-epr="AcmePartner2"
+		/>
+</SmooksTransformerTest>	

Added: labs/jbossesb/trunk/qa/junit/src/org/jboss/soa/esb/actions/SmooksTransformerTest.java
===================================================================
--- labs/jbossesb/trunk/qa/junit/src/org/jboss/soa/esb/actions/SmooksTransformerTest.java	2006-11-12 21:53:07 UTC (rev 7560)
+++ labs/jbossesb/trunk/qa/junit/src/org/jboss/soa/esb/actions/SmooksTransformerTest.java	2006-11-13 12:31:38 UTC (rev 7561)
@@ -0,0 +1,103 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2006, JBoss Inc., and others contributors as indicated 
+ * by the @authors tag. All rights reserved. 
+ * See the copyright.txt in the distribution for a
+ * full listing of individual contributors. 
+ * This copyrighted material is made available to anyone wishing to use,
+ * modify, copy, or redistribute it subject to the terms and conditions
+ * of the GNU Lesser General Public License, v. 2.1.
+ * This program is distributed in the hope that it will be useful, but WITHOUT A 
+ * 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,
+ * v.2.1 along with this distribution; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, 
+ * MA  02110-1301, USA.
+ * 
+ * (C) 2005-2006,
+ * @author JBoss Inc.
+ */
+
+package org.jboss.soa.esb.actions;
+
+import java.io.IOException;
+import java.net.URISyntaxException;
+
+import junit.framework.TestCase;
+
+import org.jboss.soa.esb.ConfigurationException;
+import org.jboss.soa.esb.actions.converters.SmooksTransformer;
+import org.jboss.soa.esb.addressing.Call;
+import org.jboss.soa.esb.addressing.EPR;
+import org.jboss.soa.esb.addressing.PortReference;
+import org.jboss.soa.esb.helpers.ConfigTree;
+import org.jboss.soa.esb.listeners.message.ActionProcessingPipeline;
+import org.jboss.soa.esb.message.Message;
+import org.jboss.soa.esb.message.format.MessageFactory;
+import org.xml.sax.SAXException;
+
+/**
+ * @author <a href="mailto:tom.fennelly at jboss.com">tom.fennelly at jboss.com</a>
+ */
+public class SmooksTransformerTest extends TestCase {
+
+	public void test_SmooksTransformer() throws SAXException, IOException, ConfigurationException, URISyntaxException {
+		Message message = createEmptyMessage();
+
+		// Set the message payload for processing - don't set the message typing
+		// or routing info on the message...
+        ActionUtils.setTaskObject(message, "<a><ddd>value</ddd></a>");
+        // Process the message...
+		process(message);
+		// Check make sure it did it OK ("ddd" converted to "c")...
+		assertEquals("<x><c>value</c></x>", (String)ActionUtils.getTaskObject(message));
+		
+		// Set the message type and routing info on the message - should override the 
+		// configured typing and routing parameters...
+		message.getProperties().setProperty(SmooksTransformer.FROM_TYPE, "Acme-Order-XML");
+		message.getHeader().getCall().getFrom().getAddr().setAddress("Acme");
+		message.getHeader().getCall().getTo().getAddr().setAddress("AcmePartner1");
+		message.getProperties().setProperty(SmooksTransformer.TO_TYPE, "Partner1-Order-XML");
+		// Set the message payload for processing...
+        ActionUtils.setTaskObject(message, "<a><ddd>value</ddd></a>");
+        // Process the message...
+		process(message);
+		// Check make sure it did it OK ("ddd" converted to "b")...
+		assertEquals("<x><b>value</b></x>", (String)ActionUtils.getTaskObject(message));
+	}
+	
+    private void process(Message message) throws SAXException, IOException, ConfigurationException {
+		ConfigTree config = ConfigTree.fromInputStream(getClass().getResourceAsStream("SmooksTransformerConfig.xml"));
+
+        ActionProcessingPipeline chain = new ActionProcessingPipeline(message, config); 
+		new Thread(chain).start();
+		
+		// Wait for the pipeline to finish processing the message...
+		while(!chain.isProcessingComplete()) {
+			try {
+				Thread.sleep(100);
+			} catch (InterruptedException e) {
+				e.printStackTrace();
+			}
+		}
+    }
+
+	private Message createEmptyMessage() {
+		Message message = MessageFactory.getInstance().getMessage();
+        Call call = new Call();
+        EPR fromEPR = new EPR();
+        EPR toEPR = new EPR();
+        PortReference fromAddr = new PortReference();
+        PortReference toAddr = new PortReference();
+
+        message.getHeader().setCall(call);
+        call.setFrom(fromEPR);
+        fromEPR.setAddr(fromAddr);
+        call.setTo(toEPR);
+        toEPR.setAddr(toAddr);
+
+		
+		return message;
+	}
+}

Added: labs/jbossesb/trunk/qa/junit/src/org/jboss/soa/esb/actions/smooks-test.cdrl
===================================================================
--- labs/jbossesb/trunk/qa/junit/src/org/jboss/soa/esb/actions/smooks-test.cdrl	2006-11-12 21:53:07 UTC (rev 7560)
+++ labs/jbossesb/trunk/qa/junit/src/org/jboss/soa/esb/actions/smooks-test.cdrl	2006-11-13 12:31:38 UTC (rev 7561)
@@ -0,0 +1,28 @@
+<?xml version='1.0'?>
+<!DOCTYPE smooks-resource-list PUBLIC '-//MILYN//DTD SMOOKS 1.0//EN' 'http://milyn.org/dtd/smooksres-list-1.0.dtd'>
+
+<smooks-resource-list>
+
+	<!-- 
+		"Acme-Order-XML" messages going from "Acme" to "AcmePartner1" 
+	-->
+	<smooks-resource useragent="from-type:Acme-Order-XML AND from-epr:Acme AND to-type:Partner1-Order-XML AND to-epr:AcmePartner1" selector="ddd" path="org.milyn.cdres.trans.RenameElementTU">
+		<param name="replacementElement">b</param>
+	</smooks-resource>
+
+	<!-- 
+		"Acme-Order-XML" messages going from "Acme" to "AcmePartner2" 
+	-->
+	<smooks-resource useragent="from-type:Acme-Order-XML AND from-epr:Acme AND to-type:Partner2-Order-XML AND to-epr:AcmePartner2" selector="ddd" path="org.milyn.cdres.trans.RenameElementTU">
+		<param name="replacementElement">c</param>
+	</smooks-resource>
+
+	<!-- 
+		"Acme-Order-XML" messages going from "Acme" to anywhere
+	-->
+	<smooks-resource useragent="from-type:Acme-Order-XML AND from-epr:Acme" selector="a" path="org.milyn.cdres.trans.RenameElementTU">
+		<param name="replacementElement">x</param>
+	</smooks-resource>
+
+</smooks-resource-list>
+

Added: labs/jbossesb/trunk/qa/junit/src/smooks-cdr.lst
===================================================================
--- labs/jbossesb/trunk/qa/junit/src/smooks-cdr.lst	2006-11-12 21:53:07 UTC (rev 7560)
+++ labs/jbossesb/trunk/qa/junit/src/smooks-cdr.lst	2006-11-13 12:31:38 UTC (rev 7561)
@@ -0,0 +1 @@
+classpath:/org/jboss/soa/esb/actions/smooks-test.cdrl

Deleted: labs/jbossesb/trunk/qa/qatests.log
===================================================================
--- labs/jbossesb/trunk/qa/qatests.log	2006-11-12 21:53:07 UTC (rev 7560)
+++ labs/jbossesb/trunk/qa/qatests.log	2006-11-13 12:31:38 UTC (rev 7561)
@@ -1,18 +0,0 @@
-2006-10-22 17:56:37,347 DEBUG [main][org.jboss.soa.esb.listeners.RemoteDirectoryPollerTest] ====== setUp ==========
-2006-10-22 17:56:37,413 INFO  [main][org.jboss.internal.soa.esb.parameters.ParamFileRepository] Setting parameter repository root dir to [/home/b_georges/projects/jboss/jbossesb/workspace/b_georges/qa/junit/src].
-2006-10-22 17:56:37,751 DEBUG [main][org.jboss.mq.referenceable.SpyConnectionFactoryObjectFactory] Extracting SpyConnectionFactory from reference
-2006-10-22 17:56:37,827 DEBUG [main][org.jboss.mq.referenceable.SpyConnectionFactoryObjectFactory] The GenericConnectionFactory is: GenericConnectionFactory[server=org.jboss.mq.il.uil2.UILServerIL at 1ff7a1e connectionProperties={ClientILService=org.jboss.mq.il.uil2.UILClientILService, UIL_TCPNODELAY_KEY=yes, UIL_CHUNKSIZE_KEY=1000000, UIL_CONNECTADDRESS_KEY=null, UIL_CONNECTPORT_KEY=0, UIL_SOTIMEOUT_KEY=120000, UIL_RECEIVE_REPLIES_KEY=No, UIL_ADDRESS_KEY=127.0.0.1, UIL_PORT_KEY=8093, PingPeriod=60000, UIL_BUFFERSIZE_KEY=2048}]
-2006-10-22 17:56:37,864 DEBUG [main][org.jboss.mq.Connection] Setting the clockDaemon's thread factory
-2006-10-22 17:56:37,929 DEBUG [UIL2.SocketManager.ReadTask#1 client=127.0.0.1:8093][org.jboss.mq.il.uil2.SocketManager] Begin ReadTask.run
-2006-10-22 17:56:37,931 DEBUG [UIL2.SocketManager.WriteTask#2 client=127.0.0.1:8093][org.jboss.mq.il.uil2.SocketManager] Begin WriteTask.run
-2006-10-22 17:56:37,932 DEBUG [UIL2.SocketManager.WriteTask#2 client=127.0.0.1:8093][org.jboss.mq.il.uil2.SocketManager] Created ObjectOutputStream
-2006-10-22 17:56:37,943 DEBUG [UIL2.SocketManager.ReadTask#1 client=127.0.0.1:8093][org.jboss.mq.il.uil2.SocketManager] Created ObjectInputStream
-2006-10-22 17:56:37,962 DEBUG [main][org.jboss.mq.il.uil2.UILClientILService] Starting
-2006-10-22 17:56:38,017 DEBUG [main][org.jboss.mq.referenceable.SpyDestinationObjectFactory] SpyDestinationObjectFactory->getObjectInstance()
-2006-10-22 17:56:38,185 INFO  [main][org.jboss.soa.esb.actions.ActionDefinitionFactory] Added alias [FileCopier] for ActionProcessor class [org.jboss.soa.esb.actions.routing.FileCopier].
-2006-10-22 17:56:38,187 INFO  [main][org.jboss.soa.esb.actions.ActionDefinitionFactory] Added ActionDefinition [FileCopy] for processor [FileCopier:org.jboss.soa.esb.actions.routing.FileCopier]. Num properties: 2
-2006-10-22 17:56:38,188 INFO  [main][org.jboss.soa.esb.actions.ActionDefinitionFactory] ActionDefinition Factory initialisation complete.
-2006-10-22 17:56:38,188 INFO  [main][org.jboss.soa.esb.util.ListenerUtils] Waiting on Listener Manager the start...
-2006-10-22 17:56:38,264 INFO  [main][org.jboss.soa.esb.util.ListenerUtils] Listener Manager running (Thread: Thread-1)!  Note this does not mean all the Listeners are up and running!
-2006-10-22 17:56:38,266 DEBUG [main][org.jboss.soa.esb.listeners.RemoteDirectoryPollerTest] FTP uploading 
-2006-10-22 17:56:38,266 DEBUG [main][org.jboss.soa.esb.listeners.RemoteDirectoryPollerTest] actions




More information about the jboss-svn-commits mailing list