[jboss-svn-commits] JBL Code SVN: r23719 - in labs/jbossesb/branches/JBESB_4_2_1_GA_CP/product/rosetta: src/org/jboss/soa/esb/listeners/config/mappers and 1 other directories.
jboss-svn-commits at lists.jboss.org
jboss-svn-commits at lists.jboss.org
Wed Nov 5 11:28:54 EST 2008
Author: tfennelly
Date: 2008-11-05 11:28:54 -0500 (Wed, 05 Nov 2008)
New Revision: 23719
Added:
labs/jbossesb/branches/JBESB_4_2_1_GA_CP/product/rosetta/tests/src/org/jboss/soa/esb/listeners/config/JBESB_1993_UnitTest.java
labs/jbossesb/branches/JBESB_4_2_1_GA_CP/product/rosetta/tests/src/org/jboss/soa/esb/listeners/config/JBESB_1993_action.xml
labs/jbossesb/branches/JBESB_4_2_1_GA_CP/product/rosetta/tests/src/org/jboss/soa/esb/listeners/config/JBESB_1993_service.xml
Modified:
labs/jbossesb/branches/JBESB_4_2_1_GA_CP/product/rosetta/src/org/jboss/soa/esb/listeners/config/GatewayGenerator.java
labs/jbossesb/branches/JBESB_4_2_1_GA_CP/product/rosetta/src/org/jboss/soa/esb/listeners/config/mappers/ActionMapper.java
Log:
Merged https://jira.jboss.org/jira/browse/JBESB-1993 from branches/JBESB_4_4_GA_CP
Modified: labs/jbossesb/branches/JBESB_4_2_1_GA_CP/product/rosetta/src/org/jboss/soa/esb/listeners/config/GatewayGenerator.java
===================================================================
--- labs/jbossesb/branches/JBESB_4_2_1_GA_CP/product/rosetta/src/org/jboss/soa/esb/listeners/config/GatewayGenerator.java 2008-11-05 16:04:13 UTC (rev 23718)
+++ labs/jbossesb/branches/JBESB_4_2_1_GA_CP/product/rosetta/src/org/jboss/soa/esb/listeners/config/GatewayGenerator.java 2008-11-05 16:28:54 UTC (rev 23719)
@@ -57,7 +57,6 @@
/**
* XMLBeans based configuration model instance.
*/
- @SuppressWarnings("unused")
private XMLBeansModel model;
/**
@@ -83,28 +82,24 @@
root = YADOMUtil.addElement(doc, "jbossesb-gateways");
root.setAttribute("parameterReloadSecs", model.getParameterReloadSecs());
- try {
- List<Service> services = model.getServices();
- HashMap<String, HashMap> hm = new HashMap<String, HashMap>();
- for (Service service : services) {
- if (hm.containsKey(service.getCategory())) {
- HashMap<String, String> hc = hm.get(service.getCategory());
-
- if (hc.containsKey(service.getName())) {
- throw new ConfigurationException("Service names must be unique within a category. "
- + "The service name " + service.getName()
- + " is already defined within the " + service.getCategory() + " category.");
- } else {
- hc.put(service.getName(), service.getName());
- }
- } else {
- HashMap <String,String> hc = new HashMap<String,String>();
- hc.put(service.getName(), service.getName());
- hm.put(service.getCategory(), hc);
- }
- }
- } catch (ConfigurationException ce) {
- logger.error("", ce);
+ List<Service> services = model.getServices();
+ HashMap<String, HashMap<String, String>> hm = new HashMap<String, HashMap<String, String>>();
+ for (Service service : services) {
+ if (hm.containsKey(service.getCategory())) {
+ HashMap<String, String> hc = hm.get(service.getCategory());
+
+ if (hc.containsKey(service.getName())) {
+ throw new ConfigurationException("Service names must be unique within a category. "
+ + "The service name " + service.getName()
+ + " is already defined within the " + service.getCategory() + " category.");
+ } else {
+ hc.put(service.getName(), service.getName());
+ }
+ } else {
+ HashMap <String,String> hc = new HashMap<String,String>();
+ hc.put(service.getName(), service.getName());
+ hm.put(service.getCategory(), hc);
+ }
}
// Iterate over all the gateway configs and map them to the gateway configuration...
Modified: labs/jbossesb/branches/JBESB_4_2_1_GA_CP/product/rosetta/src/org/jboss/soa/esb/listeners/config/mappers/ActionMapper.java
===================================================================
--- labs/jbossesb/branches/JBESB_4_2_1_GA_CP/product/rosetta/src/org/jboss/soa/esb/listeners/config/mappers/ActionMapper.java 2008-11-05 16:04:13 UTC (rev 23718)
+++ labs/jbossesb/branches/JBESB_4_2_1_GA_CP/product/rosetta/src/org/jboss/soa/esb/listeners/config/mappers/ActionMapper.java 2008-11-05 16:28:54 UTC (rev 23719)
@@ -63,20 +63,16 @@
}
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);
}
}
}
Copied: labs/jbossesb/branches/JBESB_4_2_1_GA_CP/product/rosetta/tests/src/org/jboss/soa/esb/listeners/config/JBESB_1993_UnitTest.java (from rev 23266, 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_2_1_GA_CP/product/rosetta/tests/src/org/jboss/soa/esb/listeners/config/JBESB_1993_UnitTest.java (rev 0)
+++ labs/jbossesb/branches/JBESB_4_2_1_GA_CP/product/rosetta/tests/src/org/jboss/soa/esb/listeners/config/JBESB_1993_UnitTest.java 2008-11-05 16:28:54 UTC (rev 23719)
@@ -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 ;
+ }
+ }
+ }
+}
Copied: labs/jbossesb/branches/JBESB_4_2_1_GA_CP/product/rosetta/tests/src/org/jboss/soa/esb/listeners/config/JBESB_1993_action.xml (from rev 23266, 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_2_1_GA_CP/product/rosetta/tests/src/org/jboss/soa/esb/listeners/config/JBESB_1993_action.xml (rev 0)
+++ labs/jbossesb/branches/JBESB_4_2_1_GA_CP/product/rosetta/tests/src/org/jboss/soa/esb/listeners/config/JBESB_1993_action.xml 2008-11-05 16:28:54 UTC (rev 23719)
@@ -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>
Copied: labs/jbossesb/branches/JBESB_4_2_1_GA_CP/product/rosetta/tests/src/org/jboss/soa/esb/listeners/config/JBESB_1993_service.xml (from rev 23266, 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_2_1_GA_CP/product/rosetta/tests/src/org/jboss/soa/esb/listeners/config/JBESB_1993_service.xml (rev 0)
+++ labs/jbossesb/branches/JBESB_4_2_1_GA_CP/product/rosetta/tests/src/org/jboss/soa/esb/listeners/config/JBESB_1993_service.xml 2008-11-05 16:28:54 UTC (rev 23719)
@@ -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>
More information about the jboss-svn-commits
mailing list