use of de.gessnerfl.rabbitmq.queue.management.model.Message in project rabbitmq-queue-management by gessnerfl.
the class QueueControllerIntegrationTest method shouldDeleteMessageFromQueue.
@Test
public void shouldDeleteMessageFromQueue() throws Exception {
testEnvironment.publishMessage(EXCHANGE_NAME, QUEUE_IN_NAME);
List<Message> messages = facade.getMessagesOfQueue(BROKER_NAME, QUEUE_IN_NAME, 1);
assertThat(messages, hasSize(1));
Message message = messages.get(0);
mockMvc.perform(delete("/api/" + BROKER_NAME + "/queues/" + QUEUE_IN_NAME + "/messages").param("checksum", message.getChecksum())).andExpect(status().isOk());
assertThat(facade.getMessagesOfQueue(BROKER_NAME, QUEUE_IN_NAME, 1), empty());
}
use of de.gessnerfl.rabbitmq.queue.management.model.Message in project rabbitmq-queue-management by gessnerfl.
the class QueueControllerTest method shouldDelegateCallToGetAllMessagesOfQueue.
@Test
public void shouldDelegateCallToGetAllMessagesOfQueue() {
Message message = mock(Message.class);
List<Message> messages = Arrays.asList(message);
when(rabbitMqFacade.getMessagesOfQueue(BROKER, QUEUE, QueueController.DEFAULT_LIMIT)).thenReturn(messages);
List<Message> result = sut.getQueueMessages(BROKER, QUEUE);
assertSame(messages, result);
verify(rabbitMqFacade).getMessagesOfQueue(BROKER, QUEUE, QueueController.DEFAULT_LIMIT);
}
use of de.gessnerfl.rabbitmq.queue.management.model.Message in project rabbitmq-queue-management by gessnerfl.
the class RabbitMqFacadeTest method shouldDelegateCallToGetQueueMessages.
@Test
public void shouldDelegateCallToGetQueueMessages() {
Message message = mock(Message.class);
List<Message> messages = Arrays.asList(message);
when(operations.getMessagesOfQueue(DEFAULT_BROKER, QUEUE, MAX_NUMBER_MESSAGE)).thenReturn(messages);
List<Message> result = sut.getMessagesOfQueue(DEFAULT_BROKER, QUEUE, MAX_NUMBER_MESSAGE);
assertSame(messages, result);
verify(operations).getMessagesOfQueue(DEFAULT_BROKER, QUEUE, MAX_NUMBER_MESSAGE);
}
use of de.gessnerfl.rabbitmq.queue.management.model.Message in project rabbitmq-queue-management by gessnerfl.
the class OperationsTest method shouldDelegateListOperation.
@Test
public void shouldDelegateListOperation() {
Message message = mock(Message.class);
List<Message> messages = Arrays.asList(message);
when(queueListOperation.getMessagesFromQueue(BROKER_NAME, QUEUE_NAME, MAX_NUMBER_MESSAGE)).thenReturn(messages);
List<Message> result = sut.getMessagesOfQueue(BROKER_NAME, QUEUE_NAME, MAX_NUMBER_MESSAGE);
assertSame(messages, result);
verify(queueListOperation).getMessagesFromQueue(BROKER_NAME, QUEUE_NAME, MAX_NUMBER_MESSAGE);
}
use of de.gessnerfl.rabbitmq.queue.management.model.Message in project rabbitmq-queue-management by gessnerfl.
the class MessageMapperTest method shouldMapAmqpBasicProperties.
@Test
public void shouldMapAmqpBasicProperties() {
String contentType = "contentType";
String contentEncoding = "contentEncoding";
String headerKey = "headerKey";
String headerValue = "headerValue";
Map<String, Object> headers = new HashMap<>();
headers.put(headerKey, headerValue);
Integer deliveryMode = 12;
Integer priority = 13;
String correlationId = "correlationId";
String replyTo = "replyTo";
String expiration = "expiration";
String messageId = "messageId";
Date timestamp = new Date();
String type = "type";
String userId = "userId";
String appId = "appId";
String clusterId = "clusterId";
AMQP.BasicProperties basicProperties = mock(AMQP.BasicProperties.class);
when(basicProperties.getContentType()).thenReturn(contentType);
when(basicProperties.getContentEncoding()).thenReturn(contentEncoding);
when(basicProperties.getHeaders()).thenReturn(headers);
when(basicProperties.getDeliveryMode()).thenReturn(deliveryMode);
when(basicProperties.getPriority()).thenReturn(priority);
when(basicProperties.getCorrelationId()).thenReturn(correlationId);
when(basicProperties.getReplyTo()).thenReturn(replyTo);
when(basicProperties.getExpiration()).thenReturn(expiration);
when(basicProperties.getMessageId()).thenReturn(messageId);
when(basicProperties.getTimestamp()).thenReturn(timestamp);
when(basicProperties.getType()).thenReturn(type);
when(basicProperties.getUserId()).thenReturn(userId);
when(basicProperties.getAppId()).thenReturn(appId);
when(basicProperties.getClusterId()).thenReturn(clusterId);
Envelope envelope = mock(Envelope.class);
GetResponse getResponse = mockResponse(envelope, basicProperties);
Message result = sut.map(getResponse);
BasicProperties basicPropertiesOfResult = result.getProperties();
assertNotNull(basicPropertiesOfResult);
assertEquals(contentType, basicPropertiesOfResult.getContentType());
assertEquals(contentEncoding, basicPropertiesOfResult.getContentEncoding());
assertThat(basicPropertiesOfResult.getHeaders().keySet(), Matchers.hasSize(1));
assertThat(basicPropertiesOfResult.getHeaders(), Matchers.hasKey(headerKey));
assertEquals(headerValue, basicPropertiesOfResult.getHeaders().get(headerKey));
assertEquals(deliveryMode, basicPropertiesOfResult.getDeliveryMode());
assertEquals(priority, basicPropertiesOfResult.getPriority());
assertEquals(correlationId, basicPropertiesOfResult.getCorrelationId());
assertEquals(replyTo, basicPropertiesOfResult.getReplyTo());
assertEquals(expiration, basicPropertiesOfResult.getExpiration());
assertEquals(messageId, basicPropertiesOfResult.getMessageId());
assertEquals(timestamp, basicPropertiesOfResult.getTimestamp());
assertEquals(type, basicPropertiesOfResult.getType());
assertEquals(userId, basicPropertiesOfResult.getUserId());
assertEquals(appId, basicPropertiesOfResult.getAppId());
assertEquals(clusterId, basicPropertiesOfResult.getClusterId());
}
Aggregations