[hornetq-commits] JBoss hornetq SVN: r9406 - in branches/2_2_0_HA_Improvements: src/main/org/hornetq/core/deployers/impl and 2 other directories.

do-not-reply at jboss.org do-not-reply at jboss.org
Fri Jul 16 07:12:45 EDT 2010


Author: ataylor
Date: 2010-07-16 07:12:45 -0400 (Fri, 16 Jul 2010)
New Revision: 9406

Modified:
   branches/2_2_0_HA_Improvements/src/config/common/schema/hornetq-configuration.xsd
   branches/2_2_0_HA_Improvements/src/main/org/hornetq/core/deployers/impl/FileConfigurationParser.java
   branches/2_2_0_HA_Improvements/tests/config/ConfigurationTest-full-config.xml
   branches/2_2_0_HA_Improvements/tests/src/org/hornetq/tests/unit/core/config/impl/FileConfigurationTest.java
Log:
fixed test full config and config tests

Modified: branches/2_2_0_HA_Improvements/src/config/common/schema/hornetq-configuration.xsd
===================================================================
--- branches/2_2_0_HA_Improvements/src/config/common/schema/hornetq-configuration.xsd	2010-07-16 08:13:34 UTC (rev 9405)
+++ branches/2_2_0_HA_Improvements/src/config/common/schema/hornetq-configuration.xsd	2010-07-16 11:12:45 UTC (rev 9406)
@@ -213,7 +213,7 @@
 				</xsd:element>
 				<xsd:element maxOccurs="1" minOccurs="0" ref="broadcast-period">
 				</xsd:element>
-				<xsd:element maxOccurs="unbounded" minOccurs="0" ref="connector-ref">
+				<xsd:element maxOccurs="unbounded" minOccurs="0" name="connector-ref" type="xsd:string">
 				</xsd:element>
 			</xsd:sequence>
 			<xsd:attribute name="name" type="xsd:ID" use="required"/>

Modified: branches/2_2_0_HA_Improvements/src/main/org/hornetq/core/deployers/impl/FileConfigurationParser.java
===================================================================
--- branches/2_2_0_HA_Improvements/src/main/org/hornetq/core/deployers/impl/FileConfigurationParser.java	2010-07-16 08:13:34 UTC (rev 9405)
+++ branches/2_2_0_HA_Improvements/src/main/org/hornetq/core/deployers/impl/FileConfigurationParser.java	2010-07-16 11:12:45 UTC (rev 9406)
@@ -879,7 +879,7 @@
 
          if (child.getNodeName().equals("connector-ref"))
          {
-            String connectorName = child.getAttributes().getNamedItem("connector-name").getNodeValue();
+            String connectorName = XMLConfigurationUtil.getString(e, "connector-ref", null, Validators.NOT_NULL_OR_EMPTY);
 
             connectorNames.add(connectorName);
          }
@@ -977,19 +977,7 @@
          }
          else if (child.getNodeName().equals("static-connectors"))
          {
-            NodeList children2 = child.getChildNodes();
-            
-            for (int k = 0; k < children2.getLength(); k++)
-            {
-               Node child2 = children.item(k);
-               
-               if (child2.getNodeName().equals("connector-ref"))
-               {
-                  String connName = child.getAttributes().getNamedItem("connector-name").getNodeValue();
-
-                  staticConnectorNames.add(connName);
-               }
-            }
+            getStaticConnectors(staticConnectorNames, child);
          }
       }
 
@@ -1115,19 +1103,7 @@
          }
          else if (child.getNodeName().equals("static-connectors"))
          {
-            NodeList children2 = child.getChildNodes();
-            
-            for (int k = 0; k < children2.getLength(); k++)
-            {
-               Node child2 = children.item(k);
-               
-               if (child2.getNodeName().equals("connector-ref"))
-               {
-                  String connectorName = child.getAttributes().getNamedItem("connector-name").getNodeValue();
-
-                  staticConnectorNames.add(connectorName);
-               }
-            }
+            getStaticConnectors(staticConnectorNames, child);
          }
       }
 
@@ -1175,6 +1151,20 @@
       mainConfig.getBridgeConfigurations().add(config);
    }
 
+   private void getStaticConnectors(List<String> staticConnectorNames, Node child)
+   {
+      NodeList children2 = ((Element) child).getElementsByTagName("connector-ref");
+
+      for (int k = 0; k < children2.getLength(); k++)
+      {
+         Element child2 = (Element) children2.item(k);
+
+         String connectorName = child2.getChildNodes().item(0).getNodeValue();
+
+         staticConnectorNames.add(connectorName);
+      }
+   }
+
    private void parseDivertConfiguration(final Element e, final Configuration mainConfig)
    {
       String name = e.getAttribute("name");

Modified: branches/2_2_0_HA_Improvements/tests/config/ConfigurationTest-full-config.xml
===================================================================
--- branches/2_2_0_HA_Improvements/tests/config/ConfigurationTest-full-config.xml	2010-07-16 08:13:34 UTC (rev 9405)
+++ branches/2_2_0_HA_Improvements/tests/config/ConfigurationTest-full-config.xml	2010-07-16 11:12:45 UTC (rev 9406)
@@ -1,7 +1,7 @@
 <configuration 
    xmlns="urn:hornetq" 
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
-   xsi:schemaLocation="urn:hornetq ../../src/schemas/hornetq-configuration.xsd">
+   xsi:schemaLocation="urn:hornetq ../../src/config/common/schema/hornetq-configuration.xsd">
       <clustered>true</clustered>
       <scheduled-thread-pool-max-size>12345</scheduled-thread-pool-max-size>             
       <thread-pool-max-size>54321</thread-pool-max-size>
@@ -53,8 +53,7 @@
          <class-name>org.hornetq.tests.unit.core.config.impl.TestInterceptor1</class-name>
          <class-name>org.hornetq.tests.unit.core.config.impl.TestInterceptor2</class-name>
       </remoting-interceptors>
-      
-      <backup-connector-ref connector-name="backup-connector" />     
+
       <connectors>
          <connector name="connector1">
             <factory-class>org.hornetq.tests.unit.core.config.impl.TestConnectorFactory1</factory-class>
@@ -68,11 +67,6 @@
             <param key="b1" value="w1"/>
             <param key="b2" value="234"/>
          </connector>
-         <connector name="backup-connector">
-            <factory-class>org.hornetq.tests.unit.core.config.impl.TestConnectorFactory3</factory-class>
-            <param key="c1" value="x1"/>
-            <param key="c2" value="345"/>
-         </connector>
       </connectors>
       <acceptors>
          <acceptor name="acceptor1">
@@ -92,14 +86,14 @@
 	        <group-address>192.168.0.120</group-address>
 	        <group-port>11999</group-port>
             <broadcast-period>12345</broadcast-period>
-            <connector-ref connector-name="connector1"/>
+            <connector-ref>connector1</connector-ref>
 	     </broadcast-group>
          <broadcast-group name="bg2">
             <local-bind-port>12999</local-bind-port>
             <group-address>192.168.0.121</group-address>
             <group-port>13999</group-port>
             <broadcast-period>23456</broadcast-period>
-            <connector-ref connector-name="connector2" backup-connector-name="backup-connector"/>
+            <connector-ref>connector2</connector-ref>
          </broadcast-group>
       </broadcast-groups>
       <discovery-groups>
@@ -157,7 +151,9 @@
              <reconnect-attempts>2</reconnect-attempts>
              <failover-on-server-shutdown>false</failover-on-server-shutdown>
              <use-duplicate-detection>true</use-duplicate-detection>
-             <connector-ref connector-name="connector1"/>
+             <static-connectors>
+               <connector-ref>connector1</connector-ref>
+             </static-connectors>
          </bridge>
          <bridge name="bridge2">
              <queue-name>queue2</queue-name>
@@ -168,15 +164,19 @@
       <cluster-connections>
          <cluster-connection name="cluster-connection1">
              <address>queues1</address>
+             <connector-ref>connector1</connector-ref>
              <retry-interval>3</retry-interval>
              <use-duplicate-detection>true</use-duplicate-detection>
              <forward-when-no-consumers>false</forward-when-no-consumers>
              <max-hops>1</max-hops>
-             <connector-ref connector-name="connector1" backup-connector-name="backup-connector"/>
-             <connector-ref connector-name="connector2"/>
+            <static-connectors>
+               <connector-ref>connector1</connector-ref>
+               <connector-ref>connector2</connector-ref>
+            </static-connectors>
          </cluster-connection>
          <cluster-connection name="cluster-connection2">
              <address>queues2</address>
+             <connector-ref>connector2</connector-ref>
              <retry-interval>4</retry-interval>
              <use-duplicate-detection>false</use-duplicate-detection>
              <forward-when-no-consumers>true</forward-when-no-consumers>

Modified: branches/2_2_0_HA_Improvements/tests/src/org/hornetq/tests/unit/core/config/impl/FileConfigurationTest.java
===================================================================
--- branches/2_2_0_HA_Improvements/tests/src/org/hornetq/tests/unit/core/config/impl/FileConfigurationTest.java	2010-07-16 08:13:34 UTC (rev 9405)
+++ branches/2_2_0_HA_Improvements/tests/src/org/hornetq/tests/unit/core/config/impl/FileConfigurationTest.java	2010-07-16 11:12:45 UTC (rev 9406)
@@ -93,7 +93,7 @@
                             .contains("org.hornetq.tests.unit.core.config.impl.TestInterceptor2"));
 
 
-      Assert.assertEquals(3, conf.getConnectorConfigurations().size());
+      Assert.assertEquals(2, conf.getConnectorConfigurations().size());
 
       TransportConfiguration tc = conf.getConnectorConfigurations().get("connector1");
       Assert.assertNotNull(tc);
@@ -109,12 +109,6 @@
       Assert.assertEquals("w1", tc.getParams().get("b1"));
       Assert.assertEquals("234", tc.getParams().get("b2"));
 
-      tc = conf.getConnectorConfigurations().get("backup-connector");
-      Assert.assertNotNull(tc);
-      Assert.assertEquals("org.hornetq.tests.unit.core.config.impl.TestConnectorFactory3", tc.getFactoryClassName());
-      Assert.assertEquals("x1", tc.getParams().get("c1"));
-      Assert.assertEquals("345", tc.getParams().get("c2"));
-
       Assert.assertEquals(2, conf.getAcceptorConfigurations().size());
       for (TransportConfiguration ac : conf.getAcceptorConfigurations())
       {
@@ -239,7 +233,6 @@
             Assert.assertEquals(false, ccc.isForwardWhenNoConsumers());
             Assert.assertEquals(1, ccc.getMaxHops());
             Assert.assertEquals("connector1", ccc.getStaticConnectors().get(0));
-            Assert.assertEquals("backup-connector", ccc.getStaticConnectors().get(1));
             Assert.assertEquals("connector2", ccc.getStaticConnectors().get(1));
             Assert.assertEquals(null, ccc.getDiscoveryGroupName());
          }



More information about the hornetq-commits mailing list