Java Code Examples for com.amazonaws.services.sqs.model.ReceiveMessageResult#setMessages()
The following examples show how to use
com.amazonaws.services.sqs.model.ReceiveMessageResult#setMessages() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: SqsExecutorTest.java From spring-integration-aws with MIT License | 6 votes |
@Test public void incorrectMD5Test() throws MessageMarshallerException { String payload = "Hello, World"; String messageBody = messageMarshaller.serialize(MessageBuilder .withPayload(payload).build()); com.amazonaws.services.sqs.model.Message sqsMessage = new com.amazonaws.services.sqs.model.Message(); sqsMessage.setBody(messageBody); sqsMessage.setMD5OfBody(messageBody); ReceiveMessageResult result = new ReceiveMessageResult(); result.setMessages(Collections.singletonList(sqsMessage)); when(mockSQS.receiveMessage(any(ReceiveMessageRequest.class))) .thenReturn(result); Message<?> recvMessage = executor.poll(); assertNull("No message since MD5 checksum failed", recvMessage); }
Example 2
Source File: SqsExecutorTest.java From spring-integration-aws with MIT License | 6 votes |
@Test public void correctMD5Test() throws Exception { String payload = "Hello, World"; String messageBody = messageMarshaller.serialize(MessageBuilder .withPayload(payload).build()); com.amazonaws.services.sqs.model.Message sqsMessage = new com.amazonaws.services.sqs.model.Message(); sqsMessage.setBody(messageBody); sqsMessage.setMD5OfBody(new String(Hex.encodeHex(Md5Utils .computeMD5Hash(messageBody.getBytes("UTF-8"))))); ReceiveMessageResult result = new ReceiveMessageResult(); result.setMessages(Collections.singletonList(sqsMessage)); when(mockSQS.receiveMessage(any(ReceiveMessageRequest.class))) .thenReturn(result); Message<?> recvMessage = executor.poll(); assertNotNull("message is not null", recvMessage); Message<?> enclosed = messageMarshaller .deserialize((String) recvMessage.getPayload()); String recvPayload = (String) enclosed.getPayload(); assertEquals("payload must match", payload, recvPayload); }
Example 3
Source File: ReceiveQueueBuffer.java From amazon-sqs-java-temporary-queues-client with Apache License 2.0 | 5 votes |
public synchronized void complete() { if (!isDone()) { ReceiveMessageResult result = new ReceiveMessageResult(); result.setMessages(messages); complete(result); } }