[jboss-svn-commits] JBL Code SVN: r10119 - in labs/jbossesb/trunk/product/core/listeners/tests/src/org/jboss/soa/esb: listeners and 1 other directories.
jboss-svn-commits at lists.jboss.org
jboss-svn-commits at lists.jboss.org
Sun Mar 11 11:31:53 EDT 2007
Author: mark.little at jboss.com
Date: 2007-03-11 11:31:53 -0400 (Sun, 11 Mar 2007)
New Revision: 10119
Added:
labs/jbossesb/trunk/product/core/listeners/tests/src/org/jboss/soa/esb/actions/templates/MockActionUnitTest.java
labs/jbossesb/trunk/product/core/listeners/tests/src/org/jboss/soa/esb/listeners/message/ActionProcessingPipelineUnitTest.java
Modified:
labs/jbossesb/trunk/product/core/listeners/tests/src/org/jboss/soa/esb/listeners/LifecycleUtilUnitTest.java
Log:
more unit tests.
Added: labs/jbossesb/trunk/product/core/listeners/tests/src/org/jboss/soa/esb/actions/templates/MockActionUnitTest.java
===================================================================
--- labs/jbossesb/trunk/product/core/listeners/tests/src/org/jboss/soa/esb/actions/templates/MockActionUnitTest.java (rev 0)
+++ labs/jbossesb/trunk/product/core/listeners/tests/src/org/jboss/soa/esb/actions/templates/MockActionUnitTest.java 2007-03-11 15:31:53 UTC (rev 10119)
@@ -0,0 +1,49 @@
+/*
+ * 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.templates;
+
+import org.jboss.soa.esb.message.Message;
+import org.jboss.soa.esb.message.format.MessageFactory;
+
+import junit.framework.TestCase;
+
+public class MockActionUnitTest extends TestCase
+{
+ public void testMockAction ()
+ {
+ MockAction action = new MockAction();
+ Message msg = MessageFactory.getInstance().getMessage();
+
+ msg.getBody().add("Hello", "World");
+
+ action.process(msg);
+ }
+
+ public void testMockComposer ()
+ {
+ MockComposer composer = new MockComposer();
+
+ composer.composeEmptyMessage("Hello World");
+ }
+
+}
Modified: labs/jbossesb/trunk/product/core/listeners/tests/src/org/jboss/soa/esb/listeners/LifecycleUtilUnitTest.java
===================================================================
--- labs/jbossesb/trunk/product/core/listeners/tests/src/org/jboss/soa/esb/listeners/LifecycleUtilUnitTest.java 2007-03-11 06:35:50 UTC (rev 10118)
+++ labs/jbossesb/trunk/product/core/listeners/tests/src/org/jboss/soa/esb/listeners/LifecycleUtilUnitTest.java 2007-03-11 15:31:53 UTC (rev 10119)
@@ -22,7 +22,6 @@
package org.jboss.soa.esb.listeners;
-import java.io.File;
import java.io.FileInputStream;
import org.jboss.soa.esb.helpers.ConfigTree;
Added: labs/jbossesb/trunk/product/core/listeners/tests/src/org/jboss/soa/esb/listeners/message/ActionProcessingPipelineUnitTest.java
===================================================================
--- labs/jbossesb/trunk/product/core/listeners/tests/src/org/jboss/soa/esb/listeners/message/ActionProcessingPipelineUnitTest.java (rev 0)
+++ labs/jbossesb/trunk/product/core/listeners/tests/src/org/jboss/soa/esb/listeners/message/ActionProcessingPipelineUnitTest.java 2007-03-11 15:31:53 UTC (rev 10119)
@@ -0,0 +1,111 @@
+/*
+ * 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.listeners.message;
+
+import org.jboss.soa.esb.ConfigurationException;
+import org.jboss.soa.esb.actions.templates.MockAction;
+import org.jboss.soa.esb.helpers.ConfigTree;
+import org.jboss.soa.esb.listeners.ListenerTagNames;
+import org.jboss.soa.esb.message.Message;
+import org.jboss.soa.esb.message.format.MessageFactory;
+
+import junit.framework.TestCase;
+
+public class ActionProcessingPipelineUnitTest extends TestCase
+{
+ public void testConstructor () throws Exception
+ {
+ ConfigTree tree = new ConfigTree("tree");
+ Message msg = MessageFactory.getInstance().getMessage();
+
+ msg.getBody().add("Hello", "World");
+
+ ActionProcessingPipeline pipeline = null;
+
+ try
+ {
+ pipeline = new ActionProcessingPipeline(null, tree);
+
+ fail();
+ }
+ catch (IllegalArgumentException ex)
+ {
+ }
+
+ try
+ {
+ pipeline = new ActionProcessingPipeline(msg, null);
+
+ fail();
+ }
+ catch (IllegalArgumentException ex)
+ {
+ }
+
+ try
+ {
+ pipeline = new ActionProcessingPipeline(msg, tree);
+
+ fail();
+ }
+ catch (ConfigurationException ex)
+ {
+ }
+ }
+
+ public void testMethods () throws Exception
+ {
+ ConfigTree parent = new ConfigTree("parent");
+ ConfigTree child = new ConfigTree(ListenerTagNames.ACTION_ELEMENT_TAG, parent);
+
+ Message msg = MessageFactory.getInstance().getMessage();
+
+ msg.getBody().add("Hello", "World");
+
+ child.setAttribute(ListenerTagNames.ACTION_ELEMENT_TAG, "foo");
+ child.setAttribute(ListenerTagNames.ACTION_CLASS_TAG, "bar");
+ child.setAttribute(ListenerTagNames.PROCESS_METHOD_TAG, "process");
+ child.setAttribute(ListenerTagNames.EXCEPTION_METHOD_TAG, "error");
+
+ ActionProcessingPipeline pipeline = new ActionProcessingPipeline(msg, parent);
+
+ Message msg2 = pipeline.getMessage();
+
+ if (!msg.equals(msg2))
+ fail();
+
+ pipeline.prematureTermination("foobar");
+
+ try
+ {
+ pipeline.actionClassException(child, msg, new Exception());
+ fail();
+ }
+ catch (Exception ex)
+ {
+ }
+
+ if (pipeline.isProcessingComplete())
+ fail();
+ }
+}
More information about the jboss-svn-commits
mailing list