ARTEMIS-4951 Support multiple connection router occurrences with same policy
This commit is contained in:
parent
8841c50591
commit
c50f0e7001
|
@ -2049,7 +2049,7 @@
|
|||
</xsd:annotation>
|
||||
</xsd:element>
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:ID" use="required">
|
||||
<xsd:attribute name="name" type="xsd:string" use="required">
|
||||
<xsd:annotation>
|
||||
<xsd:documentation>
|
||||
the name of the policy
|
||||
|
|
|
@ -347,7 +347,7 @@ public class FileConfigurationTest extends AbstractConfigurationTestBase {
|
|||
}
|
||||
}
|
||||
|
||||
assertEquals(5, conf.getConnectionRouters().size());
|
||||
assertEquals(6, conf.getConnectionRouters().size());
|
||||
for (ConnectionRouterConfiguration bc : conf.getConnectionRouters()) {
|
||||
if (bc.getName().equals("simple-local")) {
|
||||
assertEquals(bc.getKeyType(), KeyType.CLIENT_ID);
|
||||
|
@ -367,6 +367,13 @@ public class FileConfigurationTest extends AbstractConfigurationTestBase {
|
|||
assertFalse(bc.getPoolConfiguration().isLocalTargetEnabled());
|
||||
assertEquals("connector1", bc.getPoolConfiguration().getStaticConnectors().get(0));
|
||||
assertNull(bc.getPoolConfiguration().getDiscoveryGroupName());
|
||||
} else if (bc.getName().equals("simple-router-connector2")) {
|
||||
assertEquals(bc.getKeyType(), KeyType.USER_NAME);
|
||||
assertNull(bc.getLocalTargetFilter());
|
||||
assertEquals(bc.getPolicyConfiguration().getName(), FirstElementPolicy.NAME);
|
||||
assertFalse(bc.getPoolConfiguration().isLocalTargetEnabled());
|
||||
assertEquals("connector2", bc.getPoolConfiguration().getStaticConnectors().get(0));
|
||||
assertNull(bc.getPoolConfiguration().getDiscoveryGroupName());
|
||||
} else if (bc.getName().equals("consistent-hash-router")) {
|
||||
assertEquals(bc.getKeyType(), KeyType.SNI_HOST);
|
||||
assertEquals(bc.getKeyFilter(), "^[^.]+");
|
||||
|
|
|
@ -100,4 +100,22 @@ public class ConnectionRouterManagerTest {
|
|||
|
||||
underTest.deployConnectionRouter(connectionRouterConfiguration);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void deploy2LocalOnlyWithSamePolicy() throws Exception {
|
||||
|
||||
ManagementService mockManagementService = Mockito.mock(ManagementService.class);
|
||||
Mockito.when(mockServer.getManagementService()).thenReturn(mockManagementService);
|
||||
|
||||
ConnectionRouterConfiguration connectionRouterConfiguration = new ConnectionRouterConfiguration();
|
||||
connectionRouterConfiguration.setName("partition-local-consistent-hash").setKeyType(KeyType.CLIENT_ID).setLocalTargetFilter(String.valueOf(2));
|
||||
NamedPropertyConfiguration policyConfig = new NamedPropertyConfiguration()
|
||||
.setName(ConsistentHashModuloPolicy.NAME)
|
||||
.setProperties(Collections.singletonMap(ConsistentHashModuloPolicy.MODULO, String.valueOf(2)));
|
||||
connectionRouterConfiguration.setPolicyConfiguration(policyConfig);
|
||||
underTest.deployConnectionRouter(connectionRouterConfiguration);
|
||||
|
||||
connectionRouterConfiguration.setName("partition-local-consistent-hash-bis");
|
||||
underTest.deployConnectionRouter(connectionRouterConfiguration);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -181,6 +181,15 @@
|
|||
</static-connectors>
|
||||
</pool>
|
||||
</connection-router>
|
||||
<connection-router name="simple-router-connector2">
|
||||
<key-type>USER_NAME</key-type>
|
||||
<policy name="FIRST_ELEMENT"/>
|
||||
<pool>
|
||||
<static-connectors>
|
||||
<connector-ref>connector2</connector-ref>
|
||||
</static-connectors>
|
||||
</pool>
|
||||
</connection-router>
|
||||
<connection-router name="consistent-hash-router">
|
||||
<key-type>SNI_HOST</key-type>
|
||||
<key-filter>^[^.]+</key-filter>
|
||||
|
|
|
@ -175,6 +175,15 @@
|
|||
</static-connectors>
|
||||
</pool>
|
||||
</connection-router>
|
||||
<connection-router name="simple-router-connector2">
|
||||
<key-type>USER_NAME</key-type>
|
||||
<policy name="FIRST_ELEMENT"/>
|
||||
<pool>
|
||||
<static-connectors>
|
||||
<connector-ref>connector2</connector-ref>
|
||||
</static-connectors>
|
||||
</pool>
|
||||
</connection-router>
|
||||
<connection-router name="consistent-hash-router">
|
||||
<key-type>SNI_HOST</key-type>
|
||||
<key-filter>^[^.]+</key-filter>
|
||||
|
|
|
@ -37,6 +37,15 @@
|
|||
</static-connectors>
|
||||
</pool>
|
||||
</connection-router>
|
||||
<connection-router name="simple-router-connector2">
|
||||
<key-type>USER_NAME</key-type>
|
||||
<policy name="FIRST_ELEMENT"/>
|
||||
<pool>
|
||||
<static-connectors>
|
||||
<connector-ref>connector2</connector-ref>
|
||||
</static-connectors>
|
||||
</pool>
|
||||
</connection-router>
|
||||
<connection-router name="consistent-hash-router">
|
||||
<key-type>SNI_HOST</key-type>
|
||||
<key-filter>^[^.]+</key-filter>
|
||||
|
|
Loading…
Reference in New Issue