diff --git a/config-retry/pom.xml b/config-retry/pom.xml index 1f852d4..648a74f 100644 --- a/config-retry/pom.xml +++ b/config-retry/pom.xml @@ -69,6 +69,11 @@ org.springframework.boot spring-boot-starter-aop + + org.springframework.cloud + spring-cloud-test-support + test + org.springframework.cloud spring-cloud-config-server diff --git a/config-retry/src/test/java/demo/ConfigClientRetryApplicationTests.java b/config-retry/src/test/java/demo/ConfigClientRetryApplicationTests.java index cdb9435..b42a868 100644 --- a/config-retry/src/test/java/demo/ConfigClientRetryApplicationTests.java +++ b/config-retry/src/test/java/demo/ConfigClientRetryApplicationTests.java @@ -1,24 +1,22 @@ package demo; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertTrue; -import static org.junit.Assert.fail; - import java.lang.reflect.Method; import java.util.Map; import java.util.concurrent.Executors; +import apps.ConfigServer; import org.aopalliance.intercept.MethodInterceptor; import org.junit.AfterClass; import org.junit.BeforeClass; -import org.junit.Ignore; import org.junit.Test; import org.junit.runner.RunWith; + import org.springframework.aop.framework.Advised; import org.springframework.aop.support.AopUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.test.context.SpringBootTest; import org.springframework.cloud.config.client.ConfigServicePropertySourceLocator; +import org.springframework.cloud.test.TestSocketUtils; import org.springframework.context.ConfigurableApplicationContext; import org.springframework.retry.annotation.AnnotationAwareRetryOperationsInterceptor; import org.springframework.retry.backoff.ExponentialBackOffPolicy; @@ -27,9 +25,9 @@ import org.springframework.retry.support.RetryTemplate; import org.springframework.test.annotation.DirtiesContext; import org.springframework.test.context.junit4.SpringRunner; import org.springframework.test.util.ReflectionTestUtils; -import org.springframework.util.SocketUtils; -import apps.ConfigServer; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertTrue; @RunWith(SpringRunner.class) // Explicitly enable config client because test classpath has config server on it @@ -45,7 +43,7 @@ public class ConfigClientRetryApplicationTests { @BeforeClass public static void delayConfigServer() { - int port = SocketUtils.findAvailableTcpPort(); + int port = TestSocketUtils.findAvailableTcpPort(); System.setProperty("spring.cloud.config.uri", "http://localhost:" + port); Executors.newSingleThreadExecutor().execute(new Runnable() { @Override