From dab12fdbae570d545c1c5b1862903196d7eb1c72 Mon Sep 17 00:00:00 2001 From: Fedor Dudinskiy Date: Tue, 31 May 2022 11:09:53 +0200 Subject: [PATCH] Adapt Stork configs to the new style[1] [1] https://github.com/quarkusio/quarkus/pull/24184 NB: Changes in OCP tests were not tested, see @DisabledOnQuarkusVersion annotation for explanation --- .../quarkus/ts/stork/PongReplicaResource.java | 6 +-- .../io/quarkus/ts/stork/PongResource.java | 6 +-- .../io/quarkus/ts/stork/PungResource.java | 6 +-- .../stork/NativeStorkServiceDiscoveryIT.java | 14 ++++--- .../OpenShiftStorkServiceDiscoveryIT.java | 16 ++++---- .../quarkus/ts/stork/StorkLoadBalancerIT.java | 38 ++++++++++--------- 6 files changed, 45 insertions(+), 41 deletions(-) diff --git a/service-discovery/stork/src/main/java/io/quarkus/ts/stork/PongReplicaResource.java b/service-discovery/stork/src/main/java/io/quarkus/ts/stork/PongReplicaResource.java index 9b7fa91d0..6e0964164 100644 --- a/service-discovery/stork/src/main/java/io/quarkus/ts/stork/PongReplicaResource.java +++ b/service-discovery/stork/src/main/java/io/quarkus/ts/stork/PongReplicaResource.java @@ -21,15 +21,15 @@ public class PongReplicaResource { private static final String DEFAULT_PONG_REPLICA_RESPONSE = "pongReplica"; - @ConfigProperty(name = "stork.pong-replica.service-discovery.consul-host", defaultValue = "localhost") + @ConfigProperty(name = "quarkus.stork.pong-replica.service-discovery.consul-host", defaultValue = "localhost") String host; - @ConfigProperty(name = "stork.pong-replica.service-discovery.consul-port", defaultValue = "8500") + @ConfigProperty(name = "quarkus.stork.pong-replica.service-discovery.consul-port", defaultValue = "8500") String port; @ConfigProperty(name = "pong-replica-service-port", defaultValue = "8080") String pongPort; @ConfigProperty(name = "pong-replica-service-host", defaultValue = "localhost") String pongHost; - @ConfigProperty(name = "stork.pong-replica.service-discovery", defaultValue = "consul") + @ConfigProperty(name = "quarkus.stork.pong-replica.service-discovery.type", defaultValue = "consul") String serviceDiscoveryType; public void init(@Observes StartupEvent ev, Vertx vertx) { diff --git a/service-discovery/stork/src/main/java/io/quarkus/ts/stork/PongResource.java b/service-discovery/stork/src/main/java/io/quarkus/ts/stork/PongResource.java index 67b6d6076..3560dfc9f 100644 --- a/service-discovery/stork/src/main/java/io/quarkus/ts/stork/PongResource.java +++ b/service-discovery/stork/src/main/java/io/quarkus/ts/stork/PongResource.java @@ -24,15 +24,15 @@ public class PongResource { private static final String HEADER_ID = "x-id"; private String instanceUniqueId; - @ConfigProperty(name = "stork.pong.service-discovery.consul-host", defaultValue = "localhost") + @ConfigProperty(name = "quarkus.stork.pong.service-discovery.consul-host", defaultValue = "localhost") String host; - @ConfigProperty(name = "stork.pong.service-discovery.consul-port", defaultValue = "8500") + @ConfigProperty(name = "quarkus.stork.pong.service-discovery.consul-port", defaultValue = "8500") String port; @ConfigProperty(name = "pong-service-port", defaultValue = "8080") String pongPort; @ConfigProperty(name = "pong-service-host", defaultValue = "localhost") String pongHost; - @ConfigProperty(name = "stork.pong.service-discovery", defaultValue = "consul") + @ConfigProperty(name = "quarkus.stork.pong.service-discovery.type", defaultValue = "consul") String serviceDiscoveryType; public void init(@Observes StartupEvent ev, Vertx vertx) { diff --git a/service-discovery/stork/src/main/java/io/quarkus/ts/stork/PungResource.java b/service-discovery/stork/src/main/java/io/quarkus/ts/stork/PungResource.java index 60f588be2..422d41e27 100644 --- a/service-discovery/stork/src/main/java/io/quarkus/ts/stork/PungResource.java +++ b/service-discovery/stork/src/main/java/io/quarkus/ts/stork/PungResource.java @@ -17,15 +17,15 @@ @RouteBase(path = "/pung", produces = MediaType.TEXT_PLAIN) public class PungResource { - @ConfigProperty(name = "stork.pung.service-discovery.consul-host", defaultValue = "localhost") + @ConfigProperty(name = "quarkus.stork.pung.service-discovery.consul-host", defaultValue = "localhost") String host; - @ConfigProperty(name = "stork.pung.service-discovery.consul-port", defaultValue = "8500") + @ConfigProperty(name = "quarkus.stork.pung.service-discovery.consul-port", defaultValue = "8500") String port; @ConfigProperty(name = "pung-service-port", defaultValue = "8080") String pungPort; @ConfigProperty(name = "pung-service-host", defaultValue = "localhost") String pungHost; - @ConfigProperty(name = "stork.pung.service-discovery", defaultValue = "consul") + @ConfigProperty(name = "quarkus.stork.pung.service-discovery.type", defaultValue = "consul") String serviceDiscoveryType; public void init(@Observes StartupEvent ev, Vertx vertx) { diff --git a/service-discovery/stork/src/test/java/io/quarkus/ts/stork/NativeStorkServiceDiscoveryIT.java b/service-discovery/stork/src/test/java/io/quarkus/ts/stork/NativeStorkServiceDiscoveryIT.java index 3a42dd47f..358c1836d 100644 --- a/service-discovery/stork/src/test/java/io/quarkus/ts/stork/NativeStorkServiceDiscoveryIT.java +++ b/service-discovery/stork/src/test/java/io/quarkus/ts/stork/NativeStorkServiceDiscoveryIT.java @@ -23,15 +23,17 @@ public class NativeStorkServiceDiscoveryIT extends AbstractCommonTestCases { .withProperty("quarkus.http.port", PUNG_PORT) .withProperty("pung-service-port", PUNG_PORT) .withProperty("pung-service-host", "localhost") - .withProperty("stork.pung.service-discovery", "consul") - .withProperty("stork.pung.service-discovery.consul-port", () -> String.valueOf(consul.getPort())) - .withProperty("stork.pung.service-discovery.consul-host", () -> getConsultEndpoint(consul.getConsulEndpoint())); + .withProperty("quarkus.stork.pung.service-discovery.type", "consul") + .withProperty("quarkus.stork.pung.service-discovery.consul-port", () -> String.valueOf(consul.getPort())) + .withProperty("quarkus.stork.pung.service-discovery.consul-host", + () -> getConsultEndpoint(consul.getConsulEndpoint())); @QuarkusApplication(classes = { PingResource.class, MyBackendPungProxy.class, MyBackendPongProxy.class }) static RestService pingService = new RestService() - .withProperty("stork.pung.service-discovery", "consul") - .withProperty("stork.pung.service-discovery.consul-port", () -> String.valueOf(consul.getPort())) - .withProperty("stork.pung.service-discovery.consul-host", () -> getConsultEndpoint(consul.getConsulEndpoint())); + .withProperty("quarkus.stork.pung.service-discovery.type", "consul") + .withProperty("quarkus.stork.pung.service-discovery.consul-port", () -> String.valueOf(consul.getPort())) + .withProperty("quarkus.stork.pung.service-discovery.consul-host", + () -> getConsultEndpoint(consul.getConsulEndpoint())); @Test public void invokeServiceByName() { diff --git a/service-discovery/stork/src/test/java/io/quarkus/ts/stork/OpenShiftStorkServiceDiscoveryIT.java b/service-discovery/stork/src/test/java/io/quarkus/ts/stork/OpenShiftStorkServiceDiscoveryIT.java index c2a4788d1..871f76108 100644 --- a/service-discovery/stork/src/test/java/io/quarkus/ts/stork/OpenShiftStorkServiceDiscoveryIT.java +++ b/service-discovery/stork/src/test/java/io/quarkus/ts/stork/OpenShiftStorkServiceDiscoveryIT.java @@ -37,21 +37,21 @@ public class OpenShiftStorkServiceDiscoveryIT extends AbstractCommonTestCases { @QuarkusApplication(classes = PungResource.class) static RestService pung = new RestService() - .withProperty("stork.pung.service-discovery", "kubernetes") - .withProperty("stork.pung.service-discovery.k8s-namespace", "all"); + .withProperty("quarkus.stork.pung.service-discovery.type", "kubernetes") + .withProperty("quarkus.stork.pung.service-discovery.k8s-namespace", "all"); @QuarkusApplication(classes = PongResource.class) static RestService pong = new RestService() .onPostStart(app -> openshift.scaleTo(app, PONG_INSTANCES_AMOUNT)) - .withProperty("stork.pong.service-discovery", "kubernetes") - .withProperty("stork.pong.service-discovery.k8s-namespace", "all"); + .withProperty("quarkus.stork.pong.service-discovery.type", "kubernetes") + .withProperty("quarkus.stork.pong.service-discovery.k8s-namespace", "all"); @QuarkusApplication(classes = { PingResource.class, MyBackendPungProxy.class, MyBackendPongProxy.class }) static RestService ping = new RestService().onPreStart(app -> setupClusterRoles()) - .withProperty("stork.pong.service-discovery", "kubernetes") - .withProperty("stork.pong.service-discovery.k8s-namespace", "all") - .withProperty("stork.pung.service-discovery", "kubernetes") - .withProperty("stork.pung.service-discovery.k8s-namespace", "all"); + .withProperty("quarkus.stork.pong.service-discovery.type", "kubernetes") + .withProperty("quarkus.stork.pong.service-discovery.k8s-namespace", "all") + .withProperty("quarkus.stork.pung.service-discovery.type", "kubernetes") + .withProperty("quarkus.stork.pung.service-discovery.k8s-namespace", "all"); @AfterAll public static void tearDown() { diff --git a/service-discovery/stork/src/test/java/io/quarkus/ts/stork/StorkLoadBalancerIT.java b/service-discovery/stork/src/test/java/io/quarkus/ts/stork/StorkLoadBalancerIT.java index 6ac850508..2bc02d865 100644 --- a/service-discovery/stork/src/test/java/io/quarkus/ts/stork/StorkLoadBalancerIT.java +++ b/service-discovery/stork/src/test/java/io/quarkus/ts/stork/StorkLoadBalancerIT.java @@ -35,35 +35,37 @@ public class StorkLoadBalancerIT extends AbstractCommonTestCases { .withProperty("quarkus.http.port", PONG_PORT) .withProperty("pong-service-port", PONG_PORT) .withProperty("pong-service-host", "localhost") - .withProperty("stork.pong.service-discovery.refresh-period", "1") - .withProperty("stork.pong.service-discovery", "consul") - .withProperty("stork.pong.service-discovery.consul-port", () -> String.valueOf(consul.getPort())) - .withProperty("stork.pong.service-discovery.consul-host", () -> getConsultEndpoint(consul.getConsulEndpoint())); + .withProperty("quarkus.stork.pong.service-discovery.refresh-period", "1") + .withProperty("quarkus.stork.pong.service-discovery.type", "consul") + .withProperty("quarkus.stork.pong.service-discovery.consul-port", () -> String.valueOf(consul.getPort())) + .withProperty("quarkus.stork.pong.service-discovery.consul-host", + () -> getConsultEndpoint(consul.getConsulEndpoint())); @QuarkusApplication(classes = PongReplicaResource.class) static RestService pongReplicaService = new RestService() .withProperty("quarkus.http.port", PONG_REPLICA_PORT) .withProperty("pong-replica-service-port", PONG_REPLICA_PORT) .withProperty("pong-replica-service-host", "localhost") - .withProperty("stork.pong-replica.service-discovery.refresh-period", "1") - .withProperty("stork.pong-replica.service-discovery", "consul") - .withProperty("stork.pong-replica.service-discovery.consul-port", () -> String.valueOf(consul.getPort())) - .withProperty("stork.pong-replica.service-discovery.consul-host", + .withProperty("quarkus.stork.pong-replica.service-discovery.refresh-period", "1") + .withProperty("quarkus.stork.pong-replica.service-discovery.type", "consul") + .withProperty("quarkus.stork.pong-replica.service-discovery.consul-port", () -> String.valueOf(consul.getPort())) + .withProperty("quarkus.stork.pong-replica.service-discovery.consul-host", () -> getConsultEndpoint(consul.getConsulEndpoint())); @QuarkusApplication(classes = { PingResource.class, MyBackendPungProxy.class, MyBackendPongProxy.class }) static RestService mainPingService = new RestService() - .withProperty("stork.pong-replica.service-discovery", "consul") - .withProperty("stork.pong-replica.service-discovery.refresh-period", "1") - .withProperty("stork.pong-replica.load-balancer", "round-robin") - .withProperty("stork.pong-replica.service-discovery.consul-port", () -> String.valueOf(consul.getPort())) - .withProperty("stork.pong-replica.service-discovery.consul-host", + .withProperty("quarkus.stork.pong-replica.service-discovery.type", "consul") + .withProperty("quarkus.stork.pong-replica.service-discovery.refresh-period", "1") + .withProperty("quarkus.stork.pong-replica.load-balancer", "round-robin") + .withProperty("quarkus.stork.pong-replica.service-discovery.consul-port", () -> String.valueOf(consul.getPort())) + .withProperty("quarkus.stork.pong-replica.service-discovery.consul-host", () -> getConsultEndpoint(consul.getConsulEndpoint())) - .withProperty("stork.pong.service-discovery", "consul") - .withProperty("stork.pong.service-discovery.refresh-period", "1") - .withProperty("stork.pong.load-balancer", "round-robin") - .withProperty("stork.pong.service-discovery.consul-port", () -> String.valueOf(consul.getPort())) - .withProperty("stork.pong.service-discovery.consul-host", () -> getConsultEndpoint(consul.getConsulEndpoint())); + .withProperty("quarkus.stork.pong.service-discovery.type", "consul") + .withProperty("quarkus.stork.pong.service-discovery.refresh-period", "1") + .withProperty("quarkus.stork.pong.load-balancer", "round-robin") + .withProperty("quarkus.stork.pong.service-discovery.consul-port", () -> String.valueOf(consul.getPort())) + .withProperty("quarkus.stork.pong.service-discovery.consul-host", + () -> getConsultEndpoint(consul.getConsulEndpoint())); @Test public void storkLoadBalancerByRoundRobin() {