From 3dcefba4f6eefc23e7f81b6128f6fc4820a8ccb1 Mon Sep 17 00:00:00 2001 From: David Turanski Date: Fri, 4 Sep 2020 09:54:52 -0400 Subject: [PATCH] Replace deprecated code --- .../support/geode/GeodeContainerIntializer.java | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/common/function-test-support/src/main/java/org/springframework/cloud/fn/test/support/geode/GeodeContainerIntializer.java b/common/function-test-support/src/main/java/org/springframework/cloud/fn/test/support/geode/GeodeContainerIntializer.java index d3bb66ce..616984a3 100644 --- a/common/function-test-support/src/main/java/org/springframework/cloud/fn/test/support/geode/GeodeContainerIntializer.java +++ b/common/function-test-support/src/main/java/org/springframework/cloud/fn/test/support/geode/GeodeContainerIntializer.java @@ -16,6 +16,8 @@ package org.springframework.cloud.fn.test.support.geode; +import com.github.dockerjava.api.model.HealthCheck; +import com.github.dockerjava.api.model.HostConfig; import java.util.Optional; import java.util.function.Consumer; @@ -44,7 +46,8 @@ public class GeodeContainerIntializer { /** * Create, start, and perform post processing on a {@link GeodeContainer}. - * @param postProcessor a {@code Consumer} to run after the container is started. + * @param postProcessor a {@code Consumer} to run after the container is + * started. */ public GeodeContainerIntializer(Consumer postProcessor) { cacheServerPort = SocketUtils.findAvailableTcpPort(); @@ -71,11 +74,14 @@ public class GeodeContainerIntializer { private void startContainer() { // There is apparently no way to initialize Geode with random port mapping. Ports // must be the same on client and server. - Consumer cmd = e -> e.withPortBindings( - new PortBinding(Ports.Binding.bindPort(cacheServerPort), - new ExposedPort(cacheServerPort)), - new PortBinding(Ports.Binding.bindPort(locatorPort), new ExposedPort(locatorPort))); + Consumer cmd = e -> { + e.withHostConfig(new HostConfig().withPortBindings( + new PortBinding(Ports.Binding.bindPort(cacheServerPort), new ExposedPort(cacheServerPort)), + new PortBinding(Ports.Binding.bindPort(locatorPort), new ExposedPort(locatorPort)))); + }; + // Wait forever + geode.withCommand("tail", "-f", "/dev/null").withCreateContainerCmdModifier(cmd).start(); geode.execGfsh("start locator --name=Locator1 --hostname-for-clients=localhost --port=" + locatorPort);