[jboss-svn-commits] JBL Code SVN: r7411 - in labs/jbossesb/workspace/b_georges/product/core: listeners/src/org/jboss/soa/esb/actions listeners/src/org/jboss/soa/esb/listeners listeners/src/org/jboss/soa/esb/listeners/message listeners/src/org/jboss/soa/esb/listeners/old rosetta/src/org/jboss/soa/esb/common rosetta/src/org/jboss/soa/esb/helpers rosetta/src/org/jboss/soa/esb/services/persistence rosetta/tests/src/org/jboss/soa/esb/common/tests services services/src/org/jboss/soa/esb/services/registry services/tests services/tests/src/org/jboss/soa/esb/esb/persistence/tests services/tests/src/org/jboss/soa/esb/services/registry
jboss-svn-commits at lists.jboss.org
jboss-svn-commits at lists.jboss.org
Sun Nov 5 13:02:51 EST 2006
Author: b_georges
Date: 2006-11-05 13:02:32 -0500 (Sun, 05 Nov 2006)
New Revision: 7411
Modified:
labs/jbossesb/workspace/b_georges/product/core/listeners/src/org/jboss/soa/esb/actions/FtpDownloader.java
labs/jbossesb/workspace/b_georges/product/core/listeners/src/org/jboss/soa/esb/actions/FtpUploader.java
labs/jbossesb/workspace/b_georges/product/core/listeners/src/org/jboss/soa/esb/listeners/ListenerTagNames.java
labs/jbossesb/workspace/b_georges/product/core/listeners/src/org/jboss/soa/esb/listeners/message/ActionProcessingPipeline.java
labs/jbossesb/workspace/b_georges/product/core/listeners/src/org/jboss/soa/esb/listeners/message/EsbListenerController.java
labs/jbossesb/workspace/b_georges/product/core/listeners/src/org/jboss/soa/esb/listeners/message/JmsQueueListener.java
labs/jbossesb/workspace/b_georges/product/core/listeners/src/org/jboss/soa/esb/listeners/old/AbstractListener.java
labs/jbossesb/workspace/b_georges/product/core/listeners/src/org/jboss/soa/esb/listeners/old/RemoteDirectoryPoller.java
labs/jbossesb/workspace/b_georges/product/core/rosetta/src/org/jboss/soa/esb/common/Configuration.java
labs/jbossesb/workspace/b_georges/product/core/rosetta/src/org/jboss/soa/esb/common/Environment.java
labs/jbossesb/workspace/b_georges/product/core/rosetta/src/org/jboss/soa/esb/common/ModulePropertyManager.java
labs/jbossesb/workspace/b_georges/product/core/rosetta/src/org/jboss/soa/esb/helpers/ConfigTree.java
labs/jbossesb/workspace/b_georges/product/core/rosetta/src/org/jboss/soa/esb/services/persistence/MessageStoreFactory.java
labs/jbossesb/workspace/b_georges/product/core/rosetta/tests/src/org/jboss/soa/esb/common/tests/TestUtil.java
labs/jbossesb/workspace/b_georges/product/core/services/build.xml
labs/jbossesb/workspace/b_georges/product/core/services/src/org/jboss/soa/esb/services/registry/Registry.java
labs/jbossesb/workspace/b_georges/product/core/services/src/org/jboss/soa/esb/services/registry/RegistryFactory.java
labs/jbossesb/workspace/b_georges/product/core/services/tests/build.xml
labs/jbossesb/workspace/b_georges/product/core/services/tests/src/org/jboss/soa/esb/esb/persistence/tests/MessageStoreUnitTest.java
labs/jbossesb/workspace/b_georges/product/core/services/tests/src/org/jboss/soa/esb/services/registry/RegistryUnitTest.java
Log:
refresh
Modified: labs/jbossesb/workspace/b_georges/product/core/listeners/src/org/jboss/soa/esb/actions/FtpDownloader.java
===================================================================
--- labs/jbossesb/workspace/b_georges/product/core/listeners/src/org/jboss/soa/esb/actions/FtpDownloader.java 2006-11-05 15:18:20 UTC (rev 7410)
+++ labs/jbossesb/workspace/b_georges/product/core/listeners/src/org/jboss/soa/esb/actions/FtpDownloader.java 2006-11-05 18:02:32 UTC (rev 7411)
@@ -27,19 +27,18 @@
import java.util.List;
import org.apache.log4j.Logger;
-import org.jboss.internal.soa.esb.util.EdtFtpImpl;
import org.jboss.soa.esb.ConfigurationException;
import org.jboss.soa.esb.helpers.ConfigTree;
import org.jboss.soa.esb.helpers.KeyValuePair;
import org.jboss.soa.esb.listeners.old.GpListener;
import org.jboss.soa.esb.listeners.old.RemoteDirectoryPoller;
import org.jboss.soa.esb.message.Message;
-import org.jboss.soa.esb.util.RemoteFileSystem;
+import org.jboss.soa.esb.util.FtpClientUtil;
public class FtpDownloader extends AbstractFileAction
{
ConfigTree _parms;
- RemoteFileSystem _ftpClient;
+ FtpClientUtil _ftpClient;
String _localDir;
RemoteDirectoryPoller.WorkingFile _workFile;
Logger _logger = Logger.getLogger(this.getClass());
@@ -77,9 +76,9 @@
}
// end of kludge
// System.out.println("Downloading "+_workFile);
- _ftpClient = new EdtFtpImpl(_parms,true);
- _localDir = _parms.getAttribute(RemoteFileSystem.PARMS_LOCAL_DIR);
- String sFrom = EdtFtpImpl.fileToFtpString(_workFile);
+ _ftpClient = new FtpClientUtil(_parms,true);
+ _localDir = _parms.getAttribute(FtpClientUtil.PARMS_LOCAL_DIR);
+ String sFrom = FtpClientUtil.fileToFtpString(_workFile);
_ftpClient.downloadFile(sFrom,_workFile.getInputFile().getName());
if (_workFile.isPostDelete())
Modified: labs/jbossesb/workspace/b_georges/product/core/listeners/src/org/jboss/soa/esb/actions/FtpUploader.java
===================================================================
--- labs/jbossesb/workspace/b_georges/product/core/listeners/src/org/jboss/soa/esb/actions/FtpUploader.java 2006-11-05 15:18:20 UTC (rev 7410)
+++ labs/jbossesb/workspace/b_georges/product/core/listeners/src/org/jboss/soa/esb/actions/FtpUploader.java 2006-11-05 18:02:32 UTC (rev 7411)
@@ -27,19 +27,18 @@
import java.util.List;
import org.apache.log4j.Logger;
-import org.jboss.internal.soa.esb.util.EdtFtpImpl;
import org.jboss.soa.esb.ConfigurationException;
import org.jboss.soa.esb.helpers.ConfigTree;
import org.jboss.soa.esb.helpers.KeyValuePair;
import org.jboss.soa.esb.listeners.old.DirectoryPoller;
import org.jboss.soa.esb.listeners.old.GpListener;
import org.jboss.soa.esb.message.Message;
-import org.jboss.soa.esb.util.RemoteFileSystem;
+import org.jboss.soa.esb.util.FtpClientUtil;
public class FtpUploader extends AbstractFileAction
{
ConfigTree _parms;
- RemoteFileSystem _ftpClient;
+ FtpClientUtil _ftpClient;
String _remoteDir;
DirectoryPoller.WorkingFile _workFile;
Logger _logger = Logger.getLogger(this.getClass());
@@ -69,8 +68,8 @@
try
{
System.out.println("FTP uploading "+obj);
- _ftpClient = new EdtFtpImpl(_parms,true);
- _remoteDir = _parms.getAttribute(RemoteFileSystem.PARMS_REMOTE_DIR);
+ _ftpClient = new FtpClientUtil(_parms,true);
+ _remoteDir = _parms.getAttribute(FtpClientUtil.PARMS_REMOTE_DIR);
_ftpClient.uploadFile(_workFile,_workFile.getInputFile().getName());
if (_workFile.isPostDelete())
@@ -100,7 +99,7 @@
return new StringBuilder()
.append(_workFile.getInputFile().toString())
.append("successfully uploaded to ").append(_remoteDir)
- .append(" on ").append(_parms.getAttribute(RemoteFileSystem.PARMS_FTP_SERVER))
+ .append(" on ").append(_parms.getAttribute(FtpClientUtil.PARMS_FTP_SERVER))
.toString();
} //________________________________
@@ -109,7 +108,7 @@
return new StringBuilder()
.append("Failed to upload ").append(_workFile.getInputFile().toString())
.append(" to ").append(_remoteDir)
- .append(" on ").append(_parms.getAttribute(RemoteFileSystem.PARMS_FTP_SERVER))
+ .append(" on ").append(_parms.getAttribute(FtpClientUtil.PARMS_FTP_SERVER))
.toString();
} //________________________________
Modified: labs/jbossesb/workspace/b_georges/product/core/listeners/src/org/jboss/soa/esb/listeners/ListenerTagNames.java
===================================================================
--- labs/jbossesb/workspace/b_georges/product/core/listeners/src/org/jboss/soa/esb/listeners/ListenerTagNames.java 2006-11-05 15:18:20 UTC (rev 7410)
+++ labs/jbossesb/workspace/b_georges/product/core/listeners/src/org/jboss/soa/esb/listeners/ListenerTagNames.java 2006-11-05 18:02:32 UTC (rev 7411)
@@ -2,12 +2,24 @@
public class ListenerTagNames
{
- public static final String SERVICE_NAME_TAG = "service-name";
- public static final String TARGET_SERVICE_NAME_TAG = "target-service-name";
+ public static final String SERVICE_CATEGORY_NAME_TAG = "service-category";
+ public static final String SERVICE_NAME_TAG = "service-name";
+ public static final String SERVICE_DESCRIPTION_TAG = "service-description";
+ public static final String EPR_DESCRIPTION_TAG = "epr-description";
+
+ public static final String TARGET_SERVICE_NAME_TAG = "target-service-name";
- public static final String ACTION_ELEMENT_TAG = "action";
- public static final String ACTION_CLASS_TAG = "class";
- public static final String PROCESS_METHOD_TAG = "process";
+ public static final String ACTION_ELEMENT_TAG = "action";
+ public static final String ACTION_CLASS_TAG = "class";
+ public static final String PROCESS_METHOD_TAG = "process";
public static final String NORMAL_COMPLETION_METHOD_TAG = "okMethod";
- public static final String EXCEPTION_METHOD_TAG = "exceptionMethod";
+ public static final String EXCEPTION_METHOD_TAG = "exceptionMethod";
+ public static final String HTTP_ROUTER_ROUTE_URL = "routeUrl";
+
+
+ /** Content Based Routing */
+ public static final String CBR_TAG = "cbr";
+ /** RuleSet reference (Filename) */
+ public static final String RULE_SET_TAG = "ruleSet";
+
}
Modified: labs/jbossesb/workspace/b_georges/product/core/listeners/src/org/jboss/soa/esb/listeners/message/ActionProcessingPipeline.java
===================================================================
--- labs/jbossesb/workspace/b_georges/product/core/listeners/src/org/jboss/soa/esb/listeners/message/ActionProcessingPipeline.java 2006-11-05 15:18:20 UTC (rev 7410)
+++ labs/jbossesb/workspace/b_georges/product/core/listeners/src/org/jboss/soa/esb/listeners/message/ActionProcessingPipeline.java 2006-11-05 18:02:32 UTC (rev 7411)
@@ -70,40 +70,42 @@
_currentIndex++;
String attrName = ListenerTagNames.ACTION_CLASS_TAG;
_currentAction = oCurr.getAttribute(attrName);
-
+ _currentClass = Class.forName(_currentAction);
+ Constructor oConst = _currentClass.getConstructor(new Class[] {ConfigTree.class});
+ _currentProcessor = oConst.newInstance(_config);
+
attrName = ListenerTagNames.PROCESS_METHOD_TAG;
- String sProcessMethod = obtainAttribute(oCurr,attrName,attrName);
+ String[] saMethodList = obtainAttribute(oCurr,attrName,attrName).split(",");
- _currentClass = Class.forName(_currentAction);
- Constructor oConst = _currentClass.getConstructor(new Class[] {ConfigTree.class});
- _currentProcessor = oConst.newInstance(_config);
- Method method = _currentClass.getMethod(sProcessMethod,new Class[] {Message.class});
-
- // The processing result of each action feeds into the processing of the next action...
- try
- {
- Message next = (Message)method.invoke(_currentProcessor,new Object[] {_message} );
-
- actionClassFinishedOk(oCurr,_message);
- if(next==null)
- {
- _logger.error(prematureTermination("returned <null> - Cannot continue"));
- return;
- }
- _message = next;
- }
- catch (ClassCastException eCast)
- {
- // If action class returns non Message, log and abort chain
- _logger.error(prematureTermination("returned a non Message Object)"));
- return;
- }
- catch (InvocationTargetException e)
- {
- // If action class threw exception, log and abort chain
- actionClassException(oCurr,_message,e.getCause());
- return;
- }
+ for (String currMethod : saMethodList)
+ {
+ Method method = _currentClass.getMethod(currMethod,new Class[] {Message.class});
+
+ // The processing result of each action feeds into the processing of the next action...
+ try
+ {
+ Message next = (Message)method.invoke(_currentProcessor,new Object[] {_message} );
+ if(next==null)
+ {
+ _logger.warn(prematureTermination("returned <null> - Cannot continue"));
+ return;
+ }
+ _message = next;
+ }
+ catch (ClassCastException eCast)
+ {
+ // If action class returns non Message, log and abort chain
+ _logger.error(prematureTermination("returned a non Message Object)"));
+ return;
+ }
+ catch (InvocationTargetException e)
+ {
+ // If action class threw exception, log and abort chain
+ actionClassException(oCurr,_message,e.getCause());
+ return;
+ }
+ }
+ actionClassFinishedOk(oCurr,_message);
}
// notification of action chain end can be done with a no-operation action class
// with a proper ListenerPropertyNames.ACTION_NORMAL_COMPLETION_CALLBACK method
Modified: labs/jbossesb/workspace/b_georges/product/core/listeners/src/org/jboss/soa/esb/listeners/message/EsbListenerController.java
===================================================================
--- labs/jbossesb/workspace/b_georges/product/core/listeners/src/org/jboss/soa/esb/listeners/message/EsbListenerController.java 2006-11-05 15:18:20 UTC (rev 7410)
+++ labs/jbossesb/workspace/b_georges/product/core/listeners/src/org/jboss/soa/esb/listeners/message/EsbListenerController.java 2006-11-05 18:02:32 UTC (rev 7411)
@@ -37,8 +37,12 @@
import org.jboss.soa.esb.common.Environment;
import org.jboss.soa.esb.common.ModulePropertyManager;
import org.jboss.soa.esb.helpers.ConfigTree;
+import org.jboss.soa.esb.listeners.ListenerTagNames;
import org.jboss.soa.esb.parameters.ParamRepositoryException;
import org.jboss.soa.esb.parameters.ParamRepositoryFactory;
+import org.jboss.soa.esb.services.registry.Registry;
+import org.jboss.soa.esb.services.registry.RegistryException;
+import org.jboss.soa.esb.services.registry.RegistryFactory;
import org.jboss.soa.esb.util.Util;
import org.xml.sax.SAXException;
@@ -164,7 +168,7 @@
* @throws Exception
* Unable to load/use the named configuration.
*/
- public EsbListenerController(String p_sParameterName) throws Exception {
+ public EsbListenerController(String p_sParameterName) throws Exception {
this(EsbListenerController.getListenerConfig(p_sParameterName));
m_sParmsName = p_sParameterName;
}
@@ -212,7 +216,7 @@
* Unable to parse the configuration.
*/
private static ConfigTree getListenerConfig(String reposParam)
- throws IOException, ParamRepositoryException, SAXException {
+ throws IOException, ParamRepositoryException, SAXException {
String sXml = ParamRepositoryFactory.getInstance().get(reposParam);
ConfigTree config = ConfigTree.fromXml(sXml);
@@ -519,6 +523,11 @@
return EPRManager.getInstance(sDir);
}
+ /**
+ * @deprecated use register (ConfigTree config, EPR address) instead.
+ * @param name
+ * @param address
+ */
public void register (String name, EPR address)
{
try { getEprManager().saveEPR(name,address); }
@@ -527,7 +536,10 @@
_logger.fatal("Cannot register service",e);
}
} // ________________________________
-
+ /**
+ * @deprecated use unRegister (String serviceCategoryName, String serviceName, EPR epr) instead.
+ * @param name
+ */
public void unRegister (String name)
{
try { getEprManager().removeEPR(name); }
@@ -536,5 +548,46 @@
_logger.fatal("Cannot un-register service",e);
}
} // ________________________________
+ /**
+ * Register an EPR in the registry.
+ *
+ * @param config - a config tree containing the deployment-configuration of the service.
+ * @param epr - the epr (EndPoint Reference) of the service.
+ *
+ * @throws RegistryException
+ */
+ public void register(ConfigTree config , EPR epr) throws RegistryException
+ {
+ String serviceCategoryName = config.getAttribute(ListenerTagNames.SERVICE_CATEGORY_NAME_TAG);
+ String serviceName = config.getAttribute(ListenerTagNames.SERVICE_NAME_TAG);
+ if ("eprManager".equalsIgnoreCase(serviceCategoryName))
+ {
+ register(serviceName,epr);
+ return;
+ }
+ String serviceDescription = config.getAttribute(ListenerTagNames.SERVICE_DESCRIPTION_TAG);
+ String eprDescription = config.getAttribute(ListenerTagNames.EPR_DESCRIPTION_TAG);
+ Registry registry = RegistryFactory.getRegistry();
+ registry.registerEPR(serviceCategoryName, serviceName, serviceDescription, epr, eprDescription);
+ }
+ /**
+ * Unregister the EPR from the registry.
+ *
+ * @param serviceCategoryName - name of the category of the service ('Content Based Routing')
+ * @param serviceName - name of the service ("
+ * @param epr
+ * @throws RegistryException
+ */
+ public void unRegister(String serviceCategoryName, String serviceName , EPR epr) throws RegistryException
+ {
+ if ("eprManager".equalsIgnoreCase(serviceCategoryName))
+ {
+ unRegister(serviceName);
+ return;
+ }
+ Registry registry = RegistryFactory.getRegistry();
+ registry.unRegisterEPR(serviceCategoryName, serviceName, epr);
+ }
+
} // ____________________________________________________________________________
Modified: labs/jbossesb/workspace/b_georges/product/core/listeners/src/org/jboss/soa/esb/listeners/message/JmsQueueListener.java
===================================================================
--- labs/jbossesb/workspace/b_georges/product/core/listeners/src/org/jboss/soa/esb/listeners/message/JmsQueueListener.java 2006-11-05 15:18:20 UTC (rev 7410)
+++ labs/jbossesb/workspace/b_georges/product/core/listeners/src/org/jboss/soa/esb/listeners/message/JmsQueueListener.java 2006-11-05 18:02:32 UTC (rev 7411)
@@ -42,6 +42,7 @@
import org.jboss.soa.esb.helpers.AppServerContext;
import org.jboss.soa.esb.helpers.ConfigTree;
import org.jboss.soa.esb.listeners.ListenerTagNames;
+import org.jboss.soa.esb.services.registry.RegistryException;
import org.jboss.soa.esb.util.Util;
import org.xml.sax.SAXException;
@@ -57,7 +58,7 @@
* @since Version 4.0
*/
-public class JmsQueueListener implements Runnable
+public class JmsQueueListener extends AbstractListener
{
/**
* public constructor
@@ -68,8 +69,7 @@
public JmsQueueListener(EsbListenerController controller, ConfigTree config)
throws ConfigurationException
{
- _controller = controller;
- _config = config;
+ super(controller, config);
_iSleepForRetry = 3;
checkMyParms();
} // _______________________________
@@ -82,28 +82,32 @@
*/
public void run()
{
- _controller.register(_eprName,_epr);
-
- while (_controller.continueLooping())
- {
- long lwait = _controller.millisToWait();
- org.jboss.soa.esb.message.Message message = (lwait > 0 ) ? receiveEsbMessage(100) : null;
- if (null!=message)
- {
- ActionProcessingPipeline chain = null;
-
- try { chain = new ActionProcessingPipeline(message,_config); }
- catch (IllegalArgumentException e)
- { _logger.error(e); continue; }
- catch (ConfigurationException e)
- { _logger.error(e); continue; }
-
- // TODO Take care of thread pooling and (eventually) maximum child threads
- new Thread(chain).start();
- }
- }
- _controller.unRegister(_eprName);
- cleanup();
+ try {
+ _controller.register(_config,_epr);
+
+ while (_controller.continueLooping())
+ {
+ long lwait = _controller.millisToWait();
+ org.jboss.soa.esb.message.Message message = (lwait > 0 ) ? receiveEsbMessage(100) : null;
+ if (null!=message)
+ {
+ ActionProcessingPipeline chain = null;
+
+ try { chain = new ActionProcessingPipeline(message,_config); }
+ catch (IllegalArgumentException e)
+ { _logger.error(e); continue; }
+ catch (ConfigurationException e)
+ { _logger.error(e); continue; }
+
+ this.pipelineExecutorPool.submit(chain);
+ }
+ }
+ _controller.unRegister(_eprCategoryName, _eprName, _epr);
+ } catch (RegistryException re) {
+ _logger.fatal("Could not register myself. " + re.getLocalizedMessage(),re);
+ } finally {
+ cleanup();
+ }
} // _______________________________
/**
@@ -116,8 +120,9 @@
protected void checkMyParms() throws ConfigurationException
{
// Default value of obtainAttribute is null - Exception will be thrown
- String sQueue = obtainAttribute(JMSEpr.DESTINATION_NAME_TAG, null);
+ _queueName = obtainAttribute(JMSEpr.DESTINATION_NAME_TAG, null);
+ _eprCategoryName= obtainAttribute(ListenerTagNames.SERVICE_CATEGORY_NAME_TAG,null);
_eprName = obtainAttribute(ListenerTagNames.SERVICE_NAME_TAG,null);
// No problem if selector is null - everything in queue will be returned
@@ -127,22 +132,22 @@
_oQsess = null;
_oQueue = null;
- String sJndiType = obtainAttribute (JMSEpr.JNDI_TYPE_TAG ,"jboss");
- String sJndiURL = obtainAttribute (JMSEpr.JNDI_URL_TAG ,"localhost");
- Context oJndiCtx = AppServerContext.getServerContext(sJndiType,sJndiURL);
+ _jndiType = obtainAttribute (JMSEpr.JNDI_TYPE_TAG ,"jboss");
+ _jndiURL = obtainAttribute (JMSEpr.JNDI_URL_TAG ,"localhost");
+ _jndiCtx = AppServerContext.getServerContext(_jndiType,_jndiURL);
- String sFactClass = obtainAttribute(JMSEpr.CONNECTION_FACTORY_TAG, "ConnectionFactory");
- _epr = new JMSEpr(JMSEpr.QUEUE_TYPE,sQueue,sFactClass
- ,sJndiType,sJndiURL,_sSelector);
+ _jmsFactoryClass = obtainAttribute(JMSEpr.CONNECTION_FACTORY_TAG, "ConnectionFactory");
+ _epr = new JMSEpr(JMSEpr.QUEUE_TYPE,_queueName,_jmsFactoryClass
+ ,_jndiType,_jndiURL,_sSelector);
Exception thrown = null;
try
{
- Object tmp = oJndiCtx.lookup(sFactClass);
+ Object tmp = _jndiCtx.lookup(_jmsFactoryClass);
QueueConnectionFactory qcf = (QueueConnectionFactory) tmp;
_oQconn = qcf.createQueueConnection();
- _oQueue = (Queue) oJndiCtx.lookup(sQueue);
+ _oQueue = (Queue) _jndiCtx.lookup(_queueName);
_oQsess = _oQconn.createQueueSession(false,TopicSession.AUTO_ACKNOWLEDGE);
_oQconn.start();
_receiver = _oQsess.createReceiver(_oQueue, _sSelector);
@@ -227,6 +232,7 @@
protected String obtainAttribute(String p_sAtt, String p_sDefault)
throws ConfigurationException
{
+ _logger.info("Reading value for " + p_sAtt);
String sVal = _config.getAttribute(p_sAtt);
if ((null == sVal) && (null == p_sDefault))
throw new ConfigurationException("Missing or invalid <" + p_sAtt + "> attribute");
@@ -234,8 +240,7 @@
return (null != sVal) ? sVal : p_sDefault;
} // ________________________________
- protected EsbListenerController _controller;
- protected ConfigTree _config;
+ protected String _eprCategoryName;
protected String _eprName;
protected JMSEpr _epr;
protected MessageConsumer _receiver;
@@ -243,7 +248,13 @@
protected QueueConnection _oQconn;
protected QueueSession _oQsess;
protected Queue _oQueue;
- protected String _sSelector;
+ protected String _queueName
+ ,_sSelector
+ ,_jndiType
+ ,_jndiURL
+ ,_jmsFactoryClass
+ ;
+ protected Context _jndiCtx;
protected int _iSleepForRetry;
protected static transient Logger _logger = Logger.getLogger(JmsQueueListener.class);
Modified: labs/jbossesb/workspace/b_georges/product/core/listeners/src/org/jboss/soa/esb/listeners/old/AbstractListener.java
===================================================================
--- labs/jbossesb/workspace/b_georges/product/core/listeners/src/org/jboss/soa/esb/listeners/old/AbstractListener.java 2006-11-05 15:18:20 UTC (rev 7410)
+++ labs/jbossesb/workspace/b_georges/product/core/listeners/src/org/jboss/soa/esb/listeners/old/AbstractListener.java 2006-11-05 18:02:32 UTC (rev 7411)
@@ -182,7 +182,7 @@
* @author <a href="mailto:tom.fennelly at jboss.com">tom.fennelly at jboss.com</a>
* @since Version 4.0
*/
- private class ActionProcessingPipeline implements Runnable {
+ protected class ActionProcessingPipeline implements Runnable {
private Object initialObject;
@@ -190,7 +190,7 @@
* Private constructor.
* @param pMessage The inital processing target message.
*/
- private ActionProcessingPipeline(Object obj) {
+ protected ActionProcessingPipeline(Object obj) {
initialObject = obj;
}
@@ -290,4 +290,4 @@
}
}
-} // ____________________________________________________________________________
+}
Modified: labs/jbossesb/workspace/b_georges/product/core/listeners/src/org/jboss/soa/esb/listeners/old/RemoteDirectoryPoller.java
===================================================================
--- labs/jbossesb/workspace/b_georges/product/core/listeners/src/org/jboss/soa/esb/listeners/old/RemoteDirectoryPoller.java 2006-11-05 15:18:20 UTC (rev 7410)
+++ labs/jbossesb/workspace/b_georges/product/core/listeners/src/org/jboss/soa/esb/listeners/old/RemoteDirectoryPoller.java 2006-11-05 18:02:32 UTC (rev 7411)
@@ -28,12 +28,11 @@
import java.util.List;
import org.apache.log4j.Logger;
-import org.jboss.internal.soa.esb.util.EdtFtpImpl;
import org.jboss.soa.esb.actions.ActionDefinitionFactory;
import org.jboss.soa.esb.actions.ActionProcessor;
import org.jboss.soa.esb.helpers.ConfigTree;
import org.jboss.soa.esb.helpers.KeyValuePair;
-import org.jboss.soa.esb.util.RemoteFileSystem;
+import org.jboss.soa.esb.util.FtpClientUtil;
import org.jboss.soa.esb.util.Util;
public class RemoteDirectoryPoller extends AbstractPoller
@@ -49,7 +48,7 @@
private ConfigTree _params;
private Logger _logger = Logger.getLogger(this.getClass());
- RemoteFileSystem _ftpClient;
+ FtpClientUtil _ftpClient;
public RemoteDirectoryPoller(GpListener p_oDad, ConfigTree p_oParms,ActionDefinitionFactory actionDF)
throws Exception
@@ -83,7 +82,7 @@
try
{
- _ftpClient = new EdtFtpImpl(_params,true);
+ _ftpClient = new FtpClientUtil(_params,true);
_ftpClient.remoteRename(oF,oCurr);
}
catch (Exception e)
@@ -105,11 +104,11 @@
protected List<Object> pollForCandidates()
{
List<Object> oRet = new ArrayList<Object>();
- RemoteFileSystem _ftpClient = null;
+ FtpClientUtil _ftpClient = null;
try
{
- _ftpClient = new EdtFtpImpl(_params,true);
- _ftpClient.setRemoteDir(EdtFtpImpl.fileToFtpString(m_oInpDir));
+ _ftpClient = new FtpClientUtil(_params,true);
+ _ftpClient.setRemoteDir(FtpClientUtil.fileToFtpString(m_oInpDir));
String[] sa = _ftpClient.getFileListFromRemoteDir(m_sInpSfx);
if (null!=sa)
for (String sCurr : sa)
@@ -176,17 +175,17 @@
}
- RemoteFileSystem _ftpClient = new EdtFtpImpl(_params,false);
+ FtpClientUtil _ftpClient = new FtpClientUtil(_params,false);
_ftpClient.quit();
// Copy FTP parameters to be passed to the action class (inside the WorkingFile class)
// This is a kludge - we have to get back to this (ES)
String[] sa = new String[]
- {RemoteFileSystem.PARMS_FTP_SERVER
- ,RemoteFileSystem.PARMS_USER
- ,RemoteFileSystem.PARMS_PASSWD
- ,RemoteFileSystem.PARMS_PASSIVE
- ,RemoteFileSystem.PARMS_PORT
+ {FtpClientUtil.PARMS_FTP_SERVER
+ ,FtpClientUtil.PARMS_USER
+ ,FtpClientUtil.PARMS_PASSWD
+ ,FtpClientUtil.PARMS_PASSIVE
+ ,FtpClientUtil.PARMS_PORT
};
for (String sProp : sa)
{
@@ -260,25 +259,25 @@
public boolean isPostDelete() { return postDelete; }
public boolean localRenameToInput() { return super.renameTo(inputFile); }
- public void remoteRenameToInput(RemoteFileSystem util) throws Exception
+ public void remoteRenameToInput(FtpClientUtil util) throws Exception
{
util.remoteRename(this,inputFile);
}
public boolean localRenameToError() { return super.renameTo(errorFile); }
- public void remoteRenameToError(RemoteFileSystem util) throws Exception
+ public void remoteRenameToError(FtpClientUtil util) throws Exception
{
util.remoteRename(this,errorFile);
}
public boolean localRenameToOutput() { return renameTo(outputFile); }
- public void remoteRenameToOutput(RemoteFileSystem util) throws Exception
+ public void remoteRenameToOutput(FtpClientUtil util) throws Exception
{
util.remoteRename(this,outputFile);
}
public boolean localDelete() {return delete(); }
- public void remoteDelete(RemoteFileSystem util) throws Exception
+ public void remoteDelete(FtpClientUtil util) throws Exception
{util.deleteRemoteFile(this.toString()); }
}
Modified: labs/jbossesb/workspace/b_georges/product/core/rosetta/src/org/jboss/soa/esb/common/Configuration.java
===================================================================
--- labs/jbossesb/workspace/b_georges/product/core/rosetta/src/org/jboss/soa/esb/common/Configuration.java 2006-11-05 15:18:20 UTC (rev 7410)
+++ labs/jbossesb/workspace/b_georges/product/core/rosetta/src/org/jboss/soa/esb/common/Configuration.java 2006-11-05 18:02:32 UTC (rev 7411)
@@ -59,8 +59,8 @@
new KeyValuePair(Environment.MSG_STORE_DB_POOL_INITIAL_SIZE,getStorePoolInitialSize()),
new KeyValuePair(Environment.MSG_STORE_DB_POOL_TEST_TABLE, getStorePoolTestTable()),
new KeyValuePair(Environment.MSG_STORE_DB_POOL_TIMEOUT_MILLIS,getStorePoolTimeoutMillis()),
-
-
+ new KeyValuePair(Environment.MSG_STORE_CONN_FACTORY ,getStoreConnectionFactory()),
+ new KeyValuePair(Environment.ROUTER_CBR_CLASS, getContentBasedRouterImplementationClass())
};
public static String dump()
@@ -270,4 +270,19 @@
String property = ModulePropertyManager.getPropertyManager(ModulePropertyManager.DBSTORE_MODULE).getProperty(Environment.MSG_STORE_DB_POOL_TIMEOUT_MILLIS);
return property;
}
+
+ public static String getStoreConnectionFactory()
+ {
+ String property = ModulePropertyManager.getPropertyManager(ModulePropertyManager.CORE_MODULE).getProperty(Environment.MSG_STORE_CONN_FACTORY);
+ return property;
+ }
+
+ public static String getContentBasedRouterImplementationClass()
+ {
+ String property = ModulePropertyManager.getPropertyManager(ModulePropertyManager.ROUTER_MODULE).getProperty(Environment.ROUTER_CBR_CLASS);
+ return property;
+ }
+
+
+
}
\ No newline at end of file
Modified: labs/jbossesb/workspace/b_georges/product/core/rosetta/src/org/jboss/soa/esb/common/Environment.java
===================================================================
--- labs/jbossesb/workspace/b_georges/product/core/rosetta/src/org/jboss/soa/esb/common/Environment.java 2006-11-05 15:18:20 UTC (rev 7410)
+++ labs/jbossesb/workspace/b_georges/product/core/rosetta/src/org/jboss/soa/esb/common/Environment.java 2006-11-05 18:02:32 UTC (rev 7411)
@@ -70,15 +70,18 @@
*/
public static final String REGISTRY_PASSWORD = "org.jboss.soa.esb.registry.password";
/**
- * The Registry Scout Transport Class defines which communication protocol Scout should use to communicate
+ * The Registry Scout Transport Class property defines which communication protocol Scout should use to communicate
* with the UDDI registry. Note that this parameter is Scout specific.
*/
public static final String REGISTRY_SCOUT_TRANSPORT_CLASS = "org.jboss.soa.esb.scout.proxy.transportClass";
-
/**
* Property that holds directory to use with the helper EPRManager class.
*/
public static final String REGISTRY_FILE_HELPER_DIR = "org.jboss.soa.esb.registry.file.directory";
+ /**
+ * The Content Based Router class property declares which CBR Implementation should be used.
+ */
+ public static final String ROUTER_CBR_CLASS = "org.jboss.soa.esb.routing.cbrClass";
/*
* Connection specific properties
*/
@@ -100,6 +103,7 @@
/*
* DatabaseMessageStore Persistence Store properties.
*/
+ public static final String MSG_STORE_CONN_FACTORY = "org.jboss.soa.esb.persistence.connection.factory";
public static final String MSG_STORE_DB_CONNECTION_URL = "org.jboss.soa.esb.persistence.db.connection.url";
public static final String MSG_STORE_DB_CONNECTION_USER = "org.jboss.soa.esb.persistence.db.user";
public static final String MSG_STORE_DB_CONNECTION_PWD = "org.jboss.soa.esb.persistence.db.pwd";
Modified: labs/jbossesb/workspace/b_georges/product/core/rosetta/src/org/jboss/soa/esb/common/ModulePropertyManager.java
===================================================================
--- labs/jbossesb/workspace/b_georges/product/core/rosetta/src/org/jboss/soa/esb/common/ModulePropertyManager.java 2006-11-05 15:18:20 UTC (rev 7410)
+++ labs/jbossesb/workspace/b_georges/product/core/rosetta/src/org/jboss/soa/esb/common/ModulePropertyManager.java 2006-11-05 18:02:32 UTC (rev 7411)
@@ -86,6 +86,8 @@
public static final String TRANSPORTS_MODULE = "transports";
public static final String DBSTORE_MODULE = "dbstore";
+
+ public static final String ROUTER_MODULE = "messagerouting";
Modified: labs/jbossesb/workspace/b_georges/product/core/rosetta/src/org/jboss/soa/esb/helpers/ConfigTree.java
===================================================================
--- labs/jbossesb/workspace/b_georges/product/core/rosetta/src/org/jboss/soa/esb/helpers/ConfigTree.java 2006-11-05 15:18:20 UTC (rev 7410)
+++ labs/jbossesb/workspace/b_georges/product/core/rosetta/src/org/jboss/soa/esb/helpers/ConfigTree.java 2006-11-05 18:02:32 UTC (rev 7411)
@@ -1,15 +1,36 @@
package org.jboss.soa.esb.helpers;
-import java.util.*;
-import java.io.*;
-import org.apache.log4j.Logger;
+import java.io.ByteArrayInputStream;
+import java.io.ByteArrayOutputStream;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.Serializable;
+import java.io.UnsupportedEncodingException;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.List;
+import java.util.ListIterator;
+import java.util.Map;
+import java.util.Set;
-import javax.xml.parsers.*;
-import javax.xml.transform.*;
+import javax.xml.parsers.DocumentBuilder;
+import javax.xml.parsers.DocumentBuilderFactory;
+import javax.xml.parsers.ParserConfigurationException;
+import javax.xml.transform.OutputKeys;
+import javax.xml.transform.Transformer;
+import javax.xml.transform.TransformerConfigurationException;
+import javax.xml.transform.TransformerException;
+import javax.xml.transform.TransformerFactory;
import javax.xml.transform.dom.DOMSource;
import javax.xml.transform.stream.StreamResult;
-import org.w3c.dom.*;
+import org.apache.log4j.Logger;
+import org.w3c.dom.Document;
+import org.w3c.dom.Element;
+import org.w3c.dom.NamedNodeMap;
+import org.w3c.dom.Node;
+import org.w3c.dom.NodeList;
import org.xml.sax.SAXException;
/**
* Objects of this class are to be used for run time configuration of ESB components
@@ -134,6 +155,21 @@
return oRet;
} // _______________________________
/**
+ * obtain the list of all child "property" elements as a List<KeyValuePair>
+ * @return List<KeyValuePair> - containing all child elements with tag name "property"
+ */
+ public List<KeyValuePair> childPropertyList()
+ {
+ List<KeyValuePair> oRet = new ArrayList<KeyValuePair>();
+ for (ConfigTree current : getChildren("property"))
+ {
+ String name = current.getAttribute("name");
+ if (null!=name)
+ oRet.add(new KeyValuePair(name,current.getAttribute("value")));
+ }
+ return oRet;
+ } // _______________________________
+ /**
* concatenated values of all child String values that have been added to 'this'
* <br/>"" (zero length String) if no String child nodes
* @return String - concatenation of all String segments (equivalent to xml text nodes)
Modified: labs/jbossesb/workspace/b_georges/product/core/rosetta/src/org/jboss/soa/esb/services/persistence/MessageStoreFactory.java
===================================================================
--- labs/jbossesb/workspace/b_georges/product/core/rosetta/src/org/jboss/soa/esb/services/persistence/MessageStoreFactory.java 2006-11-05 15:18:20 UTC (rev 7410)
+++ labs/jbossesb/workspace/b_georges/product/core/rosetta/src/org/jboss/soa/esb/services/persistence/MessageStoreFactory.java 2006-11-05 18:02:32 UTC (rev 7411)
@@ -5,9 +5,11 @@
import java.lang.reflect.Constructor;
import java.net.URI;
+import org.jboss.soa.esb.common.Configuration;
+
@SuppressWarnings("unchecked")
public abstract class MessageStoreFactory {
@@ -17,7 +19,8 @@
{
try {
- Class cls = Class.forName("org.jboss.internal.soa.esb.persistence.format.MessageStoreFactoryImpl");
+// Class cls = Class.forName("org.jboss.internal.soa.esb.persistence.format.MessageStoreFactoryImpl");
+ Class cls = Class.forName(Configuration.getStoreConnectionFactory());
Constructor<MessageStoreFactory> c = cls.getConstructor(new Class[]{});
theFactory = c.newInstance(new Object[]{});
} catch (Exception e) {
Modified: labs/jbossesb/workspace/b_georges/product/core/rosetta/tests/src/org/jboss/soa/esb/common/tests/TestUtil.java
===================================================================
--- labs/jbossesb/workspace/b_georges/product/core/rosetta/tests/src/org/jboss/soa/esb/common/tests/TestUtil.java 2006-11-05 15:18:20 UTC (rev 7410)
+++ labs/jbossesb/workspace/b_georges/product/core/rosetta/tests/src/org/jboss/soa/esb/common/tests/TestUtil.java 2006-11-05 18:02:32 UTC (rev 7411)
@@ -1,5 +1,10 @@
package org.jboss.soa.esb.common.tests;
+import java.io.BufferedReader;
+import java.io.File;
+import java.io.FileReader;
+import java.io.IOException;
+
import org.apache.log4j.Logger;
import org.apache.log4j.Priority;
@@ -33,4 +38,17 @@
System.setProperty("org.jboss.soa.esb.propertyFile", jbossesbPropertiesFile);
}
+ public static String readTextFile(File file) throws IOException
+ {
+ StringBuffer sb = new StringBuffer(1024);
+ BufferedReader reader = new BufferedReader(new FileReader(file.getPath()));
+ char[] chars = new char[1];
+ while( (reader.read(chars)) > -1){
+ sb.append(String.valueOf(chars));
+ chars = new char[1];
+ }
+ reader.close();
+ return sb.toString();
+ }
+
}
Modified: labs/jbossesb/workspace/b_georges/product/core/services/build.xml
===================================================================
--- labs/jbossesb/workspace/b_georges/product/core/services/build.xml 2006-11-05 15:18:20 UTC (rev 7410)
+++ labs/jbossesb/workspace/b_georges/product/core/services/build.xml 2006-11-05 18:02:32 UTC (rev 7411)
@@ -31,6 +31,7 @@
<path id="org.jboss.esb.services.base.classpath">
<fileset dir="${org.jboss.esb.ext.lib.dir}" includes="*.jar" excludes="jbossall-client.jar"/>
<fileset dir="${org.jboss.esb.ejb3.lib.dir}" includes="*.jar,*.zip"/>
+ <pathelement location="${org.jboss.esb.internal.dest}/classes/rosetta"/>
</path>
<!-- =================================================================== -->
Modified: labs/jbossesb/workspace/b_georges/product/core/services/src/org/jboss/soa/esb/services/registry/Registry.java
===================================================================
--- labs/jbossesb/workspace/b_georges/product/core/services/src/org/jboss/soa/esb/services/registry/Registry.java 2006-11-05 15:18:20 UTC (rev 7410)
+++ labs/jbossesb/workspace/b_georges/product/core/services/src/org/jboss/soa/esb/services/registry/Registry.java 2006-11-05 18:02:32 UTC (rev 7411)
@@ -29,7 +29,7 @@
*
* @author Kurt Stam
*/
-interface Registry
+public interface Registry
{
/**
* Removes a service from the Registry along with all the ServiceBindings underneath it.
@@ -51,7 +51,7 @@
* @param eprDescription - human readable description of the EPR
* @throws RegistryException
*/
- public void registerEPR(String category, String serviceName, String serviceDescription, EPR epr, String eprDescription)
+ public void registerEPR(String serviceCategoryName, String serviceName, String serviceDescription, EPR epr, String eprDescription)
throws RegistryException;
/**
* Removes an EPR from the Registry.
@@ -60,7 +60,7 @@
* @param epr - the EndPointReference (EPR) that needs to be unregistered.
* @throws RegistryException
*/
- public void unRegisterEPR(String category, String serviceName, EPR epr) throws RegistryException;
+ public void unRegisterEPR(String serviceCategoryName, String serviceName, EPR epr) throws RegistryException;
/**
* Find all Services assigned to the Red Hat/JBossESB organization.
* @return Collection of Strings containing the service names.
@@ -74,7 +74,7 @@
* @return Collection of Strings containing the service names
* @throws RegistryException
*/
- public Collection<String> findServices(String category) throws RegistryException;
+ public Collection<String> findServices(String serviceCategoryName) throws RegistryException;
/**
* Finds all the EPRs that belong to a specific category and service combination.
*
@@ -83,5 +83,5 @@
* @return Collection of EPRs.
* @throws RegistryException
*/
- public Collection<EPR> findEPRs(String category, String serviceName) throws RegistryException;
+ public Collection<EPR> findEPRs(String serviceCategoryName, String serviceName) throws RegistryException;
}
Modified: labs/jbossesb/workspace/b_georges/product/core/services/src/org/jboss/soa/esb/services/registry/RegistryFactory.java
===================================================================
--- labs/jbossesb/workspace/b_georges/product/core/services/src/org/jboss/soa/esb/services/registry/RegistryFactory.java 2006-11-05 15:18:20 UTC (rev 7410)
+++ labs/jbossesb/workspace/b_georges/product/core/services/src/org/jboss/soa/esb/services/registry/RegistryFactory.java 2006-11-05 18:02:32 UTC (rev 7411)
@@ -24,52 +24,30 @@
import org.apache.log4j.Logger;
import org.apache.log4j.Priority;
import org.jboss.soa.esb.common.Configuration;
+import org.jboss.soa.esb.common.Factory;
/**
* Returns an Instance of the Registry.
* @author kstam
*
*/
-public class RegistryFactory
+public class RegistryFactory extends Factory
{
- private static Logger logger = Logger.getLogger(RegistryFactory.class);
+ private static Logger logger = Logger.getLogger(RegistryException.class);
- public static Registry getRegistry() {
+ public static Registry getRegistry() throws RegistryException{
Registry registry = null;
String className = Configuration.getRegistryImplementationClass();
+ logger.log(Priority.INFO, "Going to load " + className);
try {
- // instruct class loader to load the TransportFactory
+ // instruct class loader to load the Registry Implementation
Class registryClass = getClassForName(className);
// Try to instance the Registry
registry = (Registry) registryClass.newInstance();
} catch (ClassNotFoundException cnfex) {
- cnfex.printStackTrace();
- } catch (java.lang.Exception ex) {
- ex.printStackTrace();
+ throw new RegistryException("Registry Implementation=" + className + " not found", cnfex);
+ } catch (Exception e) {
+ throw new RegistryException("Invokation exception. " + e.getLocalizedMessage(), e);
}
return registry;
}
-
- /**
- * Loads the class with the given name.
- * @param className - the className to be found
- * @return - the class
- * @throws ClassNotFoundException
- */
- private static Class getClassForName(String className) throws ClassNotFoundException
- {
- Class clazz = null;
- try {
- logger.log(Priority.DEBUG, "Using the Context ClassLoader");
- ClassLoader contextClassLoader = Thread.currentThread().getContextClassLoader();
- clazz = Class.forName(className, true, contextClassLoader);
- } catch (ClassNotFoundException classNotFound) {
- if (logger.isDebugEnabled()) {
- logger.log(Priority.WARN, "The Contect ClassLoader could not find the class.");
- logger.log(Priority.WARN, "Using the System ClassLoader");
- }
- ClassLoader systemClassLoader = ClassLoader.getSystemClassLoader();
- clazz = Class.forName(className, true, systemClassLoader);
- }
- return clazz;
- }
}
Modified: labs/jbossesb/workspace/b_georges/product/core/services/tests/build.xml
===================================================================
--- labs/jbossesb/workspace/b_georges/product/core/services/tests/build.xml 2006-11-05 15:18:20 UTC (rev 7410)
+++ labs/jbossesb/workspace/b_georges/product/core/services/tests/build.xml 2006-11-05 18:02:32 UTC (rev 7411)
@@ -23,7 +23,8 @@
<path id="org.jboss.esb.tests.base.classpath">
<fileset dir="../${org.jboss.esb.ext.lib.dir}"
- includes="*.jar" excludes="jbossall-client.jar"/>
+ includes="*.jar" excludes="jbossall-client.jar"/>
+ <pathelement location="${basedir}/../rules"/>
<pathelement location="${org.jboss.esb.module.classes.dir}"/>
<pathelement location="${org.jboss.esb.internal.dest}/classes/rosetta"/>
<pathelement location="${org.jboss.esb.ejb3_conf.tests.src.dir}"/>
Modified: labs/jbossesb/workspace/b_georges/product/core/services/tests/src/org/jboss/soa/esb/esb/persistence/tests/MessageStoreUnitTest.java
===================================================================
--- labs/jbossesb/workspace/b_georges/product/core/services/tests/src/org/jboss/soa/esb/esb/persistence/tests/MessageStoreUnitTest.java 2006-11-05 15:18:20 UTC (rev 7410)
+++ labs/jbossesb/workspace/b_georges/product/core/services/tests/src/org/jboss/soa/esb/esb/persistence/tests/MessageStoreUnitTest.java 2006-11-05 18:02:32 UTC (rev 7411)
@@ -26,6 +26,8 @@
*
*
*/
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertTrue;
import java.io.BufferedReader;
import java.io.File;
@@ -35,9 +37,8 @@
import java.sql.Connection;
import java.sql.Statement;
-import junit.framework.TestCase;
+import junit.framework.JUnit4TestAdapter;
-import org.jboss.soa.esb.services.persistence.MessageStoreType;
import org.jboss.internal.soa.esb.persistence.format.db.DBConnectionManager;
import org.jboss.soa.esb.common.Configuration;
import org.jboss.soa.esb.common.tests.HsqldbUtil;
@@ -47,38 +48,31 @@
import org.jboss.soa.esb.message.format.MessageType;
import org.jboss.soa.esb.services.persistence.MessageStore;
import org.jboss.soa.esb.services.persistence.MessageStoreFactory;
+import org.jboss.soa.esb.services.persistence.MessageStoreType;
+import org.junit.AfterClass;
+import org.junit.BeforeClass;
import org.junit.Test;
-public class MessageStoreUnitTest extends TestCase{
+public class MessageStoreUnitTest {
// private static Logger log = Logger.getLogger(MessageStoreUnitTest.class);
@Test
public void testDefaultMessageStore() {
- TestUtil.setESBPropertiesFileToUse();
- MessageStoreUnitTest.runBeforeAllTests();
MessageStore store = MessageStoreFactory.getInstance().getMessageStore();
assertEquals((store != null), true);
- MessageStoreUnitTest.runAfterAllTests();
}
@Test
public void testURIMessageStore() {
- TestUtil.setESBPropertiesFileToUse();
-
//only DB supported for now
- MessageStoreUnitTest.runBeforeAllTests();
MessageStore store1 = MessageStoreFactory.getInstance().getMessageStore(MessageStoreType.DATABASE);
assertEquals((store1 != null), true);
- MessageStoreUnitTest.runAfterAllTests();
}
@Test
public void testStoreAndRetrieve() {
- TestUtil.setESBPropertiesFileToUse();
- MessageStoreUnitTest.runBeforeAllTests();
-
//add new messages
Message msg1 = MessageFactory.getInstance().getMessage(MessageType.JBOSS_XML);
Message msg2 = MessageFactory.getInstance().getMessage(MessageType.JAVA_SERIALIZED);
@@ -125,24 +119,20 @@
} catch (Exception e) {
e.printStackTrace();
}
-
- MessageStoreUnitTest.runAfterAllTests();
}
@Test
public void testDBConnectionManager() {
- TestUtil.setESBPropertiesFileToUse();
- MessageStoreUnitTest.runBeforeAllTests();
MessageStore store = MessageStoreFactory.getInstance().getMessageStore(MessageStoreType.DATABASE);
assertEquals((store != null), true);
DBConnectionManager mgr = DBConnectionManager.getInstance();
assertEquals((mgr != null), true);
- MessageStoreUnitTest.runAfterAllTests();
}
-
- private static void runBeforeAllTests() {
- TestUtil.setESBPropertiesFileToUse();
+ @BeforeClass
+ public static void runBeforeAllTests() {
+ TestUtil.setESBPropertiesFileToUse();
+ System.out.println(Configuration.dump());
try {
if (Configuration.getStoreDriver().equals("org.hsqldb.jdbcDriver")) {
HsqldbUtil.startHsqldb(TestUtil.getPrefix() + "build/hsqltestdb", "jbossesb");
@@ -153,6 +143,14 @@
String sqlCreateCmd = MessageStoreUnitTest.readTextFile(new File(sqlDir + "create_database.sql"));
String sqlDropCmd = MessageStoreUnitTest.readTextFile(new File(sqlDir + "drop_database.sql"));
+ try {
+ Class.forName(Configuration.getStoreDriver());
+ } catch (Exception e) {
+ System.out.println("ERROR: failed to load " + database + " JDBC driver.");
+ e.printStackTrace();
+ return;
+ }
+
DBConnectionManager mgr = DBConnectionManager.getInstance();
Connection con = mgr.getConnection();
Statement stmnt = con.createStatement();
@@ -168,7 +166,8 @@
}
}
- private static void runAfterAllTests() {
+ @AfterClass
+ public static void runAfterAllTests() {
try {
if (Configuration.getStoreDriver().equals("org.hsqldb.jdbcDriver"))
HsqldbUtil.stopHsqldb(Configuration.getStoreUrl(),
@@ -197,6 +196,9 @@
return sb.toString();
}
+ public static junit.framework.Test suite() {
+ return new JUnit4TestAdapter(MessageStoreUnitTest.class);
+ }
}
Modified: labs/jbossesb/workspace/b_georges/product/core/services/tests/src/org/jboss/soa/esb/services/registry/RegistryUnitTest.java
===================================================================
--- labs/jbossesb/workspace/b_georges/product/core/services/tests/src/org/jboss/soa/esb/services/registry/RegistryUnitTest.java 2006-11-05 15:18:20 UTC (rev 7410)
+++ labs/jbossesb/workspace/b_georges/product/core/services/tests/src/org/jboss/soa/esb/services/registry/RegistryUnitTest.java 2006-11-05 18:02:32 UTC (rev 7411)
@@ -36,6 +36,7 @@
import org.apache.log4j.Logger;
import org.apache.log4j.Priority;
+import org.apache.log4j.xml.DOMConfigurator;
import org.jboss.soa.esb.addressing.EPR;
import org.jboss.soa.esb.common.tests.HsqldbUtil;
import org.jboss.soa.esb.common.tests.TestUtil;
@@ -66,15 +67,25 @@
@Test
public void publishEPR()
{
- Registry registry = RegistryFactory.getRegistry();
EPR epr = new EPR();
try {
+ Registry registry = RegistryFactory.getRegistry();
registry.registerEPR(CATEGORY, SERVICE_NAME, "Service for traveling",
epr, "Specific Service Binding for traveling");
} catch (RegistryException re) {
logger.log(Priority.ERROR, re.getLocalizedMessage(), re);
assertTrue(false);
}
+ try {
+ Registry registry = RegistryFactory.getRegistry();
+ registry.registerEPR(null, SERVICE_NAME, null,
+ epr, null);
+ } catch (RegistryException re) {
+ logger.log(Priority.ERROR, re.getLocalizedMessage(), re);
+ assertTrue(false);
+ }
+ //make sure we can handle some null arguments
+
}
/**
* This test will try to find all services in the "travel" category.
@@ -82,8 +93,8 @@
@Test
public void findService()
{
- Registry registry = RegistryFactory.getRegistry();
try {
+ Registry registry = RegistryFactory.getRegistry();
Collection<String> services = registry.findServices(CATEGORY);
for (Iterator i=services.iterator();i.hasNext();) {
String serviceName = (String) i.next();
@@ -101,8 +112,8 @@
@Test
public void findEPRs()
{
- Registry registry = RegistryFactory.getRegistry();
try {
+ Registry registry = RegistryFactory.getRegistry();
Collection<EPR> eprs = registry.findEPRs(CATEGORY, SERVICE_NAME);
for (Iterator i=eprs.iterator();i.hasNext();) {
EPR epr = (EPR) i.next();
@@ -116,8 +127,8 @@
@Test
public void unregisterEPR()
{
- Registry registry = RegistryFactory.getRegistry();
try {
+ Registry registry = RegistryFactory.getRegistry();
EPR eprToBeRemoved = new EPR();
registry.unRegisterEPR(CATEGORY, SERVICE_NAME, eprToBeRemoved);
// Now make sure this EPR is really gone
@@ -132,8 +143,8 @@
@Test
public void unregisterService()
{
- Registry registry = RegistryFactory.getRegistry();
try {
+ Registry registry = RegistryFactory.getRegistry();
registry.unRegisterService(CATEGORY, SERVICE_NAME);
//Make sure it's really gone
Collection<String> services = registry.findAllServices();
@@ -149,8 +160,9 @@
* @throws Exception
*/
@BeforeClass
- public static void runBeforeAllTests() throws Exception {
+ public static void runBeforeAllTests() {
try {
+ DOMConfigurator.configure(TestUtil.getPrefix() + "etc/test/resources/log4j.xml");
TestUtil.setESBPropertiesFileToUse();
//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/services/registry/juddi-unittest.properties";
More information about the jboss-svn-commits
mailing list