use of org.springframework.amqp.rabbit.connection.ConnectionFactory in project spring-cloud-connectors by spring-cloud.
the class RabbitConnectionFactoryXmlConfigTest method cloudRabbitConnectionFactoryWithProperties.
@Test
public void cloudRabbitConnectionFactoryWithProperties() {
ApplicationContext testContext = getTestApplicationContext("cloud-rabbit-with-config.xml", createService("my-service"));
ConnectionFactory connector = testContext.getBean("service-properties", getConnectorType());
RabbitConnectionFactoryCloudConfigTestHelper.assertConfigProperties(connector, DEFAULT_CHANNEL_CACHE_SIZE, 5, 10);
}
use of org.springframework.amqp.rabbit.connection.ConnectionFactory in project spring-cloud-connectors by spring-cloud.
the class RabbitConnectionFactoryXmlConfigTest method cloudRabbitConnectionFactoryWithConfiguration.
@Test
public void cloudRabbitConnectionFactoryWithConfiguration() {
ApplicationContext testContext = getTestApplicationContext("cloud-rabbit-with-config.xml", createService("my-service"));
ConnectionFactory connector = testContext.getBean("service-channelCacheSize200", getConnectorType());
RabbitConnectionFactoryCloudConfigTestHelper.assertConfigProperties(connector, 200, -1, -1);
}
use of org.springframework.amqp.rabbit.connection.ConnectionFactory in project spring-boot by spring-projects.
the class RabbitAutoConfigurationTests method testConnectionFactoryWithOverrides.
@Test
public void testConnectionFactoryWithOverrides() {
load(TestConfiguration.class, "spring.rabbitmq.host:remote-server", "spring.rabbitmq.port:9000", "spring.rabbitmq.username:alice", "spring.rabbitmq.password:secret", "spring.rabbitmq.virtual_host:/vhost", "spring.rabbitmq.connection-timeout:123");
CachingConnectionFactory connectionFactory = this.context.getBean(CachingConnectionFactory.class);
assertThat(connectionFactory.getHost()).isEqualTo("remote-server");
assertThat(connectionFactory.getPort()).isEqualTo(9000);
assertThat(connectionFactory.getVirtualHost()).isEqualTo("/vhost");
DirectFieldAccessor dfa = new DirectFieldAccessor(connectionFactory);
com.rabbitmq.client.ConnectionFactory rcf = (com.rabbitmq.client.ConnectionFactory) dfa.getPropertyValue("rabbitConnectionFactory");
assertThat(rcf.getConnectionTimeout()).isEqualTo(123);
assertThat((Address[]) dfa.getPropertyValue("addresses")).hasSize(1);
}
use of org.springframework.amqp.rabbit.connection.ConnectionFactory in project spring-cloud-connectors by spring-cloud.
the class RabbitConnectionFactoryConfigWithServiceConfig method cloudRabbitConnectionFactoryWithProperties.
@Test
public void cloudRabbitConnectionFactoryWithProperties() {
ApplicationContext testContext = getTestApplicationContext(RabbitConnectionFactoryConfigWithServiceConfig.class, createService("my-service"));
ConnectionFactory connector = testContext.getBean("connectionFactoryWithProperties", getConnectorType());
RabbitConnectionFactoryCloudConfigTestHelper.assertConfigProperties(connector, DEFAULT_CHANNEL_CACHE_SIZE, 5, 10);
}
use of org.springframework.amqp.rabbit.connection.ConnectionFactory in project spring-cloud-connectors by spring-cloud.
the class RabbitConnectionFactoryConfigWithServiceConfig method cloudRabbitConnectionFactoryWithConfigAndProperties.
@Test
public void cloudRabbitConnectionFactoryWithConfigAndProperties() {
ApplicationContext testContext = getTestApplicationContext(RabbitConnectionFactoryConfigWithServiceConfig.class, createService("my-service"));
ConnectionFactory connector = testContext.getBean("connectionFactoryWithConfigAndProperties", getConnectorType());
RabbitConnectionFactoryCloudConfigTestHelper.assertConfigProperties(connector, 300, 15, 20);
}
Aggregations