From 9e3c735879388af7f39456972ed516d3518d291f Mon Sep 17 00:00:00 2001 From: Anastasios Ioannidis <121166333+anastasiosioannidis@users.noreply.github.com> Date: Mon, 6 Nov 2023 17:38:16 +0200 Subject: [PATCH] JAVA-22208 Fix port to 1030,1031 for jenkins (#15100) --- ...oadBalancerBooksClientIntegrationTest.java | 6 +++--- .../client/LoadBalancerIntegrationTest.java | 6 +++--- .../spring/cloud/client/TestConfig.java | 4 ++-- .../spring/cloud/client/WireMockConfig.java | 4 ++-- ...application-spring-cloud-balancer-test.yml | 19 ------------------- .../src/test/resources/application-test.yml | 4 ++-- 6 files changed, 12 insertions(+), 31 deletions(-) delete mode 100644 spring-cloud-modules/spring-cloud-eureka/spring-cloud-eureka-feign-client-integration-test/src/test/resources/application-spring-cloud-balancer-test.yml diff --git a/spring-cloud-modules/spring-cloud-eureka/spring-cloud-eureka-feign-client-integration-test/src/test/java/com/baeldung/spring/cloud/client/LoadBalancerBooksClientIntegrationTest.java b/spring-cloud-modules/spring-cloud-eureka/spring-cloud-eureka-feign-client-integration-test/src/test/java/com/baeldung/spring/cloud/client/LoadBalancerBooksClientIntegrationTest.java index 5690c24d77..a70ae1ee22 100644 --- a/spring-cloud-modules/spring-cloud-eureka/spring-cloud-eureka-feign-client-integration-test/src/test/java/com/baeldung/spring/cloud/client/LoadBalancerBooksClientIntegrationTest.java +++ b/spring-cloud-modules/spring-cloud-eureka/spring-cloud-eureka-feign-client-integration-test/src/test/java/com/baeldung/spring/cloud/client/LoadBalancerBooksClientIntegrationTest.java @@ -63,12 +63,12 @@ class LoadBalancerBooksClientIntegrationTest { String serviceId = "books-service"; RoundRobinLoadBalancer loadBalancer = new RoundRobinLoadBalancer(ServiceInstanceListSuppliers - .toProvider(serviceId, instance(serviceId, "localhost", false), instance(serviceId, "localhost", true)), + .toProvider(serviceId, instance(serviceId, "localhost", 1030, false), instance(serviceId, "localhost", 1031, true)), serviceId, -1); } - private static DefaultServiceInstance instance(String serviceId, String host, boolean secure) { - return new DefaultServiceInstance(serviceId, serviceId, host, 80, secure); + private static DefaultServiceInstance instance(String serviceId, String host, int port, boolean secure) { + return new DefaultServiceInstance(serviceId, serviceId, host, port, secure); } @Test diff --git a/spring-cloud-modules/spring-cloud-eureka/spring-cloud-eureka-feign-client-integration-test/src/test/java/com/baeldung/spring/cloud/client/LoadBalancerIntegrationTest.java b/spring-cloud-modules/spring-cloud-eureka/spring-cloud-eureka-feign-client-integration-test/src/test/java/com/baeldung/spring/cloud/client/LoadBalancerIntegrationTest.java index eee4e7b860..9761b4eb64 100644 --- a/spring-cloud-modules/spring-cloud-eureka/spring-cloud-eureka-feign-client-integration-test/src/test/java/com/baeldung/spring/cloud/client/LoadBalancerIntegrationTest.java +++ b/spring-cloud-modules/spring-cloud-eureka/spring-cloud-eureka-feign-client-integration-test/src/test/java/com/baeldung/spring/cloud/client/LoadBalancerIntegrationTest.java @@ -80,13 +80,13 @@ class LoadBalancerIntegrationTest { void staticConfigurationWorks() { String serviceId = "test-book-service"; RoundRobinLoadBalancer loadBalancer = new RoundRobinLoadBalancer(ServiceInstanceListSuppliers - .toProvider(serviceId, instance(serviceId, "bookservice1", false), instance(serviceId, "bookservice2", false)), + .toProvider(serviceId, instance(serviceId, "bookservice1", 1030, false), instance(serviceId, "bookservice2", 1031, false)), serviceId, -1); assertLoadBalancer(loadBalancer, Arrays.asList("bookservice1", "bookservice2")); } - private static DefaultServiceInstance instance(String serviceId, String host, boolean secure) { - return new DefaultServiceInstance(serviceId, serviceId, host, 80, secure); + private static DefaultServiceInstance instance(String serviceId, String host, int port, boolean secure) { + return new DefaultServiceInstance(serviceId, serviceId, host, port, secure); } @EnableAutoConfiguration diff --git a/spring-cloud-modules/spring-cloud-eureka/spring-cloud-eureka-feign-client-integration-test/src/test/java/com/baeldung/spring/cloud/client/TestConfig.java b/spring-cloud-modules/spring-cloud-eureka/spring-cloud-eureka-feign-client-integration-test/src/test/java/com/baeldung/spring/cloud/client/TestConfig.java index b3770721b1..375c945054 100644 --- a/spring-cloud-modules/spring-cloud-eureka/spring-cloud-eureka-feign-client-integration-test/src/test/java/com/baeldung/spring/cloud/client/TestConfig.java +++ b/spring-cloud-modules/spring-cloud-eureka/spring-cloud-eureka-feign-client-integration-test/src/test/java/com/baeldung/spring/cloud/client/TestConfig.java @@ -14,11 +14,11 @@ public class TestConfig { @Bean(initMethod = "start", destroyMethod = "stop") public WireMockServer mockBooksService() { - return new WireMockServer(options().port(80)); + return new WireMockServer(options().port(1030)); } @Bean(name="secondMockBooksService", initMethod = "start", destroyMethod = "stop") public WireMockServer secondBooksMockService() { - return new WireMockServer(options().port(81)); + return new WireMockServer(options().port(1031)); } } diff --git a/spring-cloud-modules/spring-cloud-eureka/spring-cloud-eureka-feign-client-integration-test/src/test/java/com/baeldung/spring/cloud/client/WireMockConfig.java b/spring-cloud-modules/spring-cloud-eureka/spring-cloud-eureka-feign-client-integration-test/src/test/java/com/baeldung/spring/cloud/client/WireMockConfig.java index 3d4f2822f4..a41faa9c5c 100644 --- a/spring-cloud-modules/spring-cloud-eureka/spring-cloud-eureka-feign-client-integration-test/src/test/java/com/baeldung/spring/cloud/client/WireMockConfig.java +++ b/spring-cloud-modules/spring-cloud-eureka/spring-cloud-eureka-feign-client-integration-test/src/test/java/com/baeldung/spring/cloud/client/WireMockConfig.java @@ -11,11 +11,11 @@ public class WireMockConfig { @Bean(initMethod = "start", destroyMethod = "stop") public WireMockServer mockBooksService() { - return new WireMockServer(80); + return new WireMockServer(1030); } @Bean(initMethod = "start", destroyMethod = "stop") public WireMockServer mockBooksService2() { - return new WireMockServer(81); + return new WireMockServer(1031); } } diff --git a/spring-cloud-modules/spring-cloud-eureka/spring-cloud-eureka-feign-client-integration-test/src/test/resources/application-spring-cloud-balancer-test.yml b/spring-cloud-modules/spring-cloud-eureka/spring-cloud-eureka-feign-client-integration-test/src/test/resources/application-spring-cloud-balancer-test.yml deleted file mode 100644 index ad11d46ae8..0000000000 --- a/spring-cloud-modules/spring-cloud-eureka/spring-cloud-eureka-feign-client-integration-test/src/test/resources/application-spring-cloud-balancer-test.yml +++ /dev/null @@ -1,19 +0,0 @@ -eureka: - client: - enabled: false - -spring: - application: - name: books-service - cloud: - loadbalancer: - ribbon: - enabled: false - discovery: - client: - simple: - instances: - books-service[0]: - uri: http://localhost:80 - books-service[1]: - uri: http://localhost:81 \ No newline at end of file diff --git a/spring-cloud-modules/spring-cloud-eureka/spring-cloud-eureka-feign-client-integration-test/src/test/resources/application-test.yml b/spring-cloud-modules/spring-cloud-eureka/spring-cloud-eureka-feign-client-integration-test/src/test/resources/application-test.yml index 231d45004f..6bd5b8efc7 100644 --- a/spring-cloud-modules/spring-cloud-eureka/spring-cloud-eureka-feign-client-integration-test/src/test/resources/application-test.yml +++ b/spring-cloud-modules/spring-cloud-eureka/spring-cloud-eureka-feign-client-integration-test/src/test/resources/application-test.yml @@ -14,6 +14,6 @@ spring: simple: instances: books-service[0]: - uri: http://localhost:80 + uri: http://localhost:1030 books-service[1]: - uri: http://localhost:81 + uri: http://localhost:1031