[jboss-svn-commits] JBL Code SVN: r12891 - in labs/jbossesb/trunk/product/rosetta: tests/src/org/jboss/soa/esb/listeners/config and 1 other directories.

jboss-svn-commits at lists.jboss.org jboss-svn-commits at lists.jboss.org
Wed Jun 27 07:33:14 EDT 2007


Author: tfennelly
Date: 2007-06-27 07:33:14 -0400 (Wed, 27 Jun 2007)
New Revision: 12891

Added:
   labs/jbossesb/trunk/product/rosetta/tests/src/org/jboss/soa/esb/listeners/config/JBESB_648.xml
   labs/jbossesb/trunk/product/rosetta/tests/src/org/jboss/soa/esb/listeners/config/JBESB_648_UnitTest.java
Modified:
   labs/jbossesb/trunk/product/rosetta/src/org/jboss/soa/esb/listeners/config/Generator.java
   labs/jbossesb/trunk/product/rosetta/tests/src/org/jboss/soa/esb/listeners/config/jbossesb_config_04.xml
   labs/jbossesb/trunk/product/rosetta/tests/src/org/jboss/soa/esb/listeners/config/jbossesb_config_05.xml
   labs/jbossesb/trunk/product/rosetta/tests/src/org/jboss/soa/esb/listeners/config/mappers/jbossesb_config_01.xml
   labs/jbossesb/trunk/product/rosetta/tests/src/org/jboss/soa/esb/listeners/config/mappers/jbossesb_config_readonly.xml
Log:
Resolution for JBESB_648.

Modified: labs/jbossesb/trunk/product/rosetta/src/org/jboss/soa/esb/listeners/config/Generator.java
===================================================================
--- labs/jbossesb/trunk/product/rosetta/src/org/jboss/soa/esb/listeners/config/Generator.java	2007-06-27 11:17:54 UTC (rev 12890)
+++ labs/jbossesb/trunk/product/rosetta/src/org/jboss/soa/esb/listeners/config/Generator.java	2007-06-27 11:33:14 UTC (rev 12891)
@@ -200,16 +200,18 @@
         /**
 		 * Get the list of ESB Gateway Listeners from the configuration.
 		 * @return The list of ESB Gateway Listeners from the configuration.
+         * @throws ConfigurationException Bad configuration.
 		 */
-		public List<Listener> getGatewayListeners() {
+		public List<Listener> getGatewayListeners() throws ConfigurationException {
 			return getListeners(true);
 		}
 
 		/**
 		 * Get the list of ESB Aware Listeners from the configuration.
 		 * @return The list of ESB Aware Listeners from the configuration.
+         * @throws ConfigurationException Bad configuration.
 		 */
-		public List<Listener> getESBAwareListeners() {
+		public List<Listener> getESBAwareListeners() throws ConfigurationException {
 			return getListeners(false);
 		}
 
@@ -296,19 +298,29 @@
 		 * Get the list of ESB Listeners based on their Gateway flag.
 		 * @return The list of ESB Aware or Gateway Listeners from the configuration.
          * @param isGateway Is the listener a gateway or ESB aware listener.
+         * @throws ConfigurationException Bad configuration.
 		 */
-		private List<Listener> getListeners(boolean isGateway) {
+		private List<Listener> getListeners(boolean isGateway) throws ConfigurationException {
 			List<Listener> gateways = new ArrayList<Listener>();
 			if (jbossesb.getServices() != null) {
                 List<Service> services = getServices();
 
                 for(Service service : services) {
+                    boolean listenerAdded = false;
+
 					for(Listener listener : service.getListeners().getListenerList()) {
 						if(isGateway(listener) == isGateway) {
 							gateways.add(listener);
-						}
+                            listenerAdded = true;
+                        }
 					}
-				}
+
+                    // Make sure each Service config has a message aware listener...
+                    // http://jira.jboss.com/jira/browse/JBESB-648
+                    if(!isGateway && !listenerAdded) {
+                        throw new ConfigurationException("Service configuration for Service '" + service.getCategory() + ":" + service.getName() + "' doesn't define a Message-Aware Listener (i.e. is-gateway='false').");
+                    }
+                }
 			}
 			
 			return gateways;

Added: labs/jbossesb/trunk/product/rosetta/tests/src/org/jboss/soa/esb/listeners/config/JBESB_648.xml
===================================================================
--- labs/jbossesb/trunk/product/rosetta/tests/src/org/jboss/soa/esb/listeners/config/JBESB_648.xml	                        (rev 0)
+++ labs/jbossesb/trunk/product/rosetta/tests/src/org/jboss/soa/esb/listeners/config/JBESB_648.xml	2007-06-27 11:33:14 UTC (rev 12891)
@@ -0,0 +1,28 @@
+<?xml version = "1.0" encoding = "UTF-8"?>
+<jbossesb xmlns="http://anonsvn.labs.jboss.com/labs/jbossesb/trunk/product/etc/schemas/xml/jbossesb-1.0.1.xsd">
+
+	<providers>
+
+        <jbr-provider name="JBR" host="192.168.1.111" protocol="http">
+            <jbr-bus busid="HTTP-1" port="8765" />
+        </jbr-provider>
+
+	</providers>
+	<services>
+
+        <service category="C" name="3" description="A1">
+			<listeners>
+                <jbr-listener name="A1-HTTP"
+                    busidref="HTTP-1"
+                    maxThreads="1"
+                    is-gateway="true"/>
+			</listeners>
+			  
+			<actions>    	    
+				<action name="a1" class="org.jboss.soa.esb.actions.converters.ByteArrayToString" />
+			</actions>
+		</service>
+
+    </services>
+	
+</jbossesb>
\ No newline at end of file


Property changes on: labs/jbossesb/trunk/product/rosetta/tests/src/org/jboss/soa/esb/listeners/config/JBESB_648.xml
___________________________________________________________________
Name: svn:mime-type
   + text/xml
Name: svn:eol-style
   + native

Added: labs/jbossesb/trunk/product/rosetta/tests/src/org/jboss/soa/esb/listeners/config/JBESB_648_UnitTest.java
===================================================================
--- labs/jbossesb/trunk/product/rosetta/tests/src/org/jboss/soa/esb/listeners/config/JBESB_648_UnitTest.java	                        (rev 0)
+++ labs/jbossesb/trunk/product/rosetta/tests/src/org/jboss/soa/esb/listeners/config/JBESB_648_UnitTest.java	2007-06-27 11:33:14 UTC (rev 12891)
@@ -0,0 +1,44 @@
+/*
+ * 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, JBoss Inc.
+ */
+package org.jboss.soa.esb.listeners.config;
+
+import junit.framework.TestCase;
+import org.jboss.soa.esb.ConfigurationException;
+
+import java.io.IOException;
+
+/**
+ * Test for bug http://jira.jboss.com/jira/browse/JBESB-648.
+ * 
+ * @author <a href="mailto:tom.fennelly at jboss.com">tom.fennelly at jboss.com</a>
+ */
+public class JBESB_648_UnitTest extends TestCase {
+
+    public void test() throws ConfigurationException, IOException {
+        Generator generator = new Generator(getClass().getResourceAsStream("JBESB_648_UnitTest.xml"));
+
+        try {
+            generator.generate();
+            fail("Failed to throw ConfigurationException.");
+        } catch(ConfigurationException e) {
+            assertEquals("Service configuration for Service 'C:3' doesn't define a Message-Aware Listener (i.e. is-gateway='false').", e.getMessage());
+        }
+    }
+}


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

Modified: labs/jbossesb/trunk/product/rosetta/tests/src/org/jboss/soa/esb/listeners/config/jbossesb_config_04.xml
===================================================================
--- labs/jbossesb/trunk/product/rosetta/tests/src/org/jboss/soa/esb/listeners/config/jbossesb_config_04.xml	2007-06-27 11:17:54 UTC (rev 12890)
+++ labs/jbossesb/trunk/product/rosetta/tests/src/org/jboss/soa/esb/listeners/config/jbossesb_config_04.xml	2007-06-27 11:33:14 UTC (rev 12891)
@@ -5,6 +5,7 @@
 
         <jbr-provider name="JBR" host="192.168.1.111" protocol="http">
             <jbr-bus busid="HTTP-1" port="8765" />
+            <jbr-bus busid="HTTP-2" port="8766" />
         </jbr-provider>
 
 	</providers>
@@ -16,8 +17,11 @@
                     busidref="HTTP-1"
                     maxThreads="1"
                     is-gateway="true"/>
-			</listeners>
-			  
+                <jbr-listener name="A2-HTTP"
+                    busidref="HTTP-2"
+                    maxThreads="1" />
+            </listeners>
+
 			<actions>    	    
 				<action name="a1" class="org.jboss.soa.esb.actions.converters.ByteArrayToString" />
 			</actions>
@@ -28,6 +32,9 @@
                     busidref="HTTP-1"
                     maxThreads="1"
                     is-gateway="true"/>
+                <jbr-listener name="A2-HTTP"
+                    busidref="HTTP-2"
+                    maxThreads="1" />
 			</listeners>
 
 			<actions>

Modified: labs/jbossesb/trunk/product/rosetta/tests/src/org/jboss/soa/esb/listeners/config/jbossesb_config_05.xml
===================================================================
--- labs/jbossesb/trunk/product/rosetta/tests/src/org/jboss/soa/esb/listeners/config/jbossesb_config_05.xml	2007-06-27 11:17:54 UTC (rev 12890)
+++ labs/jbossesb/trunk/product/rosetta/tests/src/org/jboss/soa/esb/listeners/config/jbossesb_config_05.xml	2007-06-27 11:33:14 UTC (rev 12891)
@@ -5,6 +5,7 @@
 
         <jbr-provider name="JBR" host="192.168.1.111" protocol="http">
             <jbr-bus busid="HTTP-1" port="8765" />
+            <jbr-bus busid="HTTP-2" port="8766" />
         </jbr-provider>
 
 	</providers>
@@ -16,6 +17,9 @@
                     busidref="HTTP-1"
                     maxThreads="1"
                     is-gateway="true"/>
+                <jbr-listener name="A2-HTTP"
+                    busidref="HTTP-2"
+                    maxThreads="1" />
 			</listeners>
 			  
 			<actions>    	    
@@ -28,6 +32,9 @@
                     busidref="HTTP-1"
                     maxThreads="1"
                     is-gateway="true"/>
+                <jbr-listener name="A2-HTTP"
+                    busidref="HTTP-2"
+                    maxThreads="1" />
 			</listeners>
 
 			<actions>

Modified: labs/jbossesb/trunk/product/rosetta/tests/src/org/jboss/soa/esb/listeners/config/mappers/jbossesb_config_01.xml
===================================================================
--- labs/jbossesb/trunk/product/rosetta/tests/src/org/jboss/soa/esb/listeners/config/mappers/jbossesb_config_01.xml	2007-06-27 11:17:54 UTC (rev 12890)
+++ labs/jbossesb/trunk/product/rosetta/tests/src/org/jboss/soa/esb/listeners/config/mappers/jbossesb_config_01.xml	2007-06-27 11:33:14 UTC (rev 12891)
@@ -8,8 +8,12 @@
 				<ftp-message-filter directory="/Temp" read-only="true" input-suffix=".txt" username="joe" password="secret"/>
 			</ftp-bus>
 		</ftp-provider>
-		
-	</providers>
+
+        <jbr-provider name="JBR" host="192.168.1.111" protocol="http">
+            <jbr-bus busid="HTTP-2" port="8766" />
+        </jbr-provider>
+
+    </providers>
 	<services>    
 		<service category="Test2" name="FTPTest" description="FTP server Test">
 			
@@ -18,6 +22,9 @@
 							busidref="FtpMapperTest"
 							is-gateway="true"
 							maxThreads="1"/>
+                <jbr-listener name="A2-HTTP"
+                    busidref="HTTP-2"
+                    maxThreads="1" />
 			</listeners>
 		</service>
 	</services>

Modified: labs/jbossesb/trunk/product/rosetta/tests/src/org/jboss/soa/esb/listeners/config/mappers/jbossesb_config_readonly.xml
===================================================================
--- labs/jbossesb/trunk/product/rosetta/tests/src/org/jboss/soa/esb/listeners/config/mappers/jbossesb_config_readonly.xml	2007-06-27 11:17:54 UTC (rev 12890)
+++ labs/jbossesb/trunk/product/rosetta/tests/src/org/jboss/soa/esb/listeners/config/mappers/jbossesb_config_readonly.xml	2007-06-27 11:33:14 UTC (rev 12891)
@@ -8,6 +8,10 @@
 				<ftp-message-filter directory="/Temp" read-only="true" input-suffix=".txt" username="joe" password="secret"/>
 			</ftp-bus>
 		</ftp-provider>
+
+        <jbr-provider name="JBR" host="192.168.1.111" protocol="http">
+            <jbr-bus busid="HTTP-2" port="8766" />
+        </jbr-provider>
 		
 	</providers>
 	<services>    
@@ -18,6 +22,9 @@
 							busidref="FtpMapperTest"
 							is-gateway="true"
 							maxThreads="1"/>
+                <jbr-listener name="A2-HTTP"
+                    busidref="HTTP-2"
+                    maxThreads="1" />
 			</listeners>
 		</service>
 	</services>




More information about the jboss-svn-commits mailing list