[jboss-svn-commits] JBL Code SVN: r23266 - in labs/jbossesb/branches/JBESB_4_4_GA_CP/product/rosetta: tests/src/org/jboss/soa/esb/listeners/config and 1 other directory.

jboss-svn-commits at lists.jboss.org jboss-svn-commits at lists.jboss.org
Thu Oct 2 09:55:16 EDT 2008


Author: kevin.conner at jboss.com
Date: 2008-10-02 09:55:16 -0400 (Thu, 02 Oct 2008)
New Revision: 23266

Added:
   labs/jbossesb/branches/JBESB_4_4_GA_CP/product/rosetta/tests/src/org/jboss/soa/esb/listeners/config/JBESB_1993_UnitTest.java
   labs/jbossesb/branches/JBESB_4_4_GA_CP/product/rosetta/tests/src/org/jboss/soa/esb/listeners/config/JBESB_1993_action.xml
   labs/jbossesb/branches/JBESB_4_4_GA_CP/product/rosetta/tests/src/org/jboss/soa/esb/listeners/config/JBESB_1993_service.xml
Modified:
   labs/jbossesb/branches/JBESB_4_4_GA_CP/product/rosetta/src/org/jboss/soa/esb/listeners/config/mappers/ActionMapper.java
Log:
Fix duplicate action name failures: JBESB-1993

Modified: labs/jbossesb/branches/JBESB_4_4_GA_CP/product/rosetta/src/org/jboss/soa/esb/listeners/config/mappers/ActionMapper.java
===================================================================
--- labs/jbossesb/branches/JBESB_4_4_GA_CP/product/rosetta/src/org/jboss/soa/esb/listeners/config/mappers/ActionMapper.java	2008-10-02 12:28:00 UTC (rev 23265)
+++ labs/jbossesb/branches/JBESB_4_4_GA_CP/product/rosetta/src/org/jboss/soa/esb/listeners/config/mappers/ActionMapper.java	2008-10-02 13:55:16 UTC (rev 23266)
@@ -93,20 +93,16 @@
 		        SecurityMapper.map(listenerConfigTree, listenerService);
 			List<Action> actionList = actions.getActionList();
 			
-			try {
-				HashMap<String,String> hm = new HashMap<String,String>();
-				for(Action action : actionList) {
-					mapAction(listenerConfigTree, action);
-					if (hm.containsKey(action.getName())) {
-						throw new ConfigurationException("Tried to register a duplicate action name.  Service " 
-								+ listenerService.getName() + " already contains an action named "
-								+ action.getName() + ".    Action names must be unique per service.");
-					} else {
-						hm.put(action.getName(), action.getName());
-					}
+			HashMap<String,String> hm = new HashMap<String,String>();
+			for(Action action : actionList) {
+				mapAction(listenerConfigTree, action);
+				if (hm.containsKey(action.getName())) {
+					throw new ConfigurationException("Tried to register a duplicate action name.  Service " 
+							+ listenerService.getName() + " already contains an action named "
+							+ action.getName() + ".    Action names must be unique per service.");
+				} else {
+					hm.put(action.getName(), action.getName());
 				}
-			} catch (ConfigurationException ce) {
-				logger.error("", ce);
 			}
 		}
 	}

Added: labs/jbossesb/branches/JBESB_4_4_GA_CP/product/rosetta/tests/src/org/jboss/soa/esb/listeners/config/JBESB_1993_UnitTest.java
===================================================================
--- labs/jbossesb/branches/JBESB_4_4_GA_CP/product/rosetta/tests/src/org/jboss/soa/esb/listeners/config/JBESB_1993_UnitTest.java	                        (rev 0)
+++ labs/jbossesb/branches/JBESB_4_4_GA_CP/product/rosetta/tests/src/org/jboss/soa/esb/listeners/config/JBESB_1993_UnitTest.java	2008-10-02 13:55:16 UTC (rev 23266)
@@ -0,0 +1,67 @@
+/*
+ * 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 java.io.ByteArrayOutputStream;
+import java.io.InputStream;
+
+import org.jboss.soa.esb.ConfigurationException;
+
+import junit.framework.TestCase;
+
+/**
+ * Test for bug http://jira.jboss.com/jira/browse/JBESB-1993.
+ * 
+ * @author <a href="mailto:Kevin.Conner at jboss.com">Kevin Conner</a>
+ */
+public class JBESB_1993_UnitTest extends TestCase
+{
+    public void testActionNames()
+        throws Exception
+    {
+        runTest("JBESB_1993_action.xml", "Tried to register a duplicate action name.") ;
+    }
+    
+    public void testServiceNames()
+        throws Exception
+    {
+        runTest("JBESB_1993_service.xml", "Service names must be unique within a category.") ;
+    }
+    
+    private void runTest(final String resource, final String expected)
+        throws Exception
+    {
+        final InputStream resourceIs = getClass().getResourceAsStream(resource) ;
+        final ByteArrayOutputStream listenerBAOS = new ByteArrayOutputStream() ;
+        final ByteArrayOutputStream gatewayBAOS = new ByteArrayOutputStream() ;
+        final Generator generator = new Generator(resourceIs, listenerBAOS, gatewayBAOS) ;
+        try
+        {
+            generator.generate();
+        }
+        catch (final ConfigurationException ce)
+        {
+            if (!ce.getMessage().startsWith(expected))
+            {
+                throw ce ;
+            }
+        }
+    }
+}


Property changes on: labs/jbossesb/branches/JBESB_4_4_GA_CP/product/rosetta/tests/src/org/jboss/soa/esb/listeners/config/JBESB_1993_UnitTest.java
___________________________________________________________________
Name: svn:keywords
   + Rev Date
Name: svn:eol-style
   + native

Added: labs/jbossesb/branches/JBESB_4_4_GA_CP/product/rosetta/tests/src/org/jboss/soa/esb/listeners/config/JBESB_1993_action.xml
===================================================================
--- labs/jbossesb/branches/JBESB_4_4_GA_CP/product/rosetta/tests/src/org/jboss/soa/esb/listeners/config/JBESB_1993_action.xml	                        (rev 0)
+++ labs/jbossesb/branches/JBESB_4_4_GA_CP/product/rosetta/tests/src/org/jboss/soa/esb/listeners/config/JBESB_1993_action.xml	2008-10-02 13:55:16 UTC (rev 23266)
@@ -0,0 +1,22 @@
+<?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>
+        <jms-provider name="jms" connection-factory="ConnectionFactory">
+            <jms-bus busid="testBus">
+                <jms-message-filter dest-type="QUEUE" dest-name="XXX"/>
+            </jms-bus>
+        </jms-provider>
+    </providers>
+    
+    <services>
+        <service category="TestESB" name="TestService" description="Test Service">
+            <listeners>
+                <jms-listener name="testListener" busidref="testBus"/>
+            </listeners>
+            <actions>
+                <action name="testAction" class="org.jboss.soa.esb.actions.SystemPrintln"/>
+                <action name="testAction" class="org.jboss.soa.esb.actions.SystemPrintln"/>
+            </actions>
+        </service>
+      </services>
+</jbossesb>


Property changes on: labs/jbossesb/branches/JBESB_4_4_GA_CP/product/rosetta/tests/src/org/jboss/soa/esb/listeners/config/JBESB_1993_action.xml
___________________________________________________________________
Name: svn:mime-type
   + text/xml
Name: svn:keywords
   + Rev Date
Name: svn:eol-style
   + native

Added: labs/jbossesb/branches/JBESB_4_4_GA_CP/product/rosetta/tests/src/org/jboss/soa/esb/listeners/config/JBESB_1993_service.xml
===================================================================
--- labs/jbossesb/branches/JBESB_4_4_GA_CP/product/rosetta/tests/src/org/jboss/soa/esb/listeners/config/JBESB_1993_service.xml	                        (rev 0)
+++ labs/jbossesb/branches/JBESB_4_4_GA_CP/product/rosetta/tests/src/org/jboss/soa/esb/listeners/config/JBESB_1993_service.xml	2008-10-02 13:55:16 UTC (rev 23266)
@@ -0,0 +1,29 @@
+<?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>
+        <jms-provider name="jms" connection-factory="ConnectionFactory">
+            <jms-bus busid="testBus">
+                <jms-message-filter dest-type="QUEUE" dest-name="XXX"/>
+            </jms-bus>
+        </jms-provider>
+    </providers>
+    
+    <services>
+        <service category="TestESB" name="TestService" description="Test Service">
+            <listeners>
+                <jms-listener name="testListener" busidref="testBus"/>
+            </listeners>
+            <actions>
+                <action name="testAction" class="org.jboss.soa.esb.actions.SystemPrintln"/>
+            </actions>
+        </service>
+        <service category="TestESB" name="TestService" description="Test Service">
+            <listeners>
+                <jms-listener name="testListener" busidref="testBus"/>
+            </listeners>
+            <actions>
+                <action name="testAction" class="org.jboss.soa.esb.actions.SystemPrintln"/>
+            </actions>
+        </service>
+      </services>
+</jbossesb>


Property changes on: labs/jbossesb/branches/JBESB_4_4_GA_CP/product/rosetta/tests/src/org/jboss/soa/esb/listeners/config/JBESB_1993_service.xml
___________________________________________________________________
Name: svn:mime-type
   + text/xml
Name: svn:keywords
   + Rev Date
Name: svn:eol-style
   + native




More information about the jboss-svn-commits mailing list