Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,12 @@
import org.testcontainers.containers.RabbitMQContainer;

import org.springframework.amqp.core.AcknowledgeMode;
import org.springframework.amqp.core.Binding;
import org.springframework.amqp.core.BindingBuilder;
import org.springframework.amqp.core.FanoutExchange;
import org.springframework.amqp.core.Queue;
import org.springframework.amqp.rabbit.connection.CachingConnectionFactory;
import org.springframework.amqp.rabbit.core.RabbitAdmin;
import org.springframework.amqp.rabbit.core.RabbitTemplate;
import org.springframework.amqp.rabbit.listener.SimpleMessageListenerContainer;
import org.springframework.amqp.support.AmqpHeaders;
Expand Down Expand Up @@ -54,14 +60,31 @@ public class RabbitSourceListenerTests {
RabbitMQContainer rabbitmq = new RabbitMQContainer("rabbitmq:management");
rabbitmq.start();

CachingConnectionFactory connectionFactory = new CachingConnectionFactory();
connectionFactory.setHost(rabbitmq.getHost());
connectionFactory.setPort(rabbitmq.getAmqpPort());
connectionFactory.setUsername(rabbitmq.getAdminUsername());
connectionFactory.setPassword(rabbitmq.getAdminPassword());

try {
rabbitmq.execInContainer("rabbitmqadmin", "declare", "queue", "name=scsapp-testq", "auto_delete=false", "durable=false");
rabbitmq.execInContainer("rabbitmqadmin", "declare", "queue", "name=scsapp-testq2", "auto_delete=false", "durable=false");
rabbitmq.execInContainer("rabbitmqadmin", "declare", "exchange", "name=scsapp-testex", "type=fanout");
rabbitmq.execInContainer("rabbitmqadmin", "declare", "binding", "source=scsapp-testex", "destination=scsapp-testq");
RabbitAdmin admin = new RabbitAdmin(connectionFactory);

Queue testq = new Queue("scsapp-testq", false, false, false);
Queue testq2 = new Queue("scsapp-testq2", false, false, false);
admin.declareQueue(testq);
admin.declareQueue(testq2);

FanoutExchange exchange = new FanoutExchange("scsapp-testex", false, false);
admin.declareExchange(exchange);

Binding binding = BindingBuilder.bind(testq).to(exchange);
admin.declareBinding(binding);
}
catch (Exception ex) {
throw new IllegalStateException(ex);
throw new IllegalStateException("Failed to create RabbitMQ test infrastructure", ex);
}
finally {
connectionFactory.destroy();
}

System.setProperty("spring.rabbitmq.port", rabbitmq.getAmqpPort().toString());
Expand Down
5 changes: 3 additions & 2 deletions full-build-test.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
#!/usr/bin/env bash
SCDIR=$(dirname "$(readlink -f "${BASH_SOURCE[0]}")")
SCDIR=$(realpath $SCDIR)
$SCDIR/build-core.sh "-T 0.5C install -Psnapshot -Pintegration"
$SCDIR/build-folder.sh ./applications/processor,./applications/sink,./applications/source,./applications/stream-applications-integration-tests,stream-applications-release-train "-T 0.5C install -Psnapshot -Pintegration"
: "${STREAM_APPS_VERSION:=$($SCDIR/mvn-get-version.sh)}"
$SCDIR/build-core.sh "-T 0.5C install -Psnapshot -Pintegration -Dspring.cloud.stream.applications.version=$STREAM_APPS_VERSION"
$SCDIR/build-folder.sh ./applications/processor,./applications/sink,./applications/source,./applications/stream-applications-integration-tests,stream-applications-release-train "-T 0.5C install -Psnapshot -Pintegration -Dspring.cloud.stream.applications.version=$STREAM_APPS_VERSION"
2 changes: 1 addition & 1 deletion quick-compile.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@ SCDIR=$(dirname "$(readlink -f "${BASH_SOURCE[0]}")")
SCDIR=$(realpath $SCDIR)
export MAVEN_THREADS=1C
export LOCAL=true
$SCDIR/mvnw install -DskipTests -T 1C -P-snapshot -P-integration -DskipTests
$SCDIR/mvnw clean install -DskipTests -T 1C -P-snapshot -P-integration -DskipTests
Loading