You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@activemq.apache.org by cl...@apache.org on 2024/02/06 16:59:04 UTC
(activemq-artemis) branch main updated: ARTEMIS-4637 - Allow unordered xml conf elements for clusters and bridges
This is an automated email from the ASF dual-hosted git repository.
clebertsuconic pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/activemq-artemis.git
The following commit(s) were added to refs/heads/main by this push:
new c4c2a9e718 ARTEMIS-4637 - Allow unordered xml conf elements for clusters and bridges
c4c2a9e718 is described below
commit c4c2a9e7182f41cf086eee27e619aea7afbc6ca7
Author: a181321 <an...@volvo.com>
AuthorDate: Tue Feb 6 10:10:00 2024 +0100
ARTEMIS-4637 - Allow unordered xml conf elements for clusters and bridges
---
.../resources/schema/artemis-configuration.xsd | 102 ++++++++-------------
.../config/impl/FileConfigurationParserTest.java | 9 +-
.../core/config/impl/FileConfigurationTest.java | 2 +
.../resources/ConfigurationTest-full-config.xml | 10 +-
.../ConfigurationTest-xinclude-config.xml | 2 +-
...-xinclude-schema-config-cluster-connections.xml | 2 +-
.../src/test/resources/reload-bridge-updated.xml | 2 +-
7 files changed, 58 insertions(+), 71 deletions(-)
diff --git a/artemis-server/src/main/resources/schema/artemis-configuration.xsd b/artemis-server/src/main/resources/schema/artemis-configuration.xsd
index f4d9d1d493..7355fdbeed 100644
--- a/artemis-server/src/main/resources/schema/artemis-configuration.xsd
+++ b/artemis-server/src/main/resources/schema/artemis-configuration.xsd
@@ -1054,6 +1054,37 @@
</xsd:annotation>
</xsd:element>
+ <xsd:element name="discovery-type" abstract="true"/>
+
+ <xsd:element name="static-connectors" substitutionGroup="discovery-type">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name="connector-ref" type="xsd:string" maxOccurs="unbounded" minOccurs="1"/>
+ </xsd:sequence>
+ <xsd:attribute name="allow-direct-connections-only" default="false" type="xsd:boolean" use="optional">
+ <xsd:annotation>
+ <xsd:documentation>
+ restricts a clusters connections to the listed connector-ref's
+ </xsd:documentation>
+ </xsd:annotation>
+ </xsd:attribute>
+ <xsd:attributeGroup ref="xml:specialAttrs"/>
+ </xsd:complexType>
+ </xsd:element>
+
+ <xsd:element name="discovery-group-ref" substitutionGroup="discovery-type">
+ <xsd:complexType>
+ <xsd:attribute name="discovery-group-name" type="xsd:IDREF" use="required">
+ <xsd:annotation>
+ <xsd:documentation>
+ name of the discovery group to use for this connection
+ </xsd:documentation>
+ </xsd:annotation>
+ </xsd:attribute>
+ <xsd:attributeGroup ref="xml:specialAttrs"/>
+ </xsd:complexType>
+ </xsd:element>
+
<!-- BROADCAST GROUP CONFIGURATION -->
<xsd:element name="broadcast-groups">
<xsd:annotation>
@@ -1222,13 +1253,6 @@
<xsd:attributeGroup ref="xml:specialAttrs"/>
</xsd:complexType>
- <xsd:element name="discovery-group-ref">
- <xsd:complexType>
- <xsd:attribute name="discovery-group-name" type="xsd:IDREF"/>
- <xsd:attributeGroup ref="xml:specialAttrs"/>
- </xsd:complexType>
- </xsd:element>
-
<xsd:complexType name="class-name-sequenceType">
<xsd:annotation>
<xsd:documentation>
@@ -1281,7 +1305,7 @@
</xsd:element>
<xsd:complexType name="bridgeType">
- <xsd:sequence>
+ <xsd:all>
<xsd:element name="queue-name" type="xsd:string" maxOccurs="1" minOccurs="1">
<xsd:annotation>
<xsd:documentation>
@@ -1469,29 +1493,9 @@
</xsd:annotation>
</xsd:element>
- <xsd:choice>
- <xsd:element name="static-connectors" maxOccurs="1" minOccurs="1">
- <xsd:complexType>
- <xsd:sequence>
- <xsd:element name="connector-ref" type="xsd:string" maxOccurs="unbounded" minOccurs="1"/>
- </xsd:sequence>
- <xsd:attributeGroup ref="xml:specialAttrs"/>
- </xsd:complexType>
- </xsd:element>
- <xsd:element name="discovery-group-ref" maxOccurs="1" minOccurs="1">
- <xsd:complexType>
- <xsd:attribute name="discovery-group-name" type="xsd:IDREF" use="required">
- <xsd:annotation>
- <xsd:documentation>
- name of discovery group used by this bridge
- </xsd:documentation>
- </xsd:annotation>
- </xsd:attribute>
- <xsd:attributeGroup ref="xml:specialAttrs"/>
- </xsd:complexType>
- </xsd:element>
- </xsd:choice>
- </xsd:sequence>
+ <xsd:element ref="discovery-type" maxOccurs="1" minOccurs="1"/>
+
+ </xsd:all>
<xsd:attribute name="name" type="xsd:ID" use="required">
<xsd:annotation>
@@ -2334,7 +2338,7 @@
</xsd:complexType>
<xsd:complexType name="cluster-connectionType">
- <xsd:sequence>
+ <xsd:all>
<xsd:element name="address" type="xsd:string" maxOccurs="1" minOccurs="0">
<xsd:annotation>
<xsd:documentation>
@@ -2517,36 +2521,10 @@
</xsd:annotation>
</xsd:element>
- <xsd:choice>
- <xsd:element name="static-connectors" maxOccurs="1" minOccurs="0">
- <xsd:complexType>
- <xsd:sequence>
- <xsd:element name="connector-ref" type="xsd:string" maxOccurs="unbounded" minOccurs="0"/>
- </xsd:sequence>
- <xsd:attribute name="allow-direct-connections-only" default="false" type="xsd:boolean" use="optional">
- <xsd:annotation>
- <xsd:documentation>
- restricts cluster connections to the listed connector-ref's
- </xsd:documentation>
- </xsd:annotation>
- </xsd:attribute>
- <xsd:attributeGroup ref="xml:specialAttrs"/>
- </xsd:complexType>
- </xsd:element>
- <xsd:element name="discovery-group-ref" maxOccurs="1" minOccurs="0">
- <xsd:complexType>
- <xsd:attribute name="discovery-group-name" type="xsd:IDREF" use="required">
- <xsd:annotation>
- <xsd:documentation>
- name of discovery group used by this cluster-connection
- </xsd:documentation>
- </xsd:annotation>
- </xsd:attribute>
- <xsd:attributeGroup ref="xml:specialAttrs"/>
- </xsd:complexType>
- </xsd:element>
- </xsd:choice>
- </xsd:sequence>
+ <xsd:element ref="discovery-type" maxOccurs="1" minOccurs="0"/>
+
+ </xsd:all>
+
<xsd:attribute name="name" type="xsd:ID" use="required">
<xsd:annotation>
<xsd:documentation>
diff --git a/artemis-server/src/test/java/org/apache/activemq/artemis/core/config/impl/FileConfigurationParserTest.java b/artemis-server/src/test/java/org/apache/activemq/artemis/core/config/impl/FileConfigurationParserTest.java
index 56cb63700f..a1d9a7ee53 100644
--- a/artemis-server/src/test/java/org/apache/activemq/artemis/core/config/impl/FileConfigurationParserTest.java
+++ b/artemis-server/src/test/java/org/apache/activemq/artemis/core/config/impl/FileConfigurationParserTest.java
@@ -311,6 +311,13 @@ public class FileConfigurationParserTest extends ServerTestBase {
" <connector-ref>remote-connector</connector-ref>\n" +
" </static-connectors>\n" +
" </bridge>\n" +
+ " <bridge name=\"my-other-bridge\">\n" +
+ " <static-connectors>\n" +
+ " <connector-ref>remote-connector</connector-ref>\n" +
+ " </static-connectors>\n" +
+ " <forwarding-address>mincing-machine</forwarding-address>\n" +
+ " <queue-name>sausage-factory</queue-name>\n" +
+ " </bridge>\n" +
"</bridges>\n"
+ lastPart;
ByteArrayInputStream input = new ByteArrayInputStream(configStr.getBytes(StandardCharsets.UTF_8));
@@ -318,7 +325,7 @@ public class FileConfigurationParserTest extends ServerTestBase {
Configuration config = parser.parseMainConfig(input);
List<BridgeConfiguration> bridgeConfigs = config.getBridgeConfigurations();
- assertEquals(1, bridgeConfigs.size());
+ assertEquals(2, bridgeConfigs.size());
BridgeConfiguration bconfig = bridgeConfigs.get(0);
diff --git a/artemis-server/src/test/java/org/apache/activemq/artemis/core/config/impl/FileConfigurationTest.java b/artemis-server/src/test/java/org/apache/activemq/artemis/core/config/impl/FileConfigurationTest.java
index 5216ba7a47..48516272d5 100644
--- a/artemis-server/src/test/java/org/apache/activemq/artemis/core/config/impl/FileConfigurationTest.java
+++ b/artemis-server/src/test/java/org/apache/activemq/artemis/core/config/impl/FileConfigurationTest.java
@@ -406,6 +406,7 @@ public class FileConfigurationTest extends ConfigurationImplTest {
Assert.assertEquals("connector2", ccc.getStaticConnectors().get(1));
Assert.assertEquals(null, ccc.getDiscoveryGroupName());
Assert.assertEquals(222, ccc.getProducerWindowSize());
+ Assert.assertEquals(true, ccc.isAllowDirectConnectionsOnly());
} else {
Assert.assertEquals("cluster-connection2", ccc.getName());
Assert.assertEquals("queues2", ccc.getAddress());
@@ -418,6 +419,7 @@ public class FileConfigurationTest extends ConfigurationImplTest {
Assert.assertEquals(Collections.emptyList(), ccc.getStaticConnectors());
Assert.assertEquals("dg1", ccc.getDiscoveryGroupName());
Assert.assertEquals(333, ccc.getProducerWindowSize());
+ Assert.assertEquals(false, ccc.isAllowDirectConnectionsOnly());
}
}
diff --git a/artemis-server/src/test/resources/ConfigurationTest-full-config.xml b/artemis-server/src/test/resources/ConfigurationTest-full-config.xml
index 03e3e96cf8..704cb58e0b 100644
--- a/artemis-server/src/test/resources/ConfigurationTest-full-config.xml
+++ b/artemis-server/src/test/resources/ConfigurationTest-full-config.xml
@@ -233,13 +233,13 @@
<max-retry-interval>10002</max-retry-interval>
<reconnect-attempts>2</reconnect-attempts>
<failover-on-server-shutdown>false</failover-on-server-shutdown>
- <use-duplicate-detection>true</use-duplicate-detection>
<confirmation-window-size>1G</confirmation-window-size>
<producer-window-size>444</producer-window-size>
<routing-type>STRIP</routing-type>
<static-connectors>
<connector-ref>connector1</connector-ref>
</static-connectors>
+ <use-duplicate-detection>true</use-duplicate-detection>
</bridge>
<bridge name="bridge2">
<queue-name>queue2</queue-name>
@@ -249,7 +249,6 @@
</bridge>
<bridge name="bridge3">
<queue-name>queue3</queue-name>
- <forwarding-address>bridge-forwarding-address2</forwarding-address>
<transformer>
<class-name>org.foo.BridgeTransformer3</class-name>
<property key="bridgeTransformerKey1" value="bridgeTransformerValue1"/>
@@ -257,6 +256,7 @@
</transformer>
<producer-window-size>555k</producer-window-size>
<discovery-group-ref discovery-group-name="dg1"/>
+ <forwarding-address>bridge-forwarding-address2</forwarding-address>
</bridge>
<bridge name="bridge4">
<queue-name>queue3</queue-name>
@@ -421,22 +421,22 @@
<max-hops>1</max-hops>
<producer-window-size>222</producer-window-size>
<call-failover-timeout>123</call-failover-timeout>
- <static-connectors>
+ <static-connectors allow-direct-connections-only="true">
<connector-ref>connector1</connector-ref>
<connector-ref>connector2</connector-ref>
</static-connectors>
</cluster-connection>
<cluster-connection name="cluster-connection2">
+ <discovery-group-ref discovery-group-name="dg1"/>
<address>queues2</address>
<connector-ref>connector2</connector-ref>
<call-timeout>456</call-timeout>
+ <call-failover-timeout>456</call-failover-timeout>
<retry-interval>4</retry-interval>
<use-duplicate-detection>false</use-duplicate-detection>
<message-load-balancing>STRICT</message-load-balancing>
<max-hops>2</max-hops>
<producer-window-size>333</producer-window-size>
- <call-failover-timeout>456</call-failover-timeout>
- <discovery-group-ref discovery-group-name="dg1"/>
</cluster-connection>
<cluster-connection name="cluster-connection3">
<connector-ref>connector2</connector-ref>
diff --git a/artemis-server/src/test/resources/ConfigurationTest-xinclude-config.xml b/artemis-server/src/test/resources/ConfigurationTest-xinclude-config.xml
index 84bb539057..44961398de 100644
--- a/artemis-server/src/test/resources/ConfigurationTest-xinclude-config.xml
+++ b/artemis-server/src/test/resources/ConfigurationTest-xinclude-config.xml
@@ -302,7 +302,7 @@
<max-hops>1</max-hops>
<producer-window-size>222</producer-window-size>
<call-failover-timeout>123</call-failover-timeout>
- <static-connectors>
+ <static-connectors allow-direct-connections-only="true">
<connector-ref>connector1</connector-ref>
<connector-ref>connector2</connector-ref>
</static-connectors>
diff --git a/artemis-server/src/test/resources/ConfigurationTest-xinclude-schema-config-cluster-connections.xml b/artemis-server/src/test/resources/ConfigurationTest-xinclude-schema-config-cluster-connections.xml
index ed29c619a9..aee09856e0 100644
--- a/artemis-server/src/test/resources/ConfigurationTest-xinclude-schema-config-cluster-connections.xml
+++ b/artemis-server/src/test/resources/ConfigurationTest-xinclude-schema-config-cluster-connections.xml
@@ -31,7 +31,7 @@
<max-hops>1</max-hops>
<producer-window-size>222</producer-window-size>
<call-failover-timeout>123</call-failover-timeout>
- <static-connectors>
+ <static-connectors allow-direct-connections-only="true">
<connector-ref>connector1</connector-ref>
<connector-ref>connector2</connector-ref>
</static-connectors>
diff --git a/tests/integration-tests/src/test/resources/reload-bridge-updated.xml b/tests/integration-tests/src/test/resources/reload-bridge-updated.xml
index ffa263878d..f268f85916 100644
--- a/tests/integration-tests/src/test/resources/reload-bridge-updated.xml
+++ b/tests/integration-tests/src/test/resources/reload-bridge-updated.xml
@@ -37,9 +37,9 @@ under the License.
<bridges>
<bridge name="a">
+ <concurrency>2</concurrency>
<queue-name>a-from</queue-name>
<forwarding-address>a-new</forwarding-address>
- <concurrency>2</concurrency>
<static-connectors>
<connector-ref>connector</connector-ref>
</static-connectors>