[jboss-svn-commits] JBL Code SVN: r13776 - in labs/jbossesb/trunk/product: rosetta/src/org/jboss/soa/esb/http and 6 other directories.

jboss-svn-commits at lists.jboss.org jboss-svn-commits at lists.jboss.org
Tue Jul 24 15:34:17 EDT 2007


Author: kurt.stam at jboss.com
Date: 2007-07-24 15:34:17 -0400 (Tue, 24 Jul 2007)
New Revision: 13776

Added:
   labs/jbossesb/trunk/product/rosetta/tests/src/org/jboss/soa/esb/listeners/ServiceInvokerUnitTest.java
Removed:
   labs/jbossesb/trunk/product/rosetta/tests/src/org/jboss/soa/esb/listeners/message/InvokerUnitTest.java
Modified:
   labs/jbossesb/trunk/product/rosetta/src/org/jboss/internal/soa/esb/util/LRUCache.java
   labs/jbossesb/trunk/product/rosetta/src/org/jboss/internal/soa/esb/util/StreamUtils.java
   labs/jbossesb/trunk/product/rosetta/src/org/jboss/soa/esb/http/Configurator.java
   labs/jbossesb/trunk/product/rosetta/src/org/jboss/soa/esb/http/configurators/HttpProtocol.java
   labs/jbossesb/trunk/product/rosetta/tests/src/org/jboss/soa/esb/actions/
   labs/jbossesb/trunk/product/services/jbpm/src/main/java/org/jboss/soa/esb/services/jbpm/actionhandlers/EsbActionHandler.java
   labs/jbossesb/trunk/product/tools/console/contract-web/
Log:
Cleaning up imports and deprication warnings

Modified: labs/jbossesb/trunk/product/rosetta/src/org/jboss/internal/soa/esb/util/LRUCache.java
===================================================================
--- labs/jbossesb/trunk/product/rosetta/src/org/jboss/internal/soa/esb/util/LRUCache.java	2007-07-24 18:54:14 UTC (rev 13775)
+++ labs/jbossesb/trunk/product/rosetta/src/org/jboss/internal/soa/esb/util/LRUCache.java	2007-07-24 19:34:17 UTC (rev 13776)
@@ -29,6 +29,10 @@
  */
 public class LRUCache<K, V> extends LinkedHashMap<K, V> {
 
+    /**
+     * 
+     */
+    private static final long serialVersionUID = 1L;
     private int cacheSize;
 
     /**

Modified: labs/jbossesb/trunk/product/rosetta/src/org/jboss/internal/soa/esb/util/StreamUtils.java
===================================================================
--- labs/jbossesb/trunk/product/rosetta/src/org/jboss/internal/soa/esb/util/StreamUtils.java	2007-07-24 18:54:14 UTC (rev 13775)
+++ labs/jbossesb/trunk/product/rosetta/src/org/jboss/internal/soa/esb/util/StreamUtils.java	2007-07-24 19:34:17 UTC (rev 13776)
@@ -23,13 +23,11 @@
 
 import org.jboss.soa.esb.util.ClassUtil;
 import org.jboss.soa.esb.ConfigurationException;
-import org.apache.commons.ssl.KeyMaterial;
 import org.apache.log4j.Logger;
 
 import java.io.*;
 import java.net.URI;
 import java.net.URISyntaxException;
-import java.security.GeneralSecurityException;
 
 /**
  * Stream handling utilities.

Modified: labs/jbossesb/trunk/product/rosetta/src/org/jboss/soa/esb/http/Configurator.java
===================================================================
--- labs/jbossesb/trunk/product/rosetta/src/org/jboss/soa/esb/http/Configurator.java	2007-07-24 18:54:14 UTC (rev 13775)
+++ labs/jbossesb/trunk/product/rosetta/src/org/jboss/soa/esb/http/Configurator.java	2007-07-24 19:34:17 UTC (rev 13776)
@@ -22,13 +22,10 @@
 import org.jboss.soa.esb.ConfigurationException;
 import org.jboss.soa.esb.http.HttpClientFactory;
 import org.apache.commons.httpclient.HttpClient;
-import org.apache.log4j.Logger;
 
 import java.util.Properties;
 import java.net.URI;
 import java.net.URISyntaxException;
-import java.io.FileWriter;
-import java.io.IOException;
 
 /**
  * HttpClient Configurator.

Modified: labs/jbossesb/trunk/product/rosetta/src/org/jboss/soa/esb/http/configurators/HttpProtocol.java
===================================================================
--- labs/jbossesb/trunk/product/rosetta/src/org/jboss/soa/esb/http/configurators/HttpProtocol.java	2007-07-24 18:54:14 UTC (rev 13775)
+++ labs/jbossesb/trunk/product/rosetta/src/org/jboss/soa/esb/http/configurators/HttpProtocol.java	2007-07-24 19:34:17 UTC (rev 13776)
@@ -26,7 +26,6 @@
 import org.apache.commons.httpclient.protocol.Protocol;
 import org.apache.commons.ssl.KeyMaterial;
 import org.apache.commons.ssl.SSLClient;
-import org.apache.log4j.Logger;
 import org.jboss.soa.esb.ConfigurationException;
 import org.jboss.soa.esb.http.Configurator;
 import org.jboss.soa.esb.util.ClassUtil;
@@ -64,8 +63,6 @@
  */
 public class HttpProtocol extends Configurator {
 
-    private static Logger logger = Logger.getLogger(HttpProtocol.class);
-
     public void configure(HttpClient httpClient, Properties properties) throws ConfigurationException {
         URI targetURI = getTargetURI(properties, true);
         String factory;


Property changes on: labs/jbossesb/trunk/product/rosetta/tests/src/org/jboss/soa/esb/actions
___________________________________________________________________
Name: svn:ignore
   + jbossesb-gateway.xml
jbossesb-listener.xml


Added: labs/jbossesb/trunk/product/rosetta/tests/src/org/jboss/soa/esb/listeners/ServiceInvokerUnitTest.java
===================================================================
--- labs/jbossesb/trunk/product/rosetta/tests/src/org/jboss/soa/esb/listeners/ServiceInvokerUnitTest.java	                        (rev 0)
+++ labs/jbossesb/trunk/product/rosetta/tests/src/org/jboss/soa/esb/listeners/ServiceInvokerUnitTest.java	2007-07-24 19:34:17 UTC (rev 13776)
@@ -0,0 +1,220 @@
+/*
+ * 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;
+
+import java.io.File;
+import java.io.InputStream;
+import java.sql.Connection;
+import java.sql.DriverManager;
+import java.sql.Statement;
+import java.util.Properties;
+
+import junit.framework.TestCase;
+
+import org.apache.log4j.Logger;
+import org.jboss.soa.esb.addressing.eprs.FileEpr;
+import org.jboss.soa.esb.helpers.ConfigTree;
+import org.jboss.soa.esb.listeners.ListenerTagNames;
+import org.jboss.soa.esb.listeners.RegistryUtil;
+import org.jboss.soa.esb.listeners.ServiceInvoker;
+import org.jboss.soa.esb.listeners.message.MessageDeliverException;
+import org.jboss.soa.esb.message.Message;
+import org.jboss.soa.esb.message.format.MessageFactory;
+import org.jboss.soa.esb.testutils.FileUtil;
+import org.jboss.soa.esb.testutils.HsqldbUtil;
+import org.jboss.soa.esb.testutils.TestEnvironmentUtil;
+
+public class ServiceInvokerUnitTest extends TestCase
+{
+	private Logger log = Logger.getLogger( ServiceInvokerUnitTest.class );
+
+	protected final void setup()
+	{
+		try
+		{
+			TestEnvironmentUtil.setESBPropertiesFileToUse("product",
+					"../product");
+			// Set the juddi properties file in System so juddi will pick it up
+			// later and use the test values.
+			String juddiPropertiesFile = "/org/jboss/soa/esb/listeners/juddi-unittest.properties";
+			System.setProperty("juddi.propertiesFile", juddiPropertiesFile);
+			// Read this properties file to get the db connection string
+			Properties props = new Properties();
+			InputStream inStream = Class.class
+					.getResourceAsStream(juddiPropertiesFile);
+
+			props.load(inStream);
+			mDbDriver = props.getProperty("juddi.jdbcDriver");
+			mDbUrl = props.getProperty("juddi.jdbcUrl");
+			mDbUsername = props.getProperty("juddi.jdbcUsername");
+			mDbPassword = props.getProperty("juddi.jdbcPassword");
+
+			String database = "not tested yet";
+			if ("org.hsqldb.jdbcDriver".equals(mDbDriver))
+			{
+				database = "hsqldb";
+				// Bring up hsql on default port 9001
+				HsqldbUtil.startHsqldb(TestEnvironmentUtil.getUserDir(
+						"product", "../product")
+						+ "/build/hsqltestdb", "juddi");
+			}
+			else if ("com.mysql.jdbc.Driver".equals(mDbDriver))
+			{
+				database = "mysql";
+			} // add and test your own database..
+
+			// Get the registry-schema create scripts
+			String sqlDir = TestEnvironmentUtil.getUserDir("product",
+					"../product")
+					+ "/install/jUDDI-registry/sql/" + database + "/";
+			// Drop what is there now, if exists. We want to start fresh.
+			String sqlDropCmd = FileUtil.readTextFile(new File(sqlDir
+					+ "drop_database.sql"));
+			String sqlCreateCmd = FileUtil.readTextFile(new File(sqlDir
+					+ "create_database.sql"));
+			String sqlInsertPubCmd = FileUtil.readTextFile(new File(sqlDir
+					+ "insert_publishers.sql"));
+
+			try
+			{
+				Class.forName(mDbDriver);
+			}
+			catch (Exception e)
+			{
+				log.error("ERROR: failed to load " + database
+						+ " JDBC driver.", e);
+				return;
+			}
+			con = DriverManager.getConnection(mDbUrl, mDbUsername, mDbPassword);
+			Statement stmnt = con.createStatement();
+			stmnt.execute(sqlDropCmd);
+			stmnt.execute(sqlCreateCmd);
+			stmnt.execute(sqlInsertPubCmd);
+			stmnt.close();
+		}
+		catch (Throwable e)
+		{
+			log.error("We should stop testing, since we don't have a db.", e);
+			assertTrue(false);
+		}
+	}
+
+	protected final void tearDown()
+	{
+		try
+		{
+			Thread.sleep(1000);
+			Statement stmnt = con.createStatement();
+
+			stmnt.execute("SHUTDOWN");
+			stmnt.close();
+
+			con.close();
+		}
+		catch (Exception ex)
+		{
+			log.error(ex);
+		}
+	}
+
+	public void testInvalidParameters() throws Exception
+	{
+		setup();
+
+		Message message = MessageFactory.getInstance().getMessage();
+
+		try
+		{
+            ServiceInvoker invoker = new ServiceInvoker("foo", "bar");
+            invoker.deliverAsync(message);
+			fail();
+		}
+		catch (MessageDeliverException ex)
+		{
+		}
+
+		final File tmpDir = new File(System.getProperty("java.io.tmpdir"));
+		final String tmpDirForm = tmpDir.toURL().toExternalForm();
+		FileEpr epr = new FileEpr(tmpDirForm);
+
+		epr.setInputSuffix(".testFile");
+		epr.setPostDelete(true);
+		epr.setPostSuffix(".unitProcessedOK");
+
+		ConfigTree tree = new ConfigTree("test");
+
+		tree.setAttribute(ListenerTagNames.SERVICE_CATEGORY_NAME_TAG,
+				"eprmanager");
+		tree.setAttribute(ListenerTagNames.SERVICE_NAME_TAG, "qwerty");
+
+		RegistryUtil.register(tree, epr);
+
+		try
+		{
+            ServiceInvoker invoker = new ServiceInvoker("eprmanager", "qwerty");
+            invoker.deliverAsync(message);
+		}
+		catch (Exception ex)
+		{
+			fail();
+		}
+
+		RegistryUtil.unregister("eprmanager", "qwerty", epr);
+		
+		try
+		{
+            ServiceInvoker invoker = new ServiceInvoker("eprmanager", "qwerty");
+            invoker.deliverAsync(message);
+		}
+		catch (Exception ex)
+		{
+		}
+		
+		File[] files = tmpDir.listFiles();
+		
+		for (int i = 0; i < files.length; i++)
+		{
+			if ((files[i].getName().endsWith(".unitProcessedOK")) ||
+					(files[i].getName().equals("qwerty")))
+			{
+				try
+				{
+					files[i].delete();
+				}
+				catch (Exception ex)
+				{
+				}
+			}
+		}
+	}
+
+	private static String mDbDriver;
+
+	private static String mDbUrl;
+
+	private static String mDbUsername;
+
+	private static String mDbPassword;
+
+	private static Connection con;
+}


Property changes on: labs/jbossesb/trunk/product/rosetta/tests/src/org/jboss/soa/esb/listeners/ServiceInvokerUnitTest.java
___________________________________________________________________
Name: svn:eol-style
   + native

Deleted: labs/jbossesb/trunk/product/rosetta/tests/src/org/jboss/soa/esb/listeners/message/InvokerUnitTest.java
===================================================================
--- labs/jbossesb/trunk/product/rosetta/tests/src/org/jboss/soa/esb/listeners/message/InvokerUnitTest.java	2007-07-24 18:54:14 UTC (rev 13775)
+++ labs/jbossesb/trunk/product/rosetta/tests/src/org/jboss/soa/esb/listeners/message/InvokerUnitTest.java	2007-07-24 19:34:17 UTC (rev 13776)
@@ -1,227 +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.listeners.message;
-
-import java.io.File;
-import java.io.InputStream;
-import java.sql.Connection;
-import java.sql.DriverManager;
-import java.sql.Statement;
-import java.util.Properties;
-
-import junit.framework.TestCase;
-
-import org.apache.log4j.Logger;
-import org.jboss.soa.esb.addressing.eprs.FileEpr;
-import org.jboss.soa.esb.helpers.ConfigTree;
-import org.jboss.soa.esb.listeners.ListenerTagNames;
-import org.jboss.soa.esb.listeners.RegistryUtil;
-import org.jboss.soa.esb.message.Message;
-import org.jboss.soa.esb.message.format.MessageFactory;
-import org.jboss.soa.esb.services.registry.RegistryException;
-import org.jboss.soa.esb.testutils.FileUtil;
-import org.jboss.soa.esb.testutils.HsqldbUtil;
-import org.jboss.soa.esb.testutils.TestEnvironmentUtil;
-
-public class InvokerUnitTest extends TestCase
-{
-	private Logger log = Logger.getLogger( InvokerUnitTest.class );
-
-	protected final void setup()
-	{
-		try
-		{
-			TestEnvironmentUtil.setESBPropertiesFileToUse("product",
-					"../product");
-			// Set the juddi properties file in System so juddi will pick it up
-			// later and use the test values.
-			String juddiPropertiesFile = "/org/jboss/soa/esb/listeners/juddi-unittest.properties";
-			System.setProperty("juddi.propertiesFile", juddiPropertiesFile);
-			// Read this properties file to get the db connection string
-			Properties props = new Properties();
-			InputStream inStream = Class.class
-					.getResourceAsStream(juddiPropertiesFile);
-
-			props.load(inStream);
-			mDbDriver = props.getProperty("juddi.jdbcDriver");
-			mDbUrl = props.getProperty("juddi.jdbcUrl");
-			mDbUsername = props.getProperty("juddi.jdbcUsername");
-			mDbPassword = props.getProperty("juddi.jdbcPassword");
-
-			String database = "not tested yet";
-			if ("org.hsqldb.jdbcDriver".equals(mDbDriver))
-			{
-				database = "hsqldb";
-				// Bring up hsql on default port 9001
-				HsqldbUtil.startHsqldb(TestEnvironmentUtil.getUserDir(
-						"product", "../product")
-						+ "/build/hsqltestdb", "juddi");
-			}
-			else if ("com.mysql.jdbc.Driver".equals(mDbDriver))
-			{
-				database = "mysql";
-			} // add and test your own database..
-
-			// Get the registry-schema create scripts
-			String sqlDir = TestEnvironmentUtil.getUserDir("product",
-					"../product")
-					+ "/install/jUDDI-registry/sql/" + database + "/";
-			// Drop what is there now, if exists. We want to start fresh.
-			String sqlDropCmd = FileUtil.readTextFile(new File(sqlDir
-					+ "drop_database.sql"));
-			String sqlCreateCmd = FileUtil.readTextFile(new File(sqlDir
-					+ "create_database.sql"));
-			String sqlInsertPubCmd = FileUtil.readTextFile(new File(sqlDir
-					+ "insert_publishers.sql"));
-
-			try
-			{
-				Class.forName(mDbDriver);
-			}
-			catch (Exception e)
-			{
-				log.error("ERROR: failed to load " + database
-						+ " JDBC driver.", e);
-				return;
-			}
-			con = DriverManager.getConnection(mDbUrl, mDbUsername, mDbPassword);
-			Statement stmnt = con.createStatement();
-			stmnt.execute(sqlDropCmd);
-			stmnt.execute(sqlCreateCmd);
-			stmnt.execute(sqlInsertPubCmd);
-			stmnt.close();
-		}
-		catch (Throwable e)
-		{
-			log.error("We should stop testing, since we don't have a db.", e);
-			assertTrue(false);
-		}
-	}
-
-	protected final void tearDown()
-	{
-		try
-		{
-			Thread.sleep(1000);
-			Statement stmnt = con.createStatement();
-
-			stmnt.execute("SHUTDOWN");
-			stmnt.close();
-
-			con.close();
-		}
-		catch (Exception ex)
-		{
-			log.error(ex);
-		}
-	}
-
-	public void testInvalidParameters() throws Exception
-	{
-		setup();
-
-		Message message = MessageFactory.getInstance().getMessage();
-
-		try
-		{
-			Invoker.invoke(message, null, null);
-			fail();
-		}
-		catch (RegistryException ex)
-		{
-		}
-
-		try
-		{
-			Invoker.invoke(message, "foo", "bar");
-			fail();
-		}
-		catch (RegistryException ex)
-		{
-		}
-
-		final File tmpDir = new File(System.getProperty("java.io.tmpdir"));
-		final String tmpDirForm = tmpDir.toURL().toExternalForm();
-		FileEpr epr = new FileEpr(tmpDirForm);
-
-		epr.setInputSuffix(".testFile");
-		epr.setPostDelete(true);
-		epr.setPostSuffix(".unitProcessedOK");
-
-		ConfigTree tree = new ConfigTree("test");
-
-		tree.setAttribute(ListenerTagNames.SERVICE_CATEGORY_NAME_TAG,
-				"eprmanager");
-		tree.setAttribute(ListenerTagNames.SERVICE_NAME_TAG, "qwerty");
-
-		RegistryUtil.register(tree, epr);
-
-		try
-		{
-			Invoker.invoke(message, "eprmanager", "qwerty");
-		}
-		catch (Exception ex)
-		{
-			fail();
-		}
-
-		RegistryUtil.unregister("eprmanager", "qwerty", epr);
-		
-		try
-		{
-			Invoker
-					.invokeAndAwaitResponse(message, "eprmanager", "qwerty",
-							100);
-		}
-		catch (Exception ex)
-		{
-		}
-		
-		File[] files = tmpDir.listFiles();
-		
-		for (int i = 0; i < files.length; i++)
-		{
-			if ((files[i].getName().endsWith(".unitProcessedOK")) ||
-					(files[i].getName().equals("qwerty")))
-			{
-				try
-				{
-					files[i].delete();
-				}
-				catch (Exception ex)
-				{
-				}
-			}
-		}
-	}
-
-	private static String mDbDriver;
-
-	private static String mDbUrl;
-
-	private static String mDbUsername;
-
-	private static String mDbPassword;
-
-	private static Connection con;
-}

Modified: labs/jbossesb/trunk/product/services/jbpm/src/main/java/org/jboss/soa/esb/services/jbpm/actionhandlers/EsbActionHandler.java
===================================================================
--- labs/jbossesb/trunk/product/services/jbpm/src/main/java/org/jboss/soa/esb/services/jbpm/actionhandlers/EsbActionHandler.java	2007-07-24 18:54:14 UTC (rev 13775)
+++ labs/jbossesb/trunk/product/services/jbpm/src/main/java/org/jboss/soa/esb/services/jbpm/actionhandlers/EsbActionHandler.java	2007-07-24 19:34:17 UTC (rev 13776)
@@ -33,7 +33,7 @@
 import org.dom4j.tree.DefaultElement;
 import org.jboss.soa.esb.ConfigurationException;
 import org.jboss.soa.esb.addressing.Call;
-import org.jboss.soa.esb.listeners.message.Invoker;
+import org.jboss.soa.esb.listeners.ServiceInvoker;
 import org.jboss.soa.esb.message.Body;
 import org.jboss.soa.esb.message.Message;
 import org.jboss.soa.esb.message.format.MessageFactory;
@@ -93,16 +93,19 @@
 		varsToRequest(request);
 		if (null==millisToWaitForResponse || millisToWaitForResponse < 1)
 		{
-			Invoker.invoke(request,esbCategoryName, esbServiceName);
+            ServiceInvoker invoker = new ServiceInvoker(esbCategoryName, esbServiceName);
+			invoker.deliverAsync(request);
 			return;
 		}
 		
 		Message response = null;
 		if ("MOCK_CATEGORY".equals(esbCategoryName)
-			&& "MOCK_SERVICE".equals(esbServiceName))
+			&& "MOCK_SERVICE".equals(esbServiceName)) {
 			response = request;
-		else
-			Invoker.invokeAndAwaitResponse (request,esbCategoryName, esbServiceName, millisToWaitForResponse);
+        } else {
+            ServiceInvoker invoker = new ServiceInvoker(esbCategoryName, esbServiceName);
+            invoker.deliverSync(request, millisToWaitForResponse);
+        }
 		if (null!=response)
 			varsFromResponse(response);
 	} //________________________________


Property changes on: labs/jbossesb/trunk/product/tools/console/contract-web
___________________________________________________________________
Name: svn:ignore
   + build





More information about the jboss-svn-commits mailing list