[jboss-svn-commits] JBL Code SVN: r11840 - in labs/jbossesb/workspace/rearch2/core: src/main/java/org/jboss/soa/esb/addressing/eprs and 7 other directories.

jboss-svn-commits at lists.jboss.org jboss-svn-commits at lists.jboss.org
Sun May 13 02:03:03 EDT 2007


Author: mark.little at jboss.com
Date: 2007-05-13 02:03:03 -0400 (Sun, 13 May 2007)
New Revision: 11840

Added:
   labs/jbossesb/workspace/rearch2/core/src/test/java/org/jboss/soa/esb/infrastructure/
   labs/jbossesb/workspace/rearch2/core/src/test/java/org/jboss/soa/esb/infrastructure/NullReceiverDispatcher.java
   labs/jbossesb/workspace/rearch2/core/src/test/java/org/jboss/soa/esb/infrastructure/NullReceiverDispatcherPlugin.java
   labs/jbossesb/workspace/rearch2/core/src/test/java/org/jboss/soa/esb/infrastructure/NullSenderDispatcher.java
   labs/jbossesb/workspace/rearch2/core/src/test/java/org/jboss/soa/esb/infrastructure/NullSenderDispatcherPlugin.java
   labs/jbossesb/workspace/rearch2/core/src/test/java/org/jboss/soa/esb/infrastructure/tests/
   labs/jbossesb/workspace/rearch2/core/src/test/java/org/jboss/soa/esb/infrastructure/tests/DispatcherUnitTest.java
Modified:
   labs/jbossesb/workspace/rearch2/core/etc/schemas/xml/common/dispatcher.xsd
   labs/jbossesb/workspace/rearch2/core/src/main/java/org/jboss/soa/esb/addressing/eprs/HTTPEpr.java
   labs/jbossesb/workspace/rearch2/core/src/main/java/org/jboss/soa/esb/infrastructure/Contract.java
   labs/jbossesb/workspace/rearch2/core/src/main/java/org/jboss/soa/esb/infrastructure/Dispatcher.java
   labs/jbossesb/workspace/rearch2/core/src/main/java/org/jboss/soa/esb/infrastructure/DispatcherFactory.java
   labs/jbossesb/workspace/rearch2/core/src/main/java/org/jboss/soa/esb/infrastructure/plugin/DispatcherPlugin.java
   labs/jbossesb/workspace/rearch2/core/src/test/java/org/jboss/soa/esb/addressing/helpers/tests/FTPUnitTest.java
   labs/jbossesb/workspace/rearch2/core/src/test/java/org/jboss/soa/esb/addressing/helpers/tests/HTTPUnitTest.java
   labs/jbossesb/workspace/rearch2/core/src/test/java/org/jboss/soa/esb/message/tests/SerializedMessageUnitTest.java
   labs/jbossesb/workspace/rearch2/core/src/test/java/org/jboss/soa/esb/message/tests/XMLMessageUnitTest.java
Log:


Modified: labs/jbossesb/workspace/rearch2/core/etc/schemas/xml/common/dispatcher.xsd
===================================================================
--- labs/jbossesb/workspace/rearch2/core/etc/schemas/xml/common/dispatcher.xsd	2007-05-13 04:49:13 UTC (rev 11839)
+++ labs/jbossesb/workspace/rearch2/core/etc/schemas/xml/common/dispatcher.xsd	2007-05-13 06:03:03 UTC (rev 11840)
@@ -1,5 +1,5 @@
 <?xml version="1.0" encoding="UTF-8"?>
-<xs:schema attributeFormDefault="unqualified" elementFormDefault="qualified" targetNamespace="http://labs.jboss.org/jbossesb/2007/5/dispatcher" xmlns:xs="http://www.w3.org/2001/XMLSchema">
+<xs:schema attributeFormDefault="unqualified" elementFormDefault="qualified" targetNamespace="http://labs.jboss.org/jbossesb/2007/05/dispatcher" xmlns:xs="http://www.w3.org/2001/XMLSchema">
 	<xs:complexType name="identifier">
 		<xs:sequence>
 			<xs:element maxOccurs="1" name="uid" type="xs:anyURI"/>

Modified: labs/jbossesb/workspace/rearch2/core/src/main/java/org/jboss/soa/esb/addressing/eprs/HTTPEpr.java
===================================================================
--- labs/jbossesb/workspace/rearch2/core/src/main/java/org/jboss/soa/esb/addressing/eprs/HTTPEpr.java	2007-05-13 04:49:13 UTC (rev 11839)
+++ labs/jbossesb/workspace/rearch2/core/src/main/java/org/jboss/soa/esb/addressing/eprs/HTTPEpr.java	2007-05-13 06:03:03 UTC (rev 11840)
@@ -55,7 +55,7 @@
 	
 	public HTTPEpr (URI url) throws URISyntaxException
 	{
-		super(nurl);
+		super(url);
 	}
 	
 	public HTTPEpr (String url) throws URISyntaxException

Modified: labs/jbossesb/workspace/rearch2/core/src/main/java/org/jboss/soa/esb/infrastructure/Contract.java
===================================================================
--- labs/jbossesb/workspace/rearch2/core/src/main/java/org/jboss/soa/esb/infrastructure/Contract.java	2007-05-13 04:49:13 UTC (rev 11839)
+++ labs/jbossesb/workspace/rearch2/core/src/main/java/org/jboss/soa/esb/infrastructure/Contract.java	2007-05-13 06:03:03 UTC (rev 11840)
@@ -2,8 +2,6 @@
 
 import java.net.URI;
 
-import org.jboss.soa.esb.message.Message;
-
 /*
  * JBoss, Home of Professional Open Source
  * Copyright 2006, JBoss Inc., and others contributors as indicated 
@@ -25,9 +23,29 @@
  * @author mark.little at jboss.com
  */
 
-public interface Contract
+public class Contract
 {
-	public URI getIdentifier ();
+	// should be the data returned from the XML configuration file
+	public Contract (String fileName)
+	{
+		/*
+		 * Use fileName (xml file) and pull it apart to get info
+		 * on per-dispatcher basis.
+		 */
+	}
 	
-    public Message dispatch (Message msg);
+	/**
+	 * Return the configuration information for the dispatcher.
+	 * 
+	 * @param dispatcherName the dispatcher name
+	 * @return the configuration information
+	 */
+	public Object getConfiguration (URI dispatcherName)
+	{
+		if (dispatcherName == null)
+			throw new IllegalArgumentException();
+		
+		return null;
+	}
+	
 }

Modified: labs/jbossesb/workspace/rearch2/core/src/main/java/org/jboss/soa/esb/infrastructure/Dispatcher.java
===================================================================
--- labs/jbossesb/workspace/rearch2/core/src/main/java/org/jboss/soa/esb/infrastructure/Dispatcher.java	2007-05-13 04:49:13 UTC (rev 11839)
+++ labs/jbossesb/workspace/rearch2/core/src/main/java/org/jboss/soa/esb/infrastructure/Dispatcher.java	2007-05-13 06:03:03 UTC (rev 11840)
@@ -1,6 +1,7 @@
 package org.jboss.soa.esb.infrastructure;
 
 import java.net.URI;
+import java.net.URISyntaxException;
 
 import org.jboss.soa.esb.message.Message;
 
@@ -34,7 +35,7 @@
 
 public interface Dispatcher
 {
-	public URI getIdentifier ();
+	public URI getIdentifier () throws URISyntaxException;
 	
     public Message dispatch (Message msg);
     
@@ -42,6 +43,4 @@
      * TODO add methods for ordering dispatchers in list.
      * insertBefore, insertAfter, replace etc.
      */
-    
-    bar
 }

Modified: labs/jbossesb/workspace/rearch2/core/src/main/java/org/jboss/soa/esb/infrastructure/DispatcherFactory.java
===================================================================
--- labs/jbossesb/workspace/rearch2/core/src/main/java/org/jboss/soa/esb/infrastructure/DispatcherFactory.java	2007-05-13 04:49:13 UTC (rev 11839)
+++ labs/jbossesb/workspace/rearch2/core/src/main/java/org/jboss/soa/esb/infrastructure/DispatcherFactory.java	2007-05-13 06:03:03 UTC (rev 11840)
@@ -37,13 +37,17 @@
  * may be the root of a hierarchy, or a hierarchy may be built up dynamically as
  * the message progresses through it.
  * 
+ * org.jboss.soa.esb.infrastructure.dispatcherPlugin.URI1=dispatcherclass1?configuration
+ * org.jboss.soa.esb.infrastructure.dispatcherPlugin.URI2=dispatcherclass2
+ * 
  * @author Mark Little
  *
  */
 
 public class DispatcherFactory
 {
-	public static final String DISPATCHER_PLUGIN_NAME = "org.jboss.soa.esb.infrastructure.dispatcherPlugin";
+	public static final String DISPATCHER_CONFIGURATION = "?";
+	public static final String DISPATCHER_PLUGIN_NAME = "org.jboss.soa.esb.infrastructure.dispatcherPlugin.";
 	
 	public static DispatcherFactory getFactory ()
 	{
@@ -68,7 +72,7 @@
 		DispatcherPlugin plugin = _registeredDispatchers.get(name);
 		
 		if (plugin == null)
-			throw new IllegalArgumentException("No registerd dispatcher for that identifier");
+			return null;
 		else
 			return plugin.create();
 	}
@@ -125,15 +129,32 @@
 					if (key.startsWith(DispatcherFactory.DISPATCHER_PLUGIN_NAME))
 					{
 						/*
-						 * Strip off the attribute name to get the protocol.
+						 * Strip off the attribute name to get the dispatcher name and
+						 * any configuration information.
 						 */
 						
-						URI protocol = new URI(key.substring(DISPATCHER_PLUGIN_NAME.length()));
+						URI dispatcherName = new URI(key.substring(DispatcherFactory.DISPATCHER_PLUGIN_NAME.length()));
 						String pluginClassName = (String) props.get(key);
+						URI dispatcherConfiguration = null;
+						
+						if (pluginClassName.contains(DISPATCHER_CONFIGURATION))
+						{
+							/*
+							 * Get the configuration URI off the end of the string.
+							 * Then get the actual classname to instantiate.
+							 */
+							
+							dispatcherConfiguration = new URI(pluginClassName.substring(pluginClassName.indexOf(DISPATCHER_CONFIGURATION)+1));
+							pluginClassName = pluginClassName.substring(0, pluginClassName.indexOf(DISPATCHER_CONFIGURATION) -1);
+						}
+						
 						Class pluginClass = Thread.currentThread().getContextClassLoader().loadClass(pluginClassName);
 						DispatcherPlugin plugin = (DispatcherPlugin) pluginClass.newInstance();
 						
-						DispatcherFactory._registeredDispatchers.put(protocol, plugin);
+						if (dispatcherConfiguration != null)
+							plugin.initialize(dispatcherConfiguration);
+						
+						DispatcherFactory._registeredDispatchers.put(dispatcherName, plugin);
 					}
 				}
 				

Modified: labs/jbossesb/workspace/rearch2/core/src/main/java/org/jboss/soa/esb/infrastructure/plugin/DispatcherPlugin.java
===================================================================
--- labs/jbossesb/workspace/rearch2/core/src/main/java/org/jboss/soa/esb/infrastructure/plugin/DispatcherPlugin.java	2007-05-13 04:49:13 UTC (rev 11839)
+++ labs/jbossesb/workspace/rearch2/core/src/main/java/org/jboss/soa/esb/infrastructure/plugin/DispatcherPlugin.java	2007-05-13 06:03:03 UTC (rev 11840)
@@ -1,8 +1,8 @@
 package org.jboss.soa.esb.infrastructure.plugin;
 
 import java.net.URI;
+import java.net.URISyntaxException;
 
-import org.jboss.soa.esb.infrastructure.Contract;
 import org.jboss.soa.esb.infrastructure.Dispatcher;
 
 /*
@@ -28,7 +28,9 @@
 
 public interface DispatcherPlugin
 {
-	public Dispatcher create (Contract ct);
+	public void initialize (URI conf);
 	
-	public URI getIdentifier ();
+	public Dispatcher create ();
+	
+	public URI getIdentifier () throws URISyntaxException;
 }

Modified: labs/jbossesb/workspace/rearch2/core/src/test/java/org/jboss/soa/esb/addressing/helpers/tests/FTPUnitTest.java
===================================================================
--- labs/jbossesb/workspace/rearch2/core/src/test/java/org/jboss/soa/esb/addressing/helpers/tests/FTPUnitTest.java	2007-05-13 04:49:13 UTC (rev 11839)
+++ labs/jbossesb/workspace/rearch2/core/src/test/java/org/jboss/soa/esb/addressing/helpers/tests/FTPUnitTest.java	2007-05-13 06:03:03 UTC (rev 11840)
@@ -53,9 +53,9 @@
 		{
 			FTPEpr ftp = new FTPEpr("ftp://foo.com");
 			
-			assertEquals(ftp.getURL().toString(), "ftp://foo.com");
-			assertEquals(ftp.getURL().getHost(), "foo.com");
-			assertEquals(ftp.getURL().getProtocol(), "ftp");
+			assertEquals(ftp.getURI().toString(), "ftp://foo.com");
+			assertEquals(ftp.getURI().getHost(), "foo.com");
+			assertEquals(ftp.getURI().getScheme(), "ftp");
 			
 			ftp.setPassword("foobar");
 			assertEquals(ftp.getPassword(), "foobar");

Modified: labs/jbossesb/workspace/rearch2/core/src/test/java/org/jboss/soa/esb/addressing/helpers/tests/HTTPUnitTest.java
===================================================================
--- labs/jbossesb/workspace/rearch2/core/src/test/java/org/jboss/soa/esb/addressing/helpers/tests/HTTPUnitTest.java	2007-05-13 04:49:13 UTC (rev 11839)
+++ labs/jbossesb/workspace/rearch2/core/src/test/java/org/jboss/soa/esb/addressing/helpers/tests/HTTPUnitTest.java	2007-05-13 06:03:03 UTC (rev 11840)
@@ -22,7 +22,7 @@
 
 package org.jboss.soa.esb.addressing.helpers.tests;
 
-import java.net.URL;
+import java.net.URI;
 
 import junit.framework.TestCase;
 
@@ -57,12 +57,12 @@
 			String url1 = "http://www.local.bar:8080";
 			HTTPEpr epr = new HTTPEpr(url1);
 			
-			assertEquals(epr.getURL().toString(), url1);
+			assertEquals(epr.getURI().toString(), url1);
 			
 			String url2 = "http://foo.com";
-			epr.setURL(new URL(url2));
+			epr.setURI(new URI(url2));
 			
-			assertEquals(epr.getURL().toString(), url2);
+			assertEquals(epr.getURI().toString(), url2);
 		}
 		catch (Exception ex)
 		{

Added: labs/jbossesb/workspace/rearch2/core/src/test/java/org/jboss/soa/esb/infrastructure/NullReceiverDispatcher.java
===================================================================
--- labs/jbossesb/workspace/rearch2/core/src/test/java/org/jboss/soa/esb/infrastructure/NullReceiverDispatcher.java	                        (rev 0)
+++ labs/jbossesb/workspace/rearch2/core/src/test/java/org/jboss/soa/esb/infrastructure/NullReceiverDispatcher.java	2007-05-13 06:03:03 UTC (rev 11840)
@@ -0,0 +1,54 @@
+package org.jboss.soa.esb.infrastructure;
+
+import java.net.URI;
+import java.net.URISyntaxException;
+
+import org.jboss.soa.esb.message.Message;
+
+/*
+ * 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 mark.little at jboss.com
+ */
+
+
+/**
+ * This dispatcher does nothing.
+ * 
+ * @author Mark Little
+ *
+ */
+
+public class NullReceiverDispatcher implements Dispatcher
+{
+	public NullReceiverDispatcher ()
+	{
+	}
+	
+	public URI getIdentifier () throws URISyntaxException
+	{
+		return new URI(_identifier);
+	}
+	
+    public Message dispatch (Message msg)
+    {
+    	return null;
+    }
+    
+    static String _identifier = "urn:nullreceiver";
+}

Added: labs/jbossesb/workspace/rearch2/core/src/test/java/org/jboss/soa/esb/infrastructure/NullReceiverDispatcherPlugin.java
===================================================================
--- labs/jbossesb/workspace/rearch2/core/src/test/java/org/jboss/soa/esb/infrastructure/NullReceiverDispatcherPlugin.java	                        (rev 0)
+++ labs/jbossesb/workspace/rearch2/core/src/test/java/org/jboss/soa/esb/infrastructure/NullReceiverDispatcherPlugin.java	2007-05-13 06:03:03 UTC (rev 11840)
@@ -0,0 +1,56 @@
+package org.jboss.soa.esb.infrastructure;
+
+import java.net.URI;
+import java.net.URISyntaxException;
+
+import org.jboss.soa.esb.infrastructure.plugin.DispatcherPlugin;
+
+/*
+ * 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 mark.little at jboss.com
+ */
+
+
+/**
+ * This dispatcher does nothing.
+ * 
+ * @author Mark Little
+ *
+ */
+
+public class NullReceiverDispatcherPlugin implements DispatcherPlugin
+{
+	public NullReceiverDispatcherPlugin ()
+	{
+	}
+	
+	public void initialize (URI conf)
+	{
+	}
+	
+	public Dispatcher create ()
+	{
+		return new NullReceiverDispatcher();
+	}
+
+	public URI getIdentifier () throws URISyntaxException
+	{
+		return new URI(NullReceiverDispatcher._identifier);
+	}
+}

Added: labs/jbossesb/workspace/rearch2/core/src/test/java/org/jboss/soa/esb/infrastructure/NullSenderDispatcher.java
===================================================================
--- labs/jbossesb/workspace/rearch2/core/src/test/java/org/jboss/soa/esb/infrastructure/NullSenderDispatcher.java	                        (rev 0)
+++ labs/jbossesb/workspace/rearch2/core/src/test/java/org/jboss/soa/esb/infrastructure/NullSenderDispatcher.java	2007-05-13 06:03:03 UTC (rev 11840)
@@ -0,0 +1,54 @@
+package org.jboss.soa.esb.infrastructure;
+
+import java.net.URI;
+import java.net.URISyntaxException;
+
+import org.jboss.soa.esb.message.Message;
+
+/*
+ * 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 mark.little at jboss.com
+ */
+
+
+/**
+ * This dispatcher does nothing.
+ * 
+ * @author Mark Little
+ *
+ */
+
+public class NullSenderDispatcher implements Dispatcher
+{
+	public NullSenderDispatcher ()
+	{
+	}
+	
+	public URI getIdentifier () throws URISyntaxException
+	{
+		return new URI(_identifier);
+	}
+	
+    public Message dispatch (Message msg)
+    {
+    	return null;
+    }
+    
+    static String _identifier = "urn:nullsender";
+}

Added: labs/jbossesb/workspace/rearch2/core/src/test/java/org/jboss/soa/esb/infrastructure/NullSenderDispatcherPlugin.java
===================================================================
--- labs/jbossesb/workspace/rearch2/core/src/test/java/org/jboss/soa/esb/infrastructure/NullSenderDispatcherPlugin.java	                        (rev 0)
+++ labs/jbossesb/workspace/rearch2/core/src/test/java/org/jboss/soa/esb/infrastructure/NullSenderDispatcherPlugin.java	2007-05-13 06:03:03 UTC (rev 11840)
@@ -0,0 +1,56 @@
+package org.jboss.soa.esb.infrastructure;
+
+import java.net.URI;
+import java.net.URISyntaxException;
+
+import org.jboss.soa.esb.infrastructure.plugin.DispatcherPlugin;
+
+/*
+ * 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 mark.little at jboss.com
+ */
+
+
+/**
+ * This dispatcher does nothing.
+ * 
+ * @author Mark Little
+ *
+ */
+
+public class NullSenderDispatcherPlugin implements DispatcherPlugin
+{
+	public NullSenderDispatcherPlugin ()
+	{
+	}
+	
+	public void initialize (URI conf)
+	{
+	}
+	
+	public Dispatcher create ()
+	{
+		return new NullSenderDispatcher();
+	}
+
+	public URI getIdentifier () throws URISyntaxException
+	{
+		return new URI(NullSenderDispatcher._identifier);
+	}
+}

Added: labs/jbossesb/workspace/rearch2/core/src/test/java/org/jboss/soa/esb/infrastructure/tests/DispatcherUnitTest.java
===================================================================
--- labs/jbossesb/workspace/rearch2/core/src/test/java/org/jboss/soa/esb/infrastructure/tests/DispatcherUnitTest.java	                        (rev 0)
+++ labs/jbossesb/workspace/rearch2/core/src/test/java/org/jboss/soa/esb/infrastructure/tests/DispatcherUnitTest.java	2007-05-13 06:03:03 UTC (rev 11840)
@@ -0,0 +1,94 @@
+/*
+ * 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.infrastructure.tests;
+
+import java.net.URI;
+
+import junit.framework.TestCase;
+
+import org.jboss.soa.esb.infrastructure.Dispatcher;
+import org.jboss.soa.esb.infrastructure.DispatcherFactory;
+import org.jboss.soa.esb.infrastructure.NullReceiverDispatcherPlugin;
+import org.jboss.soa.esb.infrastructure.NullSenderDispatcherPlugin;
+
+/**
+ * Unit tests for the Dispatchers.
+ * 
+ * @author Mark Little
+ */
+
+public class DispatcherUnitTest extends TestCase
+{
+	public void testNullDispatcherName ()
+	{
+		try
+		{
+			DispatcherFactory.getFactory().getDispatcher(null);
+			
+			fail();
+		}
+		catch (Exception ex)
+		{
+		}
+	}
+	
+	public void testInvalidDispatcherName ()
+	{
+		try
+		{
+			URI dummyName = new URI("urn:foobar");
+			Dispatcher instance = DispatcherFactory.getFactory().getDispatcher(dummyName);
+			
+			assertEquals((instance == null), true);
+		}
+		catch (Exception ex)
+		{
+			fail();
+		}
+	}
+	
+	public void testValidDispatcherName ()
+	{
+		try
+		{
+			NullSenderDispatcherPlugin senderPlugin = new NullSenderDispatcherPlugin();
+			NullReceiverDispatcherPlugin receiverPlugin = new NullReceiverDispatcherPlugin();
+			
+			DispatcherFactory.getFactory().addDispatcherPlugin(senderPlugin);
+			DispatcherFactory.getFactory().addDispatcherPlugin(receiverPlugin);
+			
+			Dispatcher sender = DispatcherFactory.getFactory().getDispatcher(senderPlugin.getIdentifier());
+			Dispatcher receiver = DispatcherFactory.getFactory().getDispatcher(receiverPlugin.getIdentifier());
+			
+			assertEquals((sender != null), true);
+			assertEquals(sender.getIdentifier(), senderPlugin.getIdentifier());
+			
+			assertEquals((receiver != null), true);
+			assertEquals(receiver.getIdentifier(), receiverPlugin.getIdentifier());
+		}
+		catch (Exception ex)
+		{
+			fail();
+		}
+	}
+}

Modified: labs/jbossesb/workspace/rearch2/core/src/test/java/org/jboss/soa/esb/message/tests/SerializedMessageUnitTest.java
===================================================================
--- labs/jbossesb/workspace/rearch2/core/src/test/java/org/jboss/soa/esb/message/tests/SerializedMessageUnitTest.java	2007-05-13 04:49:13 UTC (rev 11839)
+++ labs/jbossesb/workspace/rearch2/core/src/test/java/org/jboss/soa/esb/message/tests/SerializedMessageUnitTest.java	2007-05-13 06:03:03 UTC (rev 11840)
@@ -26,7 +26,7 @@
 import java.io.ByteArrayOutputStream;
 import java.io.ObjectInputStream;
 import java.io.ObjectOutputStream;
-import java.net.URL;
+import java.net.URI;
 
 import junit.framework.TestCase;
 
@@ -463,7 +463,7 @@
 
 			assertEquals(theEpr instanceof HTTPEpr, true);
 			
-			assertEquals(((HTTPEpr) theEpr).getURL().toString(), "http://www.foo.bar");
+			assertEquals(((HTTPEpr) theEpr).getURI().toString(), "http://www.foo.bar");
 		}
 		catch (Exception ex)
 		{
@@ -631,9 +631,9 @@
 
 		try
 		{
-			SFTPEpr epr = new SFTPEpr(new URL("http://www.foo.bar"), new URL("http://www.bar.foo"));
+			SFTPEpr epr = new SFTPEpr(new URI("http://www.foo.bar"), new URI("http://www.bar.foo"));
 
-			assertEquals(epr.getCertificateURL().toString(), "http://www.bar.foo");
+			assertEquals(epr.getCertificateURI().toString(), "http://www.bar.foo");
 			
 			msg.getHeader().getCall().setTo(epr);
 			
@@ -654,7 +654,7 @@
 
 			assertEquals(theEpr instanceof SFTPEpr, true);
 			
-			assertEquals(((SFTPEpr) theEpr).getCertificateURL().toString(), "http://www.bar.foo");
+			assertEquals(((SFTPEpr) theEpr).getCertificateURI().toString(), "http://www.bar.foo");
 		}
 		catch (Exception ex)
 		{

Modified: labs/jbossesb/workspace/rearch2/core/src/test/java/org/jboss/soa/esb/message/tests/XMLMessageUnitTest.java
===================================================================
--- labs/jbossesb/workspace/rearch2/core/src/test/java/org/jboss/soa/esb/message/tests/XMLMessageUnitTest.java	2007-05-13 04:49:13 UTC (rev 11839)
+++ labs/jbossesb/workspace/rearch2/core/src/test/java/org/jboss/soa/esb/message/tests/XMLMessageUnitTest.java	2007-05-13 06:03:03 UTC (rev 11840)
@@ -24,7 +24,7 @@
 
 import java.io.StringReader;
 import java.io.StringWriter;
-import java.net.URL;
+import java.net.URI;
 
 import javax.xml.parsers.DocumentBuilder;
 import javax.xml.parsers.DocumentBuilderFactory;
@@ -397,7 +397,7 @@
 			
 			assertEquals(theEpr instanceof HTTPEpr, true);
 			
-			assertEquals(((HTTPEpr) theEpr).getURL().toString(), "http://www.foo.bar");
+			assertEquals(((HTTPEpr) theEpr).getURI().toString(), "http://www.foo.bar");
 		}
 		catch (Exception ex)
 		{			
@@ -523,9 +523,9 @@
 
 		try
 		{
-			SFTPEpr epr = new SFTPEpr(new URL("http://www.foo.bar"), new URL("http://www.bar.foo"));
+			SFTPEpr epr = new SFTPEpr(new URI("http://www.foo.bar"), new URI("http://www.bar.foo"));
 
-			assertEquals(epr.getCertificateURL().toString(), "http://www.bar.foo");
+			assertEquals(epr.getCertificateURI().toString(), "http://www.bar.foo");
 			
 			msg.getHeader().getCall().setTo(epr);
 			
@@ -538,7 +538,7 @@
 			
 			assertEquals(theEpr instanceof SFTPEpr, true);
 			
-			assertEquals(((SFTPEpr) theEpr).getCertificateURL().toString(), "http://www.bar.foo");
+			assertEquals(((SFTPEpr) theEpr).getCertificateURI().toString(), "http://www.bar.foo");
 		}
 		catch (Exception ex)
 		{			




More information about the jboss-svn-commits mailing list