diff --git a/applications/sink/geode-sink/pom.xml b/applications/sink/geode-sink/pom.xml
index 9aeabee5..d459d16e 100644
--- a/applications/sink/geode-sink/pom.xml
+++ b/applications/sink/geode-sink/pom.xml
@@ -35,8 +35,9 @@
- org.springframework.cloud.fn
- function-test-support
+ org.springframework.data
+ spring-data-geode-test
+ ${spring-data-geode-test.version}
test
diff --git a/applications/sink/geode-sink/src/test/java/org/springframework/cloud/stream/app/sink/geode/GeodeSinkTests.java b/applications/sink/geode-sink/src/test/java/org/springframework/cloud/stream/app/sink/geode/GeodeSinkTests.java
index 10ff2277..7f5435ff 100644
--- a/applications/sink/geode-sink/src/test/java/org/springframework/cloud/stream/app/sink/geode/GeodeSinkTests.java
+++ b/applications/sink/geode-sink/src/test/java/org/springframework/cloud/stream/app/sink/geode/GeodeSinkTests.java
@@ -16,24 +16,27 @@
package org.springframework.cloud.stream.app.sink.geode;
+import java.io.IOException;
+
+import com.fasterxml.jackson.databind.ObjectMapper;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.apache.geode.cache.Region;
import org.apache.geode.pdx.PdxInstance;
+import org.junit.jupiter.api.AfterAll;
import org.junit.jupiter.api.BeforeAll;
import org.junit.jupiter.api.Tag;
import org.junit.jupiter.api.Test;
-import org.testcontainers.shaded.com.fasterxml.jackson.databind.ObjectMapper;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.test.context.runner.ApplicationContextRunner;
import org.springframework.cloud.fn.consumer.geode.GeodeConsumerConfiguration;
-import org.springframework.cloud.fn.test.support.geode.GeodeContainer;
-import org.springframework.cloud.fn.test.support.geode.GeodeContainerIntializer;
+import org.springframework.cloud.stream.app.sink.geodeserver.GeodeServerTestConfiguration;
import org.springframework.cloud.stream.binder.test.InputDestination;
import org.springframework.cloud.stream.binder.test.TestChannelBinderConfiguration;
import org.springframework.context.annotation.Import;
+import org.springframework.data.gemfire.tests.integration.ForkingClientServerIntegrationTestsSupport;
import org.springframework.messaging.support.GenericMessage;
import static org.assertj.core.api.Assertions.assertThat;
@@ -43,22 +46,22 @@ public class GeodeSinkTests {
private static ApplicationContextRunner applicationContextRunner;
- private static GeodeContainer geode;
-
private ObjectMapper objectMapper = new ObjectMapper();
@BeforeAll
- static void setup() {
- GeodeContainerIntializer initializer = new GeodeContainerIntializer(
- geodeContainer -> {
- geodeContainer.connectAndExecGfsh("create region --name=Stocks --type=REPLICATE");
- });
+ static void setup() throws IOException {
+ ForkingClientServerIntegrationTestsSupport.startGemFireServer(
+ GeodeServerTestConfiguration.class);
applicationContextRunner = new ApplicationContextRunner()
.withUserConfiguration(
TestChannelBinderConfiguration.getCompleteConfiguration(GeodeSinkTestApplication.class));
+ }
- geode = initializer.geodeContainer();
+ @AfterAll
+ static void stopServer() {
+ ForkingClientServerIntegrationTestsSupport.stopGemFireServer();
+ ForkingClientServerIntegrationTestsSupport.clearCacheServerPortAndPoolPortProperties();
}
@Test
@@ -70,7 +73,7 @@ public class GeodeSinkTests {
"geode.consumer.json=true",
"geode.consumer.key-expression=payload.getField('symbol')",
"geode.pool.connectType=server",
- "geode.pool.hostAddresses=" + "localhost:" + geode.getCacheServerPort())
+ "geode.pool.hostAddresses=" + "localhost:" + System.getProperty("spring.data.gemfire.cache.server.port"))
.run(context -> {
InputDestination inputDestination = context.getBean(InputDestination.class);
@@ -92,7 +95,7 @@ public class GeodeSinkTests {
"geode.region.regionName=Stocks",
"geode.consumer.key-expression='key'",
"geode.pool.connectType=server",
- "geode.pool.hostAddresses=" + "localhost:" + geode.getCacheServerPort())
+ "geode.pool.hostAddresses=" + "localhost:" + System.getProperty("spring.data.gemfire.cache.server.port"))
.run(context -> {
InputDestination inputDestination = context.getBean(InputDestination.class);
inputDestination.send(new GenericMessage<>("value"));
diff --git a/applications/sink/geode-sink/src/test/java/org/springframework/cloud/stream/app/sink/geodeserver/GeodeServerTestConfiguration.java b/applications/sink/geode-sink/src/test/java/org/springframework/cloud/stream/app/sink/geodeserver/GeodeServerTestConfiguration.java
new file mode 100644
index 00000000..82664ea9
--- /dev/null
+++ b/applications/sink/geode-sink/src/test/java/org/springframework/cloud/stream/app/sink/geodeserver/GeodeServerTestConfiguration.java
@@ -0,0 +1,46 @@
+/*
+ * Copyright 2020-2020 the original author or authors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * https://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.springframework.cloud.stream.app.sink.geodeserver;
+
+import org.apache.geode.cache.GemFireCache;
+
+import org.springframework.context.annotation.AnnotationConfigApplicationContext;
+import org.springframework.context.annotation.Bean;
+import org.springframework.data.gemfire.ReplicatedRegionFactoryBean;
+import org.springframework.data.gemfire.config.annotation.CacheServerApplication;
+
+@CacheServerApplication
+public class GeodeServerTestConfiguration {
+
+ public static void main(String[] args) {
+
+ AnnotationConfigApplicationContext applicationContext =
+ new AnnotationConfigApplicationContext(GeodeServerTestConfiguration.class);
+
+ applicationContext.registerShutdownHook();
+ }
+
+ @Bean("Stocks")
+ public ReplicatedRegionFactoryBean