Skip to content

Commit

Permalink
other(rabbitMQ): add integration test for rabbitMQ to verify message …
Browse files Browse the repository at this point in the history
…integrity (fornatting)
  • Loading branch information
mathias-vandaele committed Jul 16, 2024
1 parent 4546634 commit 8ccdcb0
Showing 1 changed file with 15 additions and 15 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -143,12 +143,12 @@ void publishMessageWithOutboundConnectorAndConsumeMessageWithInboundConnector()
OutboundConnectorFunction function = new RabbitMqFunction();

RabbitMqOutboundRouting routing =
new RabbitMqOutboundRouting(
Routing.EXCHANGE,
Routing.ROUTING_KEY,
Routing.VIRTUAL_HOST,
rabbitMq.getHost(),
rabbitMq.getAmqpPort().toString());
new RabbitMqOutboundRouting(
Routing.EXCHANGE,
Routing.ROUTING_KEY,
Routing.VIRTUAL_HOST,
rabbitMq.getHost(),
rabbitMq.getAmqpPort().toString());

// '“' and '”' are special unicode char.
RabbitMqMessage messageOutbound =
Expand All @@ -158,10 +158,10 @@ void publishMessageWithOutboundConnectorAndConsumeMessageWithInboundConnector()

var json = ObjectMapperSupplier.instance().writeValueAsString(request);
OutboundConnectorContext context =
OutboundConnectorContextBuilder.create()
.validation(new DefaultValidationProvider())
.variables(json)
.build();
OutboundConnectorContextBuilder.create()
.validation(new DefaultValidationProvider())
.variables(json)
.build();

// When
var result = function.execute(context);
Expand All @@ -171,7 +171,6 @@ void publishMessageWithOutboundConnectorAndConsumeMessageWithInboundConnector()
RabbitMqResult castedResult = (RabbitMqResult) result;
assertEquals("success", castedResult.getStatusResult());


// Given
RabbitMqExecutable executable = new RabbitMqExecutable();

Expand All @@ -180,12 +179,12 @@ void publishMessageWithOutboundConnectorAndConsumeMessageWithInboundConnector()
properties.setQueueName(ActualValue.QUEUE_NAME);

FactoryRoutingData routingData =
new FactoryRoutingData(
Routing.VIRTUAL_HOST, rabbitMq.getHost(), rabbitMq.getAmqpPort().toString());
new FactoryRoutingData(
Routing.VIRTUAL_HOST, rabbitMq.getHost(), rabbitMq.getAmqpPort().toString());
properties.setRouting(routingData);

TestInboundConnectorContext contextInbound =
InboundConnectorContextBuilder.create().properties(properties).build();
InboundConnectorContextBuilder.create().properties(properties).build();

// When
executable.activate(contextInbound);
Expand All @@ -195,7 +194,8 @@ void publishMessageWithOutboundConnectorAndConsumeMessageWithInboundConnector()
// Then
assertEquals(1, contextInbound.getCorrelations().size());
assertInstanceOf(RabbitMqInboundResult.class, contextInbound.getCorrelations().get(0));
RabbitMqInboundResult castedResultInbound = (RabbitMqInboundResult) contextInbound.getCorrelations().get(0);
RabbitMqInboundResult castedResultInbound =
(RabbitMqInboundResult) contextInbound.getCorrelations().get(0);
RabbitMqInboundMessage messageInbound = castedResultInbound.message();
assertInstanceOf(Map.class, messageInbound.body());
Map<String, Object> body = (Map<String, Object>) messageInbound.body();
Expand Down

0 comments on commit 8ccdcb0

Please sign in to comment.