Revert "Fix the integrations tests in ribbon-client-service"

This reverts commit 3e89177d
This commit is contained in:
Ali Dehghani 2020-08-31 01:09:36 +04:30
parent 50563c7f63
commit 5bcf243fdb
4 changed files with 5 additions and 28 deletions

View File

@ -9,6 +9,7 @@ weather-service:
ribbon:
eureka:
enabled: false
listOfServers: http://localhost:8021, http://localhost:8022
ServerListRefreshInterval: 5000
MaxAutoRetries: 3
MaxAutoRetriesNextServer: 1

View File

@ -10,7 +10,6 @@ import org.springframework.boot.web.server.LocalServerPort;
import org.springframework.context.ConfigurableApplicationContext;
import org.springframework.http.ResponseEntity;
import static com.baeldung.spring.cloud.ribbon.retry.TestUtils.setUpServices;
import static org.junit.jupiter.api.Assertions.assertTrue;
@SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT, classes = RibbonClientApp.class)
@ -25,10 +24,8 @@ public class RibbonRetryFailureIntegrationTest {
@BeforeAll
public static void setup() {
weatherServiceInstance1 = startApp(0);
weatherServiceInstance2 = startApp(0);
setUpServices(weatherServiceInstance1, weatherServiceInstance2);
weatherServiceInstance1 = startApp(8021);
weatherServiceInstance2 = startApp(8022);
}
@AfterAll

View File

@ -10,7 +10,6 @@ import org.springframework.boot.web.server.LocalServerPort;
import org.springframework.context.ConfigurableApplicationContext;
import org.springframework.http.ResponseEntity;
import static com.baeldung.spring.cloud.ribbon.retry.TestUtils.setUpServices;
import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertTrue;
@ -26,10 +25,8 @@ public class RibbonRetrySuccessIntegrationTest {
@BeforeAll
public static void setup() {
weatherServiceInstance1 = startApp(0);
weatherServiceInstance2 = startApp(0);
setUpServices(weatherServiceInstance1, weatherServiceInstance2);
weatherServiceInstance1 = startApp(8021);
weatherServiceInstance2 = startApp(8022);
}
private static ConfigurableApplicationContext startApp(int port) {

View File

@ -1,18 +0,0 @@
package com.baeldung.spring.cloud.ribbon.retry;
import org.springframework.boot.web.servlet.context.AnnotationConfigServletWebServerApplicationContext;
import org.springframework.context.ConfigurableApplicationContext;
class TestUtils {
static int getWebAppPort(ConfigurableApplicationContext ctx) {
return ((AnnotationConfigServletWebServerApplicationContext) ctx).getWebServer().getPort();
}
static void setUpServices(ConfigurableApplicationContext service1, ConfigurableApplicationContext service2) {
int port1 = getWebAppPort(service1);
int port2 = getWebAppPort(service2);
String serversList = String.format("http://localhost:%d, http://localhost:%d", port1, port2);
System.setProperty("weather-service.ribbon.listOfServers", serversList);
}
}