use of com.rabbitmq.http.client.domain.ExchangeInfo in project service-api by reportportal.
the class AnalyzerUtilsTest method testDefaultValues.
@Test
void testDefaultValues() {
ExchangeInfo mock = mock(ExchangeInfo.class);
when(mock.getArguments()).thenReturn(Collections.emptyMap());
assertEquals(Integer.MAX_VALUE, AnalyzerUtils.EXCHANGE_PRIORITY.applyAsInt(mock));
assertFalse(AnalyzerUtils.DOES_SUPPORT_INDEX.test(mock));
}
use of com.rabbitmq.http.client.domain.ExchangeInfo in project service-api by reportportal.
the class AnalyzerUtilsTest method testParsing.
@Test
void testParsing() {
ExchangeInfo mock = mock(ExchangeInfo.class);
when(mock.getArguments()).thenReturn(ImmutableMap.<String, Object>builder().put(ANALYZER_PRIORITY, 1).put(ANALYZER_INDEX, true).build());
assertEquals(1, AnalyzerUtils.EXCHANGE_PRIORITY.applyAsInt(mock));
assertTrue(AnalyzerUtils.DOES_SUPPORT_INDEX.test(mock));
}
use of com.rabbitmq.http.client.domain.ExchangeInfo in project spring-amqp by spring-projects.
the class RabbitRestApiTests method testSpecificExchange.
@Test
public void testSpecificExchange() {
RabbitAdmin admin = new RabbitAdmin(connectionFactory);
Map<String, Object> args = Collections.<String, Object>singletonMap("alternate-exchange", "");
Exchange exchange = new DirectExchange(UUID.randomUUID().toString(), true, true, args);
admin.declareExchange(exchange);
ExchangeInfo exchangeOut = this.rabbitRestClient.getExchange("/", exchange.getName());
assertThat(exchangeOut.isDurable()).isTrue();
assertThat(exchangeOut.isAutoDelete()).isTrue();
assertThat(exchangeOut.getName()).isEqualTo(exchange.getName());
assertThat(exchangeOut.getArguments()).isEqualTo(args);
admin.deleteExchange(exchange.getName());
}
use of com.rabbitmq.http.client.domain.ExchangeInfo in project spring-amqp by spring-projects.
the class RabbitRestApiTests method testDeleteExchange.
@Test
public void testDeleteExchange() {
String exchangeName = "testExchange";
Exchange testExchange = new DirectExchange(exchangeName);
ExchangeInfo info = new ExchangeInfo();
info.setArguments(testExchange.getArguments());
info.setAutoDelete(testExchange.isAutoDelete());
info.setDurable(testExchange.isDurable());
info.setType(testExchange.getType());
this.rabbitRestClient.declareExchange("/", testExchange.getName(), info);
ExchangeInfo exchangeToAssert = this.rabbitRestClient.getExchange("/", exchangeName);
assertThat(exchangeToAssert.getName()).isEqualTo(testExchange.getName());
assertThat(exchangeToAssert.getType()).isEqualTo(testExchange.getType());
this.rabbitRestClient.deleteExchange("/", testExchange.getName());
// 6.0.0 REST compatibility
// assertThat(this.rabbitRestClient.getExchange("/", exchangeName)).isNull();
RabbitTemplate template = new RabbitTemplate(this.connectionFactory);
assertThatExceptionOfType(AmqpException.class).isThrownBy(() -> template.execute(channel -> channel.exchangeDeclarePassive(exchangeName))).withCauseExactlyInstanceOf(IOException.class);
}
Aggregations