[jboss-svn-commits] JBL Code SVN: r8067 - in labs/jbossesb/trunk: product/core/listeners/src/org/jboss/soa/esb/listeners product/core/listeners/src/org/jboss/soa/esb/listeners/message product/core/listeners/tests/src/org/jboss/soa/esb/listeners product/core/listeners/tests/src/org/jboss/soa/esb/listeners/message product/core/services/tests/src/org/jboss/internal/soa/esb/services/registry product/samples/trailblazer2/esb/src/org/jboss/soa/esb/samples/trailblazer/util qa/junit/src/org/jboss/soa/esb/util

jboss-svn-commits at lists.jboss.org jboss-svn-commits at lists.jboss.org
Tue Dec 5 10:17:29 EST 2006


Author: tfennelly
Date: 2006-12-05 10:17:11 -0500 (Tue, 05 Dec 2006)
New Revision: 8067

Added:
   labs/jbossesb/trunk/product/core/listeners/tests/src/org/jboss/soa/esb/listeners/message/
   labs/jbossesb/trunk/product/core/listeners/tests/src/org/jboss/soa/esb/listeners/message/EsbListenerControllerTest.java
   labs/jbossesb/trunk/product/core/listeners/tests/src/org/jboss/soa/esb/listeners/message/ListenerConfig_01.xml
   labs/jbossesb/trunk/product/core/listeners/tests/src/org/jboss/soa/esb/listeners/message/MockListener.java
   labs/jbossesb/trunk/product/core/services/tests/src/org/jboss/internal/soa/esb/services/registry/MockRegistry.java
Modified:
   labs/jbossesb/trunk/product/core/listeners/src/org/jboss/soa/esb/listeners/Lifecycle.java
   labs/jbossesb/trunk/product/core/listeners/src/org/jboss/soa/esb/listeners/message/AbstractListener.java
   labs/jbossesb/trunk/product/core/listeners/src/org/jboss/soa/esb/listeners/message/CbrJmsQueueListener.java
   labs/jbossesb/trunk/product/core/listeners/src/org/jboss/soa/esb/listeners/message/EsbListenerControllerFactory.java
   labs/jbossesb/trunk/product/core/listeners/src/org/jboss/soa/esb/listeners/message/HttpListener.java
   labs/jbossesb/trunk/product/core/listeners/src/org/jboss/soa/esb/listeners/message/JmsQueueListener.java
   labs/jbossesb/trunk/product/samples/trailblazer2/esb/src/org/jboss/soa/esb/samples/trailblazer/util/Launcher.java
   labs/jbossesb/trunk/qa/junit/src/org/jboss/soa/esb/util/NewListenerUtils.java
Log:
More for http://jira.jboss.com/jira/browse/JBESB-256.

All code in place now.  Just need to add a few more tests.

Modified: labs/jbossesb/trunk/product/core/listeners/src/org/jboss/soa/esb/listeners/Lifecycle.java
===================================================================
--- labs/jbossesb/trunk/product/core/listeners/src/org/jboss/soa/esb/listeners/Lifecycle.java	2006-12-05 15:16:58 UTC (rev 8066)
+++ labs/jbossesb/trunk/product/core/listeners/src/org/jboss/soa/esb/listeners/Lifecycle.java	2006-12-05 15:17:11 UTC (rev 8067)
@@ -31,5 +31,5 @@
 	 * Get the state of the listener component.
 	 * @return The state of the component.
 	 */
-	public abstract State getState();
+	public abstract State getState();	
 }
\ No newline at end of file

Modified: labs/jbossesb/trunk/product/core/listeners/src/org/jboss/soa/esb/listeners/message/AbstractListener.java
===================================================================
--- labs/jbossesb/trunk/product/core/listeners/src/org/jboss/soa/esb/listeners/message/AbstractListener.java	2006-12-05 15:16:58 UTC (rev 8066)
+++ labs/jbossesb/trunk/product/core/listeners/src/org/jboss/soa/esb/listeners/message/AbstractListener.java	2006-12-05 15:17:11 UTC (rev 8067)
@@ -25,6 +25,7 @@
 
 import org.apache.log4j.Logger;
 import org.jboss.soa.esb.helpers.ConfigTree;
+import org.jboss.soa.esb.listeners.Lifecycle;
 
 /**
  * Base class for listener implementations  which will be responsible for implementing some sort of
@@ -33,7 +34,7 @@
  * @author <a href="mailto:johan.kumps at telenet.be">Johan Kumps</a>
  *
  */
-public abstract class AbstractListener implements Runnable {
+public abstract class AbstractListener implements Runnable, Lifecycle {
 
 	/* The logger for this class */
 	protected Logger logger = Logger.getLogger(AbstractListener.class);
@@ -81,5 +82,4 @@
 		}
 //		this.pipelineExecutorPool = Executors.newFixedThreadPool(m_iMaxThr);
 	}
-
 }

Modified: labs/jbossesb/trunk/product/core/listeners/src/org/jboss/soa/esb/listeners/message/CbrJmsQueueListener.java
===================================================================
--- labs/jbossesb/trunk/product/core/listeners/src/org/jboss/soa/esb/listeners/message/CbrJmsQueueListener.java	2006-12-05 15:16:58 UTC (rev 8066)
+++ labs/jbossesb/trunk/product/core/listeners/src/org/jboss/soa/esb/listeners/message/CbrJmsQueueListener.java	2006-12-05 15:17:11 UTC (rev 8067)
@@ -34,6 +34,7 @@
 import org.jboss.soa.esb.helpers.ConfigTree;
 import org.jboss.soa.esb.listeners.ListenerInitializationException;
 import org.jboss.soa.esb.listeners.ListenerTagNames;
+import org.jboss.soa.esb.listeners.State;
 import org.jboss.soa.esb.message.Message;
 import org.jboss.soa.esb.services.registry.RegistryException;
 import org.jboss.soa.esb.services.routing.MessageRouter;
@@ -90,6 +91,8 @@
 	        	return;
 	        }
 
+	        // We're now ready to process messages...
+	        setState(State.Ready);
 	    	while (_controller.continueLooping()) {
 	    		long lwait = _controller.millisToWait();
 	    		Message message = (lwait > 0 ) ? receiveEsbMessage(100) : null;

Modified: labs/jbossesb/trunk/product/core/listeners/src/org/jboss/soa/esb/listeners/message/EsbListenerControllerFactory.java
===================================================================
--- labs/jbossesb/trunk/product/core/listeners/src/org/jboss/soa/esb/listeners/message/EsbListenerControllerFactory.java	2006-12-05 15:16:58 UTC (rev 8066)
+++ labs/jbossesb/trunk/product/core/listeners/src/org/jboss/soa/esb/listeners/message/EsbListenerControllerFactory.java	2006-12-05 15:17:11 UTC (rev 8067)
@@ -37,7 +37,6 @@
 import org.jboss.soa.esb.helpers.ConfigTree;
 import org.jboss.soa.esb.listeners.ListenerTagNames;
 import org.jboss.soa.esb.listeners.State;
-import org.jboss.soa.esb.listeners.Lifecycle;
 import org.jboss.soa.esb.parameters.ParamRepositoryException;
 import org.jboss.soa.esb.parameters.ParamRepositoryFactory;
 import org.jboss.soa.esb.services.registry.Registry;
@@ -68,9 +67,7 @@
 	 */
 	public static EsbListenerController getInstance(String parameterName) throws Exception {
 		EsbListenerControllerImpl controller =  new EsbListenerControllerImpl(parameterName);
-		new Thread(controller).start();
-		Thread.sleep(15000); // TODO: Replace with proper sync code!
-		return controller;
+		return startController(controller);
 	}
 	
 	/**
@@ -81,8 +78,19 @@
 	 */
 	public static EsbListenerController getInstance(ConfigTree config) throws Exception {
 		EsbListenerControllerImpl controller =  new EsbListenerControllerImpl(config);
+		return startController(controller);
+	}
+
+	/**
+	 * Start the controller and wait for it to initialise.
+	 * @param controller The controller.
+	 * @return The controller.
+	 */
+	private static EsbListenerController startController(EsbListenerControllerImpl controller) {
+		// Start the controller and wait for it to transition to a state of "Ready".
 		new Thread(controller).start();
-		Thread.sleep(15000); // TODO: Replace with proper sync code!
+		State.waitUntilReady(controller);
+				
 		return controller;
 	}
 
@@ -117,9 +125,9 @@
 			oProc.run();
 			State oS = oProc.getState();
 	
-			if (null != oS.getException()) {
+			if (null != oS.getThrowable()) {
 				_logger.error("EsbListenerControllerImpl <" + args[0] + "> FAILED\n", oS
-						.getException());
+						.getThrowable());
 			}
 			System.exit(oS.getCompletionCode());
 		} // ________________________________
@@ -148,7 +156,7 @@
 	
 		private long m_lEndTime = Long.MAX_VALUE;
 	
-		private State m_oState = null;
+		private State m_oState = State.Uninitialised;
 	
 		/* (non-Javadoc)
 		 * @see org.jboss.soa.esb.listeners.message.EsbListenerController#getState()
@@ -192,7 +200,7 @@
 				String configSource = config.getAttribute("configSource");
 	
 				m_oState = State.Exception_thrown;
-				m_oState.setException(e);
+				m_oState.setThrowable(e);
 				_logger.fatal("Listener configuration and startup error.  Config Source: "
 										+ (configSource != null ? configSource
 												: "unknown"), e);
@@ -296,6 +304,7 @@
 						continue;
 					tryToLaunchChildListener(oCurr, sClass);
 				}
+				m_oState = State.Ready;
 	
 				waitForCmdOrSleep();
 	
@@ -337,8 +346,10 @@
 			{
 				Class oListener = Class.forName(p_sClassName);
 				Constructor oConst = oListener.getConstructor(new Class[] {EsbListenerController.class, ConfigTree.class});
-				Runnable oRun = (Runnable) oConst.newInstance(new Object[] { this,p_oP});
-				new Thread(oRun).start();
+				AbstractListener listener = (AbstractListener) oConst.newInstance(new Object[] { this,p_oP});
+				new Thread(listener).start();
+				// Wait for the listener it to transition to a state of "Ready".
+				State.waitUntilReady(listener);
 			}
 			catch (Exception e) 
 			{

Modified: labs/jbossesb/trunk/product/core/listeners/src/org/jboss/soa/esb/listeners/message/HttpListener.java
===================================================================
--- labs/jbossesb/trunk/product/core/listeners/src/org/jboss/soa/esb/listeners/message/HttpListener.java	2006-12-05 15:16:58 UTC (rev 8066)
+++ labs/jbossesb/trunk/product/core/listeners/src/org/jboss/soa/esb/listeners/message/HttpListener.java	2006-12-05 15:17:11 UTC (rev 8067)
@@ -35,6 +35,7 @@
 import org.jboss.soa.esb.ConfigurationException;
 import org.jboss.soa.esb.helpers.ConfigTree;
 import org.jboss.soa.esb.listeners.ListenerInitializationException;
+import org.jboss.soa.esb.listeners.State;
 import org.jboss.soa.esb.message.Message;
 
 /**
@@ -58,9 +59,13 @@
  * @author <a href="mailto:johan.kumps at telenet.be">Johan Kumps</a>
  * 
  */
-public class HttpListener extends AbstractPassiveListener implements
-		ServerInvocationHandler {
+public class HttpListener extends AbstractPassiveListener implements ServerInvocationHandler {
 
+	/**
+	 * Listener lifecycle state.
+	 */
+	private State state = State.Uninitialised;
+	
 	/* The logger for this class */
 	protected Logger logger = Logger.getLogger(HttpListener.class);
 
@@ -100,6 +105,14 @@
 
 	}
 
+    /**
+     * Get the listener lifecycle state.
+     * @return The state of the listener.
+     */
+    public State getState() {
+    	return state;
+    }
+
 	/*
 	 * Method being invoked when a request comes in.
 	 * 
@@ -191,6 +204,8 @@
 	 * Check for mandatory and optional attributes in parameter tree
 	 */
 	private void checkParams() throws ConfigurationException {
+		state = State.Loading_parameters;
+		
 		// listener url
 		this.listenHttpUrl = this._config.getAttribute(LISTEN_HTTP_URL);
 		if (this.listenHttpUrl == null) {
@@ -222,7 +237,7 @@
 	 *             when something goes wrong during remoting deamon startup
 	 */
 	private void initServer() throws ListenerInitializationException {
-
+		state = State.Running;
 		try {
 			InvokerLocator locator = new InvokerLocator(this.listenHttpUrl);
 			if (this.logger.isInfoEnabled()) {
@@ -241,13 +256,13 @@
 			if (this.logger.isInfoEnabled()) {
 				this.logger.info("HttpListener deamon started successfully!");
 			}
-		} catch (MalformedURLException e) {
-			// TODO Auto-generated catch block
-			e.printStackTrace();
-		} catch (Exception exc) {
-			throw new ListenerInitializationException(exc.getMessage(), exc);
+		} catch (Throwable thrown) {
+			state = State.Exception_thrown;
+			state.setThrowable(thrown);
+			throw new ListenerInitializationException(thrown.getMessage(), thrown);
 		}
 
+		state = State.Ready;
 	}
 
 }

Modified: labs/jbossesb/trunk/product/core/listeners/src/org/jboss/soa/esb/listeners/message/JmsQueueListener.java
===================================================================
--- labs/jbossesb/trunk/product/core/listeners/src/org/jboss/soa/esb/listeners/message/JmsQueueListener.java	2006-12-05 15:16:58 UTC (rev 8066)
+++ labs/jbossesb/trunk/product/core/listeners/src/org/jboss/soa/esb/listeners/message/JmsQueueListener.java	2006-12-05 15:17:11 UTC (rev 8067)
@@ -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.listeners.State;
 import org.jboss.soa.esb.services.registry.RegistryException;
 import org.jboss.soa.esb.util.Util;
 import org.xml.sax.SAXException;
@@ -61,6 +62,11 @@
 public class JmsQueueListener extends AbstractListener
 {
 	/**
+	 * Listener lifecycle state.
+	 */
+	private State state = State.Uninitialised;
+	
+	/**
 	 * public constructor
 	 * @param controller EsbListenerController - the controlling process
 	 * @param config ConfigTree - Containing 'static' configuration for this instance
@@ -75,6 +81,22 @@
     } // _______________________________
 
     /**
+     * Get the listener lifecycle state.
+     * @return The state of the listener.
+     */
+    public State getState() {
+    	return state;
+    }
+
+    /**
+     * Set the listener lifecycle state.
+     * @param state The new state of the listener.
+     */
+    protected void setState(State state) {
+    	this.state = state;
+    }
+    
+    /**
      * Loops until controlling process determines
      * <br/>Waits for JMS Object messages containing ESB messages
      * <br/>When one is received, instantiates an action processing pipeline to process it
@@ -82,6 +104,8 @@
      */
     public void run()
     {
+    	state = State.Running;
+    	
         _logger.debug("run() method of "+this.getClass().getSimpleName()
         		+" started on thread "+Thread.currentThread().getName());
     	 try { _controller.register(_config,_epr); }
@@ -90,6 +114,7 @@
      		_logger.fatal("Could not register service " + re.getLocalizedMessage(),re);
     	 }
 
+    	 state = State.Ready;
     	while (_controller.continueLooping())
         {
     		long lwait = _controller.millisToWait();
@@ -128,6 +153,8 @@
      */
     protected void checkMyParms() throws ConfigurationException 
     {
+    	state = State.Loading_parameters;
+    	
         // Default value of obtainAttribute is null - Exception will be thrown
         _queueName		= obtainAttribute(JMSEpr.DESTINATION_NAME_TAG, null);
 

Added: labs/jbossesb/trunk/product/core/listeners/tests/src/org/jboss/soa/esb/listeners/message/EsbListenerControllerTest.java
===================================================================
--- labs/jbossesb/trunk/product/core/listeners/tests/src/org/jboss/soa/esb/listeners/message/EsbListenerControllerTest.java	2006-12-05 15:16:58 UTC (rev 8066)
+++ labs/jbossesb/trunk/product/core/listeners/tests/src/org/jboss/soa/esb/listeners/message/EsbListenerControllerTest.java	2006-12-05 15:17:11 UTC (rev 8067)
@@ -0,0 +1,32 @@
+/*
+ * 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 JBoss Inc.
+ */
+
+package org.jboss.soa.esb.listeners.message;
+
+import junit.framework.TestCase;
+
+/**
+ * 
+ * @author <a href="mailto:tom.fennelly at jboss.com">tom.fennelly at jboss.com</a>
+ */
+public class EsbListenerControllerTest extends TestCase {
+
+}

Added: labs/jbossesb/trunk/product/core/listeners/tests/src/org/jboss/soa/esb/listeners/message/ListenerConfig_01.xml
===================================================================
--- labs/jbossesb/trunk/product/core/listeners/tests/src/org/jboss/soa/esb/listeners/message/ListenerConfig_01.xml	2006-12-05 15:16:58 UTC (rev 8066)
+++ labs/jbossesb/trunk/product/core/listeners/tests/src/org/jboss/soa/esb/listeners/message/ListenerConfig_01.xml	2006-12-05 15:17:11 UTC (rev 8067)
@@ -0,0 +1,28 @@
+<ListenerConfig>
+
+	<MockListener
+		service-category="Category"
+		service-name="Service1"
+		service-description="Blah"
+		listenerClass="org.jboss.soa.esb.listeners.message.MockListener"
+		wait="1000"
+	>
+	</MockListener>
+	<MockListener
+		service-category="Category"
+		service-name="Service1"
+		service-description="Blah"
+		listenerClass="org.jboss.soa.esb.listeners.message.MockListener"
+		wait="3000"
+	>
+	</MockListener>
+	<MockListener
+		service-category="Category"
+		service-name="Service1"
+		service-description="Blah"
+		listenerClass="org.jboss.soa.esb.listeners.message.MockListener"
+		wait="5000"
+	>
+	</MockListener>
+   
+</ContentBasedRouterTest>

Added: labs/jbossesb/trunk/product/core/listeners/tests/src/org/jboss/soa/esb/listeners/message/MockListener.java
===================================================================
--- labs/jbossesb/trunk/product/core/listeners/tests/src/org/jboss/soa/esb/listeners/message/MockListener.java	2006-12-05 15:16:58 UTC (rev 8066)
+++ labs/jbossesb/trunk/product/core/listeners/tests/src/org/jboss/soa/esb/listeners/message/MockListener.java	2006-12-05 15:17:11 UTC (rev 8067)
@@ -0,0 +1,74 @@
+/*
+ * 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 JBoss Inc.
+ */
+
+package org.jboss.soa.esb.listeners.message;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import junit.framework.TestCase;
+
+import org.jboss.soa.esb.helpers.ConfigTree;
+import org.jboss.soa.esb.helpers.KeyValuePair;
+import org.jboss.soa.esb.listeners.State;
+
+/**
+ * 
+ * @author <a href="mailto:tom.fennelly at jboss.com">tom.fennelly at jboss.com</a>
+ */
+public class MockListener extends AbstractListener {
+
+	private State state = State.Uninitialised;
+	private long wait;
+	public static List<MockListener> readListeners = new ArrayList<MockListener>();
+	
+	/**
+	 * @param controller
+	 * @param configTree
+	 */
+	protected MockListener(EsbListenerController controller, ConfigTree configTree) {
+		super(controller, configTree);
+		List<KeyValuePair> properties = configTree.attributesAsList();
+		wait = (long)KeyValuePair.getDoubleValue("wait", properties, 1000);
+	}
+
+	/* (non-Javadoc)
+	 * @see java.lang.Runnable#run()
+	 */
+	public void run() {
+		try {
+			Thread.sleep(wait);
+		} catch (InterruptedException e) {
+			TestCase.fail(e.getMessage());
+		}
+		
+		readListeners.add(this);
+		state = State.Ready;
+	}
+
+	/* (non-Javadoc)
+	 * @see org.jboss.soa.esb.listeners.Lifecycle#getState()
+	 */
+	public State getState() {
+		return state;
+	}
+
+}

Added: labs/jbossesb/trunk/product/core/services/tests/src/org/jboss/internal/soa/esb/services/registry/MockRegistry.java
===================================================================
--- labs/jbossesb/trunk/product/core/services/tests/src/org/jboss/internal/soa/esb/services/registry/MockRegistry.java	2006-12-05 15:16:58 UTC (rev 8066)
+++ labs/jbossesb/trunk/product/core/services/tests/src/org/jboss/internal/soa/esb/services/registry/MockRegistry.java	2006-12-05 15:17:11 UTC (rev 8067)
@@ -0,0 +1,110 @@
+/*
+ * 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 JBoss Inc.
+ */
+
+package org.jboss.internal.soa.esb.services.registry;
+
+import java.util.Collection;
+
+import org.jboss.soa.esb.addressing.EPR;
+import org.jboss.soa.esb.common.Environment;
+import org.jboss.soa.esb.common.ModulePropertyManager;
+import org.jboss.soa.esb.services.registry.Registry;
+import org.jboss.soa.esb.services.registry.RegistryException;
+
+/**
+ * Mock Registry implementation.
+ * <p/>
+ * Avoids the need to setup HSQLDB etc.
+ * @author <a href="mailto:tom.fennelly at jboss.com">tom.fennelly at jboss.com</a>
+ */
+public class MockRegistry implements Registry {
+
+	
+	
+	/**
+	 * Install this Mock Registry impl as the registry implementation to be used.
+	 */
+	public static void install() {
+		ModulePropertyManager.getPropertyManager(ModulePropertyManager.REGISTRY_MODULE).setProperty(Environment.REGISTRY_IMPEMENTATION_CLASS, MockRegistry.class.getName());
+	}
+	
+	/* (non-Javadoc)
+	 * @see org.jboss.soa.esb.services.registry.Registry#unRegisterService(java.lang.String, java.lang.String)
+	 */
+	public void unRegisterService(String category, String serviceName)
+			throws RegistryException {
+
+	}
+
+	/* (non-Javadoc)
+	 * @see org.jboss.soa.esb.services.registry.Registry#registerEPR(java.lang.String, java.lang.String, java.lang.String, org.jboss.soa.esb.addressing.EPR, java.lang.String)
+	 */
+	public void registerEPR(String serviceCategoryName, String serviceName,
+			String serviceDescription, EPR epr, String eprDescription)
+			throws RegistryException {
+	}
+
+	/* (non-Javadoc)
+	 * @see org.jboss.soa.esb.services.registry.Registry#unRegisterEPR(java.lang.String, java.lang.String, org.jboss.soa.esb.addressing.EPR)
+	 */
+	public void unRegisterEPR(String serviceCategoryName, String serviceName,
+			EPR epr) throws RegistryException {
+	}
+
+	/* (non-Javadoc)
+	 * @see org.jboss.soa.esb.services.registry.Registry#findAllServices()
+	 */
+	public Collection<String> findAllServices() throws RegistryException {
+		return null;
+	}
+
+	/* (non-Javadoc)
+	 * @see org.jboss.soa.esb.services.registry.Registry#findServices(java.lang.String)
+	 */
+	public Collection<String> findServices(String serviceCategoryName)
+			throws RegistryException {
+		return null;
+	}
+
+	/* (non-Javadoc)
+	 * @see org.jboss.soa.esb.services.registry.Registry#findEPRs(java.lang.String, java.lang.String)
+	 */
+	public Collection<EPR> findEPRs(String serviceCategoryName,
+			String serviceName) throws RegistryException {
+		return null;
+	}
+
+	/* (non-Javadoc)
+	 * @see org.jboss.soa.esb.services.registry.Registry#findEPR(java.lang.String, java.lang.String)
+	 */
+	public EPR findEPR(String serviceCategoryName, String serviceName)
+			throws RegistryException {
+		return null;
+	}
+	
+	private class RepositoryEntry {
+		private String serviceCategoryName;
+		private String serviceName;
+		private String serviceDescription;
+		private EPR epr;
+		private String eprDescription;
+	}
+}

Modified: labs/jbossesb/trunk/product/samples/trailblazer2/esb/src/org/jboss/soa/esb/samples/trailblazer/util/Launcher.java
===================================================================
--- labs/jbossesb/trunk/product/samples/trailblazer2/esb/src/org/jboss/soa/esb/samples/trailblazer/util/Launcher.java	2006-12-05 15:16:58 UTC (rev 8066)
+++ labs/jbossesb/trunk/product/samples/trailblazer2/esb/src/org/jboss/soa/esb/samples/trailblazer/util/Launcher.java	2006-12-05 15:17:11 UTC (rev 8067)
@@ -72,7 +72,6 @@
     		}
     		
     		if (null != gatewayConfigFile) {
-    			Thread.sleep(5000);
     			_logger.info("starting gateway listener with config file - " + gatewayConfigFile);
     			_gatewayController = new GatewayListenerController(gatewayConfigFile);
     			new Thread(_gatewayController).start();

Modified: labs/jbossesb/trunk/qa/junit/src/org/jboss/soa/esb/util/NewListenerUtils.java
===================================================================
--- labs/jbossesb/trunk/qa/junit/src/org/jboss/soa/esb/util/NewListenerUtils.java	2006-12-05 15:16:58 UTC (rev 8066)
+++ labs/jbossesb/trunk/qa/junit/src/org/jboss/soa/esb/util/NewListenerUtils.java	2006-12-05 15:17:11 UTC (rev 8067)
@@ -54,22 +54,15 @@
 	 * @return Thread of execution for this Listener configs.
 	 */
 	public static ListenersManagerTestWrapper startListeners(String paramName) throws Exception {
-		ListenersManagerTestWrapper manager;
+		EsbListenerController controller;
 		
-		manager = new ListenersManagerTestWrapper(createEsbListenerController(paramName));
+		controller = createEsbListenerController(paramName);
 		
-		logger.info("Waiting on Listener Manager the start...");
-		while(manager.listenersManager.getState() != State.Running) {
-			Thread.sleep(50);
-			if(manager.listenersManager.getState() == State.Exception_thrown) {
-				Exception e = manager.listenersManager.getState().getException();
-				logger.error("Failed to start the Listener Manager!", e);
-				TestCase.fail(e.getMessage());
-			}
-		}
-		logger.info("Listener Manager running (Thread: " + manager + ")!  Note this does not mean all the Listeners are up and running!");
+		logger.info("Waiting on Listener Controller the start...");
+		State.waitUntilReady(controller);
+		logger.info("Listener Controller running and ready to receive messages!");
 		
-		return manager;
+		return new ListenersManagerTestWrapper(controller);
 	}
 
 	/**
@@ -153,7 +146,7 @@
 		public void assertNotInException() {
 			if(listenersManager.getState() == State.Exception_thrown) {
 				String errorMsg = "ListenerManager in Exception state.  See log.  Listener Manager Thread: " + listenersManager;
-				logger.error(errorMsg, listenersManager.getState().getException());
+				logger.error(errorMsg, listenersManager.getState().getThrowable());
 				TestCase.fail(errorMsg);
 			}
 		}




More information about the jboss-svn-commits mailing list