[jboss-svn-commits] JBL Code SVN: r6148 - labs/jbossesb/workspace/tfennelly/product/core/listeners/tests/src/org/jboss/soa/esb/actions

jboss-svn-commits at lists.jboss.org jboss-svn-commits at lists.jboss.org
Mon Sep 11 14:31:24 EDT 2006


Author: tfennelly
Date: 2006-09-11 14:31:14 -0400 (Mon, 11 Sep 2006)
New Revision: 6148

Added:
   labs/jbossesb/workspace/tfennelly/product/core/listeners/tests/src/org/jboss/soa/esb/actions/ActionDefinition-Config-01.xml
   labs/jbossesb/workspace/tfennelly/product/core/listeners/tests/src/org/jboss/soa/esb/actions/ActionDefinition-Config-02.xml
   labs/jbossesb/workspace/tfennelly/product/core/listeners/tests/src/org/jboss/soa/esb/actions/ActionDefinition-Config-03.xml
   labs/jbossesb/workspace/tfennelly/product/core/listeners/tests/src/org/jboss/soa/esb/actions/ActionDefinition-Config-04.xml
   labs/jbossesb/workspace/tfennelly/product/core/listeners/tests/src/org/jboss/soa/esb/actions/ActionDefinition-Config-05.xml
   labs/jbossesb/workspace/tfennelly/product/core/listeners/tests/src/org/jboss/soa/esb/actions/ActionDefinition-Config-06.xml
   labs/jbossesb/workspace/tfennelly/product/core/listeners/tests/src/org/jboss/soa/esb/actions/ActionDefinition-Config-07.xml
   labs/jbossesb/workspace/tfennelly/product/core/listeners/tests/src/org/jboss/soa/esb/actions/ActionDefinition-Config-08.xml
   labs/jbossesb/workspace/tfennelly/product/core/listeners/tests/src/org/jboss/soa/esb/actions/ActionDefinition-Config-09.xml
   labs/jbossesb/workspace/tfennelly/product/core/listeners/tests/src/org/jboss/soa/esb/actions/ActionDefinition-Config-10.xml
   labs/jbossesb/workspace/tfennelly/product/core/listeners/tests/src/org/jboss/soa/esb/actions/ActionDefinition-Config-11.xml
   labs/jbossesb/workspace/tfennelly/product/core/listeners/tests/src/org/jboss/soa/esb/actions/ActionDefinitionFactoryUnitTest.java
   labs/jbossesb/workspace/tfennelly/product/core/listeners/tests/src/org/jboss/soa/esb/actions/LongToDateConverter.java
   labs/jbossesb/workspace/tfennelly/product/core/listeners/tests/src/org/jboss/soa/esb/actions/SmooksTransformAction-Config-01.xml
   labs/jbossesb/workspace/tfennelly/product/core/listeners/tests/src/org/jboss/soa/esb/actions/SmooksTransformActionFuncTest.java
   labs/jbossesb/workspace/tfennelly/product/core/listeners/tests/src/org/jboss/soa/esb/actions/SmooksTransformActionUnitTest.java
   labs/jbossesb/workspace/tfennelly/product/core/listeners/tests/src/org/jboss/soa/esb/actions/StringToLongConverter.java
   labs/jbossesb/workspace/tfennelly/product/core/listeners/tests/src/org/jboss/soa/esb/actions/TestActionHandler1.java
   labs/jbossesb/workspace/tfennelly/product/core/listeners/tests/src/org/jboss/soa/esb/actions/TestActionHandler2.java
   labs/jbossesb/workspace/tfennelly/product/core/listeners/tests/src/org/jboss/soa/esb/actions/TestActionHandler3.java
   labs/jbossesb/workspace/tfennelly/product/core/listeners/tests/src/org/jboss/soa/esb/actions/ToNowhereRouter.java
Log:
added

Added: labs/jbossesb/workspace/tfennelly/product/core/listeners/tests/src/org/jboss/soa/esb/actions/ActionDefinition-Config-01.xml
===================================================================
--- labs/jbossesb/workspace/tfennelly/product/core/listeners/tests/src/org/jboss/soa/esb/actions/ActionDefinition-Config-01.xml	2006-09-11 17:16:50 UTC (rev 6147)
+++ labs/jbossesb/workspace/tfennelly/product/core/listeners/tests/src/org/jboss/soa/esb/actions/ActionDefinition-Config-01.xml	2006-09-11 18:31:14 UTC (rev 6148)
@@ -0,0 +1,16 @@
+	<Actions>
+		<Action name="ActionA" handler="TestActionHandler1">
+			<property name="param1" value="val1" />
+			<property name="param2" value="val2" />
+			<property name="param3" value="val3" />
+		</Action>
+		<Action name="ActionB" handler="TestActionHandler1">
+			<property name="param1" value="val2" />
+		</Action>
+		<Action name="ActionC" handler="TestActionHandler2" />
+
+		<HandlerAliases>
+			<Alias name="TestActionHandler1" class="org.jboss.soa.esb.actions.TestActionHandler1" />
+			<Alias name="TestActionHandler2" class="org.jboss.soa.esb.actions.TestActionHandler2" />
+		</HandlerAliases>
+	</Actions>

Added: labs/jbossesb/workspace/tfennelly/product/core/listeners/tests/src/org/jboss/soa/esb/actions/ActionDefinition-Config-02.xml
===================================================================
--- labs/jbossesb/workspace/tfennelly/product/core/listeners/tests/src/org/jboss/soa/esb/actions/ActionDefinition-Config-02.xml	2006-09-11 17:16:50 UTC (rev 6147)
+++ labs/jbossesb/workspace/tfennelly/product/core/listeners/tests/src/org/jboss/soa/esb/actions/ActionDefinition-Config-02.xml	2006-09-11 18:31:14 UTC (rev 6148)
@@ -0,0 +1,9 @@
+	<Actions>
+		<Action name="" handler="TestActionHandler1">
+			<property name="param1" value="val1" />
+		</Action>
+
+		<HandlerAliases>
+			<Alias name="TestActionHandler1" class="org.jboss.soa.esb.actions.TestActionHandler1" />
+		</HandlerAliases>
+	</Actions>

Added: labs/jbossesb/workspace/tfennelly/product/core/listeners/tests/src/org/jboss/soa/esb/actions/ActionDefinition-Config-03.xml
===================================================================
--- labs/jbossesb/workspace/tfennelly/product/core/listeners/tests/src/org/jboss/soa/esb/actions/ActionDefinition-Config-03.xml	2006-09-11 17:16:50 UTC (rev 6147)
+++ labs/jbossesb/workspace/tfennelly/product/core/listeners/tests/src/org/jboss/soa/esb/actions/ActionDefinition-Config-03.xml	2006-09-11 18:31:14 UTC (rev 6148)
@@ -0,0 +1,9 @@
+	<Actions>
+		<Action name="ActionA" handler="">
+			<property name="param1" value="val1" />
+		</Action>
+
+		<HandlerAliases>
+			<Alias name="TestActionHandler1" class="org.jboss.soa.esb.actions.TestActionHandler1" />
+		</HandlerAliases>
+	</Actions>

Added: labs/jbossesb/workspace/tfennelly/product/core/listeners/tests/src/org/jboss/soa/esb/actions/ActionDefinition-Config-04.xml
===================================================================
--- labs/jbossesb/workspace/tfennelly/product/core/listeners/tests/src/org/jboss/soa/esb/actions/ActionDefinition-Config-04.xml	2006-09-11 17:16:50 UTC (rev 6147)
+++ labs/jbossesb/workspace/tfennelly/product/core/listeners/tests/src/org/jboss/soa/esb/actions/ActionDefinition-Config-04.xml	2006-09-11 18:31:14 UTC (rev 6148)
@@ -0,0 +1,9 @@
+	<Actions>
+		<Action name="ActionA" handler="TestActionHandler1">
+			<property name="" value="val1" />
+		</Action>
+
+		<HandlerAliases>
+			<Alias name="TestActionHandler1" class="org.jboss.soa.esb.actions.TestActionHandler1" />
+		</HandlerAliases>
+	</Actions>

Added: labs/jbossesb/workspace/tfennelly/product/core/listeners/tests/src/org/jboss/soa/esb/actions/ActionDefinition-Config-05.xml
===================================================================
--- labs/jbossesb/workspace/tfennelly/product/core/listeners/tests/src/org/jboss/soa/esb/actions/ActionDefinition-Config-05.xml	2006-09-11 17:16:50 UTC (rev 6147)
+++ labs/jbossesb/workspace/tfennelly/product/core/listeners/tests/src/org/jboss/soa/esb/actions/ActionDefinition-Config-05.xml	2006-09-11 18:31:14 UTC (rev 6148)
@@ -0,0 +1,9 @@
+	<Actions>
+		<Action name="ActionA" handler="TestActionHandler1">
+			<property name="param1" value="" />
+		</Action>
+
+		<HandlerAliases>
+			<Alias name="TestActionHandler1" class="org.jboss.soa.esb.actions.TestActionHandler1" />
+		</HandlerAliases>
+	</Actions>

Added: labs/jbossesb/workspace/tfennelly/product/core/listeners/tests/src/org/jboss/soa/esb/actions/ActionDefinition-Config-06.xml
===================================================================
--- labs/jbossesb/workspace/tfennelly/product/core/listeners/tests/src/org/jboss/soa/esb/actions/ActionDefinition-Config-06.xml	2006-09-11 17:16:50 UTC (rev 6147)
+++ labs/jbossesb/workspace/tfennelly/product/core/listeners/tests/src/org/jboss/soa/esb/actions/ActionDefinition-Config-06.xml	2006-09-11 18:31:14 UTC (rev 6148)
@@ -0,0 +1,9 @@
+	<Actions>
+		<Action name="ActionA" handler="UnknownHandle1">
+			<property name="param1" value="val1" />
+		</Action>
+
+		<HandlerAliases>
+			<Alias name="TestActionHandler1" class="org.jboss.soa.esb.actions.TestActionHandler1" />
+		</HandlerAliases>
+	</Actions>

Added: labs/jbossesb/workspace/tfennelly/product/core/listeners/tests/src/org/jboss/soa/esb/actions/ActionDefinition-Config-07.xml
===================================================================
--- labs/jbossesb/workspace/tfennelly/product/core/listeners/tests/src/org/jboss/soa/esb/actions/ActionDefinition-Config-07.xml	2006-09-11 17:16:50 UTC (rev 6147)
+++ labs/jbossesb/workspace/tfennelly/product/core/listeners/tests/src/org/jboss/soa/esb/actions/ActionDefinition-Config-07.xml	2006-09-11 18:31:14 UTC (rev 6148)
@@ -0,0 +1,9 @@
+	<Actions>
+		<Action name="ActionA" handler="TestActionHandler1">
+			<property name="param1" value="val1" />
+		</Action>
+
+		<HandlerAliases>
+			<Alias name="" class="org.jboss.soa.esb.actions.TestActionHandler1" />
+		</HandlerAliases>
+	</Actions>

Added: labs/jbossesb/workspace/tfennelly/product/core/listeners/tests/src/org/jboss/soa/esb/actions/ActionDefinition-Config-08.xml
===================================================================
--- labs/jbossesb/workspace/tfennelly/product/core/listeners/tests/src/org/jboss/soa/esb/actions/ActionDefinition-Config-08.xml	2006-09-11 17:16:50 UTC (rev 6147)
+++ labs/jbossesb/workspace/tfennelly/product/core/listeners/tests/src/org/jboss/soa/esb/actions/ActionDefinition-Config-08.xml	2006-09-11 18:31:14 UTC (rev 6148)
@@ -0,0 +1,6 @@
+	<Actions>
+
+		<HandlerAliases>
+			<Alias name="TestActionHandler1" class="org.jboss.soa.esb.actions.TestActionHandler1" />
+		</HandlerAliases>
+	</Actions>

Added: labs/jbossesb/workspace/tfennelly/product/core/listeners/tests/src/org/jboss/soa/esb/actions/ActionDefinition-Config-09.xml
===================================================================
--- labs/jbossesb/workspace/tfennelly/product/core/listeners/tests/src/org/jboss/soa/esb/actions/ActionDefinition-Config-09.xml	2006-09-11 17:16:50 UTC (rev 6147)
+++ labs/jbossesb/workspace/tfennelly/product/core/listeners/tests/src/org/jboss/soa/esb/actions/ActionDefinition-Config-09.xml	2006-09-11 18:31:14 UTC (rev 6148)
@@ -0,0 +1,5 @@
+	<Actions>
+		<Action name="ActionA" handler="TestActionHandler1">
+			<property name="param1" value="val1" />
+		</Action>
+	</Actions>

Added: labs/jbossesb/workspace/tfennelly/product/core/listeners/tests/src/org/jboss/soa/esb/actions/ActionDefinition-Config-10.xml
===================================================================
--- labs/jbossesb/workspace/tfennelly/product/core/listeners/tests/src/org/jboss/soa/esb/actions/ActionDefinition-Config-10.xml	2006-09-11 17:16:50 UTC (rev 6147)
+++ labs/jbossesb/workspace/tfennelly/product/core/listeners/tests/src/org/jboss/soa/esb/actions/ActionDefinition-Config-10.xml	2006-09-11 18:31:14 UTC (rev 6148)
@@ -0,0 +1,8 @@
+	<Actions>
+		<Action name="ActionA" handler="TestActionHandler1">
+			<property name="param1" value="val1" />
+		</Action>
+
+		<HandlerAliases>
+		</HandlerAliases>
+	</Actions>

Added: labs/jbossesb/workspace/tfennelly/product/core/listeners/tests/src/org/jboss/soa/esb/actions/ActionDefinition-Config-11.xml
===================================================================
--- labs/jbossesb/workspace/tfennelly/product/core/listeners/tests/src/org/jboss/soa/esb/actions/ActionDefinition-Config-11.xml	2006-09-11 17:16:50 UTC (rev 6147)
+++ labs/jbossesb/workspace/tfennelly/product/core/listeners/tests/src/org/jboss/soa/esb/actions/ActionDefinition-Config-11.xml	2006-09-11 18:31:14 UTC (rev 6148)
@@ -0,0 +1,9 @@
+	<Actions>
+		<Action name="ActionA" handler="TestActionHandler1">
+			<property name="param1" value="val1" />
+		</Action>
+
+		<HandlerAliases>
+			<Alias name="TestActionHandler1" class="org.jboss.soa.esb.actions.TestActionHandler1" />
+		</HandlerAliases>
+	</Actions>

Added: labs/jbossesb/workspace/tfennelly/product/core/listeners/tests/src/org/jboss/soa/esb/actions/ActionDefinitionFactoryUnitTest.java
===================================================================
--- labs/jbossesb/workspace/tfennelly/product/core/listeners/tests/src/org/jboss/soa/esb/actions/ActionDefinitionFactoryUnitTest.java	2006-09-11 17:16:50 UTC (rev 6147)
+++ labs/jbossesb/workspace/tfennelly/product/core/listeners/tests/src/org/jboss/soa/esb/actions/ActionDefinitionFactoryUnitTest.java	2006-09-11 18:31:14 UTC (rev 6148)
@@ -0,0 +1,91 @@
+/*
+ * 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.io.IOException;
+import java.util.List;
+
+import org.jboss.soa.esb.ConfigurationException;
+import org.jboss.soa.esb.actions.ActionDefinitionFactory.ActionDefinition;
+import org.jboss.soa.esb.helpers.DomElement;
+import org.jboss.soa.esb.helpers.KeyValuePair;
+import org.xml.sax.SAXException;
+
+import junit.framework.TestCase;
+
+/**
+ * Unit tests for the ActionDefinitionFactory class.
+ * @author <a href="mailto:tom.fennelly at jboss.com">tom.fennelly at jboss.com</a>
+ * @since Version 4.0
+ */
+public class ActionDefinitionFactoryUnitTest extends TestCase {
+
+    public void test_good_config() throws SAXException, IOException, ConfigurationException {
+        DomElement config = DomElement.fromInputStream(getClass().getResourceAsStream("ActionDefinition-Config-01.xml"));
+        ActionDefinitionFactory factory = new ActionDefinitionFactory(config);
+
+        // ActionHandler Impl with a non-default public constructor 
+        ActionDefinition actionDef = factory.getInstance("ActionA");
+        assertEquals("ActionA", actionDef.getName());
+        List<KeyValuePair> properties = actionDef.getProperties();
+        assertEquals(3, properties.size());
+        TestActionHandler1 handler1 = (TestActionHandler1) actionDef.getHandler();
+        assertEquals(actionDef.getName(), handler1.name);
+        assertEquals(properties, handler1.properties);
+        
+        actionDef = factory.getInstance("ActionB");
+        assertEquals("ActionB", actionDef.getName());
+        properties = actionDef.getProperties();
+        assertEquals(1, properties.size());
+        handler1 = (TestActionHandler1) actionDef.getHandler();
+        assertEquals(actionDef.getName(), handler1.name);
+        assertEquals(properties, handler1.properties);
+
+        // ActionHandler Impl with a non-default public constructor 
+        actionDef = factory.getInstance("ActionC");
+        assertEquals("ActionC", actionDef.getName());
+        TestActionHandler2 handler2 = (TestActionHandler2) actionDef.getHandler();
+    }
+
+    public void test_bad_config() throws SAXException, IOException, ConfigurationException {
+        test_bad_config("ActionDefinition-Config-02.xml", "Actions/Action has no 'name' defined.");
+        test_bad_config("ActionDefinition-Config-03.xml", "Actions/Action [ActionA] has no 'handler' defined.");
+        test_bad_config("ActionDefinition-Config-04.xml", "Actions/Action/property has no 'name' defined. Action [ActionA]");
+        test_bad_config("ActionDefinition-Config-05.xml", "Actions/Action/property has no 'value' defined. Action [ActionA]");
+        test_bad_config("ActionDefinition-Config-06.xml", "No action handler class defined for handler alias");
+        test_bad_config("ActionDefinition-Config-07.xml", "Actions/HandlerAliases/Alias has no 'name' defined");
+        test_bad_config("ActionDefinition-Config-08.xml", "No 'Actions/Action' configurations");
+        test_bad_config("ActionDefinition-Config-09.xml", "No 'Actions/HandlerAliases' configuration");
+        test_bad_config("ActionDefinition-Config-10.xml", "No action handler classes defined");
+    }
+    
+    private void test_bad_config(String configName, String exceptionMsg) throws SAXException, IOException, ConfigurationException {
+        DomElement config = DomElement.fromInputStream(getClass().getResourceAsStream(configName));
+        try {
+            new ActionDefinitionFactory(config);
+            fail("Expected ConfigurationException");
+        } catch(ConfigurationException e) {
+            assertTrue("Expected config exception statrting with [" + exceptionMsg + "].  Instead, go [" + e.getMessage() + "]", e.getMessage().startsWith(exceptionMsg));
+        }
+    }
+}

Added: labs/jbossesb/workspace/tfennelly/product/core/listeners/tests/src/org/jboss/soa/esb/actions/LongToDateConverter.java
===================================================================
--- labs/jbossesb/workspace/tfennelly/product/core/listeners/tests/src/org/jboss/soa/esb/actions/LongToDateConverter.java	2006-09-11 17:16:50 UTC (rev 6147)
+++ labs/jbossesb/workspace/tfennelly/product/core/listeners/tests/src/org/jboss/soa/esb/actions/LongToDateConverter.java	2006-09-11 18:31:14 UTC (rev 6148)
@@ -0,0 +1,44 @@
+/*
+ * 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.Date;
+
+/**
+ * LongToDate Converter Test Action Handler.
+ * @author <a href="mailto:tom.fennelly at jboss.com">tom.fennelly at jboss.com</a>
+ * @since Version 4.0
+ */
+public class LongToDateConverter implements ActionHandler {
+
+    /* (non-Javadoc)
+     * @see org.jboss.soa.esb.actions.ActionHandler#processAction(java.lang.Object)
+     */
+    public Object processAction(Object payload) throws ActionProcessingException {
+        if(!(payload instanceof Long)) {
+            throw new ActionProcessingException("This action handler only accepts Long object instances.");
+        }
+
+        return new Date((Long)payload);
+    }
+}

Added: labs/jbossesb/workspace/tfennelly/product/core/listeners/tests/src/org/jboss/soa/esb/actions/SmooksTransformAction-Config-01.xml
===================================================================
--- labs/jbossesb/workspace/tfennelly/product/core/listeners/tests/src/org/jboss/soa/esb/actions/SmooksTransformAction-Config-01.xml	2006-09-11 17:16:50 UTC (rev 6147)
+++ labs/jbossesb/workspace/tfennelly/product/core/listeners/tests/src/org/jboss/soa/esb/actions/SmooksTransformAction-Config-01.xml	2006-09-11 18:31:14 UTC (rev 6148)
@@ -0,0 +1,42 @@
+<TransformActionListener
+	command-queue-class="org.jboss.soa.esb.command.InMemoryCommandQueue"
+	command-queue-name="test-queue"
+>
+	
+	<ListenerConfig
+		listenerClass="org.jboss.soa.esb.util.MockPoller"
+		actions="X12N837-to-HL7V3, Process-HL7V3-Claim, HL7V3-to-X12N837, Route-to-Claims"
+		maxThreads="1"
+	>
+		<NotificationList type="OK">
+			<target class="org.jboss.soa.esb.util.MockNotificationTarget" name="ok-target" />
+		</NotificationList>
+	
+		<NotificationList type="err">
+			<target class="org.jboss.soa.esb.util.MockNotificationTarget" name="err-target" />
+		</NotificationList>
+	</ListenerConfig>
+
+	<Actions>
+		<!-- 
+			Under the new architecture I think these will be equivalent to "Contracts Definitions"? 
+		-->
+		<Action name="X12N837-to-HL7V3" handler="Smooks" />
+		<Action name="Process-HL7V3-Claim" handler="ClaimsProcessor" />
+		<Action name="HL7V3-to-X12N837" handler="Smooks" />
+		<Action name="Route-to-Claims" handler="SocketRouter">
+			<property name="address" value="xxxxx" />
+		</Action>
+
+		<HandlerAliases>
+			<!-- 
+				Under the new architecture I think these will be equivalent to "Services"?  The alias "name" being like the Service URN.
+			-->
+			<Alias name="Smooks" class="org.jboss.soa.esb.actions.SmooksTransformActionHandler" />
+			<Alias name="ClaimsProcessor" class="com.acme.health.ClaimsProcessor" />
+			<Alias name="JmsRouter" class="org.jboss.soa.esb.actions.JmsRouter" />
+			<Alias name="SocketRouter" class="org.jboss.soa.esb.actions.SocketRouter" />
+		</HandlerAliases>
+	</Actions>
+
+</TransformActionListener>

Added: labs/jbossesb/workspace/tfennelly/product/core/listeners/tests/src/org/jboss/soa/esb/actions/SmooksTransformActionFuncTest.java
===================================================================
--- labs/jbossesb/workspace/tfennelly/product/core/listeners/tests/src/org/jboss/soa/esb/actions/SmooksTransformActionFuncTest.java	2006-09-11 17:16:50 UTC (rev 6147)
+++ labs/jbossesb/workspace/tfennelly/product/core/listeners/tests/src/org/jboss/soa/esb/actions/SmooksTransformActionFuncTest.java	2006-09-11 18:31:14 UTC (rev 6148)
@@ -0,0 +1,18 @@
+package org.jboss.soa.esb.actions;
+
+import org.jboss.soa.esb.helpers.DomElement;
+import org.jboss.soa.esb.listeners.GpListener;
+import org.jboss.soa.esb.util.ListenersManagerExecThread;
+
+import junit.framework.TestCase;
+
+public class SmooksTransformActionFuncTest extends TestCase {
+
+	public void test() throws Exception {
+		DomElement config = DomElement.fromInputStream(getClass().getResourceAsStream("SmooksTransformActionListener-Config-01.xml"));
+		GpListener listenerManager = new GpListener(config);
+		ListenersManagerExecThread execThread = new ListenersManagerExecThread(listenerManager);
+		
+		// TODO: ... Work in progress...
+	}
+}

Added: labs/jbossesb/workspace/tfennelly/product/core/listeners/tests/src/org/jboss/soa/esb/actions/SmooksTransformActionUnitTest.java
===================================================================
--- labs/jbossesb/workspace/tfennelly/product/core/listeners/tests/src/org/jboss/soa/esb/actions/SmooksTransformActionUnitTest.java	2006-09-11 17:16:50 UTC (rev 6147)
+++ labs/jbossesb/workspace/tfennelly/product/core/listeners/tests/src/org/jboss/soa/esb/actions/SmooksTransformActionUnitTest.java	2006-09-11 18:31:14 UTC (rev 6148)
@@ -0,0 +1,10 @@
+package org.jboss.soa.esb.actions;
+
+import junit.framework.TestCase;
+
+public class SmooksTransformActionUnitTest extends TestCase {
+
+	public void test() {
+		// TODO: ... Work in progress...
+	}
+}

Added: labs/jbossesb/workspace/tfennelly/product/core/listeners/tests/src/org/jboss/soa/esb/actions/StringToLongConverter.java
===================================================================
--- labs/jbossesb/workspace/tfennelly/product/core/listeners/tests/src/org/jboss/soa/esb/actions/StringToLongConverter.java	2006-09-11 17:16:50 UTC (rev 6147)
+++ labs/jbossesb/workspace/tfennelly/product/core/listeners/tests/src/org/jboss/soa/esb/actions/StringToLongConverter.java	2006-09-11 18:31:14 UTC (rev 6148)
@@ -0,0 +1,42 @@
+/*
+ * 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;
+
+/**
+ * StringToLong Converter Test Action Handler.
+ * @author <a href="mailto:tom.fennelly at jboss.com">tom.fennelly at jboss.com</a>
+ * @since Version 4.0
+ */
+public class StringToLongConverter implements ActionHandler {
+
+    /* (non-Javadoc)
+     * @see org.jboss.soa.esb.actions.ActionHandler#processAction(java.lang.Object)
+     */
+    public Object processAction(Object payload) throws ActionProcessingException {
+        if(!(payload instanceof String)) {
+            throw new ActionProcessingException("This action handler only accepts String object instances.");
+        }
+
+        return Long.parseLong((String)payload);
+    }
+}

Added: labs/jbossesb/workspace/tfennelly/product/core/listeners/tests/src/org/jboss/soa/esb/actions/TestActionHandler1.java
===================================================================
--- labs/jbossesb/workspace/tfennelly/product/core/listeners/tests/src/org/jboss/soa/esb/actions/TestActionHandler1.java	2006-09-11 17:16:50 UTC (rev 6147)
+++ labs/jbossesb/workspace/tfennelly/product/core/listeners/tests/src/org/jboss/soa/esb/actions/TestActionHandler1.java	2006-09-11 18:31:14 UTC (rev 6148)
@@ -0,0 +1,54 @@
+/*
+ * 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.List;
+
+import org.jboss.soa.esb.helpers.KeyValuePair;
+
+/**
+ * 
+ * @author <a href="mailto:tom.fennelly at jboss.com">tom.fennelly at jboss.com</a>
+ * @since Version 4.0
+ */
+
+public class TestActionHandler1 implements ActionHandler {
+    
+    public String name;
+    public List<KeyValuePair> properties;
+
+	public TestActionHandler1(String name, List<KeyValuePair> properties) {
+		System.out.println("Instantiate action handler: " + name);
+        
+        this.name = name;
+        this.properties = properties;
+	}
+
+    /* (non-Javadoc)
+     * @see org.jboss.soa.esb.actions.ActionHandler#processAction(java.lang.Object)
+     */
+    public Object processAction(Object payload) {
+        System.out.println("processAction: " + payload);
+        return payload;
+    }
+}

Added: labs/jbossesb/workspace/tfennelly/product/core/listeners/tests/src/org/jboss/soa/esb/actions/TestActionHandler2.java
===================================================================
--- labs/jbossesb/workspace/tfennelly/product/core/listeners/tests/src/org/jboss/soa/esb/actions/TestActionHandler2.java	2006-09-11 17:16:50 UTC (rev 6147)
+++ labs/jbossesb/workspace/tfennelly/product/core/listeners/tests/src/org/jboss/soa/esb/actions/TestActionHandler2.java	2006-09-11 18:31:14 UTC (rev 6148)
@@ -0,0 +1,40 @@
+/*
+ * 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;
+
+/**
+ * 
+ * @author <a href="mailto:tom.fennelly at jboss.com">tom.fennelly at jboss.com</a>
+ * @since Version 4.0
+ */
+
+public class TestActionHandler2 implements ActionHandler {
+    
+    /* (non-Javadoc)
+     * @see org.jboss.soa.esb.actions.ActionHandler#processAction(java.lang.Object)
+     */
+    public Object processAction(Object payload) {
+        System.out.println("processAction: " + payload);
+        return payload;
+    }
+}

Added: labs/jbossesb/workspace/tfennelly/product/core/listeners/tests/src/org/jboss/soa/esb/actions/TestActionHandler3.java
===================================================================
--- labs/jbossesb/workspace/tfennelly/product/core/listeners/tests/src/org/jboss/soa/esb/actions/TestActionHandler3.java	2006-09-11 17:16:50 UTC (rev 6147)
+++ labs/jbossesb/workspace/tfennelly/product/core/listeners/tests/src/org/jboss/soa/esb/actions/TestActionHandler3.java	2006-09-11 18:31:14 UTC (rev 6148)
@@ -0,0 +1,44 @@
+/*
+ * 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;
+
+/**
+ * 
+ * @author <a href="mailto:tom.fennelly at jboss.com">tom.fennelly at jboss.com</a>
+ * @since Version 4.0
+ */
+
+public class TestActionHandler3 implements ActionHandler {
+
+	public TestActionHandler3(String name) {
+		System.out.println("Instantiate action handler: " + name);
+	}
+
+    /* (non-Javadoc)
+     * @see org.jboss.soa.esb.actions.ActionHandler#processAction(java.lang.Object)
+     */
+    public Object processAction(Object payload) {
+        System.out.println("processAction: " + payload);
+        return payload;
+    }
+}

Added: labs/jbossesb/workspace/tfennelly/product/core/listeners/tests/src/org/jboss/soa/esb/actions/ToNowhereRouter.java
===================================================================
--- labs/jbossesb/workspace/tfennelly/product/core/listeners/tests/src/org/jboss/soa/esb/actions/ToNowhereRouter.java	2006-09-11 17:16:50 UTC (rev 6147)
+++ labs/jbossesb/workspace/tfennelly/product/core/listeners/tests/src/org/jboss/soa/esb/actions/ToNowhereRouter.java	2006-09-11 18:31:14 UTC (rev 6148)
@@ -0,0 +1,46 @@
+/*
+ * 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;
+
+/**
+ * 
+ * @author <a href="mailto:tom.fennelly at jboss.com">tom.fennelly at jboss.com</a>
+ * @since Version 4.0
+ */
+public class ToNowhereRouter implements ActionHandler {
+
+    public static List objects = new ArrayList();
+
+    /* (non-Javadoc)
+     * @see org.jboss.soa.esb.actions.ActionHandler#processAction(java.lang.Object)
+     */
+    public Object processAction(Object payload) throws ActionProcessingException {
+        objects.add(payload);
+                
+        return null;
+    }
+
+}




More information about the jboss-svn-commits mailing list