Skip to content

Commit

Permalink
feat(testy-beat-box): Make saving messages to store as Immutable list…
Browse files Browse the repository at this point in the history
…. Change doc message. Modify pom dependencies.

closes nora/rocket/testy-box#3
  • Loading branch information
cdaleas authored and Marthym committed Nov 8, 2019
1 parent 0880835 commit ef40f5e
Show file tree
Hide file tree
Showing 6 changed files with 15 additions and 10 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
**/.idea
**/*.iml
**/*.attach_pid*
target
6 changes: 6 additions & 0 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
<properties>
<flapdoodle.version>2.1.1</flapdoodle.version>
<javax.inject.version>1</javax.inject.version>
<rabbitmq-mock.version>1.0.12</rabbitmq-mock.version>
</properties>

<dependencyManagement>
Expand All @@ -48,6 +49,11 @@
<artifactId>javax.inject</artifactId>
<version>${javax.inject.version}</version>
</dependency>
<dependency>
<groupId>com.github.fridujo</groupId>
<artifactId>rabbitmq-mock</artifactId>
<version>${rabbitmq-mock.version}</version>
</dependency>
</dependencies>
</dependencyManagement>
</project>
1 change: 0 additions & 1 deletion testy-beat-box/.gitignore

This file was deleted.

9 changes: 4 additions & 5 deletions testy-beat-box/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,6 @@
<artifactId>testy-beat-box</artifactId>
<version>1.2.0-SNAPSHOT</version>

<properties>
<rabbitmq-mock.version>1.0.12</rabbitmq-mock.version>
</properties>

<dependencies>
<dependency>
<groupId>org.junit.jupiter</groupId>
Expand All @@ -30,12 +26,15 @@
<dependency>
<groupId>com.github.fridujo</groupId>
<artifactId>rabbitmq-mock</artifactId>
<version>${rabbitmq-mock.version}</version>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-databind</artifactId>
</dependency>
<dependency>
<groupId>com.google.guava</groupId>
<artifactId>guava</artifactId>
</dependency>

<!--TEST-->
<dependency>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -189,7 +189,7 @@ public ReceiverOptions getReceiverOptions(ExtensionContext context) {
* {@literal @}RegisterExtension
* WithRabbitMock wRabbitMock = WithRabbitMock.builder()
* .declareQueueAndExchange("queue-name", "exchange-queue-name")
* .declareSupplier(() - "ID" + math.random())
* .declareSupplier(() -&gt; "ID" + math.random())
* .build();
* </pre>
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

import com.fasterxml.jackson.databind.ObjectMapper;
import com.github.fridujo.rabbitmq.mock.MockConnectionFactory;
import com.google.common.collect.ImmutableList;
import com.rabbitmq.client.AMQP;
import com.rabbitmq.client.BuiltinExchangeType;
import com.rabbitmq.client.Channel;
Expand All @@ -24,7 +25,6 @@
import reactor.rabbitmq.SenderOptions;

import java.io.IOException;
import java.util.ArrayList;
import java.util.List;

/**
Expand Down Expand Up @@ -95,7 +95,7 @@ private void declareAndBindQueues(Channel channel) throws IOException {
}

private void declareConsumer(Channel channel, ExtensionContext extensionContext) {
List<Delivery> messages = new ArrayList<>();
ImmutableList.Builder<Delivery> messages = new ImmutableList.Builder<>();
try {
channel.basicConsume(queueName, true,
new DefaultConsumer(channel) {
Expand All @@ -116,7 +116,7 @@ public void handleDelivery(String consumerTag,
} catch (IOException e) {
LOGGER.error("Failure during message reception", e);
}
getStore(extensionContext).put(P_RABBIT_MESSAGE_RECEIVED, messages);
getStore(extensionContext).put(P_RABBIT_MESSAGE_RECEIVED, messages.build());
}

@Override
Expand Down

0 comments on commit ef40f5e

Please sign in to comment.