[jboss-svn-commits] JBL Code SVN: r10099 - in labs/jbossesb/trunk/product/core/listeners/tests/src/org/jboss/soa/esb/actions: routing and 1 other directory.

jboss-svn-commits at lists.jboss.org jboss-svn-commits at lists.jboss.org
Fri Mar 9 14:30:52 EST 2007


Author: mark.little at jboss.com
Date: 2007-03-09 14:30:52 -0500 (Fri, 09 Mar 2007)
New Revision: 10099

Added:
   labs/jbossesb/trunk/product/core/listeners/tests/src/org/jboss/soa/esb/actions/routing/
   labs/jbossesb/trunk/product/core/listeners/tests/src/org/jboss/soa/esb/actions/routing/EchoRouterUnitTest.java
   labs/jbossesb/trunk/product/core/listeners/tests/src/org/jboss/soa/esb/actions/routing/HttpRouterUnitTest.java
   labs/jbossesb/trunk/product/core/listeners/tests/src/org/jboss/soa/esb/actions/routing/JmsRouterUnitTest.java
Log:
http://jira.jboss.com/jira/browse/JBESB-346

Added: labs/jbossesb/trunk/product/core/listeners/tests/src/org/jboss/soa/esb/actions/routing/EchoRouterUnitTest.java
===================================================================
--- labs/jbossesb/trunk/product/core/listeners/tests/src/org/jboss/soa/esb/actions/routing/EchoRouterUnitTest.java	                        (rev 0)
+++ labs/jbossesb/trunk/product/core/listeners/tests/src/org/jboss/soa/esb/actions/routing/EchoRouterUnitTest.java	2007-03-09 19:30:52 UTC (rev 10099)
@@ -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.routing;
+
+import junit.framework.TestCase;
+
+import org.jboss.soa.esb.message.Message;
+import org.jboss.soa.esb.message.format.MessageFactory;
+
+public class EchoRouterUnitTest extends TestCase
+{
+	public EchoRouterUnitTest ()
+	{
+	}
+
+	public void testRouter () throws Exception
+	{
+		EchoRouter router = new EchoRouter(null);
+		Message msg = MessageFactory.getInstance().getMessage();
+		
+		msg.getBody().setContents("hello world".getBytes());
+		
+		router.process(msg);
+		
+		router.getErrorNotification(null);
+		router.getOkNotification(null);
+	}
+	
+}

Added: labs/jbossesb/trunk/product/core/listeners/tests/src/org/jboss/soa/esb/actions/routing/HttpRouterUnitTest.java
===================================================================
--- labs/jbossesb/trunk/product/core/listeners/tests/src/org/jboss/soa/esb/actions/routing/HttpRouterUnitTest.java	                        (rev 0)
+++ labs/jbossesb/trunk/product/core/listeners/tests/src/org/jboss/soa/esb/actions/routing/HttpRouterUnitTest.java	2007-03-09 19:30:52 UTC (rev 10099)
@@ -0,0 +1,82 @@
+/*
+ * 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.routing;
+
+import junit.framework.TestCase;
+
+import org.jboss.soa.esb.actions.ActionProcessingException;
+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;
+
+public class HttpRouterUnitTest extends TestCase
+{
+	public HttpRouterUnitTest ()
+	{
+	}
+
+	public void testRouter () throws Exception
+	{
+		ConfigTree tree = new ConfigTree("test");
+		
+		tree.setAttribute(ListenerTagNames.HTTP_ROUTER_ROUTE_URL, "http://foo.bar");
+		
+		HttpRouter router = new HttpRouter(tree);
+		
+		Message msg = MessageFactory.getInstance().getMessage();
+		
+		msg.getBody().setContents("hello world".getBytes());
+		
+		boolean exception = false;
+		
+		try
+		{
+			router.process(msg);
+		}
+		catch (ActionProcessingException ex)
+		{
+			exception = true;
+		}
+		
+		if (!exception)
+			fail();
+		
+		tree.setAttribute(ListenerTagNames.HTTP_ROUTER_ROUTE_URL, "http://www.jboss.com");
+		
+		router = new HttpRouter(tree);
+		
+		try
+		{
+			router.process(msg);
+		}
+		catch (ActionProcessingException ex)
+		{
+			fail();
+		}
+		
+		router.getErrorNotification(null);
+		router.getOkNotification(null);
+	}
+	
+}

Added: labs/jbossesb/trunk/product/core/listeners/tests/src/org/jboss/soa/esb/actions/routing/JmsRouterUnitTest.java
===================================================================
--- labs/jbossesb/trunk/product/core/listeners/tests/src/org/jboss/soa/esb/actions/routing/JmsRouterUnitTest.java	                        (rev 0)
+++ labs/jbossesb/trunk/product/core/listeners/tests/src/org/jboss/soa/esb/actions/routing/JmsRouterUnitTest.java	2007-03-09 19:30:52 UTC (rev 10099)
@@ -0,0 +1,84 @@
+/*
+ * 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.routing;
+
+import junit.framework.TestCase;
+
+import org.jboss.soa.esb.ConfigurationException;
+import org.jboss.soa.esb.actions.ActionProcessingException;
+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;
+
+public class JmsRouterUnitTest extends TestCase
+{
+	public JmsRouterUnitTest ()
+	{
+	}
+
+	public void testRouter () throws Exception
+	{
+		ConfigTree tree = new ConfigTree("test");
+		
+		tree.setAttribute("jndiName", "foobar");
+		
+		JMSRouter router = new JMSRouter(tree);
+		boolean exception = false;
+		
+		Message msg = MessageFactory.getInstance().getMessage();
+		
+		msg.getBody().setContents("hello world".getBytes());
+		
+		try
+		{
+			router.route(msg);
+		}
+		catch (ActionProcessingException ex)
+		{
+			exception = true;
+		}
+		
+		if (!exception)
+			fail();
+		
+		router.unwrap = true;
+		
+		try
+		{
+			msg.getBody().add("org.jboss.soa.esb.actions.current.after", "hello world");
+			router.process(msg);
+		}
+		catch (ActionProcessingException ex)
+		{
+			exception = true;
+		}
+
+		if (!exception)
+			fail();
+		
+		router.getErrorNotification(null);
+		router.getOkNotification(null);
+	}
+	
+}




More information about the jboss-svn-commits mailing list