diff --git a/applications/source/rabbit-source/src/test/java/org/springframework/cloud/stream/app/source/rabbit/RabbitSourceListenerTests.java b/applications/source/rabbit-source/src/test/java/org/springframework/cloud/stream/app/source/rabbit/RabbitSourceListenerTests.java index d736790da..bd3169ca9 100644 --- a/applications/source/rabbit-source/src/test/java/org/springframework/cloud/stream/app/source/rabbit/RabbitSourceListenerTests.java +++ b/applications/source/rabbit-source/src/test/java/org/springframework/cloud/stream/app/source/rabbit/RabbitSourceListenerTests.java @@ -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; @@ -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()); diff --git a/full-build-test.sh b/full-build-test.sh index 6e321fb2f..6ce7b855d 100755 --- a/full-build-test.sh +++ b/full-build-test.sh @@ -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" diff --git a/quick-compile.sh b/quick-compile.sh index cc64d8ed4..7127efc7f 100755 --- a/quick-compile.sh +++ b/quick-compile.sh @@ -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