added test for mirroring and properties

This commit is contained in:
Andy Taylor 2022-07-19 11:22:48 +01:00 committed by clebertsuconic
parent 71b781d919
commit d67910f1a6
1 changed files with 39 additions and 0 deletions

View File

@ -38,6 +38,7 @@ import org.apache.activemq.artemis.api.core.TransportConfiguration;
import org.apache.activemq.artemis.core.config.Configuration;
import org.apache.activemq.artemis.core.config.amqpBrokerConnectivity.AMQPBrokerConnectConfiguration;
import org.apache.activemq.artemis.core.config.amqpBrokerConnectivity.AMQPBrokerConnectionAddressType;
import org.apache.activemq.artemis.core.config.amqpBrokerConnectivity.AMQPBrokerConnectionElement;
import org.apache.activemq.artemis.core.config.amqpBrokerConnectivity.AMQPMirrorBrokerConnectionElement;
import org.apache.activemq.artemis.core.config.ha.LiveOnlyPolicyConfiguration;
import org.apache.activemq.artemis.core.deployers.impl.FileConfigurationParser;
@ -629,6 +630,44 @@ public class ConfigurationImplTest extends ActiveMQTestBase {
Assert.assertEquals("2", configuration.getConnectionRouters().get(0).getPolicyConfiguration().getProperties().get(ConsistentHashModuloPolicy.MODULO));
}
@Test
public void testAMQPConnectionsConfiguration() throws Throwable {
ConfigurationImpl configuration = new ConfigurationImpl();
Properties insertionOrderedProperties = new ConfigurationImpl.InsertionOrderedProperties();
insertionOrderedProperties.put("AMQPConnections.target.uri", "localhost:61617");
insertionOrderedProperties.put("AMQPConnections.target.retryInterval", 55);
insertionOrderedProperties.put("AMQPConnections.target.reconnectAttempts", -2);
insertionOrderedProperties.put("AMQPConnections.target.user", "admin");
insertionOrderedProperties.put("AMQPConnections.target.password", "password");
insertionOrderedProperties.put("AMQPConnections.target.autoStart", "true");
insertionOrderedProperties.put("AMQPConnections.target.connectionElements.mirror.type", "MIRROR");
insertionOrderedProperties.put("AMQPConnections.target.connectionElements.mirror.messageAcknowledgements", "true");
insertionOrderedProperties.put("AMQPConnections.target.connectionElements.mirror.queueCreation", "true");
insertionOrderedProperties.put("AMQPConnections.target.connectionElements.mirror.queueRemoval", "true");
insertionOrderedProperties.put("AMQPConnections.target.connectionElements.mirror.addressFilter", "foo");
configuration.parsePrefixedProperties(insertionOrderedProperties, null);
Assert.assertEquals(1, configuration.getAMQPConnections().size());
AMQPBrokerConnectConfiguration connectConfiguration = configuration.getAMQPConnections().get(0);
Assert.assertEquals("target", connectConfiguration.getName());
Assert.assertEquals("localhost:61617", connectConfiguration.getUri());
Assert.assertEquals(55, connectConfiguration.getRetryInterval());
Assert.assertEquals(-2, connectConfiguration.getReconnectAttempts());
Assert.assertEquals("admin", connectConfiguration.getUser());
Assert.assertEquals("password", connectConfiguration.getPassword());
Assert.assertEquals(1,connectConfiguration.getConnectionElements().size());
AMQPBrokerConnectionElement amqpBrokerConnectionElement = connectConfiguration.getConnectionElements().get(0);
Assert.assertTrue(amqpBrokerConnectionElement instanceof AMQPMirrorBrokerConnectionElement);
AMQPMirrorBrokerConnectionElement amqpMirrorBrokerConnectionElement = (AMQPMirrorBrokerConnectionElement) amqpBrokerConnectionElement;
Assert.assertEquals("mirror", amqpMirrorBrokerConnectionElement.getName());
Assert.assertEquals(true, amqpMirrorBrokerConnectionElement.isMessageAcknowledgements());
Assert.assertEquals(true, amqpMirrorBrokerConnectionElement.isQueueCreation());
Assert.assertEquals(true, amqpMirrorBrokerConnectionElement.isQueueRemoval());
Assert.assertEquals("foo", amqpMirrorBrokerConnectionElement.getAddressFilter());
}
@Test
public void testCoreBridgeConfiguration() throws Throwable {
ConfigurationImpl configuration = new ConfigurationImpl();