diff --git a/stream-applications-integration-tests/README.adoc b/stream-applications-integration-tests/README.adoc index a3596db..361577f 100644 --- a/stream-applications-integration-tests/README.adoc +++ b/stream-applications-integration-tests/README.adoc @@ -17,20 +17,19 @@ The tests use following patterns: == Source To test a source, we may require some application specific setup or event to trigger the source. For example, the jdbc source needs some data in the database to which it is listening. -Then use an `outputPayloadVerifier` or `outputMessageVerifier` to verify the output. +Then use an `OutputMatcher` to verify the output. == Sink -To test a sink, we need to publish a message to its input. Simply use the provided KafkaTemplate or RabbitTemplate beans. +To test a sink, we need to publish a message to its input. Simply use the provided TestTopicSender. Then we need to verify the result by checking the sink's external resource. == Processor -To test a processor we publish a message and use an `outputPayloadVerifier` or `outputMessageVerifier` to verify the output. +To test a processor we publish a message and use an `OutputMatcher` to verify the output. == Configuration See link:src/test/java/org/springframework/cloud/stream/apps/integration/test/common/Configuration.java[Configuration] for configuration options. These tests use Spring but not boot currently. The most important setting is the image versions to test. -By default, we use `latest`. To override it, set the System property, e.g., ./mvnw clean test -Dspring.cloud.stream.applications.version=3.0.0-M3 diff --git a/stream-applications-integration-tests/src/test/java/org/springframework/cloud/stream/apps/integration/test/source/geode/GeodeSourceTests.java b/stream-applications-integration-tests/src/test/java/org/springframework/cloud/stream/apps/integration/test/source/geode/GeodeSourceTests.java index c75827b..4c29043 100644 --- a/stream-applications-integration-tests/src/test/java/org/springframework/cloud/stream/apps/integration/test/source/geode/GeodeSourceTests.java +++ b/stream-applications-integration-tests/src/test/java/org/springframework/cloud/stream/apps/integration/test/source/geode/GeodeSourceTests.java @@ -30,7 +30,6 @@ import org.apache.geode.cache.client.ClientCache; import org.apache.geode.cache.client.ClientCacheFactory; import org.apache.geode.cache.client.ClientRegionShortcut; import org.junit.jupiter.api.AfterAll; -import org.junit.jupiter.api.AfterEach; import org.junit.jupiter.api.Test; import org.testcontainers.images.builder.ImageFromDockerfile; import org.testcontainers.junit.jupiter.Container; @@ -42,7 +41,6 @@ import org.springframework.cloud.stream.app.test.integration.OutputMatcher; import org.springframework.cloud.stream.app.test.integration.StreamAppContainer; import org.springframework.cloud.stream.app.test.integration.StreamAppContainerTestUtils; import org.springframework.cloud.stream.app.test.integration.rabbitmq.RabbitMQStreamAppContainer; -import org.springframework.context.ConfigurableApplicationContext; import static org.awaitility.Awaitility.await; import static org.springframework.cloud.stream.apps.integration.test.common.Configuration.DEFAULT_DURATION; @@ -63,9 +61,6 @@ public abstract class GeodeSourceTests { @Autowired private OutputMatcher outputMatcher; - @Autowired - private ConfigurableApplicationContext context; - @Container private static final GeodeContainer geode = (GeodeContainer) new GeodeContainer(new ImageFromDockerfile() .withFileFromClasspath("Dockerfile", "geode/Dockerfile") @@ -107,32 +102,20 @@ public abstract class GeodeSourceTests { @Test void test() throws InterruptedException { await().atMost(Duration.ofMinutes(2)).until(logMatcher.matches()); + if (source instanceof RabbitMQStreamAppContainer) { + // TODO: Some race condition. Need to investigate + Thread.sleep(10000); + } String random = UUID.randomUUID().toString(); - clientRegion.put(random, random); - if (source instanceof RabbitMQStreamAppContainer) { - // Thread.sleep(30); - } - else { - return; - } - await().atMost(Duration.ofSeconds(30)) - .until(outputMatcher.payloadMatches((String s) -> { - System.out.println("!!!!!!!!!!!!!Matching on " + s); - return s.contains(random); - })); - } - - @AfterEach - void clear() { + .until(outputMatcher.payloadMatches((String s) -> s.contains(random))); } @AfterAll static void cleanup() { source.stop(); clientCache.close(); - geode.stop(); } } diff --git a/stream-applications-integration-tests/src/test/java/org/springframework/cloud/stream/apps/integration/test/source/geode/RabbitMQGeodeSourceTests.java b/stream-applications-integration-tests/src/test/java/org/springframework/cloud/stream/apps/integration/test/source/geode/RabbitMQGeodeSourceTests.java index da0204a..1a788b3 100644 --- a/stream-applications-integration-tests/src/test/java/org/springframework/cloud/stream/apps/integration/test/source/geode/RabbitMQGeodeSourceTests.java +++ b/stream-applications-integration-tests/src/test/java/org/springframework/cloud/stream/apps/integration/test/source/geode/RabbitMQGeodeSourceTests.java @@ -17,7 +17,6 @@ package org.springframework.cloud.stream.apps.integration.test.source.geode; import org.junit.jupiter.api.BeforeAll; -import org.junit.jupiter.api.Disabled; import org.springframework.cloud.stream.app.test.integration.rabbitmq.RabbitMQConfig; import org.springframework.cloud.stream.app.test.integration.rabbitmq.RabbitMQStreamAppTest; @@ -25,7 +24,6 @@ import org.springframework.cloud.stream.app.test.integration.rabbitmq.RabbitMQSt import static org.springframework.cloud.stream.apps.integration.test.common.Configuration.VERSION; @RabbitMQStreamAppTest -@Disabled("Some race condition when package tests run together") class RabbitMQGeodeSourceTests extends GeodeSourceTests { @BeforeAll