[jboss-svn-commits] JBL Code SVN: r7371 - in labs/jbossesb/trunk: product/core/services/src/org/jboss/soa/esb/services/registry qa/junit/src/org/jboss/soa/esb/listeners/message

jboss-svn-commits at lists.jboss.org jboss-svn-commits at lists.jboss.org
Fri Nov 3 12:20:13 EST 2006


Author: kurt.stam at jboss.com
Date: 2006-11-03 12:20:11 -0500 (Fri, 03 Nov 2006)
New Revision: 7371

Modified:
   labs/jbossesb/trunk/product/core/services/src/org/jboss/soa/esb/services/registry/Registry.java
   labs/jbossesb/trunk/qa/junit/src/org/jboss/soa/esb/listeners/message/CbrJmsQueueListenerTest.java
Log:
Integration this test.

Modified: labs/jbossesb/trunk/product/core/services/src/org/jboss/soa/esb/services/registry/Registry.java
===================================================================
--- labs/jbossesb/trunk/product/core/services/src/org/jboss/soa/esb/services/registry/Registry.java	2006-11-03 16:51:09 UTC (rev 7370)
+++ labs/jbossesb/trunk/product/core/services/src/org/jboss/soa/esb/services/registry/Registry.java	2006-11-03 17:20:11 UTC (rev 7371)
@@ -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/trunk/qa/junit/src/org/jboss/soa/esb/listeners/message/CbrJmsQueueListenerTest.java
===================================================================
--- labs/jbossesb/trunk/qa/junit/src/org/jboss/soa/esb/listeners/message/CbrJmsQueueListenerTest.java	2006-11-03 16:51:09 UTC (rev 7370)
+++ labs/jbossesb/trunk/qa/junit/src/org/jboss/soa/esb/listeners/message/CbrJmsQueueListenerTest.java	2006-11-03 17:20:11 UTC (rev 7371)
@@ -27,6 +27,8 @@
 import java.io.InputStream;
 import java.sql.DriverManager;
 import java.sql.Statement;
+import java.util.Collection;
+import java.util.Iterator;
 import java.util.Properties;
 
 import junit.framework.JUnit4TestAdapter;
@@ -40,6 +42,9 @@
 import org.jboss.soa.esb.listeners.message.EsbListenerController;
 import org.jboss.soa.esb.message.Message;
 import org.jboss.soa.esb.message.format.MessageFactory;
+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.services.util.FileUtil;
 import org.jboss.soa.esb.util.TestUtil;
 import org.junit.AfterClass;
@@ -55,13 +60,14 @@
 {
 	private Logger logger = Logger.getLogger(this.getClass());
 	private static EsbListenerController _proc = null;
-	private static EPR _epr = null;
 	
+	
 	private static String mDbDriver;
 	private static String mDbUrl;
 	private static String mDbUsername;
 	private static String mDbPassword;
 	
+	private static final String SERVICE_CATEGORY_NAME = "MessageRouting";
 	private static final String SERVICE_NAME = "ContentBasedRouterService";
 	
 	/**
@@ -77,11 +83,11 @@
 			_proc = new EsbListenerController(deploymentConfigFile);
 			new Thread(_proc).start();
 			// give the listener time to register
-			Thread.sleep(2000);
-//			sendOneMessage();
+			Thread.sleep(4000);
+			sendOneMessage();
 			_proc.requestEnd();
 //			//give the action class time to finish
-			Thread.sleep(2000);
+			Thread.sleep(4000);
 //	
 			EsbListenerController.State oS = _proc.getState();
 			System.out.println("Exit state = "+oS.toString());
@@ -91,19 +97,22 @@
 		}
 	}
 	
-	@SuppressWarnings("unused")
 	private static void sendOneMessage() throws Exception{		
 		Message msg = MessageFactory.getInstance().getMessage();
 		msg.getBody().setContents("Routing Test Body".getBytes());		
 		try {
-			_epr = EsbListenerController.getEprManager().loadEPR(SERVICE_NAME); //TODO: replace with a real registry lookup
-		}catch(Exception e) {
+			Registry registry = RegistryFactory.getRegistry();
+			Collection<EPR> eprs = registry.findEPRs(SERVICE_CATEGORY_NAME, SERVICE_NAME);
+			for (Iterator<EPR> eprIterator=eprs.iterator();eprIterator.hasNext();){
+				EPR epr = eprIterator.next();
+				Courier courier = CourierFactory.getCourier(epr);
+				courier.deliver(msg);
+				break;
+			}
+		}catch(RegistryException e) {
 			System.out.println("nobody servicing service " + SERVICE_NAME);
 			return;
 		}
-		Courier courier = CourierFactory.getCourier(_epr);
-		courier.deliver(msg);
-		
 	}
 
 	public static junit.framework.Test suite() {




More information about the jboss-svn-commits mailing list