From 4a200d35a1e0eae75b8e8e0d311250dd4991589b Mon Sep 17 00:00:00 2001 From: runner Date: Thu, 11 May 2023 11:22:22 +0000 Subject: [PATCH 01/19] updating poms for 1.3.29 branch with snapshot versions From f7ceb2d7adf40b2a39e8d47ad90de4f2f43c57bb Mon Sep 17 00:00:00 2001 From: runner Date: Thu, 11 May 2023 11:22:23 +0000 Subject: [PATCH 02/19] updating poms for 1.3.30-SNAPSHOT development --- gateleen-cache/pom.xml | 2 +- gateleen-core/pom.xml | 2 +- gateleen-delegate/pom.xml | 2 +- gateleen-delta/pom.xml | 2 +- gateleen-expansion/pom.xml | 2 +- gateleen-hook-js/pom.xml | 2 +- gateleen-hook/pom.xml | 2 +- gateleen-kafka/pom.xml | 2 +- gateleen-logging/pom.xml | 2 +- gateleen-merge/pom.xml | 2 +- gateleen-monitoring/pom.xml | 2 +- gateleen-packing/pom.xml | 2 +- gateleen-player/pom.xml | 2 +- gateleen-playground/pom.xml | 2 +- gateleen-qos/pom.xml | 2 +- gateleen-queue/pom.xml | 2 +- gateleen-routing/pom.xml | 2 +- gateleen-runconfig/pom.xml | 2 +- gateleen-scheduler/pom.xml | 2 +- gateleen-security/pom.xml | 2 +- gateleen-test/pom.xml | 2 +- gateleen-testhelper/pom.xml | 2 +- gateleen-user/pom.xml | 2 +- gateleen-validation/pom.xml | 2 +- pom.xml | 2 +- 25 files changed, 25 insertions(+), 25 deletions(-) diff --git a/gateleen-cache/pom.xml b/gateleen-cache/pom.xml index 79642915..f6d9aef4 100644 --- a/gateleen-cache/pom.xml +++ b/gateleen-cache/pom.xml @@ -6,7 +6,7 @@ org.swisspush.gateleen gateleen - 1.3.29-SNAPSHOT + 1.3.30-SNAPSHOT gateleen-cache diff --git a/gateleen-core/pom.xml b/gateleen-core/pom.xml index 240cfcbd..58fe365a 100644 --- a/gateleen-core/pom.xml +++ b/gateleen-core/pom.xml @@ -6,7 +6,7 @@ org.swisspush.gateleen gateleen - 1.3.29-SNAPSHOT + 1.3.30-SNAPSHOT gateleen-core diff --git a/gateleen-delegate/pom.xml b/gateleen-delegate/pom.xml index 94b517e6..e48742e1 100644 --- a/gateleen-delegate/pom.xml +++ b/gateleen-delegate/pom.xml @@ -6,7 +6,7 @@ org.swisspush.gateleen gateleen - 1.3.29-SNAPSHOT + 1.3.30-SNAPSHOT gateleen-delegate diff --git a/gateleen-delta/pom.xml b/gateleen-delta/pom.xml index 955825e7..cba97954 100644 --- a/gateleen-delta/pom.xml +++ b/gateleen-delta/pom.xml @@ -6,7 +6,7 @@ org.swisspush.gateleen gateleen - 1.3.29-SNAPSHOT + 1.3.30-SNAPSHOT gateleen-delta diff --git a/gateleen-expansion/pom.xml b/gateleen-expansion/pom.xml index 1bf35785..bee0d3e8 100644 --- a/gateleen-expansion/pom.xml +++ b/gateleen-expansion/pom.xml @@ -6,7 +6,7 @@ org.swisspush.gateleen gateleen - 1.3.29-SNAPSHOT + 1.3.30-SNAPSHOT gateleen-expansion diff --git a/gateleen-hook-js/pom.xml b/gateleen-hook-js/pom.xml index d27a6184..fd261338 100644 --- a/gateleen-hook-js/pom.xml +++ b/gateleen-hook-js/pom.xml @@ -4,7 +4,7 @@ org.swisspush.gateleen gateleen - 1.3.29-SNAPSHOT + 1.3.30-SNAPSHOT gateleen-hook-js jar diff --git a/gateleen-hook/pom.xml b/gateleen-hook/pom.xml index 08e8cc7d..f01878ac 100644 --- a/gateleen-hook/pom.xml +++ b/gateleen-hook/pom.xml @@ -6,7 +6,7 @@ org.swisspush.gateleen gateleen - 1.3.29-SNAPSHOT + 1.3.30-SNAPSHOT gateleen-hook diff --git a/gateleen-kafka/pom.xml b/gateleen-kafka/pom.xml index ea66bafe..6349d069 100644 --- a/gateleen-kafka/pom.xml +++ b/gateleen-kafka/pom.xml @@ -6,7 +6,7 @@ org.swisspush.gateleen gateleen - 1.3.29-SNAPSHOT + 1.3.30-SNAPSHOT gateleen-kafka diff --git a/gateleen-logging/pom.xml b/gateleen-logging/pom.xml index 2d198d22..91f075f8 100644 --- a/gateleen-logging/pom.xml +++ b/gateleen-logging/pom.xml @@ -6,7 +6,7 @@ org.swisspush.gateleen gateleen - 1.3.29-SNAPSHOT + 1.3.30-SNAPSHOT gateleen-logging diff --git a/gateleen-merge/pom.xml b/gateleen-merge/pom.xml index 9d4c9f48..7638220e 100644 --- a/gateleen-merge/pom.xml +++ b/gateleen-merge/pom.xml @@ -6,7 +6,7 @@ org.swisspush.gateleen gateleen - 1.3.29-SNAPSHOT + 1.3.30-SNAPSHOT gateleen-merge diff --git a/gateleen-monitoring/pom.xml b/gateleen-monitoring/pom.xml index 0df5b63a..0f6fc053 100644 --- a/gateleen-monitoring/pom.xml +++ b/gateleen-monitoring/pom.xml @@ -6,7 +6,7 @@ org.swisspush.gateleen gateleen - 1.3.29-SNAPSHOT + 1.3.30-SNAPSHOT gateleen-monitoring diff --git a/gateleen-packing/pom.xml b/gateleen-packing/pom.xml index b0ca3060..8930f2f3 100644 --- a/gateleen-packing/pom.xml +++ b/gateleen-packing/pom.xml @@ -6,7 +6,7 @@ org.swisspush.gateleen gateleen - 1.3.29-SNAPSHOT + 1.3.30-SNAPSHOT gateleen-packing diff --git a/gateleen-player/pom.xml b/gateleen-player/pom.xml index 1bd36585..bc9ff1bc 100644 --- a/gateleen-player/pom.xml +++ b/gateleen-player/pom.xml @@ -6,7 +6,7 @@ org.swisspush.gateleen gateleen - 1.3.29-SNAPSHOT + 1.3.30-SNAPSHOT gateleen-player diff --git a/gateleen-playground/pom.xml b/gateleen-playground/pom.xml index 03c56cf6..bd7b5f3b 100644 --- a/gateleen-playground/pom.xml +++ b/gateleen-playground/pom.xml @@ -6,7 +6,7 @@ org.swisspush.gateleen gateleen - 1.3.29-SNAPSHOT + 1.3.30-SNAPSHOT gateleen-playground diff --git a/gateleen-qos/pom.xml b/gateleen-qos/pom.xml index 43b27b74..96de0fce 100644 --- a/gateleen-qos/pom.xml +++ b/gateleen-qos/pom.xml @@ -6,7 +6,7 @@ org.swisspush.gateleen gateleen - 1.3.29-SNAPSHOT + 1.3.30-SNAPSHOT gateleen-qos diff --git a/gateleen-queue/pom.xml b/gateleen-queue/pom.xml index 886db6e2..8c51f92b 100644 --- a/gateleen-queue/pom.xml +++ b/gateleen-queue/pom.xml @@ -6,7 +6,7 @@ org.swisspush.gateleen gateleen - 1.3.29-SNAPSHOT + 1.3.30-SNAPSHOT gateleen-queue diff --git a/gateleen-routing/pom.xml b/gateleen-routing/pom.xml index 38260a39..c8250abf 100644 --- a/gateleen-routing/pom.xml +++ b/gateleen-routing/pom.xml @@ -6,7 +6,7 @@ org.swisspush.gateleen gateleen - 1.3.29-SNAPSHOT + 1.3.30-SNAPSHOT gateleen-routing diff --git a/gateleen-runconfig/pom.xml b/gateleen-runconfig/pom.xml index 0bbeb371..7b50abd0 100644 --- a/gateleen-runconfig/pom.xml +++ b/gateleen-runconfig/pom.xml @@ -6,7 +6,7 @@ org.swisspush.gateleen gateleen - 1.3.29-SNAPSHOT + 1.3.30-SNAPSHOT gateleen-runconfig diff --git a/gateleen-scheduler/pom.xml b/gateleen-scheduler/pom.xml index 4ce97458..1ed31793 100644 --- a/gateleen-scheduler/pom.xml +++ b/gateleen-scheduler/pom.xml @@ -6,7 +6,7 @@ org.swisspush.gateleen gateleen - 1.3.29-SNAPSHOT + 1.3.30-SNAPSHOT gateleen-scheduler diff --git a/gateleen-security/pom.xml b/gateleen-security/pom.xml index f7a3d2f2..29416b78 100644 --- a/gateleen-security/pom.xml +++ b/gateleen-security/pom.xml @@ -6,7 +6,7 @@ org.swisspush.gateleen gateleen - 1.3.29-SNAPSHOT + 1.3.30-SNAPSHOT gateleen-security diff --git a/gateleen-test/pom.xml b/gateleen-test/pom.xml index 5853d960..8934decd 100644 --- a/gateleen-test/pom.xml +++ b/gateleen-test/pom.xml @@ -6,7 +6,7 @@ org.swisspush.gateleen gateleen - 1.3.29-SNAPSHOT + 1.3.30-SNAPSHOT gateleen-test jar diff --git a/gateleen-testhelper/pom.xml b/gateleen-testhelper/pom.xml index 8de06697..1513a853 100644 --- a/gateleen-testhelper/pom.xml +++ b/gateleen-testhelper/pom.xml @@ -6,7 +6,7 @@ org.swisspush.gateleen gateleen - 1.3.29-SNAPSHOT + 1.3.30-SNAPSHOT gateleen-testhelper diff --git a/gateleen-user/pom.xml b/gateleen-user/pom.xml index 8d242425..6eb0dbbe 100644 --- a/gateleen-user/pom.xml +++ b/gateleen-user/pom.xml @@ -6,7 +6,7 @@ org.swisspush.gateleen gateleen - 1.3.29-SNAPSHOT + 1.3.30-SNAPSHOT gateleen-user diff --git a/gateleen-validation/pom.xml b/gateleen-validation/pom.xml index aded87f6..b9585560 100644 --- a/gateleen-validation/pom.xml +++ b/gateleen-validation/pom.xml @@ -6,7 +6,7 @@ org.swisspush.gateleen gateleen - 1.3.29-SNAPSHOT + 1.3.30-SNAPSHOT gateleen-validation diff --git a/pom.xml b/pom.xml index 5f05b412..08e2a615 100644 --- a/pom.xml +++ b/pom.xml @@ -6,7 +6,7 @@ org.swisspush.gateleen gateleen - 1.3.29-SNAPSHOT + 1.3.30-SNAPSHOT pom gateleen Middleware library based on Vert.x to build advanced JSON/REST communication servers From 3f8d7114644c1bec43660324907f6b5a758055d2 Mon Sep 17 00:00:00 2001 From: runner Date: Thu, 11 May 2023 11:22:25 +0000 Subject: [PATCH 03/19] updating poms for branch'release-1.3.29' with non-snapshot versions --- gateleen-cache/pom.xml | 2 +- gateleen-core/pom.xml | 2 +- gateleen-delegate/pom.xml | 2 +- gateleen-delta/pom.xml | 2 +- gateleen-expansion/pom.xml | 2 +- gateleen-hook-js/pom.xml | 2 +- gateleen-hook/pom.xml | 2 +- gateleen-kafka/pom.xml | 2 +- gateleen-logging/pom.xml | 2 +- gateleen-merge/pom.xml | 2 +- gateleen-monitoring/pom.xml | 2 +- gateleen-packing/pom.xml | 2 +- gateleen-player/pom.xml | 2 +- gateleen-playground/pom.xml | 2 +- gateleen-qos/pom.xml | 2 +- gateleen-queue/pom.xml | 2 +- gateleen-routing/pom.xml | 2 +- gateleen-runconfig/pom.xml | 2 +- gateleen-scheduler/pom.xml | 2 +- gateleen-security/pom.xml | 2 +- gateleen-test/pom.xml | 2 +- gateleen-testhelper/pom.xml | 2 +- gateleen-user/pom.xml | 2 +- gateleen-validation/pom.xml | 2 +- pom.xml | 2 +- 25 files changed, 25 insertions(+), 25 deletions(-) diff --git a/gateleen-cache/pom.xml b/gateleen-cache/pom.xml index 79642915..b8f88beb 100644 --- a/gateleen-cache/pom.xml +++ b/gateleen-cache/pom.xml @@ -6,7 +6,7 @@ org.swisspush.gateleen gateleen - 1.3.29-SNAPSHOT + 1.3.29 gateleen-cache diff --git a/gateleen-core/pom.xml b/gateleen-core/pom.xml index 240cfcbd..e07213ce 100644 --- a/gateleen-core/pom.xml +++ b/gateleen-core/pom.xml @@ -6,7 +6,7 @@ org.swisspush.gateleen gateleen - 1.3.29-SNAPSHOT + 1.3.29 gateleen-core diff --git a/gateleen-delegate/pom.xml b/gateleen-delegate/pom.xml index 94b517e6..6346f649 100644 --- a/gateleen-delegate/pom.xml +++ b/gateleen-delegate/pom.xml @@ -6,7 +6,7 @@ org.swisspush.gateleen gateleen - 1.3.29-SNAPSHOT + 1.3.29 gateleen-delegate diff --git a/gateleen-delta/pom.xml b/gateleen-delta/pom.xml index 955825e7..fccc12ca 100644 --- a/gateleen-delta/pom.xml +++ b/gateleen-delta/pom.xml @@ -6,7 +6,7 @@ org.swisspush.gateleen gateleen - 1.3.29-SNAPSHOT + 1.3.29 gateleen-delta diff --git a/gateleen-expansion/pom.xml b/gateleen-expansion/pom.xml index 1bf35785..394673f8 100644 --- a/gateleen-expansion/pom.xml +++ b/gateleen-expansion/pom.xml @@ -6,7 +6,7 @@ org.swisspush.gateleen gateleen - 1.3.29-SNAPSHOT + 1.3.29 gateleen-expansion diff --git a/gateleen-hook-js/pom.xml b/gateleen-hook-js/pom.xml index d27a6184..f5063ffa 100644 --- a/gateleen-hook-js/pom.xml +++ b/gateleen-hook-js/pom.xml @@ -4,7 +4,7 @@ org.swisspush.gateleen gateleen - 1.3.29-SNAPSHOT + 1.3.29 gateleen-hook-js jar diff --git a/gateleen-hook/pom.xml b/gateleen-hook/pom.xml index 08e8cc7d..7b3c03df 100644 --- a/gateleen-hook/pom.xml +++ b/gateleen-hook/pom.xml @@ -6,7 +6,7 @@ org.swisspush.gateleen gateleen - 1.3.29-SNAPSHOT + 1.3.29 gateleen-hook diff --git a/gateleen-kafka/pom.xml b/gateleen-kafka/pom.xml index ea66bafe..a58f05a1 100644 --- a/gateleen-kafka/pom.xml +++ b/gateleen-kafka/pom.xml @@ -6,7 +6,7 @@ org.swisspush.gateleen gateleen - 1.3.29-SNAPSHOT + 1.3.29 gateleen-kafka diff --git a/gateleen-logging/pom.xml b/gateleen-logging/pom.xml index 2d198d22..faeda584 100644 --- a/gateleen-logging/pom.xml +++ b/gateleen-logging/pom.xml @@ -6,7 +6,7 @@ org.swisspush.gateleen gateleen - 1.3.29-SNAPSHOT + 1.3.29 gateleen-logging diff --git a/gateleen-merge/pom.xml b/gateleen-merge/pom.xml index 9d4c9f48..0d19a591 100644 --- a/gateleen-merge/pom.xml +++ b/gateleen-merge/pom.xml @@ -6,7 +6,7 @@ org.swisspush.gateleen gateleen - 1.3.29-SNAPSHOT + 1.3.29 gateleen-merge diff --git a/gateleen-monitoring/pom.xml b/gateleen-monitoring/pom.xml index 0df5b63a..1952dbf3 100644 --- a/gateleen-monitoring/pom.xml +++ b/gateleen-monitoring/pom.xml @@ -6,7 +6,7 @@ org.swisspush.gateleen gateleen - 1.3.29-SNAPSHOT + 1.3.29 gateleen-monitoring diff --git a/gateleen-packing/pom.xml b/gateleen-packing/pom.xml index b0ca3060..d26f7e86 100644 --- a/gateleen-packing/pom.xml +++ b/gateleen-packing/pom.xml @@ -6,7 +6,7 @@ org.swisspush.gateleen gateleen - 1.3.29-SNAPSHOT + 1.3.29 gateleen-packing diff --git a/gateleen-player/pom.xml b/gateleen-player/pom.xml index 1bd36585..a189f1b0 100644 --- a/gateleen-player/pom.xml +++ b/gateleen-player/pom.xml @@ -6,7 +6,7 @@ org.swisspush.gateleen gateleen - 1.3.29-SNAPSHOT + 1.3.29 gateleen-player diff --git a/gateleen-playground/pom.xml b/gateleen-playground/pom.xml index 03c56cf6..ab9943be 100644 --- a/gateleen-playground/pom.xml +++ b/gateleen-playground/pom.xml @@ -6,7 +6,7 @@ org.swisspush.gateleen gateleen - 1.3.29-SNAPSHOT + 1.3.29 gateleen-playground diff --git a/gateleen-qos/pom.xml b/gateleen-qos/pom.xml index 43b27b74..907e8b4e 100644 --- a/gateleen-qos/pom.xml +++ b/gateleen-qos/pom.xml @@ -6,7 +6,7 @@ org.swisspush.gateleen gateleen - 1.3.29-SNAPSHOT + 1.3.29 gateleen-qos diff --git a/gateleen-queue/pom.xml b/gateleen-queue/pom.xml index 886db6e2..2c4aea46 100644 --- a/gateleen-queue/pom.xml +++ b/gateleen-queue/pom.xml @@ -6,7 +6,7 @@ org.swisspush.gateleen gateleen - 1.3.29-SNAPSHOT + 1.3.29 gateleen-queue diff --git a/gateleen-routing/pom.xml b/gateleen-routing/pom.xml index 38260a39..850e0bff 100644 --- a/gateleen-routing/pom.xml +++ b/gateleen-routing/pom.xml @@ -6,7 +6,7 @@ org.swisspush.gateleen gateleen - 1.3.29-SNAPSHOT + 1.3.29 gateleen-routing diff --git a/gateleen-runconfig/pom.xml b/gateleen-runconfig/pom.xml index 0bbeb371..ddc10cf3 100644 --- a/gateleen-runconfig/pom.xml +++ b/gateleen-runconfig/pom.xml @@ -6,7 +6,7 @@ org.swisspush.gateleen gateleen - 1.3.29-SNAPSHOT + 1.3.29 gateleen-runconfig diff --git a/gateleen-scheduler/pom.xml b/gateleen-scheduler/pom.xml index 4ce97458..009c2aa0 100644 --- a/gateleen-scheduler/pom.xml +++ b/gateleen-scheduler/pom.xml @@ -6,7 +6,7 @@ org.swisspush.gateleen gateleen - 1.3.29-SNAPSHOT + 1.3.29 gateleen-scheduler diff --git a/gateleen-security/pom.xml b/gateleen-security/pom.xml index f7a3d2f2..d44ea263 100644 --- a/gateleen-security/pom.xml +++ b/gateleen-security/pom.xml @@ -6,7 +6,7 @@ org.swisspush.gateleen gateleen - 1.3.29-SNAPSHOT + 1.3.29 gateleen-security diff --git a/gateleen-test/pom.xml b/gateleen-test/pom.xml index 5853d960..d88bc1ee 100644 --- a/gateleen-test/pom.xml +++ b/gateleen-test/pom.xml @@ -6,7 +6,7 @@ org.swisspush.gateleen gateleen - 1.3.29-SNAPSHOT + 1.3.29 gateleen-test jar diff --git a/gateleen-testhelper/pom.xml b/gateleen-testhelper/pom.xml index 8de06697..9c7c3af1 100644 --- a/gateleen-testhelper/pom.xml +++ b/gateleen-testhelper/pom.xml @@ -6,7 +6,7 @@ org.swisspush.gateleen gateleen - 1.3.29-SNAPSHOT + 1.3.29 gateleen-testhelper diff --git a/gateleen-user/pom.xml b/gateleen-user/pom.xml index 8d242425..ad63de3c 100644 --- a/gateleen-user/pom.xml +++ b/gateleen-user/pom.xml @@ -6,7 +6,7 @@ org.swisspush.gateleen gateleen - 1.3.29-SNAPSHOT + 1.3.29 gateleen-user diff --git a/gateleen-validation/pom.xml b/gateleen-validation/pom.xml index aded87f6..aab3d6bf 100644 --- a/gateleen-validation/pom.xml +++ b/gateleen-validation/pom.xml @@ -6,7 +6,7 @@ org.swisspush.gateleen gateleen - 1.3.29-SNAPSHOT + 1.3.29 gateleen-validation diff --git a/pom.xml b/pom.xml index 5f05b412..8ae347f8 100644 --- a/pom.xml +++ b/pom.xml @@ -6,7 +6,7 @@ org.swisspush.gateleen gateleen - 1.3.29-SNAPSHOT + 1.3.29 pom gateleen Middleware library based on Vert.x to build advanced JSON/REST communication servers From cb8a1b0f97b62f59426649c3a292025e739705d4 Mon Sep 17 00:00:00 2001 From: runner Date: Thu, 11 May 2023 11:26:48 +0000 Subject: [PATCH 04/19] updating develop poms to master versions to avoid merge conflicts --- gateleen-cache/pom.xml | 2 +- gateleen-core/pom.xml | 2 +- gateleen-delegate/pom.xml | 2 +- gateleen-delta/pom.xml | 2 +- gateleen-expansion/pom.xml | 2 +- gateleen-hook-js/pom.xml | 2 +- gateleen-hook/pom.xml | 2 +- gateleen-kafka/pom.xml | 2 +- gateleen-logging/pom.xml | 2 +- gateleen-merge/pom.xml | 2 +- gateleen-monitoring/pom.xml | 2 +- gateleen-packing/pom.xml | 2 +- gateleen-player/pom.xml | 2 +- gateleen-playground/pom.xml | 2 +- gateleen-qos/pom.xml | 2 +- gateleen-queue/pom.xml | 2 +- gateleen-routing/pom.xml | 2 +- gateleen-runconfig/pom.xml | 2 +- gateleen-scheduler/pom.xml | 2 +- gateleen-security/pom.xml | 2 +- gateleen-test/pom.xml | 2 +- gateleen-testhelper/pom.xml | 2 +- gateleen-user/pom.xml | 2 +- gateleen-validation/pom.xml | 2 +- pom.xml | 2 +- 25 files changed, 25 insertions(+), 25 deletions(-) diff --git a/gateleen-cache/pom.xml b/gateleen-cache/pom.xml index f6d9aef4..b8f88beb 100644 --- a/gateleen-cache/pom.xml +++ b/gateleen-cache/pom.xml @@ -6,7 +6,7 @@ org.swisspush.gateleen gateleen - 1.3.30-SNAPSHOT + 1.3.29 gateleen-cache diff --git a/gateleen-core/pom.xml b/gateleen-core/pom.xml index 58fe365a..e07213ce 100644 --- a/gateleen-core/pom.xml +++ b/gateleen-core/pom.xml @@ -6,7 +6,7 @@ org.swisspush.gateleen gateleen - 1.3.30-SNAPSHOT + 1.3.29 gateleen-core diff --git a/gateleen-delegate/pom.xml b/gateleen-delegate/pom.xml index e48742e1..6346f649 100644 --- a/gateleen-delegate/pom.xml +++ b/gateleen-delegate/pom.xml @@ -6,7 +6,7 @@ org.swisspush.gateleen gateleen - 1.3.30-SNAPSHOT + 1.3.29 gateleen-delegate diff --git a/gateleen-delta/pom.xml b/gateleen-delta/pom.xml index cba97954..fccc12ca 100644 --- a/gateleen-delta/pom.xml +++ b/gateleen-delta/pom.xml @@ -6,7 +6,7 @@ org.swisspush.gateleen gateleen - 1.3.30-SNAPSHOT + 1.3.29 gateleen-delta diff --git a/gateleen-expansion/pom.xml b/gateleen-expansion/pom.xml index bee0d3e8..394673f8 100644 --- a/gateleen-expansion/pom.xml +++ b/gateleen-expansion/pom.xml @@ -6,7 +6,7 @@ org.swisspush.gateleen gateleen - 1.3.30-SNAPSHOT + 1.3.29 gateleen-expansion diff --git a/gateleen-hook-js/pom.xml b/gateleen-hook-js/pom.xml index fd261338..f5063ffa 100644 --- a/gateleen-hook-js/pom.xml +++ b/gateleen-hook-js/pom.xml @@ -4,7 +4,7 @@ org.swisspush.gateleen gateleen - 1.3.30-SNAPSHOT + 1.3.29 gateleen-hook-js jar diff --git a/gateleen-hook/pom.xml b/gateleen-hook/pom.xml index f01878ac..7b3c03df 100644 --- a/gateleen-hook/pom.xml +++ b/gateleen-hook/pom.xml @@ -6,7 +6,7 @@ org.swisspush.gateleen gateleen - 1.3.30-SNAPSHOT + 1.3.29 gateleen-hook diff --git a/gateleen-kafka/pom.xml b/gateleen-kafka/pom.xml index 6349d069..a58f05a1 100644 --- a/gateleen-kafka/pom.xml +++ b/gateleen-kafka/pom.xml @@ -6,7 +6,7 @@ org.swisspush.gateleen gateleen - 1.3.30-SNAPSHOT + 1.3.29 gateleen-kafka diff --git a/gateleen-logging/pom.xml b/gateleen-logging/pom.xml index 91f075f8..faeda584 100644 --- a/gateleen-logging/pom.xml +++ b/gateleen-logging/pom.xml @@ -6,7 +6,7 @@ org.swisspush.gateleen gateleen - 1.3.30-SNAPSHOT + 1.3.29 gateleen-logging diff --git a/gateleen-merge/pom.xml b/gateleen-merge/pom.xml index 7638220e..0d19a591 100644 --- a/gateleen-merge/pom.xml +++ b/gateleen-merge/pom.xml @@ -6,7 +6,7 @@ org.swisspush.gateleen gateleen - 1.3.30-SNAPSHOT + 1.3.29 gateleen-merge diff --git a/gateleen-monitoring/pom.xml b/gateleen-monitoring/pom.xml index 0f6fc053..1952dbf3 100644 --- a/gateleen-monitoring/pom.xml +++ b/gateleen-monitoring/pom.xml @@ -6,7 +6,7 @@ org.swisspush.gateleen gateleen - 1.3.30-SNAPSHOT + 1.3.29 gateleen-monitoring diff --git a/gateleen-packing/pom.xml b/gateleen-packing/pom.xml index 8930f2f3..d26f7e86 100644 --- a/gateleen-packing/pom.xml +++ b/gateleen-packing/pom.xml @@ -6,7 +6,7 @@ org.swisspush.gateleen gateleen - 1.3.30-SNAPSHOT + 1.3.29 gateleen-packing diff --git a/gateleen-player/pom.xml b/gateleen-player/pom.xml index bc9ff1bc..a189f1b0 100644 --- a/gateleen-player/pom.xml +++ b/gateleen-player/pom.xml @@ -6,7 +6,7 @@ org.swisspush.gateleen gateleen - 1.3.30-SNAPSHOT + 1.3.29 gateleen-player diff --git a/gateleen-playground/pom.xml b/gateleen-playground/pom.xml index bd7b5f3b..ab9943be 100644 --- a/gateleen-playground/pom.xml +++ b/gateleen-playground/pom.xml @@ -6,7 +6,7 @@ org.swisspush.gateleen gateleen - 1.3.30-SNAPSHOT + 1.3.29 gateleen-playground diff --git a/gateleen-qos/pom.xml b/gateleen-qos/pom.xml index 96de0fce..907e8b4e 100644 --- a/gateleen-qos/pom.xml +++ b/gateleen-qos/pom.xml @@ -6,7 +6,7 @@ org.swisspush.gateleen gateleen - 1.3.30-SNAPSHOT + 1.3.29 gateleen-qos diff --git a/gateleen-queue/pom.xml b/gateleen-queue/pom.xml index 8c51f92b..2c4aea46 100644 --- a/gateleen-queue/pom.xml +++ b/gateleen-queue/pom.xml @@ -6,7 +6,7 @@ org.swisspush.gateleen gateleen - 1.3.30-SNAPSHOT + 1.3.29 gateleen-queue diff --git a/gateleen-routing/pom.xml b/gateleen-routing/pom.xml index c8250abf..850e0bff 100644 --- a/gateleen-routing/pom.xml +++ b/gateleen-routing/pom.xml @@ -6,7 +6,7 @@ org.swisspush.gateleen gateleen - 1.3.30-SNAPSHOT + 1.3.29 gateleen-routing diff --git a/gateleen-runconfig/pom.xml b/gateleen-runconfig/pom.xml index 7b50abd0..ddc10cf3 100644 --- a/gateleen-runconfig/pom.xml +++ b/gateleen-runconfig/pom.xml @@ -6,7 +6,7 @@ org.swisspush.gateleen gateleen - 1.3.30-SNAPSHOT + 1.3.29 gateleen-runconfig diff --git a/gateleen-scheduler/pom.xml b/gateleen-scheduler/pom.xml index 1ed31793..009c2aa0 100644 --- a/gateleen-scheduler/pom.xml +++ b/gateleen-scheduler/pom.xml @@ -6,7 +6,7 @@ org.swisspush.gateleen gateleen - 1.3.30-SNAPSHOT + 1.3.29 gateleen-scheduler diff --git a/gateleen-security/pom.xml b/gateleen-security/pom.xml index 29416b78..d44ea263 100644 --- a/gateleen-security/pom.xml +++ b/gateleen-security/pom.xml @@ -6,7 +6,7 @@ org.swisspush.gateleen gateleen - 1.3.30-SNAPSHOT + 1.3.29 gateleen-security diff --git a/gateleen-test/pom.xml b/gateleen-test/pom.xml index 8934decd..d88bc1ee 100644 --- a/gateleen-test/pom.xml +++ b/gateleen-test/pom.xml @@ -6,7 +6,7 @@ org.swisspush.gateleen gateleen - 1.3.30-SNAPSHOT + 1.3.29 gateleen-test jar diff --git a/gateleen-testhelper/pom.xml b/gateleen-testhelper/pom.xml index 1513a853..9c7c3af1 100644 --- a/gateleen-testhelper/pom.xml +++ b/gateleen-testhelper/pom.xml @@ -6,7 +6,7 @@ org.swisspush.gateleen gateleen - 1.3.30-SNAPSHOT + 1.3.29 gateleen-testhelper diff --git a/gateleen-user/pom.xml b/gateleen-user/pom.xml index 6eb0dbbe..ad63de3c 100644 --- a/gateleen-user/pom.xml +++ b/gateleen-user/pom.xml @@ -6,7 +6,7 @@ org.swisspush.gateleen gateleen - 1.3.30-SNAPSHOT + 1.3.29 gateleen-user diff --git a/gateleen-validation/pom.xml b/gateleen-validation/pom.xml index b9585560..aab3d6bf 100644 --- a/gateleen-validation/pom.xml +++ b/gateleen-validation/pom.xml @@ -6,7 +6,7 @@ org.swisspush.gateleen gateleen - 1.3.30-SNAPSHOT + 1.3.29 gateleen-validation diff --git a/pom.xml b/pom.xml index 08e2a615..8ae347f8 100644 --- a/pom.xml +++ b/pom.xml @@ -6,7 +6,7 @@ org.swisspush.gateleen gateleen - 1.3.30-SNAPSHOT + 1.3.29 pom gateleen Middleware library based on Vert.x to build advanced JSON/REST communication servers From 73e66b6f448aef8bf650ffbf2996d5322216e336 Mon Sep 17 00:00:00 2001 From: runner Date: Thu, 11 May 2023 11:26:50 +0000 Subject: [PATCH 05/19] Updating develop poms back to pre merge state --- gateleen-cache/pom.xml | 2 +- gateleen-core/pom.xml | 2 +- gateleen-delegate/pom.xml | 2 +- gateleen-delta/pom.xml | 2 +- gateleen-expansion/pom.xml | 2 +- gateleen-hook-js/pom.xml | 2 +- gateleen-hook/pom.xml | 2 +- gateleen-kafka/pom.xml | 2 +- gateleen-logging/pom.xml | 2 +- gateleen-merge/pom.xml | 2 +- gateleen-monitoring/pom.xml | 2 +- gateleen-packing/pom.xml | 2 +- gateleen-player/pom.xml | 2 +- gateleen-playground/pom.xml | 2 +- gateleen-qos/pom.xml | 2 +- gateleen-queue/pom.xml | 2 +- gateleen-routing/pom.xml | 2 +- gateleen-runconfig/pom.xml | 2 +- gateleen-scheduler/pom.xml | 2 +- gateleen-security/pom.xml | 2 +- gateleen-test/pom.xml | 2 +- gateleen-testhelper/pom.xml | 2 +- gateleen-user/pom.xml | 2 +- gateleen-validation/pom.xml | 2 +- pom.xml | 2 +- 25 files changed, 25 insertions(+), 25 deletions(-) diff --git a/gateleen-cache/pom.xml b/gateleen-cache/pom.xml index b8f88beb..f6d9aef4 100644 --- a/gateleen-cache/pom.xml +++ b/gateleen-cache/pom.xml @@ -6,7 +6,7 @@ org.swisspush.gateleen gateleen - 1.3.29 + 1.3.30-SNAPSHOT gateleen-cache diff --git a/gateleen-core/pom.xml b/gateleen-core/pom.xml index e07213ce..58fe365a 100644 --- a/gateleen-core/pom.xml +++ b/gateleen-core/pom.xml @@ -6,7 +6,7 @@ org.swisspush.gateleen gateleen - 1.3.29 + 1.3.30-SNAPSHOT gateleen-core diff --git a/gateleen-delegate/pom.xml b/gateleen-delegate/pom.xml index 6346f649..e48742e1 100644 --- a/gateleen-delegate/pom.xml +++ b/gateleen-delegate/pom.xml @@ -6,7 +6,7 @@ org.swisspush.gateleen gateleen - 1.3.29 + 1.3.30-SNAPSHOT gateleen-delegate diff --git a/gateleen-delta/pom.xml b/gateleen-delta/pom.xml index fccc12ca..cba97954 100644 --- a/gateleen-delta/pom.xml +++ b/gateleen-delta/pom.xml @@ -6,7 +6,7 @@ org.swisspush.gateleen gateleen - 1.3.29 + 1.3.30-SNAPSHOT gateleen-delta diff --git a/gateleen-expansion/pom.xml b/gateleen-expansion/pom.xml index 394673f8..bee0d3e8 100644 --- a/gateleen-expansion/pom.xml +++ b/gateleen-expansion/pom.xml @@ -6,7 +6,7 @@ org.swisspush.gateleen gateleen - 1.3.29 + 1.3.30-SNAPSHOT gateleen-expansion diff --git a/gateleen-hook-js/pom.xml b/gateleen-hook-js/pom.xml index f5063ffa..fd261338 100644 --- a/gateleen-hook-js/pom.xml +++ b/gateleen-hook-js/pom.xml @@ -4,7 +4,7 @@ org.swisspush.gateleen gateleen - 1.3.29 + 1.3.30-SNAPSHOT gateleen-hook-js jar diff --git a/gateleen-hook/pom.xml b/gateleen-hook/pom.xml index 7b3c03df..f01878ac 100644 --- a/gateleen-hook/pom.xml +++ b/gateleen-hook/pom.xml @@ -6,7 +6,7 @@ org.swisspush.gateleen gateleen - 1.3.29 + 1.3.30-SNAPSHOT gateleen-hook diff --git a/gateleen-kafka/pom.xml b/gateleen-kafka/pom.xml index a58f05a1..6349d069 100644 --- a/gateleen-kafka/pom.xml +++ b/gateleen-kafka/pom.xml @@ -6,7 +6,7 @@ org.swisspush.gateleen gateleen - 1.3.29 + 1.3.30-SNAPSHOT gateleen-kafka diff --git a/gateleen-logging/pom.xml b/gateleen-logging/pom.xml index faeda584..91f075f8 100644 --- a/gateleen-logging/pom.xml +++ b/gateleen-logging/pom.xml @@ -6,7 +6,7 @@ org.swisspush.gateleen gateleen - 1.3.29 + 1.3.30-SNAPSHOT gateleen-logging diff --git a/gateleen-merge/pom.xml b/gateleen-merge/pom.xml index 0d19a591..7638220e 100644 --- a/gateleen-merge/pom.xml +++ b/gateleen-merge/pom.xml @@ -6,7 +6,7 @@ org.swisspush.gateleen gateleen - 1.3.29 + 1.3.30-SNAPSHOT gateleen-merge diff --git a/gateleen-monitoring/pom.xml b/gateleen-monitoring/pom.xml index 1952dbf3..0f6fc053 100644 --- a/gateleen-monitoring/pom.xml +++ b/gateleen-monitoring/pom.xml @@ -6,7 +6,7 @@ org.swisspush.gateleen gateleen - 1.3.29 + 1.3.30-SNAPSHOT gateleen-monitoring diff --git a/gateleen-packing/pom.xml b/gateleen-packing/pom.xml index d26f7e86..8930f2f3 100644 --- a/gateleen-packing/pom.xml +++ b/gateleen-packing/pom.xml @@ -6,7 +6,7 @@ org.swisspush.gateleen gateleen - 1.3.29 + 1.3.30-SNAPSHOT gateleen-packing diff --git a/gateleen-player/pom.xml b/gateleen-player/pom.xml index a189f1b0..bc9ff1bc 100644 --- a/gateleen-player/pom.xml +++ b/gateleen-player/pom.xml @@ -6,7 +6,7 @@ org.swisspush.gateleen gateleen - 1.3.29 + 1.3.30-SNAPSHOT gateleen-player diff --git a/gateleen-playground/pom.xml b/gateleen-playground/pom.xml index ab9943be..bd7b5f3b 100644 --- a/gateleen-playground/pom.xml +++ b/gateleen-playground/pom.xml @@ -6,7 +6,7 @@ org.swisspush.gateleen gateleen - 1.3.29 + 1.3.30-SNAPSHOT gateleen-playground diff --git a/gateleen-qos/pom.xml b/gateleen-qos/pom.xml index 907e8b4e..96de0fce 100644 --- a/gateleen-qos/pom.xml +++ b/gateleen-qos/pom.xml @@ -6,7 +6,7 @@ org.swisspush.gateleen gateleen - 1.3.29 + 1.3.30-SNAPSHOT gateleen-qos diff --git a/gateleen-queue/pom.xml b/gateleen-queue/pom.xml index 2c4aea46..8c51f92b 100644 --- a/gateleen-queue/pom.xml +++ b/gateleen-queue/pom.xml @@ -6,7 +6,7 @@ org.swisspush.gateleen gateleen - 1.3.29 + 1.3.30-SNAPSHOT gateleen-queue diff --git a/gateleen-routing/pom.xml b/gateleen-routing/pom.xml index 850e0bff..c8250abf 100644 --- a/gateleen-routing/pom.xml +++ b/gateleen-routing/pom.xml @@ -6,7 +6,7 @@ org.swisspush.gateleen gateleen - 1.3.29 + 1.3.30-SNAPSHOT gateleen-routing diff --git a/gateleen-runconfig/pom.xml b/gateleen-runconfig/pom.xml index ddc10cf3..7b50abd0 100644 --- a/gateleen-runconfig/pom.xml +++ b/gateleen-runconfig/pom.xml @@ -6,7 +6,7 @@ org.swisspush.gateleen gateleen - 1.3.29 + 1.3.30-SNAPSHOT gateleen-runconfig diff --git a/gateleen-scheduler/pom.xml b/gateleen-scheduler/pom.xml index 009c2aa0..1ed31793 100644 --- a/gateleen-scheduler/pom.xml +++ b/gateleen-scheduler/pom.xml @@ -6,7 +6,7 @@ org.swisspush.gateleen gateleen - 1.3.29 + 1.3.30-SNAPSHOT gateleen-scheduler diff --git a/gateleen-security/pom.xml b/gateleen-security/pom.xml index d44ea263..29416b78 100644 --- a/gateleen-security/pom.xml +++ b/gateleen-security/pom.xml @@ -6,7 +6,7 @@ org.swisspush.gateleen gateleen - 1.3.29 + 1.3.30-SNAPSHOT gateleen-security diff --git a/gateleen-test/pom.xml b/gateleen-test/pom.xml index d88bc1ee..8934decd 100644 --- a/gateleen-test/pom.xml +++ b/gateleen-test/pom.xml @@ -6,7 +6,7 @@ org.swisspush.gateleen gateleen - 1.3.29 + 1.3.30-SNAPSHOT gateleen-test jar diff --git a/gateleen-testhelper/pom.xml b/gateleen-testhelper/pom.xml index 9c7c3af1..1513a853 100644 --- a/gateleen-testhelper/pom.xml +++ b/gateleen-testhelper/pom.xml @@ -6,7 +6,7 @@ org.swisspush.gateleen gateleen - 1.3.29 + 1.3.30-SNAPSHOT gateleen-testhelper diff --git a/gateleen-user/pom.xml b/gateleen-user/pom.xml index ad63de3c..6eb0dbbe 100644 --- a/gateleen-user/pom.xml +++ b/gateleen-user/pom.xml @@ -6,7 +6,7 @@ org.swisspush.gateleen gateleen - 1.3.29 + 1.3.30-SNAPSHOT gateleen-user diff --git a/gateleen-validation/pom.xml b/gateleen-validation/pom.xml index aab3d6bf..b9585560 100644 --- a/gateleen-validation/pom.xml +++ b/gateleen-validation/pom.xml @@ -6,7 +6,7 @@ org.swisspush.gateleen gateleen - 1.3.29 + 1.3.30-SNAPSHOT gateleen-validation diff --git a/pom.xml b/pom.xml index 8ae347f8..08e2a615 100644 --- a/pom.xml +++ b/pom.xml @@ -6,7 +6,7 @@ org.swisspush.gateleen gateleen - 1.3.29 + 1.3.30-SNAPSHOT pom gateleen Middleware library based on Vert.x to build advanced JSON/REST communication servers From 4bd95332ecdbf2086a605250da05e5494bda14f6 Mon Sep 17 00:00:00 2001 From: Marc-Andre Weber Date: Fri, 12 May 2023 09:07:31 +0200 Subject: [PATCH 06/19] Bumped some dependency versions --- pom.xml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pom.xml b/pom.xml index 08e2a615..1065a336 100644 --- a/pom.xml +++ b/pom.xml @@ -53,7 +53,7 @@ /usr/local/bin/chromedriver 4.2.1 4.3.3 - 2.13.0 + 2.15.0 5.3.21 @@ -398,7 +398,7 @@ org.json json - 20210307 + 20230227 joda-time From 4e805d4bbda50af3a660495d570cc176381bece6 Mon Sep 17 00:00:00 2001 From: Marc-Andre Weber Date: Fri, 12 May 2023 09:26:22 +0200 Subject: [PATCH 07/19] Bumped some more dependency versions --- gateleen-hook-js/package.json | 2 +- pom.xml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/gateleen-hook-js/package.json b/gateleen-hook-js/package.json index edb1a87e..05abbc7e 100644 --- a/gateleen-hook-js/package.json +++ b/gateleen-hook-js/package.json @@ -20,7 +20,7 @@ "devDependencies": { "autoprefixer-core": "6.0.1", "cssnano": "3.7.4", - "grunt": "0.4.5", + "grunt": "1.5.3", "grunt-cli": "1.2.0", "grunt-contrib-clean": "1.0.0", "grunt-contrib-concat": "1.0.1", diff --git a/pom.xml b/pom.xml index 1065a336..e631355b 100644 --- a/pom.xml +++ b/pom.xml @@ -418,7 +418,7 @@ net.minidev json-smart - 2.4.7 + 2.4.10 From 1a837b7c1e1f9512161d6e561c88cd75e6bc81fb Mon Sep 17 00:00:00 2001 From: Marc-Andre Weber Date: Fri, 12 May 2023 09:52:04 +0200 Subject: [PATCH 08/19] Bumped spring framework dependency version to 5.3.27 --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index e631355b..e229d50d 100644 --- a/pom.xml +++ b/pom.xml @@ -54,7 +54,7 @@ 4.2.1 4.3.3 2.15.0 - 5.3.21 + 5.3.27 From cd43a66ed374ac372b8968de5023b6efb46a7731 Mon Sep 17 00:00:00 2001 From: "Ball, Nware" Date: Mon, 22 May 2023 08:06:02 +0700 Subject: [PATCH 09/19] remove any reference to Post internal resources --- gateleen-hook-js/.npmrc-post | 2 -- gateleen-hook-js/pom.xml | 2 -- 2 files changed, 4 deletions(-) delete mode 100644 gateleen-hook-js/.npmrc-post diff --git a/gateleen-hook-js/.npmrc-post b/gateleen-hook-js/.npmrc-post deleted file mode 100644 index 9af0a1b0..00000000 --- a/gateleen-hook-js/.npmrc-post +++ /dev/null @@ -1,2 +0,0 @@ -registry = https://artifactory.tools.post.ch/artifactory/api/npm/npm-virtual -sass_binary_site = https://artifactory.tools.post.ch/artifactory/files-local/node-sass diff --git a/gateleen-hook-js/pom.xml b/gateleen-hook-js/pom.xml index d7abbcb7..6c5e04dd 100644 --- a/gateleen-hook-js/pom.xml +++ b/gateleen-hook-js/pom.xml @@ -17,8 +17,6 @@ - http://artifactory.pnet.ch/artifactory/list/ext-binaries-local/node/ - http://artifactory.pnet.ch/artifactory/list/ext-binaries-local/node/ .npmrc-post From 294ce13f5d51a2c165ff949d4e3abf1e474bd339 Mon Sep 17 00:00:00 2001 From: "Ball, Nware" Date: Mon, 22 May 2023 11:00:33 +0700 Subject: [PATCH 10/19] remove any reference to Post internal resources --- .../src/main/resources/playground/server/pages/queue.html | 6 +----- .../test/resources/testresource_valid_scheduler_resource | 2 +- 2 files changed, 2 insertions(+), 6 deletions(-) diff --git a/gateleen-playground/src/main/resources/playground/server/pages/queue.html b/gateleen-playground/src/main/resources/playground/server/pages/queue.html index d88f7a28..0d7c9603 100755 --- a/gateleen-playground/src/main/resources/playground/server/pages/queue.html +++ b/gateleen-playground/src/main/resources/playground/server/pages/queue.html @@ -144,11 +144,7 @@ })[0]; var uniqueId = uniqueIdHeader ? uniqueIdHeader[1] : undefined; console.log(request) - var link = uniqueId ? - "  ": - ""; - row.find(".uri").html(request.uri + link); + row.find(".uri").html(request.uri); row.find(".edit").attr("href", "/playground/server/pages/editor.html#"+uri+"/"+index); index++; var headers = row.find(".headers"); diff --git a/gateleen-scheduler/src/test/resources/testresource_valid_scheduler_resource b/gateleen-scheduler/src/test/resources/testresource_valid_scheduler_resource index b737c92c..e652fd78 100644 --- a/gateleen-scheduler/src/test/resources/testresource_valid_scheduler_resource +++ b/gateleen-scheduler/src/test/resources/testresource_valid_scheduler_resource @@ -44,7 +44,7 @@ "requests": [{ "uri": "/playground/osb/scheduler", "method": "PUT", - "payload": "dummy", + "payload": "dummy", "headers": [ [ "Content-Type", From eb6868222c6226ca4a4f10c95e04780b8b8eced6 Mon Sep 17 00:00:00 2001 From: "Ball, Nware" Date: Mon, 22 May 2023 15:20:51 +0700 Subject: [PATCH 11/19] use public .npmrc --- gateleen-hook-js/pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gateleen-hook-js/pom.xml b/gateleen-hook-js/pom.xml index 6c5e04dd..f4bd3492 100644 --- a/gateleen-hook-js/pom.xml +++ b/gateleen-hook-js/pom.xml @@ -17,7 +17,7 @@ - .npmrc-post + .npmrc-public From 248ca4fab91f1f5eb504b83628e07dbd92d95d20 Mon Sep 17 00:00:00 2001 From: "Ball, Nware" Date: Tue, 23 May 2023 09:06:53 +0700 Subject: [PATCH 12/19] use default .npmrc --- gateleen-hook-js/{.npmrc-public => .npmrc} | 0 gateleen-hook-js/pom.xml | 2 +- 2 files changed, 1 insertion(+), 1 deletion(-) rename gateleen-hook-js/{.npmrc-public => .npmrc} (100%) diff --git a/gateleen-hook-js/.npmrc-public b/gateleen-hook-js/.npmrc similarity index 100% rename from gateleen-hook-js/.npmrc-public rename to gateleen-hook-js/.npmrc diff --git a/gateleen-hook-js/pom.xml b/gateleen-hook-js/pom.xml index f4bd3492..77b3fb14 100644 --- a/gateleen-hook-js/pom.xml +++ b/gateleen-hook-js/pom.xml @@ -17,7 +17,7 @@ - .npmrc-public + .npmrc From 27667ab746c2a2c78bf9dee27eb2061a0cf06c87 Mon Sep 17 00:00:00 2001 From: Marc-Andre Weber Date: Thu, 8 Jun 2023 15:49:29 +0200 Subject: [PATCH 13/19] #541 Access redis through redisProvider [inital commit] --- .../storage/CacheRequestRedisCommand.java | 18 ++-- .../cache/storage/ClearCacheRedisCommand.java | 24 ++--- .../cache/storage/RedisCacheStorage.java | 36 ++++--- .../cache/storage/RedisCacheStorageTest.java | 4 +- .../core/lock/impl/RedisBasedLock.java | 16 ++-- .../lock/lua/ReleaseLockRedisCommand.java | 22 +++-- .../gateleen/core/lua/LuaScriptState.java | 14 +-- .../gateleen/core/util/FailedAsyncResult.java | 31 +++++++ .../core/lock/impl/RedisBasedLockTest.java | 9 +- .../gateleen/delta/DeltaHandler.java | 52 +++++++---- .../gateleen/delta/DeltaHandlerTest.java | 38 +++++++- .../impl/RedisReducedPropagationStorage.java | 38 +++++--- .../lua/RemoveExpiredQueuesRedisCommand.java | 17 ++-- .../lua/StartQueueTimerRedisCommand.java | 23 ++--- ...tionStorageAddQueueMultipleQueuesTest.java | 5 +- ...onStorageRemoveExpiredQueuesEmptyTest.java | 5 +- .../RedisReducedPropagationStorageTest.java | 5 +- .../gateleen/kafka/KafkaMessageSender.java | 2 +- .../monitoring/CustomRedisMonitor.java | 6 +- .../gateleen/monitoring/RedisMonitor.java | 62 +++++++------ .../gateleen/monitoring/RedisMonitorTest.java | 11 ++- .../swisspush/gateleen/playground/Server.java | 18 ++-- .../impl/RedisQueueCircuitBreakerStorage.java | 93 ++++++++++--------- .../lua/CloseCircuitRedisCommand.java | 36 +++---- .../lua/GetAllCircuitsRedisCommand.java | 28 +++--- .../lua/HalfOpenCircuitRedisCommand.java | 36 +++---- .../lua/ReOpenCircuitRedisCommand.java | 36 +++---- .../lua/UnlockSampleQueuesRedisCommand.java | 36 +++---- .../lua/UpdateStatsRedisCommand.java | 24 ++--- .../RedisQueueCircuitBreakerStorageTest.java | 3 +- .../gateleen/runconfig/RunConfig.java | 28 +++--- .../gateleen/scheduler/Scheduler.java | 68 +++++++------- .../gateleen/scheduler/SchedulerFactory.java | 20 ++-- .../scheduler/SchedulerResourceManager.java | 17 ++-- .../scheduler/SchedulerFactoryTest.java | 12 ++- .../org/swisspush/gateleen/AbstractTest.java | 18 ++-- 36 files changed, 541 insertions(+), 370 deletions(-) create mode 100644 gateleen-core/src/main/java/org/swisspush/gateleen/core/util/FailedAsyncResult.java diff --git a/gateleen-cache/src/main/java/org/swisspush/gateleen/cache/storage/CacheRequestRedisCommand.java b/gateleen-cache/src/main/java/org/swisspush/gateleen/cache/storage/CacheRequestRedisCommand.java index aa72af44..edb8283f 100644 --- a/gateleen-cache/src/main/java/org/swisspush/gateleen/cache/storage/CacheRequestRedisCommand.java +++ b/gateleen-cache/src/main/java/org/swisspush/gateleen/cache/storage/CacheRequestRedisCommand.java @@ -1,10 +1,10 @@ package org.swisspush.gateleen.cache.storage; import io.vertx.core.Promise; -import io.vertx.redis.client.RedisAPI; import org.slf4j.Logger; import org.swisspush.gateleen.core.lua.LuaScriptState; import org.swisspush.gateleen.core.lua.RedisCommand; +import org.swisspush.gateleen.core.redis.RedisProvider; import org.swisspush.gateleen.core.util.RedisUtils; import java.util.List; @@ -18,23 +18,23 @@ public class CacheRequestRedisCommand implements RedisCommand { private final List keys; private final List arguments; private final Promise promise; - private final RedisAPI redisAPI; + private final RedisProvider redisProvider; private final Logger log; public CacheRequestRedisCommand(LuaScriptState luaScriptState, List keys, List arguments, - RedisAPI redisAPI, Logger log, final Promise promise) { + RedisProvider redisProvider, Logger log, final Promise promise) { this.luaScriptState = luaScriptState; this.keys = keys; this.arguments = arguments; - this.redisAPI = redisAPI; + this.redisProvider = redisProvider; this.log = log; this.promise = promise; } @Override public void exec(int executionCounter) { - List args= RedisUtils.toPayload(luaScriptState.getSha(), keys.size(), keys, arguments); - redisAPI.evalsha(args, event -> { + List args = RedisUtils.toPayload(luaScriptState.getSha(), keys.size(), keys, arguments); + redisProvider.redis().onSuccess(redisAPI -> redisAPI.evalsha(args, event -> { if (event.succeeded()) { String resultStr = event.result().toString(); if ("OK".equals(resultStr)) { @@ -50,13 +50,13 @@ public void exec(int executionCounter) { if (executionCounter > 10) { promise.fail("amount the script got loaded is higher than 10, we abort"); } else { - luaScriptState.loadLuaScript(new CacheRequestRedisCommand(luaScriptState, keys, arguments, redisAPI, log, promise), executionCounter); + luaScriptState.loadLuaScript(new CacheRequestRedisCommand(luaScriptState, keys, arguments, + redisProvider, log, promise), executionCounter); } } else { promise.fail("CacheRequestRedisCommand request failed with message: " + message); } } - }); - + })).onFailure(throwable -> promise.fail("Redis: CacheRequestRedisCommand request failed with message: " + throwable.getMessage())); } } diff --git a/gateleen-cache/src/main/java/org/swisspush/gateleen/cache/storage/ClearCacheRedisCommand.java b/gateleen-cache/src/main/java/org/swisspush/gateleen/cache/storage/ClearCacheRedisCommand.java index c9a36590..d31d7d16 100644 --- a/gateleen-cache/src/main/java/org/swisspush/gateleen/cache/storage/ClearCacheRedisCommand.java +++ b/gateleen-cache/src/main/java/org/swisspush/gateleen/cache/storage/ClearCacheRedisCommand.java @@ -1,10 +1,10 @@ package org.swisspush.gateleen.cache.storage; import io.vertx.core.Promise; -import io.vertx.redis.client.RedisAPI; import org.slf4j.Logger; import org.swisspush.gateleen.core.lua.LuaScriptState; import org.swisspush.gateleen.core.lua.RedisCommand; +import org.swisspush.gateleen.core.redis.RedisProvider; import org.swisspush.gateleen.core.util.RedisUtils; import java.util.List; @@ -18,41 +18,41 @@ public class ClearCacheRedisCommand implements RedisCommand { private final List keys; private final List arguments; private final Promise promise; - private final RedisAPI redisAPI; + private final RedisProvider redisProvider; private final Logger log; public ClearCacheRedisCommand(LuaScriptState luaScriptState, List keys, List arguments, - RedisAPI redisAPI, Logger log, final Promise promise) { + RedisProvider redisProvider, Logger log, final Promise promise) { this.luaScriptState = luaScriptState; this.keys = keys; this.arguments = arguments; - this.redisAPI = redisAPI; + this.redisProvider = redisProvider; this.log = log; this.promise = promise; } @Override public void exec(int executionCounter) { - List args= RedisUtils.toPayload(luaScriptState.getSha(), keys.size(), keys, arguments); - redisAPI.evalsha(args, event -> { - if(event.succeeded()){ + List args = RedisUtils.toPayload(luaScriptState.getSha(), keys.size(), keys, arguments); + redisProvider.redis().onSuccess(redisAPI -> redisAPI.evalsha(args, event -> { + if (event.succeeded()) { Long clearedItemsCount = event.result().toLong(); promise.complete(clearedItemsCount); } else { String message = event.cause().getMessage(); - if(message != null && message.startsWith("NOSCRIPT")) { + if (message != null && message.startsWith("NOSCRIPT")) { log.warn("ClearCacheRedisCommand script couldn't be found, reload it"); log.warn("amount the script got loaded: " + executionCounter); - if(executionCounter > 10) { + if (executionCounter > 10) { promise.fail("amount the script got loaded is higher than 10, we abort"); } else { - luaScriptState.loadLuaScript(new ClearCacheRedisCommand(luaScriptState, keys, arguments, redisAPI, log, promise), executionCounter); + luaScriptState.loadLuaScript(new ClearCacheRedisCommand(luaScriptState, keys, arguments, + redisProvider, log, promise), executionCounter); } } else { promise.fail("ClearCacheRedisCommand request failed with message: " + message); } } - }); - + })).onFailure(throwable -> promise.fail("Redis: ClearCacheRedisCommand request failed with message: " + throwable.getMessage())); } } diff --git a/gateleen-cache/src/main/java/org/swisspush/gateleen/cache/storage/RedisCacheStorage.java b/gateleen-cache/src/main/java/org/swisspush/gateleen/cache/storage/RedisCacheStorage.java index ef9701f3..d2262fdd 100644 --- a/gateleen-cache/src/main/java/org/swisspush/gateleen/cache/storage/RedisCacheStorage.java +++ b/gateleen-cache/src/main/java/org/swisspush/gateleen/cache/storage/RedisCacheStorage.java @@ -6,11 +6,11 @@ import io.vertx.core.Vertx; import io.vertx.core.buffer.Buffer; import io.vertx.core.json.JsonArray; -import io.vertx.redis.client.RedisAPI; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.swisspush.gateleen.core.lock.Lock; import org.swisspush.gateleen.core.lua.LuaScriptState; +import org.swisspush.gateleen.core.redis.RedisProvider; import org.swisspush.gateleen.core.util.Address; import java.time.Duration; @@ -29,7 +29,7 @@ public class RedisCacheStorage implements CacheStorage { private Logger log = LoggerFactory.getLogger(RedisCacheStorage.class); private final Lock lock; - private final RedisAPI redisAPI; + private final RedisProvider redisProvider; private LuaScriptState clearCacheLuaScriptState; private LuaScriptState cacheRequestLuaScriptState; @@ -37,11 +37,11 @@ public class RedisCacheStorage implements CacheStorage { public static final String CACHE_PREFIX = "gateleen.cache:"; public static final String STORAGE_CLEANUP_TASK_LOCK = "cacheStorageCleanupTask"; - public RedisCacheStorage(Vertx vertx, Lock lock, RedisAPI redisAPI, long storageCleanupIntervalMs) { + public RedisCacheStorage(Vertx vertx, Lock lock, RedisProvider redisProvider, long storageCleanupIntervalMs) { this.lock = lock; - this.redisAPI = redisAPI; - clearCacheLuaScriptState = new LuaScriptState(CacheLuaScripts.CLEAR_CACHE, redisAPI, false); - cacheRequestLuaScriptState = new LuaScriptState(CacheLuaScripts.CACHE_REQUEST, redisAPI, false); + this.redisProvider = redisProvider; + clearCacheLuaScriptState = new LuaScriptState(CacheLuaScripts.CLEAR_CACHE, redisProvider, false); + cacheRequestLuaScriptState = new LuaScriptState(CacheLuaScripts.CACHE_REQUEST, redisProvider, false); vertx.setPeriodic(storageCleanupIntervalMs, event -> { String token = token(STORAGE_CLEANUP_TASK_LOCK); @@ -80,7 +80,7 @@ public Future cacheRequest(String cacheIdentifier, Buffer cachedObject, Du Promise promise = Promise.promise(); List keys = Collections.singletonList(CACHED_REQUESTS); List arguments = List.of(CACHE_PREFIX, cacheIdentifier, cachedObject.toString(), String.valueOf(cacheExpiry.toMillis())); - CacheRequestRedisCommand cmd = new CacheRequestRedisCommand(cacheRequestLuaScriptState, keys, arguments, redisAPI, log, promise); + CacheRequestRedisCommand cmd = new CacheRequestRedisCommand(cacheRequestLuaScriptState, keys, arguments, redisProvider, log, promise); cmd.exec(0); return promise.future(); } @@ -88,7 +88,7 @@ public Future cacheRequest(String cacheIdentifier, Buffer cachedObject, Du @Override public Future> cachedRequest(String cacheIdentifier) { Promise> promise = Promise.promise(); - redisAPI.get(CACHE_PREFIX + cacheIdentifier, event -> { + redisProvider.redis().onSuccess(redisAPI -> redisAPI.get(CACHE_PREFIX + cacheIdentifier, event -> { if (event.failed()) { String message = "Failed to get cached request '" + cacheIdentifier + "'. Cause: " + logCause(event); log.error(message); @@ -100,6 +100,10 @@ public Future> cachedRequest(String cacheIdentifier) { promise.complete(Optional.empty()); } } + })).onFailure(throwable -> { + String message = "Redis: Failed to get cached request '" + cacheIdentifier + "'. Cause: " + throwable.getMessage(); + log.error(message); + promise.fail(message); }); return promise.future(); } @@ -109,7 +113,7 @@ public Future clearCache() { Promise promise = Promise.promise(); List keys = Collections.singletonList(CACHED_REQUESTS); List arguments = List.of(CACHE_PREFIX, "true"); - ClearCacheRedisCommand cmd = new ClearCacheRedisCommand(clearCacheLuaScriptState, keys, arguments, redisAPI, log, promise); + ClearCacheRedisCommand cmd = new ClearCacheRedisCommand(clearCacheLuaScriptState, keys, arguments, redisProvider, log, promise); cmd.exec(0); return promise.future(); } @@ -117,7 +121,7 @@ public Future clearCache() { @Override public Future cacheEntriesCount() { Promise promise = Promise.promise(); - redisAPI.scard(CACHED_REQUESTS, reply -> { + redisProvider.redis().onSuccess(redisAPI -> redisAPI.scard(CACHED_REQUESTS, reply -> { if (reply.failed()) { String message = "Failed to get count of cached requests. Cause: " + logCause(reply); log.error(message); @@ -125,6 +129,10 @@ public Future cacheEntriesCount() { } else { promise.complete(reply.result().toLong()); } + })).onFailure(throwable -> { + String message = "Redis: Failed to get count of cached requests. Cause: " + throwable.getMessage(); + log.error(message); + promise.fail(message); }); return promise.future(); @@ -133,7 +141,7 @@ public Future cacheEntriesCount() { @Override public Future> cacheEntries() { Promise> promise = Promise.promise(); - redisAPI.smembers(CACHED_REQUESTS, reply -> { + redisProvider.redis().onSuccess(redisAPI -> redisAPI.smembers(CACHED_REQUESTS, reply -> { if (reply.failed()) { String message = "Failed to get cached requests. Cause: " + logCause(reply); log.error(message); @@ -147,6 +155,10 @@ public Future> cacheEntries() { .collect(Collectors.toSet()); promise.complete(result); } + })).onFailure(throwable -> { + String message = "Redis: Failed to get cached requests. Cause: " + throwable.getMessage(); + log.error(message); + promise.fail(message); }); return promise.future(); @@ -156,7 +168,7 @@ private Future cleanup() { Promise promise = Promise.promise(); List keys = Collections.singletonList(CACHED_REQUESTS); List arguments = List.of(CACHE_PREFIX, "false"); - ClearCacheRedisCommand cmd = new ClearCacheRedisCommand(clearCacheLuaScriptState, keys, arguments, redisAPI, log, promise); + ClearCacheRedisCommand cmd = new ClearCacheRedisCommand(clearCacheLuaScriptState, keys, arguments, redisProvider, log, promise); cmd.exec(0); return promise.future(); } diff --git a/gateleen-cache/src/test/java/org/swisspush/gateleen/cache/storage/RedisCacheStorageTest.java b/gateleen-cache/src/test/java/org/swisspush/gateleen/cache/storage/RedisCacheStorageTest.java index 648c5508..738717ed 100644 --- a/gateleen-cache/src/test/java/org/swisspush/gateleen/cache/storage/RedisCacheStorageTest.java +++ b/gateleen-cache/src/test/java/org/swisspush/gateleen/cache/storage/RedisCacheStorageTest.java @@ -59,7 +59,9 @@ public void setUp() { Mockito.when(lock.acquireLock(anyString(), anyString(), anyLong())).thenReturn(Future.succeededFuture(Boolean.TRUE)); Mockito.when(lock.releaseLock(anyString(), anyString())).thenReturn(Future.succeededFuture(Boolean.TRUE)); - redisCacheStorage = new RedisCacheStorage(vertx, lock, RedisAPI.api(new RedisClient(vertx, new RedisOptions())), 2000); + RedisAPI redisAPI = RedisAPI.api(new RedisClient(vertx, new RedisOptions())); + + redisCacheStorage = new RedisCacheStorage(vertx, lock, () -> Future.succeededFuture(redisAPI), 2000); jedis = new Jedis(new HostAndPort("localhost", 6379)); try { jedis.flushAll(); diff --git a/gateleen-core/src/main/java/org/swisspush/gateleen/core/lock/impl/RedisBasedLock.java b/gateleen-core/src/main/java/org/swisspush/gateleen/core/lock/impl/RedisBasedLock.java index 2b1f351a..ac60a674 100644 --- a/gateleen-core/src/main/java/org/swisspush/gateleen/core/lock/impl/RedisBasedLock.java +++ b/gateleen-core/src/main/java/org/swisspush/gateleen/core/lock/impl/RedisBasedLock.java @@ -6,7 +6,6 @@ import io.vertx.core.Promise; import io.vertx.core.json.JsonArray; import io.vertx.redis.client.Command; -import io.vertx.redis.client.RedisAPI; import io.vertx.redis.client.Response; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -14,6 +13,8 @@ import org.swisspush.gateleen.core.lock.lua.LockLuaScripts; import org.swisspush.gateleen.core.lock.lua.ReleaseLockRedisCommand; import org.swisspush.gateleen.core.lua.LuaScriptState; +import org.swisspush.gateleen.core.redis.RedisProvider; +import org.swisspush.gateleen.core.util.FailedAsyncResult; import org.swisspush.gateleen.core.util.RedisUtils; import java.util.Collections; @@ -31,11 +32,11 @@ public class RedisBasedLock implements Lock { public static final String STORAGE_PREFIX = "gateleen.core-lock:"; private LuaScriptState releaseLockLuaScriptState; - private RedisAPI redisAPI; + private RedisProvider redisProvider; - public RedisBasedLock(RedisAPI redisAPI) { - this.redisAPI = redisAPI; - this.releaseLockLuaScriptState = new LuaScriptState(LockLuaScripts.LOCK_RELEASE, redisAPI, false); + public RedisBasedLock(RedisProvider redisProvider) { + this.redisProvider = redisProvider; + this.releaseLockLuaScriptState = new LuaScriptState(LockLuaScripts.LOCK_RELEASE, redisProvider, false); } private void redisSetWithOptions(String key, String value, boolean nx, long px, Handler> handler) { @@ -44,7 +45,8 @@ private void redisSetWithOptions(String key, String value, boolean nx, long px, if (nx) { options.add("NX"); } - redisAPI.send(Command.SET, RedisUtils.toPayload(key, value, options).toArray(new String[0])).onComplete(handler); + redisProvider.redis().onSuccess(redisAPI -> redisAPI.send(Command.SET, RedisUtils.toPayload(key, value, options).toArray(new String[0])) + .onComplete(handler)).onFailure(throwable -> handler.handle(new FailedAsyncResult<>(throwable))); } @Override @@ -70,7 +72,7 @@ public Future releaseLock(String lock, String token) { List keys = Collections.singletonList(buildLockKey(lock)); List arguments = Collections.singletonList(token); ReleaseLockRedisCommand cmd = new ReleaseLockRedisCommand(releaseLockLuaScriptState, - keys, arguments, redisAPI, log, promise); + keys, arguments, redisProvider, log, promise); cmd.exec(0); return promise.future(); } diff --git a/gateleen-core/src/main/java/org/swisspush/gateleen/core/lock/lua/ReleaseLockRedisCommand.java b/gateleen-core/src/main/java/org/swisspush/gateleen/core/lock/lua/ReleaseLockRedisCommand.java index c29ca308..eece7fed 100644 --- a/gateleen-core/src/main/java/org/swisspush/gateleen/core/lock/lua/ReleaseLockRedisCommand.java +++ b/gateleen-core/src/main/java/org/swisspush/gateleen/core/lock/lua/ReleaseLockRedisCommand.java @@ -1,10 +1,10 @@ package org.swisspush.gateleen.core.lock.lua; import io.vertx.core.Promise; -import io.vertx.redis.client.RedisAPI; import org.slf4j.Logger; import org.swisspush.gateleen.core.lua.LuaScriptState; import org.swisspush.gateleen.core.lua.RedisCommand; +import org.swisspush.gateleen.core.redis.RedisProvider; import java.util.ArrayList; import java.util.List; @@ -18,15 +18,15 @@ public class ReleaseLockRedisCommand implements RedisCommand { private List keys; private List arguments; private Promise promise; - private RedisAPI redisAPI; + private RedisProvider redisProvider; private Logger log; public ReleaseLockRedisCommand(LuaScriptState luaScriptState, List keys, List arguments, - RedisAPI redisAPI, Logger log, final Promise promise) { + RedisProvider redisProvider, Logger log, final Promise promise) { this.luaScriptState = luaScriptState; this.keys = keys; this.arguments = arguments; - this.redisAPI = redisAPI; + this.redisProvider = redisProvider; this.log = log; this.promise = promise; } @@ -38,24 +38,26 @@ public void exec(int executionCounter) { args.add(String.valueOf(keys.size())); args.addAll(keys); args.addAll(arguments); - redisAPI.evalsha(args, event -> { - if(event.succeeded()){ + + redisProvider.redis().onSuccess(redisAPI -> redisAPI.evalsha(args, event -> { + if (event.succeeded()) { Long unlocked = event.result().toLong(); promise.complete(unlocked > 0); } else { String message = event.cause().getMessage(); - if(message != null && message.startsWith("NOSCRIPT")) { + if (message != null && message.startsWith("NOSCRIPT")) { log.warn("ReleaseLockRedisCommand script couldn't be found, reload it"); log.warn("amount the script got loaded: " + executionCounter); - if(executionCounter > 10) { + if (executionCounter > 10) { promise.fail("amount the script got loaded is higher than 10, we abort"); } else { - luaScriptState.loadLuaScript(new ReleaseLockRedisCommand(luaScriptState, keys, arguments, redisAPI, log, promise), executionCounter); + luaScriptState.loadLuaScript(new ReleaseLockRedisCommand(luaScriptState, keys, + arguments, redisProvider, log, promise), executionCounter); } } else { promise.fail("ReleaseLockRedisCommand request failed with message: " + message); } } - }); + })).onFailure(throwable -> promise.fail("Redis: ReleaseLockRedisCommand request failed with error: " + throwable.getMessage())); } } diff --git a/gateleen-core/src/main/java/org/swisspush/gateleen/core/lua/LuaScriptState.java b/gateleen-core/src/main/java/org/swisspush/gateleen/core/lua/LuaScriptState.java index b9688c37..8a4f9521 100644 --- a/gateleen-core/src/main/java/org/swisspush/gateleen/core/lua/LuaScriptState.java +++ b/gateleen-core/src/main/java/org/swisspush/gateleen/core/lua/LuaScriptState.java @@ -1,9 +1,9 @@ package org.swisspush.gateleen.core.lua; -import io.vertx.redis.client.RedisAPI; import org.apache.commons.codec.digest.DigestUtils; import org.slf4j.Logger; import org.slf4j.LoggerFactory; +import org.swisspush.gateleen.core.redis.RedisProvider; import java.io.BufferedReader; import java.io.IOException; @@ -28,13 +28,13 @@ public class LuaScriptState { */ private String sha; - private RedisAPI redisAPI; + private RedisProvider redisProvider; private Logger log = LoggerFactory.getLogger(LuaScriptState.class); - public LuaScriptState(LuaScript luaScriptType, RedisAPI redisAPI, boolean logoutput) { + public LuaScriptState(LuaScript luaScriptType, RedisProvider redisProvider, boolean logoutput) { this.luaScriptType = luaScriptType; - this.redisAPI = redisAPI; + this.redisProvider = redisProvider; this.logoutput = logoutput; this.composeLuaScript(luaScriptType); this.loadLuaScript(new RedisCommandDoNothing(), 0); @@ -86,7 +86,7 @@ private String readLuaScriptFromClasspath(LuaScript luaScriptType) { public void loadLuaScript(final RedisCommand redisCommand, int executionCounter) { final int executionCounterIncr = ++executionCounter; // check first if the lua script already exists in the store - redisAPI.script(Arrays.asList("exists", this.sha),resultArray -> { + redisProvider.redis().onSuccess(redisAPI -> redisAPI.script(Arrays.asList("exists", sha), resultArray -> { if (resultArray.failed()) { log.error("Error checking whether lua script exists", resultArray.cause()); return; @@ -100,7 +100,7 @@ public void loadLuaScript(final RedisCommand redisCommand, int executionCounter) log.info("load lua script for script type: {} logutput: {}", luaScriptType, logoutput); redisAPI.script(Arrays.asList("load",script), stringAsyncResult -> { String newSha = stringAsyncResult.result().toString(); - log.info("got sha from redis for lua script: {}: {}", luaScriptType, newSha); + log.info("got sha from redis for lua script: {}: {}", luaScriptType, newSha); if (!newSha.equals(sha)) { log.warn("the sha calculated by myself: {} doesn't match with the sha from redis: {}. " + "We use the sha from redis", sha, newSha); @@ -110,7 +110,7 @@ public void loadLuaScript(final RedisCommand redisCommand, int executionCounter) redisCommand.exec(executionCounterIncr); }); } - }); + })).onFailure(throwable -> log.error("Redis: Error checking whether lua script exists", throwable)); } public String getScript() { diff --git a/gateleen-core/src/main/java/org/swisspush/gateleen/core/util/FailedAsyncResult.java b/gateleen-core/src/main/java/org/swisspush/gateleen/core/util/FailedAsyncResult.java new file mode 100644 index 00000000..410cb71d --- /dev/null +++ b/gateleen-core/src/main/java/org/swisspush/gateleen/core/util/FailedAsyncResult.java @@ -0,0 +1,31 @@ +package org.swisspush.gateleen.core.util; + +import io.vertx.core.AsyncResult; + +public class FailedAsyncResult implements AsyncResult { + private final Throwable cause; + + public FailedAsyncResult(Throwable cause) { + this.cause = cause; + } + + @Override + public T result() { + return null; + } + + @Override + public Throwable cause() { + return cause; + } + + @Override + public boolean succeeded() { + return false; + } + + @Override + public boolean failed() { + return true; + } +} diff --git a/gateleen-core/src/test/java/org/swisspush/gateleen/core/lock/impl/RedisBasedLockTest.java b/gateleen-core/src/test/java/org/swisspush/gateleen/core/lock/impl/RedisBasedLockTest.java index 606d981e..6ccfff0a 100644 --- a/gateleen-core/src/test/java/org/swisspush/gateleen/core/lock/impl/RedisBasedLockTest.java +++ b/gateleen-core/src/test/java/org/swisspush/gateleen/core/lock/impl/RedisBasedLockTest.java @@ -1,6 +1,7 @@ package org.swisspush.gateleen.core.lock.impl; import com.jayway.awaitility.Duration; +import io.vertx.core.Future; import io.vertx.core.Vertx; import io.vertx.ext.unit.Async; import io.vertx.ext.unit.TestContext; @@ -9,7 +10,10 @@ import io.vertx.redis.client.RedisAPI; import io.vertx.redis.client.RedisOptions; import io.vertx.redis.client.impl.RedisClient; -import org.junit.*; +import org.junit.After; +import org.junit.Before; +import org.junit.BeforeClass; +import org.junit.Test; import org.junit.runner.RunWith; import redis.clients.jedis.Jedis; import redis.clients.jedis.exceptions.JedisConnectionException; @@ -38,7 +42,8 @@ public class RedisBasedLockTest { @BeforeClass public static void setupLock(){ vertx = Vertx.vertx(); - redisBasedLock = new RedisBasedLock(RedisAPI.api(new RedisClient(vertx, new RedisOptions()))); + RedisAPI redisAPI = RedisAPI.api(new RedisClient(vertx, new RedisOptions())); + redisBasedLock = new RedisBasedLock(() -> Future.succeededFuture(redisAPI)); } @Before diff --git a/gateleen-delta/src/main/java/org/swisspush/gateleen/delta/DeltaHandler.java b/gateleen-delta/src/main/java/org/swisspush/gateleen/delta/DeltaHandler.java index b6e60527..f272e60b 100755 --- a/gateleen-delta/src/main/java/org/swisspush/gateleen/delta/DeltaHandler.java +++ b/gateleen-delta/src/main/java/org/swisspush/gateleen/delta/DeltaHandler.java @@ -9,11 +9,11 @@ import io.vertx.core.http.*; import io.vertx.core.json.JsonArray; import io.vertx.core.json.JsonObject; -import io.vertx.redis.client.RedisAPI; import io.vertx.redis.client.Response; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.swisspush.gateleen.core.http.RequestLoggerFactory; +import org.swisspush.gateleen.core.redis.RedisProvider; import org.swisspush.gateleen.core.util.*; import org.swisspush.gateleen.core.util.ExpansionDeltaUtil.CollectionResourceContainer; import org.swisspush.gateleen.core.util.ExpansionDeltaUtil.SlashHandling; @@ -49,19 +49,19 @@ public class DeltaHandler implements RuleProvider.RuleChangesObserver { private static final String ETAG_KEY_PREFIX = "delta:etags"; private HttpClient httpClient; - private RedisAPI redisAPI; + private RedisProvider redisProvider; private boolean rejectLimitOffsetRequests; private RuleProvider ruleProvider; private RuleFeaturesProvider ruleFeaturesProvider = new RuleFeaturesProvider(new ArrayList<>()); - public DeltaHandler(RedisAPI redisAPI, HttpClient httpClient, RuleProvider ruleProvider) { - this(redisAPI, httpClient, ruleProvider, false); + public DeltaHandler(RedisProvider redisProvider, HttpClient httpClient, RuleProvider ruleProvider) { + this(redisProvider, httpClient, ruleProvider, false); } - public DeltaHandler(RedisAPI redisAPI, HttpClient httpClient, RuleProvider ruleProvider, boolean rejectLimitOffsetRequests) { - this.redisAPI = redisAPI; + public DeltaHandler(RedisProvider redisProvider, HttpClient httpClient, RuleProvider ruleProvider, boolean rejectLimitOffsetRequests) { + this.redisProvider = redisProvider; this.httpClient = httpClient; this.rejectLimitOffsetRequests = rejectLimitOffsetRequests; @@ -126,7 +126,7 @@ private void handleResourcePUT(final HttpServerRequest request, final Router rou handleDeltaEtag(request, log, updateDelta -> { if (updateDelta) { // increment and get update-id - redisAPI.incr(SEQUENCE_KEY, reply -> { + redisProvider.redis().onSuccess(redisAPI -> redisAPI.incr(SEQUENCE_KEY, reply -> { if (reply.failed()) { log.error("incr command for redisKey {} failed with cause: {}", SEQUENCE_KEY, logCause(reply)); handleError(request, "error incrementing/accessing sequence for update-id"); @@ -148,8 +148,10 @@ private void handleResourcePUT(final HttpServerRequest request, final Router rou router.route(request); } }); + })).onFailure(throwable -> { + log.error("Redis: handleResourcePUT failed", throwable); + handleError(request, "handleResourcePUT: error incrementing/accessing sequence for update-id "); }); - } else { log.debug("skip updating delta, resume request"); request.resume(); @@ -172,7 +174,7 @@ private void handleDeltaEtag(final HttpServerRequest request, final Logger log, */ final String requestEtag = request.headers().get(IF_NONE_MATCH_HEADER); final String etagResourceKey = getResourceKey(request.path(), true); - redisAPI.get(etagResourceKey, event -> { + redisProvider.redis().onSuccess(redisAPI -> redisAPI.get(etagResourceKey, event -> { if (event.failed()) { log.error("get command for redisKey {} failed with cause: {}", etagResourceKey, logCause(event)); callback.handle(Boolean.TRUE); @@ -196,6 +198,9 @@ private void handleDeltaEtag(final HttpServerRequest request, final Logger log, saveOrUpdateDeltaEtag(etagResourceKey, request, log, aBoolean -> callback.handle(Boolean.TRUE)); } } + })).onFailure(throwable -> { + log.error("Redis: handleDeltaEtag failed for redisKey {}", etagResourceKey, throwable); + callback.handle(Boolean.TRUE); }); } @@ -211,11 +216,13 @@ private void saveOrUpdateDeltaEtag(final String etagResourceKey, final HttpServe } private void saveDelta(String deltaKey, String deltaValue, Long expireAfter, Handler> handler) { - if (expireAfter == null) { - redisAPI.set(Arrays.asList(deltaKey, deltaValue), (Handler) handler); - } else { - redisAPI.setex(deltaKey, String.valueOf(expireAfter), deltaValue, (Handler) handler); - } + redisProvider.redis().onSuccess(redisAPI -> { + if (expireAfter == null) { + redisAPI.set(Arrays.asList(deltaKey, deltaValue), (Handler) handler); + } else { + redisAPI.setex(deltaKey, String.valueOf(expireAfter), deltaValue, (Handler) handler); + } + }).onFailure(throwable -> handler.handle(new FailedAsyncResult<>(throwable))); } private String extractStringDeltaParameter(HttpServerRequest request, Logger log) { @@ -326,20 +333,25 @@ private void handleCollectionGET(final HttpServerRequest request, final String u } // read update-ids - redisAPI.mget(deltaResourceKeys, event -> { + redisProvider.redis().onSuccess(redisAPI -> redisAPI.mget(deltaResourceKeys, event -> { if (event.failed()) { - log.error("mget command failed with cuase: {}", logCause(event)); + log.error("mget command failed with cause: {}", logCause(event)); handleError(request, "error reading delta information"); return; } Response mgetValues = event.result(); - DeltaResourcesContainer deltaResourcesContainer = getDeltaResourceNames(subResourceNames, mgetValues, updateIdNumber); + DeltaResourcesContainer deltaResourcesContainer = getDeltaResourceNames(subResourceNames, + mgetValues, updateIdNumber); - JsonObject result = buildResultJsonObject(deltaResourcesContainer.getResourceNames(), dataContainer.getCollectionName()); - request.response().putHeader(DELTA_HEADER, "" + deltaResourcesContainer.getMaxUpdateId()); + JsonObject result = buildResultJsonObject(deltaResourcesContainer.getResourceNames(), + dataContainer.getCollectionName()); + request.response().putHeader(DELTA_HEADER, + "" + deltaResourcesContainer.getMaxUpdateId()); request.response().end(result.toString()); + })).onFailure(event -> { + log.error("Redis: handleCollectionGET failed", event); + handleError(request, "error reading delta information"); }); - } else { if (log.isTraceEnabled()) { log.trace("DeltaHandler: targetUri ({}) NOT using database", targetUri); diff --git a/gateleen-delta/src/test/java/org/swisspush/gateleen/delta/DeltaHandlerTest.java b/gateleen-delta/src/test/java/org/swisspush/gateleen/delta/DeltaHandlerTest.java index 16b45f46..b55049a9 100644 --- a/gateleen-delta/src/test/java/org/swisspush/gateleen/delta/DeltaHandlerTest.java +++ b/gateleen-delta/src/test/java/org/swisspush/gateleen/delta/DeltaHandlerTest.java @@ -6,6 +6,7 @@ import io.vertx.core.MultiMap; import io.vertx.core.http.HttpMethod; import io.vertx.core.http.HttpServerRequest; +import io.vertx.core.http.HttpServerResponse; import io.vertx.core.http.impl.headers.HeadersMultiMap; import io.vertx.ext.unit.TestContext; import io.vertx.ext.unit.junit.VertxUnitRunner; @@ -13,9 +14,11 @@ import org.junit.Before; import org.junit.Test; import org.junit.runner.RunWith; +import org.mockito.ArgumentCaptor; import org.mockito.Matchers; import org.swisspush.gateleen.core.http.DummyHttpServerRequest; import org.swisspush.gateleen.core.http.DummyHttpServerResponse; +import org.swisspush.gateleen.core.redis.RedisProvider; import org.swisspush.gateleen.core.util.StatusCode; import org.swisspush.gateleen.routing.Router; import org.swisspush.gateleen.routing.Rule; @@ -31,14 +34,20 @@ public class DeltaHandlerTest { private RedisAPI redisAPI; + private RedisProvider redisProvider; private RuleProvider ruleProvider; private Router router = mock(Router.class); private HttpServerRequest request; + private HttpServerResponse response; private MultiMap requestHeaders = MultiMap.caseInsensitiveMultiMap(); @Before public void before() { redisAPI = mock(RedisAPI.class); + + redisProvider = mock(RedisProvider.class); + when(redisProvider.redis()).thenReturn(Future.succeededFuture(redisAPI)); + doAnswer(invocation -> { Handler> handler = (Handler>) invocation.getArguments()[1]; handler.handle(Future.succeededFuture(555L)); @@ -51,6 +60,8 @@ public void before() { ruleProvider = mock(RuleProvider.class); request = mock(HttpServerRequest.class); + response = mock(HttpServerResponse.class); + when(request.response()).thenReturn(response); when(request.method()).thenReturn(HttpMethod.PUT); when(request.path()).thenReturn("/a/b/c"); when(request.headers()).thenReturn(requestHeaders); @@ -58,7 +69,7 @@ public void before() { @Test public void testIsDeltaRequest(TestContext context) { - DeltaHandler deltaHandler = new DeltaHandler(redisAPI, null, ruleProvider); + DeltaHandler deltaHandler = new DeltaHandler(redisProvider, null, ruleProvider); deltaHandler.rulesChanged(List.of( rule("/gateleen/server/res_1", false), rule("/gateleen/server/res_2", true)) @@ -141,7 +152,7 @@ public void testIsDeltaRequest(TestContext context) { @Test public void testDeltaNoExpiry() { - DeltaHandler deltaHandler = new DeltaHandler(redisAPI, null, ruleProvider); + DeltaHandler deltaHandler = new DeltaHandler(redisProvider, null, ruleProvider); deltaHandler.handle(request, router); verify(redisAPI, times(1)).set(eq(Arrays.asList("delta:resources:a:b:c", "555")), Matchers.any()); @@ -152,16 +163,35 @@ public void testDeltaNoExpiry() { public void testDeltaWithExpiry() { requestHeaders.add("x-expire-after", "123"); - DeltaHandler deltaHandler = new DeltaHandler(redisAPI, null, ruleProvider); + DeltaHandler deltaHandler = new DeltaHandler(redisProvider, null, ruleProvider); deltaHandler.handle(request, router); verify(redisAPI, times(1)).setex(eq("delta:resources:a:b:c"), eq("123"), eq("555"), Matchers.any()); verify(redisAPI, never()).set(Matchers.any(), Matchers.any()); } + @Test + public void testFailingRedisProviderAccess(TestContext context) { + requestHeaders.add("x-expire-after", "123"); + + when(redisProvider.redis()).thenReturn(Future.failedFuture("Boooom")); + + ArgumentCaptor statusCodeCaptor = ArgumentCaptor.forClass(Integer.class); + when(request.response().setStatusCode(statusCodeCaptor.capture())).thenReturn(response); + + ArgumentCaptor bodyCaptor = ArgumentCaptor.forClass(String.class); + when(request.response().end(bodyCaptor.capture())).thenReturn(Future.succeededFuture()); + + DeltaHandler deltaHandler = new DeltaHandler(redisProvider, null, ruleProvider); + deltaHandler.handle(request, router); + + context.assertEquals(StatusCode.INTERNAL_SERVER_ERROR.getStatusCode(), statusCodeCaptor.getValue(), "StatusCode should be 500"); + context.assertTrue(bodyCaptor.getValue().startsWith("handleResourcePUT")); + } + @Test public void testRejectLimitOffsetParameters(TestContext context) { - DeltaHandler deltaHandler = new DeltaHandler(redisAPI, null, ruleProvider, true); + DeltaHandler deltaHandler = new DeltaHandler(redisProvider, null, ruleProvider, true); final DummyHttpServerResponse response = new DummyHttpServerResponse(); DeltaRequest request = new DeltaRequest(MultiMap.caseInsensitiveMultiMap() .add("delta", "0") diff --git a/gateleen-hook/src/main/java/org/swisspush/gateleen/hook/reducedpropagation/impl/RedisReducedPropagationStorage.java b/gateleen-hook/src/main/java/org/swisspush/gateleen/hook/reducedpropagation/impl/RedisReducedPropagationStorage.java index fc7b49d7..cd1a34cc 100644 --- a/gateleen-hook/src/main/java/org/swisspush/gateleen/hook/reducedpropagation/impl/RedisReducedPropagationStorage.java +++ b/gateleen-hook/src/main/java/org/swisspush/gateleen/hook/reducedpropagation/impl/RedisReducedPropagationStorage.java @@ -5,11 +5,11 @@ import io.vertx.core.Promise; import io.vertx.core.json.DecodeException; import io.vertx.core.json.JsonObject; -import io.vertx.redis.client.RedisAPI; import io.vertx.redis.client.Response; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.swisspush.gateleen.core.lua.LuaScriptState; +import org.swisspush.gateleen.core.redis.RedisProvider; import org.swisspush.gateleen.core.util.StringUtils; import org.swisspush.gateleen.hook.reducedpropagation.ReducedPropagationStorage; import org.swisspush.gateleen.hook.reducedpropagation.lua.ReducedPropagationLuaScripts; @@ -27,7 +27,7 @@ * @author https://github.com/mcweba [Marc-Andre Weber] */ public class RedisReducedPropagationStorage implements ReducedPropagationStorage { - private RedisAPI redisAPI; + private RedisProvider redisProvider; private Logger log = LoggerFactory.getLogger(RedisReducedPropagationStorage.class); static final String QUEUE_TIMERS = "gateleen.hook-reducedpropagation-queuetimers"; @@ -36,11 +36,11 @@ public class RedisReducedPropagationStorage implements ReducedPropagationStorage private LuaScriptState startQueueTimerLuaScriptState; private LuaScriptState removeExpiredQueuesRedisCommand; - public RedisReducedPropagationStorage(RedisAPI redisAPI) { - this.redisAPI = redisAPI; + public RedisReducedPropagationStorage(RedisProvider redisProvider) { + this.redisProvider = redisProvider; - startQueueTimerLuaScriptState = new LuaScriptState(ReducedPropagationLuaScripts.START_QUEUE_TIMER, redisAPI, false); - removeExpiredQueuesRedisCommand = new LuaScriptState(ReducedPropagationLuaScripts.REMOVE_EXPIRED_QUEUES, redisAPI, false); + startQueueTimerLuaScriptState = new LuaScriptState(ReducedPropagationLuaScripts.START_QUEUE_TIMER, redisProvider, false); + removeExpiredQueuesRedisCommand = new LuaScriptState(ReducedPropagationLuaScripts.REMOVE_EXPIRED_QUEUES, redisProvider, false); } @Override @@ -49,7 +49,7 @@ public Future removeExpiredQueues(long currentTS) { List keys = Collections.singletonList(QUEUE_TIMERS); List arguments = Collections.singletonList(String.valueOf(currentTS)); RemoveExpiredQueuesRedisCommand cmd = new RemoveExpiredQueuesRedisCommand(removeExpiredQueuesRedisCommand, - keys, arguments, redisAPI, log, promise); + keys, arguments, redisProvider, log, promise); cmd.exec(0); return promise.future(); } @@ -60,7 +60,7 @@ public Future addQueue(String queue, long expireTS) { List keys = Collections.singletonList(QUEUE_TIMERS); List arguments = Arrays.asList(queue, String.valueOf(expireTS)); StartQueueTimerRedisCommand cmd = new StartQueueTimerRedisCommand(startQueueTimerLuaScriptState, - keys, arguments, redisAPI, log, promise); + keys, arguments, redisProvider, log, promise); cmd.exec(0); return promise.future(); } @@ -80,7 +80,7 @@ public Future storeQueueRequest(String queue, JsonObject queueRequest) { try { String queueRequestStr = queueRequest.encode(); - redisAPI.hset(Arrays.asList(QUEUE_REQUESTS, queue, queueRequestStr), reply -> { + redisProvider.redis().onSuccess(redisAPI -> redisAPI.hset(Arrays.asList(QUEUE_REQUESTS, queue, queueRequestStr), reply -> { if (reply.failed()) { String message = "Failed to store request for queue '" + queue + "'. Cause: " + logCause(reply); log.error(message); @@ -88,6 +88,9 @@ public Future storeQueueRequest(String queue, JsonObject queueRequest) { } else { promise.complete(); } + })).onFailure(throwable -> { + String message = "Failed to store request for queue '" + queue + "'. Cause: " + throwable.getMessage(); + failPromise(promise, message, throwable); }); } catch (DecodeException ex) { promise.fail("Failed to decode request for queue '" + queue + "'"); @@ -105,7 +108,7 @@ public Future getQueueRequest(String queue) { return promise.future(); } - redisAPI.hget(QUEUE_REQUESTS, queue, reply -> { + redisProvider.redis().onSuccess(redisAPI -> redisAPI.hget(QUEUE_REQUESTS, queue, reply -> { if (reply.failed()) { String message = "get queue request '" + queue + "' from hash '" + QUEUE_REQUESTS + "' resulted in cause " + logCause(reply); log.error(message); @@ -123,8 +126,11 @@ public Future getQueueRequest(String queue) { promise.complete(null); } } - + })).onFailure(throwable -> { + String message = "get queue request '" + queue + "' from hash '" + QUEUE_REQUESTS + "' resulted in cause " + throwable.getMessage(); + failPromise(promise, message, throwable); }); + return promise.future(); } @@ -137,7 +143,7 @@ public Future removeQueueRequest(String queue) { return promise.future(); } - redisAPI.hdel(Arrays.asList(QUEUE_REQUESTS, queue), reply -> { + redisProvider.redis().onSuccess(redisAPI -> redisAPI.hdel(Arrays.asList(QUEUE_REQUESTS, queue), reply -> { if (reply.failed()) { String message = "Failed to remove request for queue '" + queue + "'. Cause: " + logCause(reply); log.error(message); @@ -145,6 +151,9 @@ public Future removeQueueRequest(String queue) { } else { promise.complete(); } + })).onFailure(throwable -> { + String message = "Failed to remove request for queue '" + queue + "'. Cause: " + throwable.getMessage(); + failPromise(promise, message, throwable); }); return promise.future(); @@ -156,4 +165,9 @@ private static String logCause(AsyncResult result) { } return null; } + + private void failPromise(Promise promise, String message, Throwable throwable) { + log.error(message, throwable); + promise.fail(message); + } } diff --git a/gateleen-hook/src/main/java/org/swisspush/gateleen/hook/reducedpropagation/lua/RemoveExpiredQueuesRedisCommand.java b/gateleen-hook/src/main/java/org/swisspush/gateleen/hook/reducedpropagation/lua/RemoveExpiredQueuesRedisCommand.java index 4c502683..2b68f591 100644 --- a/gateleen-hook/src/main/java/org/swisspush/gateleen/hook/reducedpropagation/lua/RemoveExpiredQueuesRedisCommand.java +++ b/gateleen-hook/src/main/java/org/swisspush/gateleen/hook/reducedpropagation/lua/RemoveExpiredQueuesRedisCommand.java @@ -1,12 +1,12 @@ package org.swisspush.gateleen.hook.reducedpropagation.lua; import io.vertx.core.Promise; -import io.vertx.redis.client.RedisAPI; import io.vertx.redis.client.Response; import io.vertx.redis.client.impl.types.MultiType; import org.slf4j.Logger; import org.swisspush.gateleen.core.lua.LuaScriptState; import org.swisspush.gateleen.core.lua.RedisCommand; +import org.swisspush.gateleen.core.redis.RedisProvider; import org.swisspush.gateleen.core.util.RedisUtils; import java.util.List; @@ -20,15 +20,15 @@ public class RemoveExpiredQueuesRedisCommand implements RedisCommand { private List keys; private List arguments; private Promise promise; - private RedisAPI redisAPI; + private RedisProvider redisProvider; private Logger log; public RemoveExpiredQueuesRedisCommand(LuaScriptState luaScriptState, List keys, List arguments, - RedisAPI redisAPI, Logger log, final Promise promise) { + RedisProvider redisProvider, Logger log, final Promise promise) { this.luaScriptState = luaScriptState; this.keys = keys; this.arguments = arguments; - this.redisAPI = redisAPI; + this.redisProvider = redisProvider; this.log = log; this.promise = promise; } @@ -36,7 +36,7 @@ public RemoveExpiredQueuesRedisCommand(LuaScriptState luaScriptState, List args = RedisUtils.toPayload(luaScriptState.getSha(), keys.size(), keys, arguments); - redisAPI.evalsha(args, event -> { + redisProvider.redis().onSuccess(redisAPI -> redisAPI.evalsha(args, event -> { if (event.succeeded()) { Response response = event.result(); if (response != null && response.size() != 0) { @@ -52,13 +52,14 @@ public void exec(int executionCounter) { if (executionCounter > 10) { promise.fail("amount the script got loaded is higher than 10, we abort"); } else { - luaScriptState.loadLuaScript(new RemoveExpiredQueuesRedisCommand(luaScriptState, keys, arguments, redisAPI, log, promise), executionCounter); + luaScriptState.loadLuaScript(new RemoveExpiredQueuesRedisCommand(luaScriptState, keys, arguments, + redisProvider, log, promise), executionCounter); } } else { promise.fail("RemoveExpiredQueuesRedisCommand request failed with message: " + message); } } - }); - + })).onFailure(throwable -> promise.fail("Redis: RemoveExpiredQueuesRedisCommand request failed with message: " + + throwable.getMessage())); } } diff --git a/gateleen-hook/src/main/java/org/swisspush/gateleen/hook/reducedpropagation/lua/StartQueueTimerRedisCommand.java b/gateleen-hook/src/main/java/org/swisspush/gateleen/hook/reducedpropagation/lua/StartQueueTimerRedisCommand.java index d660a61f..13b0936d 100644 --- a/gateleen-hook/src/main/java/org/swisspush/gateleen/hook/reducedpropagation/lua/StartQueueTimerRedisCommand.java +++ b/gateleen-hook/src/main/java/org/swisspush/gateleen/hook/reducedpropagation/lua/StartQueueTimerRedisCommand.java @@ -1,10 +1,10 @@ package org.swisspush.gateleen.hook.reducedpropagation.lua; import io.vertx.core.Promise; -import io.vertx.redis.client.RedisAPI; import org.slf4j.Logger; import org.swisspush.gateleen.core.lua.LuaScriptState; import org.swisspush.gateleen.core.lua.RedisCommand; +import org.swisspush.gateleen.core.redis.RedisProvider; import org.swisspush.gateleen.core.util.RedisUtils; import java.util.List; @@ -18,15 +18,15 @@ public class StartQueueTimerRedisCommand implements RedisCommand { private List keys; private List arguments; private Promise promise; - private RedisAPI redisAPI; + private RedisProvider redisProvider; private Logger log; public StartQueueTimerRedisCommand(LuaScriptState luaScriptState, List keys, List arguments, - RedisAPI redisAPI, Logger log, final Promise promise) { + RedisProvider redisProvider, Logger log, final Promise promise) { this.luaScriptState = luaScriptState; this.keys = keys; this.arguments = arguments; - this.redisAPI = redisAPI; + this.redisProvider = redisProvider; this.log = log; this.promise = promise; } @@ -34,26 +34,27 @@ public StartQueueTimerRedisCommand(LuaScriptState luaScriptState, List k @Override public void exec(int executionCounter) { List args = RedisUtils.toPayload(luaScriptState.getSha(), keys.size(), keys, arguments); - redisAPI.evalsha(args, event -> { - if(event.succeeded()){ + redisProvider.redis().onSuccess(redisAPI -> redisAPI.evalsha(args, event -> { + if (event.succeeded()) { Integer insertCount = event.result().toInteger(); Boolean timerStarted = insertCount != null && insertCount > 0; promise.complete(timerStarted); } else { String message = event.cause().getMessage(); - if(message != null && message.startsWith("NOSCRIPT")) { + if (message != null && message.startsWith("NOSCRIPT")) { log.warn("StartQueueTimerRedisCommand script couldn't be found, reload it"); log.warn("amount the script got loaded: " + String.valueOf(executionCounter)); - if(executionCounter > 10) { + if (executionCounter > 10) { promise.fail("amount the script got loaded is higher than 10, we abort"); } else { - luaScriptState.loadLuaScript(new StartQueueTimerRedisCommand(luaScriptState, keys, arguments, redisAPI, log, promise), executionCounter); + luaScriptState.loadLuaScript(new StartQueueTimerRedisCommand(luaScriptState, keys, arguments, + redisProvider, log, promise), executionCounter); } } else { promise.fail("StartQueueTimerRedisCommand request failed with message: " + message); } } - }); - + })).onFailure(throwable -> promise.fail("Redis: StartQueueTimerRedisCommand request failed with message: " + + throwable.getMessage())); } } diff --git a/gateleen-hook/src/test/java/org/swisspush/gateleen/hook/reducedpropagation/impl/RedisReducedPropagationStorageAddQueueMultipleQueuesTest.java b/gateleen-hook/src/test/java/org/swisspush/gateleen/hook/reducedpropagation/impl/RedisReducedPropagationStorageAddQueueMultipleQueuesTest.java index 48ae1ffe..d370c727 100644 --- a/gateleen-hook/src/test/java/org/swisspush/gateleen/hook/reducedpropagation/impl/RedisReducedPropagationStorageAddQueueMultipleQueuesTest.java +++ b/gateleen-hook/src/test/java/org/swisspush/gateleen/hook/reducedpropagation/impl/RedisReducedPropagationStorageAddQueueMultipleQueuesTest.java @@ -1,5 +1,6 @@ package org.swisspush.gateleen.hook.reducedpropagation.impl; +import io.vertx.core.Future; import io.vertx.core.Vertx; import io.vertx.ext.unit.Async; import io.vertx.ext.unit.TestContext; @@ -45,7 +46,9 @@ public class RedisReducedPropagationStorageAddQueueMultipleQueuesTest { @BeforeClass public static void setupStorage() { vertx = Vertx.vertx(); - storage = new RedisReducedPropagationStorage(RedisAPI.api(new RedisClient(vertx, new RedisOptions()))); + + RedisAPI redisAPI = RedisAPI.api(new RedisClient(vertx, new RedisOptions())); + storage = new RedisReducedPropagationStorage(() -> Future.succeededFuture(redisAPI)); } @Before diff --git a/gateleen-hook/src/test/java/org/swisspush/gateleen/hook/reducedpropagation/impl/RedisReducedPropagationStorageRemoveExpiredQueuesEmptyTest.java b/gateleen-hook/src/test/java/org/swisspush/gateleen/hook/reducedpropagation/impl/RedisReducedPropagationStorageRemoveExpiredQueuesEmptyTest.java index 30cdfa3e..bca92a8c 100644 --- a/gateleen-hook/src/test/java/org/swisspush/gateleen/hook/reducedpropagation/impl/RedisReducedPropagationStorageRemoveExpiredQueuesEmptyTest.java +++ b/gateleen-hook/src/test/java/org/swisspush/gateleen/hook/reducedpropagation/impl/RedisReducedPropagationStorageRemoveExpiredQueuesEmptyTest.java @@ -1,5 +1,6 @@ package org.swisspush.gateleen.hook.reducedpropagation.impl; +import io.vertx.core.Future; import io.vertx.core.Vertx; import io.vertx.ext.unit.Async; import io.vertx.ext.unit.TestContext; @@ -43,7 +44,9 @@ public class RedisReducedPropagationStorageRemoveExpiredQueuesEmptyTest { @BeforeClass public static void setupStorage() { vertx = Vertx.vertx(); - storage = new RedisReducedPropagationStorage(RedisAPI.api(new RedisClient(vertx, new RedisOptions()))); + + RedisAPI redisAPI = RedisAPI.api(new RedisClient(vertx, new RedisOptions())); + storage = new RedisReducedPropagationStorage(() -> Future.succeededFuture(redisAPI)); } @Before diff --git a/gateleen-hook/src/test/java/org/swisspush/gateleen/hook/reducedpropagation/impl/RedisReducedPropagationStorageTest.java b/gateleen-hook/src/test/java/org/swisspush/gateleen/hook/reducedpropagation/impl/RedisReducedPropagationStorageTest.java index 6f209282..9379e4f4 100644 --- a/gateleen-hook/src/test/java/org/swisspush/gateleen/hook/reducedpropagation/impl/RedisReducedPropagationStorageTest.java +++ b/gateleen-hook/src/test/java/org/swisspush/gateleen/hook/reducedpropagation/impl/RedisReducedPropagationStorageTest.java @@ -1,5 +1,6 @@ package org.swisspush.gateleen.hook.reducedpropagation.impl; +import io.vertx.core.Future; import io.vertx.core.Vertx; import io.vertx.core.json.JsonObject; import io.vertx.ext.unit.Async; @@ -45,7 +46,9 @@ public class RedisReducedPropagationStorageTest { @BeforeClass public static void setupStorage() { vertx = Vertx.vertx(); - storage = new RedisReducedPropagationStorage(RedisAPI.api(new RedisClient(vertx, new RedisOptions()))); + + RedisAPI redisAPI = RedisAPI.api(new RedisClient(vertx, new RedisOptions())); + storage = new RedisReducedPropagationStorage(() -> Future.succeededFuture(redisAPI)); } @Before diff --git a/gateleen-kafka/src/main/java/org/swisspush/gateleen/kafka/KafkaMessageSender.java b/gateleen-kafka/src/main/java/org/swisspush/gateleen/kafka/KafkaMessageSender.java index 34ae4f1b..1b74bf72 100644 --- a/gateleen-kafka/src/main/java/org/swisspush/gateleen/kafka/KafkaMessageSender.java +++ b/gateleen-kafka/src/main/java/org/swisspush/gateleen/kafka/KafkaMessageSender.java @@ -45,6 +45,6 @@ private Future sendMessage(KafkaProducer kafkaProducer, Ka log.debug("Message successfully sent to kafka topic '{}' on partition {} with offset {}. Timestamp: {}", metadata.getTopic(), metadata.getPartition(), metadata.getOffset(), metadata.getTimestamp()); return Future.succeededFuture(); - }).onFailure(event -> log.warn("Failed to send message with key '{}' to kafka. Cause: {}", message.key(), event)); + }).onFailure(throwable -> log.warn("Failed to send message with key '{}' to kafka. Cause: {}", message.key(), throwable)); } } diff --git a/gateleen-monitoring/src/main/java/org/swisspush/gateleen/monitoring/CustomRedisMonitor.java b/gateleen-monitoring/src/main/java/org/swisspush/gateleen/monitoring/CustomRedisMonitor.java index b530bd25..54d824b8 100644 --- a/gateleen-monitoring/src/main/java/org/swisspush/gateleen/monitoring/CustomRedisMonitor.java +++ b/gateleen-monitoring/src/main/java/org/swisspush/gateleen/monitoring/CustomRedisMonitor.java @@ -1,7 +1,7 @@ package org.swisspush.gateleen.monitoring; import io.vertx.core.Vertx; -import io.vertx.redis.client.RedisAPI; +import org.swisspush.gateleen.core.redis.RedisProvider; /** * @deprecated Extend the {@link RedisMonitor} in your client source code @@ -9,8 +9,8 @@ */ public class CustomRedisMonitor extends RedisMonitor { - public CustomRedisMonitor(Vertx vertx, RedisAPI redisAPI, String name, String restStoragePrefix, int period) { - super(vertx, redisAPI, name, period); + public CustomRedisMonitor(Vertx vertx, RedisProvider redisProvider, String name, String restStoragePrefix, int period) { + super(vertx, redisProvider, name, period); enableElementCount("expirable", restStoragePrefix + ":expirable"); } } diff --git a/gateleen-monitoring/src/main/java/org/swisspush/gateleen/monitoring/RedisMonitor.java b/gateleen-monitoring/src/main/java/org/swisspush/gateleen/monitoring/RedisMonitor.java index 6bcf241c..ba41511d 100644 --- a/gateleen-monitoring/src/main/java/org/swisspush/gateleen/monitoring/RedisMonitor.java +++ b/gateleen-monitoring/src/main/java/org/swisspush/gateleen/monitoring/RedisMonitor.java @@ -3,9 +3,9 @@ import com.google.common.base.Splitter; import io.vertx.core.Vertx; import io.vertx.core.buffer.Buffer; -import io.vertx.redis.client.RedisAPI; import org.slf4j.Logger; import org.slf4j.LoggerFactory; +import org.swisspush.gateleen.core.redis.RedisProvider; import org.swisspush.gateleen.core.util.Address; import java.util.ArrayList; @@ -19,7 +19,7 @@ public class RedisMonitor { private Vertx vertx; - private RedisAPI redisAPI; + private RedisProvider redisProvider; private int period; private long timer; private Logger log = LoggerFactory.getLogger(RedisMonitor.class); @@ -32,44 +32,46 @@ public class RedisMonitor { private final MetricsPublisher publisher; /** - * @param vertx vertx - * @param redisAPI redisAPI - * @param name name - * @param period in seconds. + * @param vertx vertx + * @param redisProvider RedisProvider + * @param name name + * @param period in seconds. */ - public RedisMonitor(Vertx vertx, RedisAPI redisAPI, String name, int period) { - this(vertx, redisAPI, name, period, + public RedisMonitor(Vertx vertx, RedisProvider redisProvider, String name, int period) { + this(vertx, redisProvider, name, period, new EventBusMetricsPublisher(vertx, Address.monitoringAddress(), "redis." + name + ".") ); } - public RedisMonitor(Vertx vertx, RedisAPI redisAPI, String name, int period, MetricsPublisher publisher) { + public RedisMonitor(Vertx vertx, RedisProvider redisProvider, String name, int period, MetricsPublisher publisher) { this.vertx = vertx; - this.redisAPI = redisAPI; + this.redisProvider = redisProvider; this.period = period * 1000; this.publisher = publisher; } public void start() { timer = vertx.setPeriodic(period, timer -> { - redisAPI.info(new ArrayList<>()).onComplete(event -> { - if (event.succeeded()) { - collectMetrics(event.result().toBuffer()); - } else { - log.warn("Cannot collect INFO from redis"); - } - }); - - if (metricName != null && elementCountKey != null) { - redisAPI.zcard(elementCountKey, reply -> { - if (reply.succeeded()) { - long value = reply.result().toLong(); - publisher.publishMetric(metricName, value); + redisProvider.redis().onSuccess(redisAPI -> { + redisAPI.info(new ArrayList<>()).onComplete(event -> { + if (event.succeeded()) { + collectMetrics(event.result().toBuffer()); } else { - log.warn("Cannot collect zcard from redis for key {}", elementCountKey); + log.warn("Cannot collect INFO from redis"); } }); - } + + if (metricName != null && elementCountKey != null) { + redisAPI.zcard(elementCountKey, reply -> { + if (reply.succeeded()) { + long value = reply.result().toLong(); + publisher.publishMetric(metricName, value); + } else { + log.warn("Cannot collect zcard from redis for key {}", elementCountKey); + } + }); + } + }).onFailure(throwable -> log.warn("Cannot collect INFO from redis", throwable)); }); } @@ -102,11 +104,11 @@ private void collectMetrics(Buffer buffer) { .filter(input -> input != null && input.contains(DELIMITER) && !input.contains("executable") && !input.contains("config_file")).forEach(entry -> { - List keyValue = Splitter.on(DELIMITER).omitEmptyStrings().trimResults().splitToList(entry); - if (keyValue.size() == 2) { - map.put(keyValue.get(0), keyValue.get(1)); - } - }); + List keyValue = Splitter.on(DELIMITER).omitEmptyStrings().trimResults().splitToList(entry); + if (keyValue.size() == 2) { + map.put(keyValue.get(0), keyValue.get(1)); + } + }); log.debug("got redis metrics {}", map); diff --git a/gateleen-monitoring/src/test/java/org/swisspush/gateleen/monitoring/RedisMonitorTest.java b/gateleen-monitoring/src/test/java/org/swisspush/gateleen/monitoring/RedisMonitorTest.java index 74555ca8..1efe344a 100644 --- a/gateleen-monitoring/src/test/java/org/swisspush/gateleen/monitoring/RedisMonitorTest.java +++ b/gateleen-monitoring/src/test/java/org/swisspush/gateleen/monitoring/RedisMonitorTest.java @@ -12,13 +12,13 @@ import org.junit.runner.RunWith; import org.mockito.ArgumentCaptor; import org.mockito.Mockito; +import org.swisspush.gateleen.core.redis.RedisProvider; import org.swisspush.gateleen.core.util.ResourcesUtils; import java.util.List; import static org.mockito.Matchers.any; -import static org.mockito.Mockito.timeout; -import static org.mockito.Mockito.verify; +import static org.mockito.Mockito.*; /** * Tests for the {@link RedisMonitor} class @@ -30,6 +30,7 @@ public class RedisMonitorTest { private Vertx vertx; private RedisAPI redisAPI; + private RedisProvider redisProvider; private RedisMonitor redisMonitor; private MetricsPublisher publisher; @@ -38,9 +39,13 @@ public class RedisMonitorTest { @Before public void setUp() { vertx = Vertx.vertx(); + redisAPI = Mockito.mock(RedisAPI.class); + redisProvider = Mockito.mock(RedisProvider.class); + when(redisProvider.redis()).thenReturn(Future.succeededFuture(redisAPI)); + publisher = Mockito.mock(MetricsPublisher.class); - redisMonitor = new RedisMonitor(vertx, redisAPI, "main", 1, publisher); + redisMonitor = new RedisMonitor(vertx, redisProvider, "main", 1, publisher); } @Test diff --git a/gateleen-playground/src/main/java/org/swisspush/gateleen/playground/Server.java b/gateleen-playground/src/main/java/org/swisspush/gateleen/playground/Server.java index a5dcf81e..c081510b 100755 --- a/gateleen-playground/src/main/java/org/swisspush/gateleen/playground/Server.java +++ b/gateleen-playground/src/main/java/org/swisspush/gateleen/playground/Server.java @@ -1,6 +1,7 @@ package org.swisspush.gateleen.playground; import io.vertx.core.AbstractVerticle; +import io.vertx.core.Future; import io.vertx.core.Handler; import io.vertx.core.Vertx; import io.vertx.core.http.HttpClient; @@ -29,6 +30,7 @@ import org.swisspush.gateleen.core.http.LocalHttpClient; import org.swisspush.gateleen.core.lock.Lock; import org.swisspush.gateleen.core.lock.impl.RedisBasedLock; +import org.swisspush.gateleen.core.redis.RedisProvider; import org.swisspush.gateleen.core.resource.CopyResourceHandler; import org.swisspush.gateleen.core.storage.EventBusResourceStorage; import org.swisspush.gateleen.core.storage.ResourceStorage; @@ -187,20 +189,22 @@ public void start() { if (success) { redisClient = new RedisClient(vertx, new RedisOptions().setConnectionString("redis://" + redisHost + ":" + redisPort)); redisApi = RedisAPI.api(redisClient); - new CustomRedisMonitor(vertx, redisApi, "main", "rest-storage", 10).start(); + RedisProvider redisProvider = () -> Future.succeededFuture(redisApi); + + new CustomRedisMonitor(vertx, redisProvider, "main", "rest-storage", 10).start(); storage = new EventBusResourceStorage(vertx.eventBus(), Address.storageAddress() + "-main"); corsHandler = new CORSHandler(); RuleProvider ruleProvider = new RuleProvider(vertx, RULES_ROOT, storage, props); - deltaHandler = new DeltaHandler(redisApi, selfClient, ruleProvider, true); + deltaHandler = new DeltaHandler(redisProvider, selfClient, ruleProvider, true); expansionHandler = new ExpansionHandler(ruleProvider, selfClient, props, ROOT); copyResourceHandler = new CopyResourceHandler(selfClient, SERVER_ROOT + "/v1/copy"); monitoringHandler = new MonitoringHandler(vertx, storage, PREFIX, SERVER_ROOT + "/monitoring/rpr"); - Lock lock = new RedisBasedLock(redisApi); + Lock lock = new RedisBasedLock(redisProvider); - cacheStorage = new RedisCacheStorage(vertx, lock, redisApi, 20 * 1000); + cacheStorage = new RedisCacheStorage(vertx, lock, redisProvider, 20 * 1000); cacheDataFetcher = new DefaultCacheDataFetcher(new ClientRequestCreator(selfClient)); cacheHandler = new CacheHandler(cacheDataFetcher, cacheStorage, SERVER_ROOT + "/cache"); @@ -234,7 +238,7 @@ public void start() { roleProfileHandler.enableResourceLogging(true); QueueClient queueClient = new QueueClient(vertx, monitoringHandler); - reducedPropagationManager = new ReducedPropagationManager(vertx, new RedisReducedPropagationStorage(redisApi), + reducedPropagationManager = new ReducedPropagationManager(vertx, new RedisReducedPropagationStorage(redisProvider), queueClient, lock); reducedPropagationManager.startExpiredQueueProcessing(5000); @@ -259,7 +263,7 @@ public void start() { SERVER_ROOT + "/admin/v1/kafka/topicsConfig",SERVER_ROOT + "/streaming/"); kafkaHandler.initialize(); - schedulerResourceManager = new SchedulerResourceManager(vertx, redisApi, storage, monitoringHandler, + schedulerResourceManager = new SchedulerResourceManager(vertx, redisProvider, storage, monitoringHandler, SERVER_ROOT + "/admin/v1/schedulers"); schedulerResourceManager.enableResourceLogging(true); @@ -296,7 +300,7 @@ public void start() { queueCircuitBreakerConfigurationResourceManager = new QueueCircuitBreakerConfigurationResourceManager(vertx, storage, SERVER_ROOT + "/admin/v1/circuitbreaker"); queueCircuitBreakerConfigurationResourceManager.enableResourceLogging(true); - QueueCircuitBreakerStorage queueCircuitBreakerStorage = new RedisQueueCircuitBreakerStorage(redisApi); + QueueCircuitBreakerStorage queueCircuitBreakerStorage = new RedisQueueCircuitBreakerStorage(redisProvider); QueueCircuitBreakerHttpRequestHandler requestHandler = new QueueCircuitBreakerHttpRequestHandler(vertx, queueCircuitBreakerStorage, SERVER_ROOT + "/queuecircuitbreaker/circuit"); diff --git a/gateleen-queue/src/main/java/org/swisspush/gateleen/queue/queuing/circuitbreaker/impl/RedisQueueCircuitBreakerStorage.java b/gateleen-queue/src/main/java/org/swisspush/gateleen/queue/queuing/circuitbreaker/impl/RedisQueueCircuitBreakerStorage.java index e19b8eae..ede5d59a 100644 --- a/gateleen-queue/src/main/java/org/swisspush/gateleen/queue/queuing/circuitbreaker/impl/RedisQueueCircuitBreakerStorage.java +++ b/gateleen-queue/src/main/java/org/swisspush/gateleen/queue/queuing/circuitbreaker/impl/RedisQueueCircuitBreakerStorage.java @@ -4,11 +4,11 @@ import io.vertx.core.Future; import io.vertx.core.Promise; import io.vertx.core.json.JsonObject; -import io.vertx.redis.client.RedisAPI; import io.vertx.redis.client.Response; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.swisspush.gateleen.core.lua.LuaScriptState; +import org.swisspush.gateleen.core.redis.RedisProvider; import org.swisspush.gateleen.core.util.StringUtils; import org.swisspush.gateleen.queue.queuing.circuitbreaker.QueueCircuitBreakerStorage; import org.swisspush.gateleen.queue.queuing.circuitbreaker.lua.*; @@ -26,7 +26,7 @@ */ public class RedisQueueCircuitBreakerStorage implements QueueCircuitBreakerStorage { - private RedisAPI redisAPI; + private RedisProvider redisProvider; private Logger log = LoggerFactory.getLogger(RedisQueueCircuitBreakerStorage.class); public static final String STORAGE_PREFIX = "gateleen.queue-circuit-breaker:"; @@ -47,39 +47,40 @@ public class RedisQueueCircuitBreakerStorage implements QueueCircuitBreakerStora private LuaScriptState unlockSampleQueuesLuaScriptState; private LuaScriptState getAllCircuitsLuaScriptState; - public RedisQueueCircuitBreakerStorage(RedisAPI redisAPI) { - this.redisAPI = redisAPI; + public RedisQueueCircuitBreakerStorage(RedisProvider redisProvider) { + this.redisProvider = redisProvider; - openCircuitLuaScriptState = new LuaScriptState(QueueCircuitBreakerLuaScripts.UPDATE_CIRCUIT, redisAPI, false); - closeCircuitLuaScriptState = new LuaScriptState(QueueCircuitBreakerLuaScripts.CLOSE_CIRCUIT, redisAPI, false); - reOpenCircuitLuaScriptState = new LuaScriptState(QueueCircuitBreakerLuaScripts.REOPEN_CIRCUIT, redisAPI, false); - halfOpenCircuitLuaScriptState = new LuaScriptState(QueueCircuitBreakerLuaScripts.HALFOPEN_CIRCUITS, redisAPI, false); - unlockSampleQueuesLuaScriptState = new LuaScriptState(QueueCircuitBreakerLuaScripts.UNLOCK_SAMPLES, redisAPI, false); - getAllCircuitsLuaScriptState = new LuaScriptState(QueueCircuitBreakerLuaScripts.ALL_CIRCUITS, redisAPI, false); + openCircuitLuaScriptState = new LuaScriptState(QueueCircuitBreakerLuaScripts.UPDATE_CIRCUIT, redisProvider, false); + closeCircuitLuaScriptState = new LuaScriptState(QueueCircuitBreakerLuaScripts.CLOSE_CIRCUIT, redisProvider, false); + reOpenCircuitLuaScriptState = new LuaScriptState(QueueCircuitBreakerLuaScripts.REOPEN_CIRCUIT, redisProvider, false); + halfOpenCircuitLuaScriptState = new LuaScriptState(QueueCircuitBreakerLuaScripts.HALFOPEN_CIRCUITS, redisProvider, false); + unlockSampleQueuesLuaScriptState = new LuaScriptState(QueueCircuitBreakerLuaScripts.UNLOCK_SAMPLES, redisProvider, false); + getAllCircuitsLuaScriptState = new LuaScriptState(QueueCircuitBreakerLuaScripts.ALL_CIRCUITS, redisProvider, false); } @Override public Future getQueueCircuitState(PatternAndCircuitHash patternAndCircuitHash) { Promise promise = Promise.promise(); - redisAPI.hget(buildInfosKey(patternAndCircuitHash.getCircuitHash()), FIELD_STATE, event -> { - if (event.failed()) { - promise.fail(event.cause()); - } else { - String stateAsString = Objects.toString(event.result(), ""); - if (StringUtils.isEmpty(stateAsString)) { - log.info("No status information found for circuit {}. Using default value {}", - patternAndCircuitHash.getPattern().pattern(), QueueCircuitState.CLOSED); - } - promise.complete(QueueCircuitState.fromString(stateAsString, QueueCircuitState.CLOSED)); - } - }); + redisProvider.redis().onSuccess(redisAPI -> redisAPI.hget(buildInfosKey(patternAndCircuitHash.getCircuitHash()), + FIELD_STATE, event -> { + if (event.failed()) { + promise.fail(event.cause()); + } else { + String stateAsString = Objects.toString(event.result(), ""); + if (StringUtils.isEmpty(stateAsString)) { + log.info("No status information found for circuit {}. Using default value {}", + patternAndCircuitHash.getPattern().pattern(), QueueCircuitState.CLOSED); + } + promise.complete(QueueCircuitState.fromString(stateAsString, QueueCircuitState.CLOSED)); + } + })).onFailure(promise::fail); return promise.future(); } @Override public Future getQueueCircuitState(String circuitHash) { Promise promise = Promise.promise(); - redisAPI.hget(buildInfosKey(circuitHash), FIELD_STATE, event -> { + redisProvider.redis().onSuccess(redisAPI -> redisAPI.hget(buildInfosKey(circuitHash), FIELD_STATE, event -> { if (event.failed()) { promise.fail(event.cause()); } else { @@ -89,19 +90,21 @@ public Future getQueueCircuitState(String circuitHash) { } promise.complete(QueueCircuitState.fromString(stateAsString, QueueCircuitState.CLOSED)); } - }); + })).onFailure(promise::fail); return promise.future(); } @Override public Future getQueueCircuitInformation(String circuitHash) { Promise promise = Promise.promise(); - redisAPI.hmget(Arrays.asList(buildInfosKey(circuitHash), FIELD_STATE, FIELD_FAILRATIO, FIELD_CIRCUIT), event -> { + redisProvider.redis().onSuccess(redisAPI -> redisAPI.hmget(Arrays.asList(buildInfosKey(circuitHash), FIELD_STATE, + FIELD_FAILRATIO, FIELD_CIRCUIT), event -> { if (event.failed()) { promise.fail(event.cause()); } else { try { - QueueCircuitState state = QueueCircuitState.fromString(Objects.toString(event.result().get(0), null), QueueCircuitState.CLOSED); + QueueCircuitState state = QueueCircuitState.fromString(Objects.toString(event.result().get(0), null), + QueueCircuitState.CLOSED); String failRatioStr = Objects.toString(event.result().get(1), null); String circuit = Objects.toString(event.result().get(2), null); JsonObject result = new JsonObject(); @@ -119,7 +122,7 @@ public Future getQueueCircuitInformation(String circuitHash) { promise.fail(e); } } - }); + })).onFailure(promise::fail); return promise.future(); } @@ -129,7 +132,7 @@ public Future getAllCircuits() { List keys = Collections.singletonList(STORAGE_ALL_CIRCUITS); List arguments = Arrays.asList(STORAGE_PREFIX, STORAGE_INFOS_SUFFIX); GetAllCircuitsRedisCommand cmd = new GetAllCircuitsRedisCommand(getAllCircuitsLuaScriptState, - keys, arguments, redisAPI, log, promise); + keys, arguments, redisProvider, log, promise); cmd.exec(0); return promise.future(); } @@ -161,7 +164,7 @@ public Future updateStatistics(PatternAndCircuitHash pat ); UpdateStatsRedisCommand cmd = new UpdateStatsRedisCommand(openCircuitLuaScriptState, - keys, arguments, redisAPI, log, promise); + keys, arguments, redisProvider, log, promise); cmd.exec(0); return promise.future(); } @@ -169,26 +172,28 @@ public Future updateStatistics(PatternAndCircuitHash pat @Override public Future lockQueue(String queueName, PatternAndCircuitHash patternAndCircuitHash) { Promise promise = Promise.promise(); - redisAPI.zadd(Arrays.asList(buildQueuesKey(patternAndCircuitHash.getCircuitHash()), String.valueOf(System.currentTimeMillis()), queueName), event -> { + redisProvider.redis().onSuccess(redisAPI -> redisAPI.zadd(Arrays.asList(buildQueuesKey(patternAndCircuitHash.getCircuitHash()), + String.valueOf(System.currentTimeMillis()), queueName), event -> { if (event.failed()) { promise.fail(event.cause().getMessage()); return; } promise.complete(); - }); + })).onFailure(throwable -> promise.fail(throwable.getMessage())); return promise.future(); } @Override public Future popQueueToUnlock() { Promise promise = Promise.promise(); - redisAPI.lpop(Collections.singletonList(STORAGE_QUEUES_TO_UNLOCK), event -> { - if (event.failed()) { - promise.fail(event.cause().getMessage()); - return; - } - promise.complete(Objects.toString(event.result(), null)); - }); + redisProvider.redis().onSuccess(redisAPI -> redisAPI.lpop(Collections.singletonList(STORAGE_QUEUES_TO_UNLOCK), + event -> { + if (event.failed()) { + promise.fail(event.cause().getMessage()); + return; + } + promise.complete(Objects.toString(event.result(), null)); + })).onFailure(throwable -> promise.fail(throwable.getMessage())); return promise.future(); } @@ -222,7 +227,7 @@ private Future closeCircuit(String circuitHash, boolean circuitRemoved) { ); CloseCircuitRedisCommand cmd = new CloseCircuitRedisCommand(closeCircuitLuaScriptState, - keys, arguments, redisAPI, log, promise); + keys, arguments, redisProvider, log, promise); cmd.exec(0); return promise.future(); } @@ -247,7 +252,7 @@ public Future closeAllCircuits() { private Future closeCircuitsByKey(String key) { Promise promise = Promise.promise(); - redisAPI.smembers(key, event -> { + redisProvider.redis().onSuccess(redisAPI -> redisAPI.smembers(key, event -> { if (event.succeeded()) { List promises = new ArrayList<>(); for (Response circuit : event.result()) { @@ -267,7 +272,7 @@ private Future closeCircuitsByKey(String key) { } else { promise.fail(event.cause().getMessage()); } - }); + })).onFailure(throwable -> promise.fail(throwable.getMessage())); return promise.future(); } @@ -285,7 +290,7 @@ public Future reOpenCircuit(PatternAndCircuitHash patternAndCircuitHash) { List arguments = Collections.singletonList(circuitHash); ReOpenCircuitRedisCommand cmd = new ReOpenCircuitRedisCommand(reOpenCircuitLuaScriptState, - keys, arguments, redisAPI, log, promise); + keys, arguments, redisProvider, log, promise); cmd.exec(0); return promise.future(); @@ -297,7 +302,7 @@ public Future setOpenCircuitsToHalfOpen() { List keys = Arrays.asList(STORAGE_HALFOPEN_CIRCUITS, STORAGE_OPEN_CIRCUITS); List arguments = Arrays.asList(STORAGE_PREFIX, STORAGE_INFOS_SUFFIX); HalfOpenCircuitRedisCommand cmd = new HalfOpenCircuitRedisCommand(halfOpenCircuitLuaScriptState, - keys, arguments, redisAPI, log, promise); + keys, arguments, redisProvider, log, promise); cmd.exec(0); return promise.future(); } @@ -314,7 +319,7 @@ public Future unlockSampleQueues() { String.valueOf(System.currentTimeMillis())); UnlockSampleQueuesRedisCommand cmd = new UnlockSampleQueuesRedisCommand(unlockSampleQueuesLuaScriptState, - keys, arguments, redisAPI, log, promise); + keys, arguments, redisProvider, log, promise); cmd.exec(0); return promise.future(); diff --git a/gateleen-queue/src/main/java/org/swisspush/gateleen/queue/queuing/circuitbreaker/lua/CloseCircuitRedisCommand.java b/gateleen-queue/src/main/java/org/swisspush/gateleen/queue/queuing/circuitbreaker/lua/CloseCircuitRedisCommand.java index 8e7e2a2a..4d9d5f81 100644 --- a/gateleen-queue/src/main/java/org/swisspush/gateleen/queue/queuing/circuitbreaker/lua/CloseCircuitRedisCommand.java +++ b/gateleen-queue/src/main/java/org/swisspush/gateleen/queue/queuing/circuitbreaker/lua/CloseCircuitRedisCommand.java @@ -1,10 +1,10 @@ package org.swisspush.gateleen.queue.queuing.circuitbreaker.lua; import io.vertx.core.Promise; -import io.vertx.redis.client.RedisAPI; import org.slf4j.Logger; import org.swisspush.gateleen.core.lua.LuaScriptState; import org.swisspush.gateleen.core.lua.RedisCommand; +import org.swisspush.gateleen.core.redis.RedisProvider; import org.swisspush.gateleen.core.util.RedisUtils; import java.util.List; @@ -14,43 +14,45 @@ */ public class CloseCircuitRedisCommand implements RedisCommand { - private LuaScriptState luaScriptState; - private List keys; - private List arguments; - private Promise promise; - private RedisAPI redisAPI; - private Logger log; + private final LuaScriptState luaScriptState; + private final List keys; + private final List arguments; + private final Promise promise; + private final RedisProvider redisProvider; + private final Logger log; public CloseCircuitRedisCommand(LuaScriptState luaScriptState, List keys, List arguments, - RedisAPI redisAPI, Logger log, final Promise promise) { + RedisProvider redisProvider, Logger log, final Promise promise) { this.luaScriptState = luaScriptState; this.keys = keys; this.arguments = arguments; - this.redisAPI = redisAPI; + this.redisProvider = redisProvider; this.log = log; this.promise = promise; } @Override public void exec(int executionCounter) { - List args= RedisUtils.toPayload(luaScriptState.getSha(), keys.size(), keys, arguments); - redisAPI.evalsha(args, event -> { - if(event.succeeded()){ + List args = RedisUtils.toPayload(luaScriptState.getSha(), keys.size(), keys, arguments); + redisProvider.redis().onSuccess(redisAPI -> redisAPI.evalsha(args, event -> { + if (event.succeeded()) { promise.complete(); } else { String message = event.cause().getMessage(); - if(message != null && message.startsWith("NOSCRIPT")) { + if (message != null && message.startsWith("NOSCRIPT")) { log.warn("CloseCircuitRedisCommand script couldn't be found, reload it"); - log.warn("amount the script got loaded: " + String.valueOf(executionCounter)); - if(executionCounter > 10) { + log.warn("amount the script got loaded: " + executionCounter); + if (executionCounter > 10) { promise.fail("amount the script got loaded is higher than 10, we abort"); } else { - luaScriptState.loadLuaScript(new CloseCircuitRedisCommand(luaScriptState, keys, arguments, redisAPI, log, promise), executionCounter); + luaScriptState.loadLuaScript(new CloseCircuitRedisCommand(luaScriptState, keys, arguments, + redisProvider, log, promise), executionCounter); } } else { promise.fail("CloseCircuitRedisCommand request failed with message: " + message); } } - }); + })).onFailure(throwable -> promise.fail("Redis: CloseCircuitRedisCommand request failed with message: " + + throwable.getMessage())); } } diff --git a/gateleen-queue/src/main/java/org/swisspush/gateleen/queue/queuing/circuitbreaker/lua/GetAllCircuitsRedisCommand.java b/gateleen-queue/src/main/java/org/swisspush/gateleen/queue/queuing/circuitbreaker/lua/GetAllCircuitsRedisCommand.java index 00186b13..2ebbcf01 100644 --- a/gateleen-queue/src/main/java/org/swisspush/gateleen/queue/queuing/circuitbreaker/lua/GetAllCircuitsRedisCommand.java +++ b/gateleen-queue/src/main/java/org/swisspush/gateleen/queue/queuing/circuitbreaker/lua/GetAllCircuitsRedisCommand.java @@ -2,11 +2,11 @@ import io.vertx.core.Promise; import io.vertx.core.json.JsonObject; -import io.vertx.redis.client.RedisAPI; import io.vertx.redis.client.Response; import org.slf4j.Logger; import org.swisspush.gateleen.core.lua.LuaScriptState; import org.swisspush.gateleen.core.lua.RedisCommand; +import org.swisspush.gateleen.core.redis.RedisProvider; import org.swisspush.gateleen.core.util.RedisUtils; import java.util.List; @@ -20,46 +20,48 @@ public class GetAllCircuitsRedisCommand implements RedisCommand { private List keys; private List arguments; private Promise promise; - private RedisAPI redisAPI; + private RedisProvider redisProvider; private Logger log; public GetAllCircuitsRedisCommand(LuaScriptState luaScriptState, List keys, List arguments, - RedisAPI redisAPI, Logger log, final Promise promise) { + RedisProvider redisProvider, Logger log, final Promise promise) { this.luaScriptState = luaScriptState; this.keys = keys; this.arguments = arguments; - this.redisAPI = redisAPI; + this.redisProvider = redisProvider; this.log = log; this.promise = promise; } @Override public void exec(int executionCounter) { - List args= RedisUtils.toPayload(luaScriptState.getSha(), keys.size(), keys, arguments); - redisAPI.evalsha(args, event -> { - if(event.succeeded()){ + List args = RedisUtils.toPayload(luaScriptState.getSha(), keys.size(), keys, arguments); + redisProvider.redis().onSuccess(redisAPI -> redisAPI.evalsha(args, event -> { + if (event.succeeded()) { Response response = event.result(); - try{ + try { String objectStr = response.toString(); JsonObject obj = new JsonObject(objectStr); promise.complete(obj); - }catch (Exception e){ + } catch (Exception e) { promise.fail("could not get json from lua script. cause: " + e); } } else { String message = event.cause().getMessage(); - if(message != null && message.startsWith("NOSCRIPT")) { + if (message != null && message.startsWith("NOSCRIPT")) { log.warn("GetAllCircuitsRedisCommand script couldn't be found, reload it"); log.warn("amount the script got loaded: {}", executionCounter); - if(executionCounter > 10) { + if (executionCounter > 10) { promise.fail("amount the script got loaded is higher than 10, we abort"); } else { - luaScriptState.loadLuaScript(new GetAllCircuitsRedisCommand(luaScriptState, keys, arguments, redisAPI, log, promise), executionCounter); + luaScriptState.loadLuaScript(new GetAllCircuitsRedisCommand(luaScriptState, keys, arguments, + redisProvider, log, promise), executionCounter); } } else { promise.fail("GetAllCircuitsRedisCommand request failed with message: " + message); } } - }); + })).onFailure(throwable -> promise.fail("Redis: GetAllCircuitsRedisCommand request failed with message: " + + throwable.getMessage())); } } diff --git a/gateleen-queue/src/main/java/org/swisspush/gateleen/queue/queuing/circuitbreaker/lua/HalfOpenCircuitRedisCommand.java b/gateleen-queue/src/main/java/org/swisspush/gateleen/queue/queuing/circuitbreaker/lua/HalfOpenCircuitRedisCommand.java index e5877dff..011218b7 100644 --- a/gateleen-queue/src/main/java/org/swisspush/gateleen/queue/queuing/circuitbreaker/lua/HalfOpenCircuitRedisCommand.java +++ b/gateleen-queue/src/main/java/org/swisspush/gateleen/queue/queuing/circuitbreaker/lua/HalfOpenCircuitRedisCommand.java @@ -1,10 +1,10 @@ package org.swisspush.gateleen.queue.queuing.circuitbreaker.lua; import io.vertx.core.Promise; -import io.vertx.redis.client.RedisAPI; import org.slf4j.Logger; import org.swisspush.gateleen.core.lua.LuaScriptState; import org.swisspush.gateleen.core.lua.RedisCommand; +import org.swisspush.gateleen.core.redis.RedisProvider; import org.swisspush.gateleen.core.util.RedisUtils; import java.util.List; @@ -14,43 +14,45 @@ */ public class HalfOpenCircuitRedisCommand implements RedisCommand { - private LuaScriptState luaScriptState; - private List keys; - private List arguments; - private Promise promise; - private RedisAPI redisAPI; - private Logger log; + private final LuaScriptState luaScriptState; + private final List keys; + private final List arguments; + private final Promise promise; + private final RedisProvider redisProvider; + private final Logger log; public HalfOpenCircuitRedisCommand(LuaScriptState luaScriptState, List keys, List arguments, - RedisAPI redisAPI, Logger log, final Promise promise) { + RedisProvider redisProvider, Logger log, final Promise promise) { this.luaScriptState = luaScriptState; this.keys = keys; this.arguments = arguments; - this.redisAPI = redisAPI; + this.redisProvider = redisProvider; this.log = log; this.promise = promise; } @Override public void exec(int executionCounter) { - List args= RedisUtils.toPayload(luaScriptState.getSha(), keys.size(), keys, arguments); - redisAPI.evalsha(args, event -> { - if(event.succeeded()){ + List args = RedisUtils.toPayload(luaScriptState.getSha(), keys.size(), keys, arguments); + redisProvider.redis().onSuccess(redisAPI -> redisAPI.evalsha(args, event -> { + if (event.succeeded()) { promise.complete(event.result().toLong()); } else { String message = event.cause().getMessage(); - if(message != null && message.startsWith("NOSCRIPT")) { + if (message != null && message.startsWith("NOSCRIPT")) { log.warn("HalfOpenCircuitRedisCommand script couldn't be found, reload it"); - log.warn("amount the script got loaded: " + String.valueOf(executionCounter)); - if(executionCounter > 10) { + log.warn("amount the script got loaded: " + executionCounter); + if (executionCounter > 10) { promise.fail("amount the script got loaded is higher than 10, we abort"); } else { - luaScriptState.loadLuaScript(new HalfOpenCircuitRedisCommand(luaScriptState, keys, arguments, redisAPI, log, promise), executionCounter); + luaScriptState.loadLuaScript(new HalfOpenCircuitRedisCommand(luaScriptState, keys, arguments, + redisProvider, log, promise), executionCounter); } } else { promise.fail("HalfOpenCircuitRedisCommand request failed with message: " + message); } } - }); + })).onFailure(throwable -> promise.fail("Redis: HalfOpenCircuitRedisCommand request failed with message: " + + throwable.getMessage())); } } diff --git a/gateleen-queue/src/main/java/org/swisspush/gateleen/queue/queuing/circuitbreaker/lua/ReOpenCircuitRedisCommand.java b/gateleen-queue/src/main/java/org/swisspush/gateleen/queue/queuing/circuitbreaker/lua/ReOpenCircuitRedisCommand.java index a1700330..3758b314 100644 --- a/gateleen-queue/src/main/java/org/swisspush/gateleen/queue/queuing/circuitbreaker/lua/ReOpenCircuitRedisCommand.java +++ b/gateleen-queue/src/main/java/org/swisspush/gateleen/queue/queuing/circuitbreaker/lua/ReOpenCircuitRedisCommand.java @@ -1,10 +1,10 @@ package org.swisspush.gateleen.queue.queuing.circuitbreaker.lua; import io.vertx.core.Promise; -import io.vertx.redis.client.RedisAPI; import org.slf4j.Logger; import org.swisspush.gateleen.core.lua.LuaScriptState; import org.swisspush.gateleen.core.lua.RedisCommand; +import org.swisspush.gateleen.core.redis.RedisProvider; import org.swisspush.gateleen.core.util.RedisUtils; import java.util.List; @@ -14,43 +14,45 @@ */ public class ReOpenCircuitRedisCommand implements RedisCommand { - private LuaScriptState luaScriptState; - private List keys; - private List arguments; - private Promise promise; - private RedisAPI redisAPI; - private Logger log; + private final LuaScriptState luaScriptState; + private final List keys; + private final List arguments; + private final Promise promise; + private final RedisProvider redisProvider; + private final Logger log; public ReOpenCircuitRedisCommand(LuaScriptState luaScriptState, List keys, List arguments, - RedisAPI redisAPI, Logger log, final Promise promise) { + RedisProvider redisProvider, Logger log, final Promise promise) { this.luaScriptState = luaScriptState; this.keys = keys; this.arguments = arguments; - this.redisAPI = redisAPI; + this.redisProvider = redisProvider; this.log = log; this.promise = promise; } @Override public void exec(int executionCounter) { - List args= RedisUtils.toPayload(luaScriptState.getSha(), keys.size(), keys, arguments); - redisAPI.evalsha(args, event -> { - if(event.succeeded()){ + List args = RedisUtils.toPayload(luaScriptState.getSha(), keys.size(), keys, arguments); + redisProvider.redis().onSuccess(redisAPI -> redisAPI.evalsha(args, event -> { + if (event.succeeded()) { promise.complete(); } else { String message = event.cause().getMessage(); - if(message != null && message.startsWith("NOSCRIPT")) { + if (message != null && message.startsWith("NOSCRIPT")) { log.warn("ReOpenCircuitRedisCommand script couldn't be found, reload it"); - log.warn("amount the script got loaded: " + String.valueOf(executionCounter)); - if(executionCounter > 10) { + log.warn("amount the script got loaded: " + executionCounter); + if (executionCounter > 10) { promise.fail("amount the script got loaded is higher than 10, we abort"); } else { - luaScriptState.loadLuaScript(new ReOpenCircuitRedisCommand(luaScriptState, keys, arguments, redisAPI, log, promise), executionCounter); + luaScriptState.loadLuaScript(new ReOpenCircuitRedisCommand(luaScriptState, keys, arguments, + redisProvider, log, promise), executionCounter); } } else { promise.fail("ReOpenCircuitRedisCommand request failed with message: " + message); } } - }); + })).onFailure(throwable -> promise.fail("Redis: ReOpenCircuitRedisCommand request failed with message: " + + throwable.getMessage())); } } diff --git a/gateleen-queue/src/main/java/org/swisspush/gateleen/queue/queuing/circuitbreaker/lua/UnlockSampleQueuesRedisCommand.java b/gateleen-queue/src/main/java/org/swisspush/gateleen/queue/queuing/circuitbreaker/lua/UnlockSampleQueuesRedisCommand.java index 5d2ebebe..6c2751bf 100644 --- a/gateleen-queue/src/main/java/org/swisspush/gateleen/queue/queuing/circuitbreaker/lua/UnlockSampleQueuesRedisCommand.java +++ b/gateleen-queue/src/main/java/org/swisspush/gateleen/queue/queuing/circuitbreaker/lua/UnlockSampleQueuesRedisCommand.java @@ -1,11 +1,11 @@ package org.swisspush.gateleen.queue.queuing.circuitbreaker.lua; import io.vertx.core.Promise; -import io.vertx.redis.client.RedisAPI; import io.vertx.redis.client.Response; import org.slf4j.Logger; import org.swisspush.gateleen.core.lua.LuaScriptState; import org.swisspush.gateleen.core.lua.RedisCommand; +import org.swisspush.gateleen.core.redis.RedisProvider; import org.swisspush.gateleen.core.util.RedisUtils; import java.util.List; @@ -15,44 +15,46 @@ */ public class UnlockSampleQueuesRedisCommand implements RedisCommand { - private LuaScriptState luaScriptState; - private List keys; - private List arguments; - private Promise promise; - private RedisAPI redisAPI; - private Logger log; + private final LuaScriptState luaScriptState; + private final List keys; + private final List arguments; + private final Promise promise; + private final RedisProvider redisProvider; + private final Logger log; public UnlockSampleQueuesRedisCommand(LuaScriptState luaScriptState, List keys, List arguments, - RedisAPI redisAPI, Logger log, final Promise promise) { + RedisProvider redisProvider, Logger log, final Promise promise) { this.luaScriptState = luaScriptState; this.keys = keys; this.arguments = arguments; - this.redisAPI = redisAPI; + this.redisProvider = redisProvider; this.log = log; this.promise = promise; } @Override public void exec(int executionCounter) { - List args= RedisUtils.toPayload(luaScriptState.getSha(), keys.size(), keys, arguments); - redisAPI.evalsha(args, event -> { - if(event.succeeded()){ + List args = RedisUtils.toPayload(luaScriptState.getSha(), keys.size(), keys, arguments); + redisProvider.redis().onSuccess(redisAPI -> redisAPI.evalsha(args, event -> { + if (event.succeeded()) { Response result = event.result(); promise.complete(result); } else { String message = event.cause().getMessage(); - if(message != null && message.startsWith("NOSCRIPT")) { + if (message != null && message.startsWith("NOSCRIPT")) { log.warn("UnlockSampleQueuesRedisCommand script couldn't be found, reload it"); - log.warn("amount the script got loaded: " + String.valueOf(executionCounter)); - if(executionCounter > 10) { + log.warn("amount the script got loaded: " + executionCounter); + if (executionCounter > 10) { promise.fail("amount the script got loaded is higher than 10, we abort"); } else { - luaScriptState.loadLuaScript(new UnlockSampleQueuesRedisCommand(luaScriptState, keys, arguments, redisAPI, log, promise), executionCounter); + luaScriptState.loadLuaScript(new UnlockSampleQueuesRedisCommand(luaScriptState, keys, arguments, + redisProvider, log, promise), executionCounter); } } else { promise.fail("UnlockSampleQueuesRedisCommand request failed with message: " + message); } } - }); + })).onFailure(throwable -> promise.fail("Redis: UnlockSampleQueuesRedisCommand request failed with message: " + + throwable.getMessage())); } } diff --git a/gateleen-queue/src/main/java/org/swisspush/gateleen/queue/queuing/circuitbreaker/lua/UpdateStatsRedisCommand.java b/gateleen-queue/src/main/java/org/swisspush/gateleen/queue/queuing/circuitbreaker/lua/UpdateStatsRedisCommand.java index 5ec3c921..f2581294 100644 --- a/gateleen-queue/src/main/java/org/swisspush/gateleen/queue/queuing/circuitbreaker/lua/UpdateStatsRedisCommand.java +++ b/gateleen-queue/src/main/java/org/swisspush/gateleen/queue/queuing/circuitbreaker/lua/UpdateStatsRedisCommand.java @@ -1,10 +1,10 @@ package org.swisspush.gateleen.queue.queuing.circuitbreaker.lua; import io.vertx.core.Promise; -import io.vertx.redis.client.RedisAPI; import org.slf4j.Logger; import org.swisspush.gateleen.core.lua.LuaScriptState; import org.swisspush.gateleen.core.lua.RedisCommand; +import org.swisspush.gateleen.core.redis.RedisProvider; import org.swisspush.gateleen.core.util.RedisUtils; import org.swisspush.gateleen.queue.queuing.circuitbreaker.util.UpdateStatisticsResult; @@ -19,24 +19,24 @@ public class UpdateStatsRedisCommand implements RedisCommand { private List keys; private List arguments; private Promise promise; - private RedisAPI redisAPI; + private RedisProvider redisProvider; private Logger log; public UpdateStatsRedisCommand(LuaScriptState luaScriptState, List keys, List arguments, - RedisAPI redisAPI, Logger log, final Promise promise) { + RedisProvider redisProvider, Logger log, final Promise promise) { this.luaScriptState = luaScriptState; this.keys = keys; this.arguments = arguments; - this.redisAPI = redisAPI; + this.redisProvider = redisProvider; this.log = log; this.promise = promise; } @Override public void exec(int executionCounter) { - List args= RedisUtils.toPayload(luaScriptState.getSha(), keys.size(), keys, arguments); - redisAPI.evalsha(args, event -> { - if(event.succeeded()){ + List args = RedisUtils.toPayload(luaScriptState.getSha(), keys.size(), keys, arguments); + redisProvider.redis().onSuccess(redisAPI -> redisAPI.evalsha(args, event -> { + if (event.succeeded()) { String value = event.result().toString(); if (log.isTraceEnabled()) { log.trace("UpdateStatsRedisCommand lua script got result: " + value); @@ -44,18 +44,20 @@ public void exec(int executionCounter) { promise.complete(UpdateStatisticsResult.fromString(value, UpdateStatisticsResult.ERROR)); } else { String message = event.cause().getMessage(); - if(message != null && message.startsWith("NOSCRIPT")) { + if (message != null && message.startsWith("NOSCRIPT")) { log.warn("UpdateStatsRedisCommand script couldn't be found, reload it"); log.warn("amount the script got loaded: " + String.valueOf(executionCounter)); - if(executionCounter > 10) { + if (executionCounter > 10) { promise.fail("amount the script got loaded is higher than 10, we abort"); } else { - luaScriptState.loadLuaScript(new UpdateStatsRedisCommand(luaScriptState, keys, arguments, redisAPI, log, promise), executionCounter); + luaScriptState.loadLuaScript(new UpdateStatsRedisCommand(luaScriptState, keys, arguments, + redisProvider, log, promise), executionCounter); } } else { promise.fail("UpdateStatsRedisCommand request failed with message: " + message); } } - }); + })).onFailure(throwable -> promise.fail("Redis: UpdateStatsRedisCommand request failed with message: " + + throwable.getMessage())); } } diff --git a/gateleen-queue/src/test/java/org/swisspush/gateleen/queue/queuing/circuitbreaker/impl/RedisQueueCircuitBreakerStorageTest.java b/gateleen-queue/src/test/java/org/swisspush/gateleen/queue/queuing/circuitbreaker/impl/RedisQueueCircuitBreakerStorageTest.java index d918eaa5..be974185 100644 --- a/gateleen-queue/src/test/java/org/swisspush/gateleen/queue/queuing/circuitbreaker/impl/RedisQueueCircuitBreakerStorageTest.java +++ b/gateleen-queue/src/test/java/org/swisspush/gateleen/queue/queuing/circuitbreaker/impl/RedisQueueCircuitBreakerStorageTest.java @@ -49,7 +49,8 @@ public class RedisQueueCircuitBreakerStorageTest { @BeforeClass public static void setupStorage(){ vertx = Vertx.vertx(); - storage = new RedisQueueCircuitBreakerStorage(RedisAPI.api(new RedisClient(vertx, new RedisOptions()))); + RedisAPI redisAPI = RedisAPI.api(new RedisClient(vertx, new RedisOptions())); + storage = new RedisQueueCircuitBreakerStorage(() -> Future.succeededFuture(redisAPI)); } @Before diff --git a/gateleen-runconfig/src/main/java/org/swisspush/gateleen/runconfig/RunConfig.java b/gateleen-runconfig/src/main/java/org/swisspush/gateleen/runconfig/RunConfig.java index c3033882..a3770b79 100755 --- a/gateleen-runconfig/src/main/java/org/swisspush/gateleen/runconfig/RunConfig.java +++ b/gateleen-runconfig/src/main/java/org/swisspush/gateleen/runconfig/RunConfig.java @@ -203,7 +203,7 @@ private void init() { } log.info(SERVER_NAME + " starting with log configuration " + conf); - Configurator.initialize("",conf); + Configurator.initialize("", conf); } public static RunConfigBuilder with() { @@ -490,22 +490,22 @@ public static void deployModules(final Vertx vertx, Class verticleClass, Map { - if (event1.failed()) { - log.error("Could not load rest storage redis module", event1.cause()); + // rest storage module + vertx.deployVerticle("org.swisspush.reststorage.RestStorageMod", new DeploymentOptions().setConfig(RunConfig.buildStorageConfig()).setInstances(4), event1 -> { + if (event1.failed()) { + log.error("Could not load rest storage redis module", event1.cause()); + handler.handle(false); + return; + } + + // metrics module + vertx.deployVerticle("org.swisspush.metrics.MetricsModule", new DeploymentOptions().setConfig(RunConfig.buildMetricsConfig()), event2 -> { + if (event2.failed()) { + log.error("Could not load metrics module", event2.cause()); handler.handle(false); return; } - - // metrics module - vertx.deployVerticle("org.swisspush.metrics.MetricsModule", new DeploymentOptions().setConfig(RunConfig.buildMetricsConfig()), event2 -> { - if (event2.failed()) { - log.error("Could not load metrics module", event2.cause()); - handler.handle(false); - return; - } - handler.handle(true); + handler.handle(true); }); }); }); diff --git a/gateleen-scheduler/src/main/java/org/swisspush/gateleen/scheduler/Scheduler.java b/gateleen-scheduler/src/main/java/org/swisspush/gateleen/scheduler/Scheduler.java index 7ecc9cbd..5abe6fab 100755 --- a/gateleen-scheduler/src/main/java/org/swisspush/gateleen/scheduler/Scheduler.java +++ b/gateleen-scheduler/src/main/java/org/swisspush/gateleen/scheduler/Scheduler.java @@ -5,11 +5,11 @@ import io.vertx.core.Vertx; import io.vertx.core.eventbus.Message; import io.vertx.core.json.JsonObject; -import io.vertx.redis.client.RedisAPI; import org.quartz.CronExpression; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.swisspush.gateleen.core.http.HttpRequest; +import org.swisspush.gateleen.core.redis.RedisProvider; import org.swisspush.gateleen.monitoring.MonitoringHandler; import org.swisspush.gateleen.queue.expiry.ExpiryCheckHandler; import org.swisspush.gateleen.queue.queuing.QueueClient; @@ -31,7 +31,7 @@ public class Scheduler { private Vertx vertx; - private RedisAPI redisAPI; + private RedisProvider redisProvider; private String redisquesAddress; private String name; private CronExpression cronExpression; @@ -45,10 +45,12 @@ public class Scheduler { private Logger log; - public Scheduler(Vertx vertx, String redisquesAddress, RedisAPI redisAPI, String name, String cronExpression, List requests, MonitoringHandler monitoringHandler, int maxRandomOffset, boolean executeOnStartup, boolean executeOnReload) throws ParseException { + public Scheduler(Vertx vertx, String redisquesAddress, RedisProvider redisProvider, String name, String cronExpression, + List requests, MonitoringHandler monitoringHandler, int maxRandomOffset, + boolean executeOnStartup, boolean executeOnReload) throws ParseException { this.vertx = vertx; this.redisquesAddress = redisquesAddress; - this.redisAPI = redisAPI; + this.redisProvider = redisProvider; this.name = name; this.cronExpression = new CronExpression(cronExpression); this.requests = requests; @@ -77,30 +79,33 @@ private void calcRandomOffset(int maxRandomOffset) { public void start() { log.info("Starting scheduler [ " + cronExpression.getCronExpression() + " ]"); - timer = vertx.setPeriodic(5000, timer -> redisAPI.get("schedulers:" + name, reply -> { - final String stringValue = reply.result() == null ? null : reply.result().toString(); - - /* - To guarantee that a scheduler is always triggered after the same interval, - we have to subtract the randomOffset from the current time. This way we don’t - change the behavior of the scheduler, because we simply “adjust” the current time. - */ - if (stringValue == null || Long.parseLong(stringValue) <= (System.currentTimeMillis() - randomOffset)) { - // Either first use of the scheduler or run time reached. - // We need to set the next run time - final long nextRunTime = nextRunTime(); - if (log.isTraceEnabled()) { - log.trace("Setting next run time to " + SimpleDateFormat.getDateTimeInstance().format(new Date(nextRunTime))); - } - redisAPI.getset("schedulers:" + name, "" + nextRunTime, event -> { - String previousValue = event.result() == null ? null : event.result().toString(); - if (stringValue != null && stringValue.equals(previousValue)) { - // a run time was set and we were the first instance to update it - trigger(); + + timer = vertx.setPeriodic(5000, timer -> redisProvider.redis() + .onSuccess(redisAPI -> redisAPI.get("schedulers:" + name, reply -> { + final String stringValue = reply.result() == null ? null : reply.result().toString(); + + /* + To guarantee that a scheduler is always triggered after the same interval, + we have to subtract the randomOffset from the current time. This way we don’t + change the behavior of the scheduler, because we simply “adjust” the current time. + */ + if (stringValue == null || Long.parseLong(stringValue) <= (System.currentTimeMillis() - randomOffset)) { + // Either first use of the scheduler or run time reached. + // We need to set the next run time + final long nextRunTime = Scheduler.this.nextRunTime(); + if (log.isTraceEnabled()) { + log.trace("Setting next run time to " + SimpleDateFormat.getDateTimeInstance().format(new Date(nextRunTime))); + } + redisAPI.getset("schedulers:" + name, "" + nextRunTime, event -> { + String previousValue = event.result() == null ? null : event.result().toString(); + if (stringValue != null && stringValue.equals(previousValue)) { + // a run time was set and we were the first instance to update it + Scheduler.this.trigger(); + } + }); } - }); - } - })); + })).onFailure(throwable -> log.error("Redis: Unable to trigger scheduler", throwable))); + if ((!executed && executeOnStartup) || executeOnReload) { executed = true; trigger(); @@ -111,11 +116,11 @@ public void stop() { log.info("Stopping scheduler [ " + cronExpression.getCronExpression() + " ] "); vertx.cancelTimer(timer); String key = "schedulers:" + name; - redisAPI.del(Collections.singletonList(key), reply -> { + redisProvider.redis().onSuccess(redisAPI -> redisAPI.del(Collections.singletonList(key), reply -> { if (reply.failed()) { log.error("Could not reset scheduler '" + key + "'"); } - }); + })).onFailure(throwable -> log.error("Redis: Could not reset scheduler '" + key + "'")); } private void trigger() { @@ -143,9 +148,8 @@ private void trigger() { private long nextRunTime() { /* - To not increase the interval, we also have to adapt the - current time, by subtracting the randomOffset. Otherwise - the interval will be increased by the randomOffset. + To not increase the interval, we also have to adapt the current time, by subtracting the randomOffset. + Otherwise, the interval will be increased by the randomOffset. */ return cronExpression.getNextValidTimeAfter(new Date(System.currentTimeMillis() - randomOffset)).getTime(); } diff --git a/gateleen-scheduler/src/main/java/org/swisspush/gateleen/scheduler/SchedulerFactory.java b/gateleen-scheduler/src/main/java/org/swisspush/gateleen/scheduler/SchedulerFactory.java index e4297e2e..9093f4d1 100755 --- a/gateleen-scheduler/src/main/java/org/swisspush/gateleen/scheduler/SchedulerFactory.java +++ b/gateleen-scheduler/src/main/java/org/swisspush/gateleen/scheduler/SchedulerFactory.java @@ -2,13 +2,12 @@ import io.vertx.core.Vertx; import io.vertx.core.buffer.Buffer; -import io.vertx.core.json.DecodeException; import io.vertx.core.json.JsonArray; import io.vertx.core.json.JsonObject; -import io.vertx.redis.client.RedisAPI; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.swisspush.gateleen.core.http.HttpRequest; +import org.swisspush.gateleen.core.redis.RedisProvider; import org.swisspush.gateleen.core.util.StringUtils; import org.swisspush.gateleen.core.validation.ValidationResult; import org.swisspush.gateleen.monitoring.MonitoringHandler; @@ -40,19 +39,20 @@ public class SchedulerFactory { private final Map properties; private final JsonArray defaultRequestHeaders; private Vertx vertx; - private RedisAPI redisAPI; + private RedisProvider redisProvider; private MonitoringHandler monitoringHandler; private String schedulersSchema; private String redisquesAddress; private Logger log = LoggerFactory.getLogger(SchedulerFactory.class); - public SchedulerFactory(Map properties, Map defaultRequestHeaders, Vertx vertx, RedisAPI redisAPI, - MonitoringHandler monitoringHandler, String schedulersSchema, String redisquesAddress) { + public SchedulerFactory(Map properties, Map defaultRequestHeaders, Vertx vertx, + RedisProvider redisProvider, MonitoringHandler monitoringHandler, String schedulersSchema, + String redisquesAddress) { this.properties = properties; this.defaultRequestHeaders = defaultRequestHeadersAsJsonArray(defaultRequestHeaders); this.vertx = vertx; - this.redisAPI = redisAPI; + this.redisProvider = redisProvider; this.monitoringHandler = monitoringHandler; this.schedulersSchema = schedulersSchema; this.redisquesAddress = redisquesAddress; @@ -114,13 +114,17 @@ public List parseSchedulers(Buffer buffer) throws ValidationException List requests = new ArrayList<>(); for (int i = 0; i < ((ArrayList) schedulerJson.get(REQUESTS)).size(); i++) { try { - requests.add(new HttpRequest(prepare((JsonObject) mainObject.getJsonObject(SCHEDULERS).getJsonObject(entry.getKey()).getJsonArray(REQUESTS).getValue(i)))); + requests.add(new HttpRequest(prepare((JsonObject) mainObject.getJsonObject(SCHEDULERS) + .getJsonObject(entry.getKey()).getJsonArray(REQUESTS).getValue(i))) + ); } catch (Exception e) { throw new ValidationException("Could not parse request [" + i + "] of scheduler " + entry.getKey(), e); } } try { - result.add(new Scheduler(vertx, redisquesAddress, redisAPI, entry.getKey(), (String) schedulerJson.get("cronExpression"), requests, monitoringHandler, maxRandomOffset, executeOnStartup, executeOnReload)); + result.add(new Scheduler(vertx, redisquesAddress, redisProvider, entry.getKey(), + (String) schedulerJson.get("cronExpression"), requests, monitoringHandler, maxRandomOffset, executeOnStartup, executeOnReload) + ); } catch (ParseException e) { throw new ValidationException("Could not parse cron expression of scheduler '" + entry.getKey() + "'", e); } diff --git a/gateleen-scheduler/src/main/java/org/swisspush/gateleen/scheduler/SchedulerResourceManager.java b/gateleen-scheduler/src/main/java/org/swisspush/gateleen/scheduler/SchedulerResourceManager.java index 32089fc6..40020af9 100755 --- a/gateleen-scheduler/src/main/java/org/swisspush/gateleen/scheduler/SchedulerResourceManager.java +++ b/gateleen-scheduler/src/main/java/org/swisspush/gateleen/scheduler/SchedulerResourceManager.java @@ -11,6 +11,7 @@ import org.slf4j.LoggerFactory; import org.swisspush.gateleen.core.logging.LoggableResource; import org.swisspush.gateleen.core.logging.RequestLogger; +import org.swisspush.gateleen.core.redis.RedisProvider; import org.swisspush.gateleen.core.refresh.Refreshable; import org.swisspush.gateleen.core.storage.ResourceStorage; import org.swisspush.gateleen.core.util.Address; @@ -40,23 +41,23 @@ public class SchedulerResourceManager implements Refreshable, LoggableResource { private String schedulersSchema; private boolean logConfigurationResourceChanges = false; - public SchedulerResourceManager(Vertx vertx, RedisAPI redisAPI, final ResourceStorage storage, + public SchedulerResourceManager(Vertx vertx, RedisProvider redisProvider, final ResourceStorage storage, MonitoringHandler monitoringHandler, String schedulersUri) { - this(vertx, redisAPI, storage, monitoringHandler, schedulersUri, null); + this(vertx, redisProvider, storage, monitoringHandler, schedulersUri, null); } - public SchedulerResourceManager(Vertx vertx,RedisAPI redisAPI, final ResourceStorage storage, + public SchedulerResourceManager(Vertx vertx, RedisProvider redisProvider, final ResourceStorage storage, MonitoringHandler monitoringHandler, String schedulersUri, Map props) { - this(vertx, redisAPI, storage, monitoringHandler, schedulersUri, props, Address.redisquesAddress()); + this(vertx, redisProvider, storage, monitoringHandler, schedulersUri, props, Address.redisquesAddress()); } - public SchedulerResourceManager(Vertx vertx, RedisAPI redisAPI, final ResourceStorage storage, + public SchedulerResourceManager(Vertx vertx, RedisProvider redisProvider, final ResourceStorage storage, MonitoringHandler monitoringHandler, String schedulersUri, Map props, String redisquesAddress) { - this(vertx, redisAPI, storage, monitoringHandler, schedulersUri, props, redisquesAddress, Collections.emptyMap()); + this(vertx, redisProvider, storage, monitoringHandler, schedulersUri, props, redisquesAddress, Collections.emptyMap()); } - public SchedulerResourceManager(Vertx vertx, RedisAPI redisAPI, final ResourceStorage storage, + public SchedulerResourceManager(Vertx vertx, RedisProvider redisProvider, final ResourceStorage storage, MonitoringHandler monitoringHandler, String schedulersUri, Map props, String redisquesAddress, Map defaultRequestHeaders) { this.vertx = vertx; @@ -65,7 +66,7 @@ public SchedulerResourceManager(Vertx vertx, RedisAPI redisAPI, final ResourceSt this.properties = props; this.schedulersSchema = ResourcesUtils.loadResource("gateleen_scheduler_schema_schedulers", true); - this.schedulerFactory = new SchedulerFactory(properties, defaultRequestHeaders, vertx, redisAPI, + this.schedulerFactory = new SchedulerFactory(properties, defaultRequestHeaders, vertx, redisProvider, monitoringHandler, schedulersSchema, redisquesAddress); updateSchedulers(); diff --git a/gateleen-scheduler/src/test/java/org/swisspush/gateleen/scheduler/SchedulerFactoryTest.java b/gateleen-scheduler/src/test/java/org/swisspush/gateleen/scheduler/SchedulerFactoryTest.java index dc7573bc..037c7ed6 100755 --- a/gateleen-scheduler/src/test/java/org/swisspush/gateleen/scheduler/SchedulerFactoryTest.java +++ b/gateleen-scheduler/src/test/java/org/swisspush/gateleen/scheduler/SchedulerFactoryTest.java @@ -1,5 +1,6 @@ package org.swisspush.gateleen.scheduler; +import io.vertx.core.Future; import io.vertx.core.Vertx; import io.vertx.core.buffer.Buffer; import io.vertx.core.eventbus.EventBus; @@ -14,6 +15,7 @@ import org.junit.runner.RunWith; import org.mockito.Mockito; import org.swisspush.gateleen.core.http.HttpRequest; +import org.swisspush.gateleen.core.redis.RedisProvider; import org.swisspush.gateleen.core.util.Address; import org.swisspush.gateleen.core.util.ResourcesUtils; import org.swisspush.gateleen.monitoring.MonitoringHandler; @@ -22,6 +24,8 @@ import java.util.Collections; import java.util.List; +import static org.mockito.Mockito.when; + /** * Tests for the {@link SchedulerFactory} class * @@ -34,6 +38,7 @@ public class SchedulerFactoryTest { private MonitoringHandler monitoringHandler; private RedisAPI redisAPI; + private RedisProvider redisProvider; private SchedulerFactory schedulerFactory; @Rule @@ -52,10 +57,13 @@ public void setUp() { Mockito.when(vertx.eventBus()).thenReturn(Mockito.mock(EventBus.class)); redisAPI = Mockito.mock(RedisAPI.class); + redisProvider = Mockito.mock(RedisProvider.class); + when(redisProvider.redis()).thenReturn(Future.succeededFuture(redisAPI)); monitoringHandler = Mockito.mock(MonitoringHandler.class); - schedulerFactory = new SchedulerFactory(null, Collections.emptyMap(), vertx, redisAPI, monitoringHandler, schedulersSchema, Address.redisquesAddress()); + schedulerFactory = new SchedulerFactory(null, Collections.emptyMap(), vertx, redisProvider, monitoringHandler, + schedulersSchema, Address.redisquesAddress()); } @Test @@ -96,7 +104,7 @@ public void testValidSchedulerConfig(TestContext context) throws ValidationExcep @Test public void testValidSchedulerConfigWithDefaultHeaders(TestContext context) throws ValidationException { - schedulerFactory = new SchedulerFactory(null, Collections.singletonMap("x-foo", "zzz"), vertx, redisAPI, + schedulerFactory = new SchedulerFactory(null, Collections.singletonMap("x-foo", "zzz"), vertx, redisProvider, monitoringHandler, schedulersSchema, Address.redisquesAddress()); List schedulers = schedulerFactory.parseSchedulers(Buffer.buffer(VALID_SCHEDULER_RESOURCE)); context.assertNotNull(schedulers); diff --git a/gateleen-test/src/test/java/org/swisspush/gateleen/AbstractTest.java b/gateleen-test/src/test/java/org/swisspush/gateleen/AbstractTest.java index 6b41d659..d998581c 100755 --- a/gateleen-test/src/test/java/org/swisspush/gateleen/AbstractTest.java +++ b/gateleen-test/src/test/java/org/swisspush/gateleen/AbstractTest.java @@ -4,6 +4,7 @@ import io.restassured.builder.RequestSpecBuilder; import io.restassured.parsing.Parser; import io.restassured.specification.RequestSpecification; +import io.vertx.core.Future; import io.vertx.core.Handler; import io.vertx.core.Vertx; import io.vertx.core.http.HttpServer; @@ -31,6 +32,7 @@ import org.swisspush.gateleen.core.lock.Lock; import org.swisspush.gateleen.core.lock.impl.RedisBasedLock; import org.swisspush.gateleen.core.property.PropertyHandler; +import org.swisspush.gateleen.core.redis.RedisProvider; import org.swisspush.gateleen.core.resource.CopyResourceHandler; import org.swisspush.gateleen.core.storage.EventBusResourceStorage; import org.swisspush.gateleen.core.storage.ResourceStorage; @@ -141,6 +143,8 @@ public static void setupBeforeClass(TestContext context) { if (success) { RedisClient redisClient = new RedisClient(vertx, new RedisOptions().setConnectionString("redis://" + redisHost + ":" + redisPort)); RedisAPI redisAPI = RedisAPI.api(redisClient); + RedisProvider redisProvider = () -> Future.succeededFuture(redisAPI); + ResourceStorage storage = new EventBusResourceStorage(vertx.eventBus(), Address.storageAddress() + "-main"); MonitoringHandler monitoringHandler = new MonitoringHandler(vertx, storage, PREFIX); ConfigurationResourceManager configurationResourceManager = new ConfigurationResourceManager(vertx, storage); @@ -155,15 +159,15 @@ public static void setupBeforeClass(TestContext context) { RoleProfileHandler roleProfileHandler = new RoleProfileHandler(vertx, storage, SERVER_ROOT + "/roles/v1/([^/]+)/profile"); qosHandler = new QoSHandler(vertx, storage, SERVER_ROOT + "/admin/v1/qos", props, PREFIX); - Lock lock = new RedisBasedLock(redisAPI); + Lock lock = new RedisBasedLock(redisProvider); QueueClient queueClient = new QueueClient(vertx, monitoringHandler); - ReducedPropagationManager reducedPropagationManager = new ReducedPropagationManager(vertx, new RedisReducedPropagationStorage(redisAPI), queueClient, lock); + ReducedPropagationManager reducedPropagationManager = new ReducedPropagationManager(vertx, new RedisReducedPropagationStorage(redisProvider), queueClient, lock); reducedPropagationManager.startExpiredQueueProcessing(1000); hookHandler = new HookHandler(vertx, selfClient, storage, loggingResourceManager, monitoringHandler, SERVER_ROOT + "/users/v1/%s/profile", ROOT + "/server/hooks/v1/", queueClient, false, reducedPropagationManager); propertyHandler = new PropertyHandler(ROOT, props); - schedulerResourceManager = new SchedulerResourceManager(vertx, redisAPI, storage, monitoringHandler, SERVER_ROOT + "/admin/v1/schedulers"); + schedulerResourceManager = new SchedulerResourceManager(vertx, redisProvider, storage, monitoringHandler, SERVER_ROOT + "/admin/v1/schedulers"); ResetMetricsController resetMetricsController = new ResetMetricsController(vertx); resetMetricsController.registerResetMetricsControlMBean(JMX_DOMAIN, PREFIX); LogController logController = new LogController(); @@ -174,7 +178,7 @@ public static void setupBeforeClass(TestContext context) { cacheHandler = new CacheHandler( new DefaultCacheDataFetcher(new ClientRequestCreator(selfClient)), - new RedisCacheStorage(vertx, lock, redisAPI, 60000), + new RedisCacheStorage(vertx, lock, redisProvider, 60000), SERVER_ROOT + "/cache"); customHttpResponseHandler = new CustomHttpResponseHandler(RETURN_HTTP_STATUS_ROOT); @@ -184,7 +188,7 @@ public static void setupBeforeClass(TestContext context) { QueueCircuitBreakerRulePatternToCircuitMapping rulePatternToCircuitMapping = new QueueCircuitBreakerRulePatternToCircuitMapping(); QueueCircuitBreakerConfigurationResourceManager queueCircuitBreakerConfigurationResourceManager = new QueueCircuitBreakerConfigurationResourceManager(vertx, storage, SERVER_ROOT + "/admin/v1/circuitbreaker"); - QueueCircuitBreakerStorage queueCircuitBreakerStorage = new RedisQueueCircuitBreakerStorage(redisAPI); + QueueCircuitBreakerStorage queueCircuitBreakerStorage = new RedisQueueCircuitBreakerStorage(redisProvider); QueueCircuitBreakerHttpRequestHandler requestHandler = new QueueCircuitBreakerHttpRequestHandler(vertx, queueCircuitBreakerStorage, SERVER_ROOT + "/queuecircuitbreaker/circuit"); @@ -195,7 +199,7 @@ public static void setupBeforeClass(TestContext context) { new QueueProcessor(vertx, selfClient, monitoringHandler, queueCircuitBreaker); final QueueBrowser queueBrowser = new QueueBrowser(vertx, SERVER_ROOT + "/queuing", Address.redisquesAddress(), monitoringHandler); - new CustomRedisMonitor(vertx, redisAPI, "main", "rest-storage", 10).start(); + new CustomRedisMonitor(vertx, redisProvider, "main", "rest-storage", 10).start(); Router router = Router.builder() .withVertx(vertx) .withStorage(storage) @@ -222,7 +226,7 @@ public static void setupBeforeClass(TestContext context) { RunConfig.with() .cacheHandler(cacheHandler) .corsHandler(new CORSHandler()) - .deltaHandler(new DeltaHandler(redisAPI, selfClient, ruleProvider)) + .deltaHandler(new DeltaHandler(redisProvider, selfClient, ruleProvider)) .expansionHandler(new ExpansionHandler(vertx, storage, selfClient, props, ROOT, RULES_ROOT)) .hookHandler(hookHandler) .qosHandler(qosHandler) From d1a602b3f745a9ccc687b165ed8452958c741eb0 Mon Sep 17 00:00:00 2001 From: Marc-Andre Weber Date: Fri, 9 Jun 2023 07:11:47 +0200 Subject: [PATCH 14/19] #541 Access redis through redisProvider [not yet final] --- .../gateleen/core/redis/RedisProvider.java | 14 ++++++++++++++ 1 file changed, 14 insertions(+) create mode 100644 gateleen-core/src/main/java/org/swisspush/gateleen/core/redis/RedisProvider.java diff --git a/gateleen-core/src/main/java/org/swisspush/gateleen/core/redis/RedisProvider.java b/gateleen-core/src/main/java/org/swisspush/gateleen/core/redis/RedisProvider.java new file mode 100644 index 00000000..f950bf07 --- /dev/null +++ b/gateleen-core/src/main/java/org/swisspush/gateleen/core/redis/RedisProvider.java @@ -0,0 +1,14 @@ +package org.swisspush.gateleen.core.redis; + +import io.vertx.core.Future; +import io.vertx.redis.client.RedisAPI; + +/** + * Provider for {@link RedisAPI} + * + * @author https://github.com/mcweba [Marc-Andre Weber] + */ +public interface RedisProvider { + + Future redis(); +} From 7039f23c1c58cd7cb386618a58a28949aa027080 Mon Sep 17 00:00:00 2001 From: Marc-Andre Weber Date: Fri, 9 Jun 2023 13:06:13 +0200 Subject: [PATCH 15/19] #541 Access redis through redisProvider --- .../lock/lua/ReleaseLockLuaScriptTests.java | 18 +-- .../swisspush/gateleen/playground/Server.java | 2 +- .../duplicate/DuplicateCheckHandler.java | 16 +- .../queue/queuing/QueuingHandler.java | 14 +- .../RedisQueueCircuitBreakerStorageTest.java | 14 +- .../gateleen/runconfig/RunConfig.java | 21 ++- .../SchedulerResourceManagerTest.java | 148 ++++++++++++++++++ .../org/swisspush/gateleen/AbstractTest.java | 2 +- 8 files changed, 191 insertions(+), 44 deletions(-) create mode 100644 gateleen-scheduler/src/test/java/org/swisspush/gateleen/scheduler/SchedulerResourceManagerTest.java diff --git a/gateleen-core/src/test/java/org/swisspush/gateleen/core/lock/lua/ReleaseLockLuaScriptTests.java b/gateleen-core/src/test/java/org/swisspush/gateleen/core/lock/lua/ReleaseLockLuaScriptTests.java index 8b29d5eb..153f3538 100644 --- a/gateleen-core/src/test/java/org/swisspush/gateleen/core/lock/lua/ReleaseLockLuaScriptTests.java +++ b/gateleen-core/src/test/java/org/swisspush/gateleen/core/lock/lua/ReleaseLockLuaScriptTests.java @@ -136,17 +136,17 @@ public void testReleaseExpiredLocks(){ @Test public void testReleaseLockRespectingOwnership(){ - String lock1 = buildLockKey("lock_1"); - String lock2 = buildLockKey("lock_2"); - String lock3 = buildLockKey("lock_3"); + String lock1 = buildLockKey("lock_4"); + String lock2 = buildLockKey("lock_5"); + String lock3 = buildLockKey("lock_6"); assertThat(jedis.exists(lock1), is(false)); assertThat(jedis.exists(lock2), is(false)); assertThat(jedis.exists(lock3), is(false)); - acquireLock(lock1, "token_1", 200); - acquireLock(lock2, "token_2", 500); - acquireLock(lock3, "token_3", 1000); + acquireLock(lock1, "token_4", 200); + acquireLock(lock2, "token_5", 500); + acquireLock(lock3, "token_6", 1000); assertThat(jedis.exists(lock1), is(true)); assertThat(jedis.exists(lock2), is(true)); @@ -168,9 +168,9 @@ public void testReleaseLockRespectingOwnership(){ assertThat(jedis.exists(lock2), is(true)); assertThat(jedis.exists(lock3), is(true)); - assertThat(0L, equalTo(evalScriptReleaseLock(lock1, "token_1"))); - assertThat(0L, equalTo(evalScriptReleaseLock(lock2, "token_2"))); - assertThat(0L, equalTo(evalScriptReleaseLock(lock3, "token_3"))); + assertThat(0L, equalTo(evalScriptReleaseLock(lock1, "token_4"))); + assertThat(0L, equalTo(evalScriptReleaseLock(lock2, "token_5"))); + assertThat(0L, equalTo(evalScriptReleaseLock(lock3, "token_6"))); assertThat(jedis.exists(lock1), is(true)); assertThat(jedis.exists(lock2), is(true)); diff --git a/gateleen-playground/src/main/java/org/swisspush/gateleen/playground/Server.java b/gateleen-playground/src/main/java/org/swisspush/gateleen/playground/Server.java index c081510b..80759ecd 100755 --- a/gateleen-playground/src/main/java/org/swisspush/gateleen/playground/Server.java +++ b/gateleen-playground/src/main/java/org/swisspush/gateleen/playground/Server.java @@ -341,7 +341,7 @@ public void start() { .delegateHandler(delegateHandler) .customHttpResponseHandler(customHttpResponseHandler) .contentTypeConstraintHandler(contentTypeConstraintHandler) - .build(vertx, redisApi, Server.class, router, monitoringHandler, queueBrowser); + .build(vertx, redisProvider, Server.class, router, monitoringHandler, queueBrowser); Handler routingContextHandlerrNew = runConfig.buildRoutingContextHandler(); selfClient.setRoutingContexttHandler(routingContextHandlerrNew); diff --git a/gateleen-queue/src/main/java/org/swisspush/gateleen/queue/duplicate/DuplicateCheckHandler.java b/gateleen-queue/src/main/java/org/swisspush/gateleen/queue/duplicate/DuplicateCheckHandler.java index 7b70f9a5..02ee9e2e 100644 --- a/gateleen-queue/src/main/java/org/swisspush/gateleen/queue/duplicate/DuplicateCheckHandler.java +++ b/gateleen-queue/src/main/java/org/swisspush/gateleen/queue/duplicate/DuplicateCheckHandler.java @@ -1,13 +1,13 @@ package org.swisspush.gateleen.queue.duplicate; import com.google.common.collect.ImmutableList; -import io.vertx.redis.client.RedisAPI; -import org.swisspush.gateleen.core.util.HashCodeGenerator; import io.vertx.core.AsyncResult; import io.vertx.core.Handler; import io.vertx.core.buffer.Buffer; import org.slf4j.Logger; import org.slf4j.LoggerFactory; +import org.swisspush.gateleen.core.redis.RedisProvider; +import org.swisspush.gateleen.core.util.HashCodeGenerator; import java.util.Objects; @@ -33,16 +33,16 @@ private DuplicateCheckHandler() { * in the database, a new entry will be saved to the database using a key which is created from the given parameters (uri and buffer). * The new entry expires after ttl has expired. * - * @param redisAPI redisAPI + * @param redisProvider provider for redis * @param uri the request uri * @param buffer the request payload * @param ttl the timeToLive (in seconds) for the storage entry * @param callback the result callback. Returns true if the request is a duplicate else returns false */ - public static void checkDuplicateRequest(RedisAPI redisAPI, String uri, Buffer buffer, String ttl, Handler callback) { + public static void checkDuplicateRequest(RedisProvider redisProvider, String uri, Buffer buffer, String ttl, Handler callback) { Integer timeToLive = parseTimeToLive(ttl); String redisKey = getRedisKey(uri, HashCodeGenerator.createHashCode(uri, buffer.toString())); - handleStorage(redisAPI, redisKey, timeToLive, callback); + handleStorage(redisProvider, redisKey, timeToLive, callback); } private static Integer parseTimeToLive(String ttl) { @@ -60,10 +60,10 @@ private static String getRedisKey(String uri, String hash) { return String.format(REDIS_KEY_TEMPLATE, uri, hash); } - private static void handleStorage(RedisAPI redisAPI, final String redisKey, int ttl, final Handler callback) { + private static void handleStorage(RedisProvider redisProvider, final String redisKey, int ttl, final Handler callback) { // read from storage - redisAPI.get(redisKey, reply -> { + redisProvider.redis().onSuccess(redisAPI -> redisAPI.get(redisKey, reply -> { if (reply.failed()) { log.error("get command for redisKey '{}' resulted in cause {}", redisKey, logCause(reply)); return; @@ -89,7 +89,7 @@ private static void handleStorage(RedisAPI redisAPI, final String redisKey, int log.info("received a duplicate request for redisKey: {}", redisKey); callback.handle(Boolean.TRUE); } - }); + })).onFailure(throwable -> log.error("Redis: get command for redisKey '{}' resulted in cause {}", redisKey, throwable.getMessage())); } private static String logCause(AsyncResult result) { diff --git a/gateleen-queue/src/main/java/org/swisspush/gateleen/queue/queuing/QueuingHandler.java b/gateleen-queue/src/main/java/org/swisspush/gateleen/queue/queuing/QueuingHandler.java index af319c10..46dc1837 100755 --- a/gateleen-queue/src/main/java/org/swisspush/gateleen/queue/queuing/QueuingHandler.java +++ b/gateleen-queue/src/main/java/org/swisspush/gateleen/queue/queuing/QueuingHandler.java @@ -6,7 +6,7 @@ import io.vertx.core.buffer.Buffer; import io.vertx.core.http.HttpMethod; import io.vertx.core.http.HttpServerRequest; -import io.vertx.redis.client.RedisAPI; +import org.swisspush.gateleen.core.redis.RedisProvider; import org.swisspush.gateleen.core.util.Address; import org.swisspush.gateleen.core.util.StatusCode; import org.swisspush.gateleen.monitoring.MonitoringHandler; @@ -33,16 +33,16 @@ public static boolean isQueued(HttpServerRequest request) { private HttpServerRequest request; private Vertx vertx; - private RedisAPI redisAPI; + private RedisProvider redisProvider; - public QueuingHandler(Vertx vertx, RedisAPI redisAPI, HttpServerRequest request, MonitoringHandler monitoringHandler) { - this(vertx, redisAPI, request, new QueueClient(vertx, monitoringHandler)); + public QueuingHandler(Vertx vertx, RedisProvider redisProvider, HttpServerRequest request, MonitoringHandler monitoringHandler) { + this(vertx, redisProvider, request, new QueueClient(vertx, monitoringHandler)); } - public QueuingHandler(Vertx vertx, RedisAPI redisAPI, HttpServerRequest request, RequestQueue requestQueue) { + public QueuingHandler(Vertx vertx, RedisProvider redisProvider, HttpServerRequest request, RequestQueue requestQueue) { this.request = request; this.vertx = vertx; - this.redisAPI = redisAPI; + this.redisProvider = redisProvider; this.requestQueue = requestQueue; } @@ -54,7 +54,7 @@ public void handle(final Buffer buffer) { headers.remove(QUEUE_HEADER); if (headers.names().contains(DUPLICATE_CHECK_HEADER)) { - DuplicateCheckHandler.checkDuplicateRequest(redisAPI, request.uri(), buffer, headers.get(DUPLICATE_CHECK_HEADER), requestIsDuplicate -> { + DuplicateCheckHandler.checkDuplicateRequest(redisProvider, request.uri(), buffer, headers.get(DUPLICATE_CHECK_HEADER), requestIsDuplicate -> { if (requestIsDuplicate) { // don't handle this request since it's a duplicate request.response().setStatusCode(StatusCode.ACCEPTED.getStatusCode()); diff --git a/gateleen-queue/src/test/java/org/swisspush/gateleen/queue/queuing/circuitbreaker/impl/RedisQueueCircuitBreakerStorageTest.java b/gateleen-queue/src/test/java/org/swisspush/gateleen/queue/queuing/circuitbreaker/impl/RedisQueueCircuitBreakerStorageTest.java index be974185..8af60224 100644 --- a/gateleen-queue/src/test/java/org/swisspush/gateleen/queue/queuing/circuitbreaker/impl/RedisQueueCircuitBreakerStorageTest.java +++ b/gateleen-queue/src/test/java/org/swisspush/gateleen/queue/queuing/circuitbreaker/impl/RedisQueueCircuitBreakerStorageTest.java @@ -22,10 +22,7 @@ import redis.clients.jedis.Jedis; import redis.clients.jedis.exceptions.JedisConnectionException; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.List; -import java.util.Set; +import java.util.*; import java.util.regex.Pattern; import static org.swisspush.gateleen.queue.queuing.circuitbreaker.impl.RedisQueueCircuitBreakerStorage.*; @@ -724,9 +721,12 @@ public void testUnlockSampleQueues(TestContext context){ storage.unlockSampleQueues().onComplete(event -> { context.assertTrue(event.succeeded()); - context.assertTrue(event.result().get(0).toString().contains("c1_1")); - context.assertTrue(event.result().get(1).toString().contains("c2_1")); - context.assertTrue(event.result().get(2).toString().contains("c3_1")); + context.assertEquals(3, event.result().size()); + Set results = new HashSet<>(); + results.add(event.result().get(0).toString()); + results.add(event.result().get(1).toString()); + results.add(event.result().get(2).toString()); + context.assertTrue(results.containsAll(Arrays.asList("c1_1", "c2_1", "c3_1"))); context.assertEquals(3L, jedis.scard(STORAGE_ALL_CIRCUITS)); context.assertEquals(3L, jedis.scard(STORAGE_HALFOPEN_CIRCUITS)); diff --git a/gateleen-runconfig/src/main/java/org/swisspush/gateleen/runconfig/RunConfig.java b/gateleen-runconfig/src/main/java/org/swisspush/gateleen/runconfig/RunConfig.java index a3770b79..cf311aa8 100755 --- a/gateleen-runconfig/src/main/java/org/swisspush/gateleen/runconfig/RunConfig.java +++ b/gateleen-runconfig/src/main/java/org/swisspush/gateleen/runconfig/RunConfig.java @@ -6,7 +6,6 @@ import io.vertx.core.http.HttpServerRequest; import io.vertx.core.json.JsonObject; import io.vertx.ext.web.RoutingContext; -import io.vertx.redis.client.RedisAPI; import org.apache.commons.lang.ArrayUtils; import org.apache.logging.log4j.core.config.Configurator; import org.joda.time.DateTime; @@ -20,6 +19,7 @@ import org.swisspush.gateleen.core.cors.CORSHandler; import org.swisspush.gateleen.core.event.EventBusHandler; import org.swisspush.gateleen.core.property.PropertyHandler; +import org.swisspush.gateleen.core.redis.RedisProvider; import org.swisspush.gateleen.core.resource.CopyResourceHandler; import org.swisspush.gateleen.core.util.Address; import org.swisspush.gateleen.core.util.ResponseStatusCodeLogUtil; @@ -51,7 +51,6 @@ import org.swisspush.redisques.util.RedisquesConfiguration; import org.swisspush.reststorage.util.ModuleConfiguration; -import java.io.FileNotFoundException; import java.util.HashMap; import java.util.Map; import java.util.Random; @@ -82,7 +81,7 @@ public class RunConfig { private final Class verticleClass; private Vertx vertx; - private RedisAPI redisAPI; + private RedisProvider redisProvider; private Router router; private CacheHandler cacheHandler; private CORSHandler corsHandler; @@ -111,7 +110,7 @@ public class RunConfig { private KafkaHandler kafkaHandler; private CustomHttpResponseHandler customHttpResponseHandler; - public RunConfig(Vertx vertx, RedisAPI redisAPI, Class verticleClass, Router router, MonitoringHandler monitoringHandler, + public RunConfig(Vertx vertx, RedisProvider redisProvider, Class verticleClass, Router router, MonitoringHandler monitoringHandler, QueueBrowser queueBrowser, CORSHandler corsHandler, SchedulerResourceManager schedulerResourceManager, ValidationResourceManager validationResourceManager, LoggingResourceManager loggingResourceManager, ConfigurationResourceManager configurationResourceManager, @@ -124,7 +123,7 @@ public RunConfig(Vertx vertx, RedisAPI redisAPI, Class verticleClass, Router rou CustomHttpResponseHandler customHttpResponseHandler, ContentTypeConstraintHandler contentTypeConstraintHandler, CacheHandler cacheHandler) { this.vertx = vertx; - this.redisAPI = redisAPI; + this.redisProvider = redisProvider; this.verticleClass = verticleClass; this.router = router; this.monitoringHandler = monitoringHandler; @@ -158,7 +157,7 @@ public RunConfig(Vertx vertx, RedisAPI redisAPI, Class verticleClass, Router rou private RunConfig(RunConfigBuilder builder) { this(builder.vertx, - builder.redisAPI, + builder.redisProvider, builder.verticleClass, builder.router, builder.monitoringHandler, @@ -215,7 +214,7 @@ public static RunConfigBuilder with() { */ public static class RunConfigBuilder { private Vertx vertx; - private RedisAPI redisAPI; + private RedisProvider redisProvider; private Class verticleClass; private Router router; private MonitoringHandler monitoringHandler; @@ -368,9 +367,9 @@ public RunConfigBuilder cacheHandler(CacheHandler cacheHandler) { return this; } - public RunConfig build(Vertx vertx, RedisAPI redisAPI, Class verticleClass, Router router, MonitoringHandler monitoringHandler, QueueBrowser queueBrowser) { + public RunConfig build(Vertx vertx, RedisProvider redisProvider, Class verticleClass, Router router, MonitoringHandler monitoringHandler, QueueBrowser queueBrowser) { this.vertx = vertx; - this.redisAPI = redisAPI; + this.redisProvider = redisProvider; this.verticleClass = verticleClass; this.router = router; this.monitoringHandler = monitoringHandler; @@ -577,11 +576,11 @@ private void handleRequest(final RoutingContext ctx) { return; } if (PackingHandler.isPacked(request)) { - request.bodyHandler(new PackingHandler(request, new QueuingHandler(vertx, redisAPI, request, monitoringHandler))); + request.bodyHandler(new PackingHandler(request, new QueuingHandler(vertx, redisProvider, request, monitoringHandler))); } else { if (QueuingHandler.isQueued(request)) { setISO8601Timestamps(request); - request.bodyHandler(new QueuingHandler(vertx, redisAPI, request, monitoringHandler)); + request.bodyHandler(new QueuingHandler(vertx, redisProvider, request, monitoringHandler)); } else { if (cacheHandler != null && cacheHandler.handle(request)) { return; diff --git a/gateleen-scheduler/src/test/java/org/swisspush/gateleen/scheduler/SchedulerResourceManagerTest.java b/gateleen-scheduler/src/test/java/org/swisspush/gateleen/scheduler/SchedulerResourceManagerTest.java new file mode 100644 index 00000000..152f8b9b --- /dev/null +++ b/gateleen-scheduler/src/test/java/org/swisspush/gateleen/scheduler/SchedulerResourceManagerTest.java @@ -0,0 +1,148 @@ +package org.swisspush.gateleen.scheduler; + +import io.vertx.core.Future; +import io.vertx.core.Handler; +import io.vertx.core.MultiMap; +import io.vertx.core.Vertx; +import io.vertx.core.buffer.Buffer; +import io.vertx.core.http.HttpMethod; +import io.vertx.core.http.HttpServerRequest; +import io.vertx.core.http.HttpServerResponse; +import io.vertx.ext.unit.TestContext; +import io.vertx.ext.unit.junit.VertxUnitRunner; +import io.vertx.redis.client.RedisAPI; +import org.junit.Before; +import org.junit.Test; +import org.junit.runner.RunWith; +import org.mockito.Mockito; +import org.swisspush.gateleen.core.http.DummyHttpServerRequest; +import org.swisspush.gateleen.core.http.DummyHttpServerResponse; +import org.swisspush.gateleen.core.redis.RedisProvider; +import org.swisspush.gateleen.core.storage.MockResourceStorage; +import org.swisspush.gateleen.core.storage.ResourceStorage; +import org.swisspush.gateleen.core.util.ResourcesUtils; +import org.swisspush.gateleen.core.util.StatusCode; +import org.swisspush.gateleen.monitoring.MonitoringHandler; + +import java.util.Collections; + +import static org.mockito.Matchers.any; +import static org.mockito.Mockito.*; + +/** + * Tests for the {@link SchedulerResourceManager} class + * + * @author https://github.com/mcweba [Marc-Andre Weber] + */ +@RunWith(VertxUnitRunner.class) +public class SchedulerResourceManagerTest { + + private Vertx vertx; + private MonitoringHandler monitoringHandler; + private RedisProvider redisProvider; + private ResourceStorage storage; + private SchedulerResourceManager schedulerResourceManager; + + private final String schedulersUri = "/playground/server/admin/v1/schedulers"; + + private final String VALID_SCHEDULER_RESOURCE = ResourcesUtils.loadResource("testresource_valid_scheduler_resource", true); + private final String INVALID_JSON = ResourcesUtils.loadResource("testresource_invalid_json", true); + + @Before + public void setUp() { + vertx = Vertx.vertx(); + + RedisAPI redisAPI = Mockito.mock(RedisAPI.class); + redisProvider = Mockito.mock(RedisProvider.class); + when(redisProvider.redis()).thenReturn(Future.succeededFuture(redisAPI)); + + monitoringHandler = Mockito.mock(MonitoringHandler.class); + + storage = Mockito.spy(new MockResourceStorage(Collections.emptyMap())); + } + + @Test + public void testReadSchedulersResource(TestContext context){ + schedulerResourceManager = new SchedulerResourceManager(vertx, redisProvider, storage, monitoringHandler, + schedulersUri); + + // on initialization, the schedulers must be read from storage + verify(storage, timeout(100).times(1)).get(eq(schedulersUri), any()); + + vertx.eventBus().publish("gateleen.schedulers-updated", true); + + // after eventbus message, the schedulers must be read from storage again + verify(storage, timeout(100).times(1)).get(eq(schedulersUri), any()); + } + + @Test + public void testHandleValidSchedulerResource(TestContext context){ + schedulerResourceManager = new SchedulerResourceManager(vertx, redisProvider, storage, monitoringHandler, + schedulersUri); + + HttpServerResponse response = spy(new SchedulerResourceResponse()); + SchedulerResourceRequest request = new SchedulerResourceRequest(HttpMethod.PUT, schedulersUri, VALID_SCHEDULER_RESOURCE, response); + + schedulerResourceManager.handleSchedulerResource(request); + + verify(response, timeout(100).times(1)).end(); + } + + @Test + public void testHandleInvalidSchedulerResource(TestContext context){ + schedulerResourceManager = new SchedulerResourceManager(vertx, redisProvider, storage, monitoringHandler, + schedulersUri); + + HttpServerResponse response = spy(new SchedulerResourceResponse()); + SchedulerResourceRequest request = new SchedulerResourceRequest(HttpMethod.PUT, schedulersUri, INVALID_JSON, response); + + schedulerResourceManager.handleSchedulerResource(request); + + verify(response, timeout(100).times(1)).setStatusCode(StatusCode.BAD_REQUEST.getStatusCode()); + } + + static class SchedulerResourceRequest extends DummyHttpServerRequest { + private final String uri; + private final HttpMethod method; + private final String body; + private final HttpServerResponse response; + + SchedulerResourceRequest(HttpMethod method, String uri, String body, HttpServerResponse response) { + this.method = method; + this.uri = uri; + this.body = body; + this.response = response; + } + + @Override public HttpMethod method() { + return method; + } + @Override public String uri() { + return uri; + } + @Override public HttpServerRequest bodyHandler(Handler bodyHandler) { + bodyHandler.handle(Buffer.buffer(body)); + return this; + } + + @Override + public MultiMap headers() { + return MultiMap.caseInsensitiveMultiMap(); + } + + @Override public HttpServerResponse response() { return response; } + + + } + + static class SchedulerResourceResponse extends DummyHttpServerResponse { + + private final MultiMap headers; + + SchedulerResourceResponse(){ + this.headers = MultiMap.caseInsensitiveMultiMap(); + } + + @Override public MultiMap headers() { return headers; } + } +} diff --git a/gateleen-test/src/test/java/org/swisspush/gateleen/AbstractTest.java b/gateleen-test/src/test/java/org/swisspush/gateleen/AbstractTest.java index d998581c..5aea9381 100755 --- a/gateleen-test/src/test/java/org/swisspush/gateleen/AbstractTest.java +++ b/gateleen-test/src/test/java/org/swisspush/gateleen/AbstractTest.java @@ -243,7 +243,7 @@ public static void setupBeforeClass(TestContext context) { .delegateHandler(delegateHandler) .mergeHandler(mergeHandler) .customHttpResponseHandler(customHttpResponseHandler) - .build(vertx, redisAPI, AbstractTest.class, router, monitoringHandler, queueBrowser); + .build(vertx, redisProvider, AbstractTest.class, router, monitoringHandler, queueBrowser); Handler routingContextHandlerrNew = runConfig.buildRoutingContextHandler(); selfClient.setRoutingContexttHandler(routingContextHandlerrNew); mainServer = vertx.createHttpServer(); From 6d242210f0fd87c1f3791acdabf1d2e64e292bbe Mon Sep 17 00:00:00 2001 From: Marc-Andre Weber Date: Tue, 13 Jun 2023 15:28:16 +0200 Subject: [PATCH 16/19] #541 Code cleanup --- .../gateleen/cache/CacheHandlerTest.java | 4 +- .../core/http/LocalHttpServerResponse.java | 30 --------------- .../ConfigurationResourceTestBase.java | 4 +- .../core/logging/RequestLoggerTest.java | 4 +- .../core/util/HttpServerRequestUtilTest.java | 4 +- .../gateleen/core/util/RoleExtractorTest.java | 2 +- .../gateleen/expansion/ExpansionHandler.java | 2 +- .../expansion/ExpansionHandlerTest.java | 2 +- .../swisspush/gateleen/hook/HookHandler.java | 4 +- .../org/swisspush/gateleen/hook/Route.java | 2 +- .../lua/RemoveExpiredQueuesRedisCommand.java | 14 +++---- .../lua/StartQueueTimerRedisCommand.java | 14 +++---- .../gateleen/hook/HookHandlerTest.java | 2 +- .../gateleen/logging/LoggingHandlerTest.java | 6 --- .../logging/LoggingSchemaValidationTest.java | 4 -- .../gateleen/monitoring/RedisMonitor.java | 36 +++++++++--------- .../monitoring/MonitoringHandlerTest.java | 2 +- .../swisspush/gateleen/qos/QoSHandler.java | 2 +- .../gateleen/qos/QoSHandlerTest.java | 4 +- .../duplicate/DuplicateCheckHandler.java | 2 +- .../lua/UpdateStatsRedisCommand.java | 14 +++---- .../queue/queuing/QueueProcessorTest.java | 2 +- ...eakerConfigurationResourceManagerTest.java | 2 +- .../swisspush/gateleen/routing/Forwarder.java | 4 +- .../gateleen/routing/Translator.java | 11 ++---- .../CustomHttpResponseHandlerTest.java | 2 +- .../authorization/RoleAuthorizer.java | 6 +-- .../authorization/AclFactoryTest.java | 1 - .../authorization/RoleMapperTest.java | 38 +++++++++---------- .../org/swisspush/gateleen/TestUtils.java | 2 +- .../core/property/PropertyHandlerTest.java | 18 ++++----- .../gateleen/core/storage/CleanupTest.java | 8 ++-- .../swisspush/gateleen/hook/ListenerTest.java | 1 - 33 files changed, 98 insertions(+), 155 deletions(-) diff --git a/gateleen-cache/src/test/java/org/swisspush/gateleen/cache/CacheHandlerTest.java b/gateleen-cache/src/test/java/org/swisspush/gateleen/cache/CacheHandlerTest.java index 9a766509..3c68ffb5 100644 --- a/gateleen-cache/src/test/java/org/swisspush/gateleen/cache/CacheHandlerTest.java +++ b/gateleen-cache/src/test/java/org/swisspush/gateleen/cache/CacheHandlerTest.java @@ -301,7 +301,7 @@ public void testCacheAdminFunctionEntriesEmpty(TestContext context) { context.assertEquals(CONTENT_TYPE_JSON, response.headers().get(CONTENT_TYPE_HEADER)); } - private class Request extends DummyHttpServerRequest { + private static class Request extends DummyHttpServerRequest { private MultiMap headers; private HttpMethod httpMethod; private String uri; @@ -332,7 +332,7 @@ public Request(HttpMethod httpMethod, String uri, MultiMap headers, HttpServerRe public HttpServerRequest resume() { return this; } } - private class Response extends DummyHttpServerResponse { + private static class Response extends DummyHttpServerResponse { private MultiMap headers; public Response() { diff --git a/gateleen-core/src/main/java/org/swisspush/gateleen/core/http/LocalHttpServerResponse.java b/gateleen-core/src/main/java/org/swisspush/gateleen/core/http/LocalHttpServerResponse.java index 4ba9e623..0637e987 100644 --- a/gateleen-core/src/main/java/org/swisspush/gateleen/core/http/LocalHttpServerResponse.java +++ b/gateleen-core/src/main/java/org/swisspush/gateleen/core/http/LocalHttpServerResponse.java @@ -294,11 +294,6 @@ public Future end() { return doEnd(); } - @Override - public Future sendFile(String filename, long offset, long length) { - throw new UnsupportedOperationException(); - } - @Override public void close() { // makes not really sense as we have no underlying TCP connection which can be closed @@ -324,31 +319,6 @@ public boolean headWritten() { return written; } - @Override - public Future push(HttpMethod method, String host, String path, MultiMap headers) { - throw new UnsupportedOperationException(); - } - - @Override - public HttpServerResponse addCookie(Cookie cookie) { - throw new UnsupportedOperationException(); - } - - @Override - public @Nullable Cookie removeCookie(String name, boolean invalidate) { - throw new UnsupportedOperationException(); - } - - @Override - public Set removeCookies(String name, boolean invalidate) { - throw new UnsupportedOperationException(); - } - - @Override - public @Nullable Cookie removeCookie(String name, String domain, String path, boolean invalidate) { - throw new UnsupportedOperationException(); - } - @Override public HttpServerResponse setWriteQueueMaxSize(int maxSize) { return this; diff --git a/gateleen-core/src/test/java/org/swisspush/gateleen/core/configuration/ConfigurationResourceTestBase.java b/gateleen-core/src/test/java/org/swisspush/gateleen/core/configuration/ConfigurationResourceTestBase.java index 1ac8a6a4..e7b89d59 100644 --- a/gateleen-core/src/test/java/org/swisspush/gateleen/core/configuration/ConfigurationResourceTestBase.java +++ b/gateleen-core/src/test/java/org/swisspush/gateleen/core/configuration/ConfigurationResourceTestBase.java @@ -86,7 +86,7 @@ public void setUp(){ log = LoggerFactory.getLogger(ConfigurationResourceValidatorTest.class); } - protected class PersonResourceRequest extends DummyHttpServerRequest { + protected static class PersonResourceRequest extends DummyHttpServerRequest { private HttpMethod method; private String uri; @@ -127,7 +127,7 @@ public HttpServerResponse response() { } } - protected class TestConfigurationResourceObserver implements ConfigurationResourceObserver { + protected static class TestConfigurationResourceObserver implements ConfigurationResourceObserver { @Override public void resourceChanged(String resourceUri, Buffer resource) { } diff --git a/gateleen-core/src/test/java/org/swisspush/gateleen/core/logging/RequestLoggerTest.java b/gateleen-core/src/test/java/org/swisspush/gateleen/core/logging/RequestLoggerTest.java index 5152b2cf..91621d0a 100644 --- a/gateleen-core/src/test/java/org/swisspush/gateleen/core/logging/RequestLoggerTest.java +++ b/gateleen-core/src/test/java/org/swisspush/gateleen/core/logging/RequestLoggerTest.java @@ -87,7 +87,7 @@ public void testLogRequestResponseHeaders(TestContext context){ .request(eq(Address.requestLoggingConsumerAddress()), eq(expected), any(Handler.class)); } - class MockedRequest extends DummyHttpServerRequest { + static class MockedRequest extends DummyHttpServerRequest { private String uri; private HttpMethod method; @@ -111,7 +111,7 @@ public MockedRequest(String uri, HttpMethod method, MultiMap headers, HttpServer @Override public HttpServerResponse response() { return response; } } - class MockedResponse extends DummyHttpServerResponse { + static class MockedResponse extends DummyHttpServerResponse { private MultiMap headers; diff --git a/gateleen-core/src/test/java/org/swisspush/gateleen/core/util/HttpServerRequestUtilTest.java b/gateleen-core/src/test/java/org/swisspush/gateleen/core/util/HttpServerRequestUtilTest.java index c61ad61f..81c7c390 100644 --- a/gateleen-core/src/test/java/org/swisspush/gateleen/core/util/HttpServerRequestUtilTest.java +++ b/gateleen-core/src/test/java/org/swisspush/gateleen/core/util/HttpServerRequestUtilTest.java @@ -73,7 +73,7 @@ public void testIsRequestHopsLimitExceeded(TestContext context){ context.assertFalse(HttpServerRequestUtil.isRequestHopsLimitExceeded(request, 10)); } - class IncreaseHopsRequest extends DummyHttpServerRequest { + static class IncreaseHopsRequest extends DummyHttpServerRequest { private MultiMap headers; @@ -84,7 +84,7 @@ public IncreaseHopsRequest(MultiMap headers) { @Override public MultiMap headers() { return headers; } } - class RemoteAddressRequest extends DummyHttpServerRequest { + static class RemoteAddressRequest extends DummyHttpServerRequest { private String host; diff --git a/gateleen-core/src/test/java/org/swisspush/gateleen/core/util/RoleExtractorTest.java b/gateleen-core/src/test/java/org/swisspush/gateleen/core/util/RoleExtractorTest.java index c8731c9a..b9b6114e 100644 --- a/gateleen-core/src/test/java/org/swisspush/gateleen/core/util/RoleExtractorTest.java +++ b/gateleen-core/src/test/java/org/swisspush/gateleen/core/util/RoleExtractorTest.java @@ -110,7 +110,7 @@ private MultiMap buildRoleHeaders(String headerValues){ return headers; } - class TestHttpServerRequest extends DummyHttpServerRequest { + static class TestHttpServerRequest extends DummyHttpServerRequest { private MultiMap headers; public TestHttpServerRequest(MultiMap headers) { diff --git a/gateleen-expansion/src/main/java/org/swisspush/gateleen/expansion/ExpansionHandler.java b/gateleen-expansion/src/main/java/org/swisspush/gateleen/expansion/ExpansionHandler.java index 6c120a78..a75f5c39 100755 --- a/gateleen-expansion/src/main/java/org/swisspush/gateleen/expansion/ExpansionHandler.java +++ b/gateleen-expansion/src/main/java/org/swisspush/gateleen/expansion/ExpansionHandler.java @@ -432,7 +432,7 @@ private Integer extractExpandParamValue(final HttpServerRequest request, final L log.debug("got expand parameter value " + expandValue); try { - Integer value = Integer.valueOf(expandValue); + int value = Integer.parseInt(expandValue); if (value < 0) { log.warn("expand parameter value '{}' is not a positive number", expandValue); return null; diff --git a/gateleen-expansion/src/test/java/org/swisspush/gateleen/expansion/ExpansionHandlerTest.java b/gateleen-expansion/src/test/java/org/swisspush/gateleen/expansion/ExpansionHandlerTest.java index 7ab42057..b3c2a4e2 100644 --- a/gateleen-expansion/src/test/java/org/swisspush/gateleen/expansion/ExpansionHandlerTest.java +++ b/gateleen-expansion/src/test/java/org/swisspush/gateleen/expansion/ExpansionHandlerTest.java @@ -274,7 +274,7 @@ public void testBadRequestResponseForExceedingMaxExpansionLevelHard(TestContext verifyZeroInteractions(httpClient); } - private class Request extends DummyHttpServerRequest { + private static class Request extends DummyHttpServerRequest { private MultiMap params; private HttpMethod httpMethod; private String uri; diff --git a/gateleen-hook/src/main/java/org/swisspush/gateleen/hook/HookHandler.java b/gateleen-hook/src/main/java/org/swisspush/gateleen/hook/HookHandler.java index b5f40e00..d38c1c9a 100755 --- a/gateleen-hook/src/main/java/org/swisspush/gateleen/hook/HookHandler.java +++ b/gateleen-hook/src/main/java/org/swisspush/gateleen/hook/HookHandler.java @@ -293,7 +293,7 @@ private void registerCleanupHandler(Handler readyHandler) { for (Listener listener : listenerRepository.getListeners()) { final Optional expirationTime = listener.getHook().getExpirationTime(); - if (!expirationTime.isPresent()) { + if (expirationTime.isEmpty()) { if (log.isTraceEnabled()) { log.trace("Listener {} will never expire.", listener.getListenerId()); } @@ -309,7 +309,7 @@ private void registerCleanupHandler(Handler readyHandler) { for (String key : routes.keySet()) { Route route = routes.get(key); final Optional expirationTime = route.getHook().getExpirationTime(); - if (!expirationTime.isPresent()) { + if (expirationTime.isEmpty()) { if (log.isTraceEnabled()) { log.trace("Route {} will never expire.", key); } diff --git a/gateleen-hook/src/main/java/org/swisspush/gateleen/hook/Route.java b/gateleen-hook/src/main/java/org/swisspush/gateleen/hook/Route.java index a7b9cb47..fdc320eb 100755 --- a/gateleen-hook/src/main/java/org/swisspush/gateleen/hook/Route.java +++ b/gateleen-hook/src/main/java/org/swisspush/gateleen/hook/Route.java @@ -152,7 +152,7 @@ private void createRule() { } if (!httpHook.getMethods().isEmpty()) { - rule.setMethods(httpHook.getMethods().toArray(new String[httpHook.getMethods().size()])); + rule.setMethods(httpHook.getMethods().toArray(new String[0])); } if(!httpHook.getTranslateStatus().isEmpty()){ diff --git a/gateleen-hook/src/main/java/org/swisspush/gateleen/hook/reducedpropagation/lua/RemoveExpiredQueuesRedisCommand.java b/gateleen-hook/src/main/java/org/swisspush/gateleen/hook/reducedpropagation/lua/RemoveExpiredQueuesRedisCommand.java index 2b68f591..6ee17cdb 100644 --- a/gateleen-hook/src/main/java/org/swisspush/gateleen/hook/reducedpropagation/lua/RemoveExpiredQueuesRedisCommand.java +++ b/gateleen-hook/src/main/java/org/swisspush/gateleen/hook/reducedpropagation/lua/RemoveExpiredQueuesRedisCommand.java @@ -16,12 +16,12 @@ */ public class RemoveExpiredQueuesRedisCommand implements RedisCommand { - private LuaScriptState luaScriptState; - private List keys; - private List arguments; - private Promise promise; - private RedisProvider redisProvider; - private Logger log; + private final LuaScriptState luaScriptState; + private final List keys; + private final List arguments; + private final Promise promise; + private final RedisProvider redisProvider; + private final Logger log; public RemoveExpiredQueuesRedisCommand(LuaScriptState luaScriptState, List keys, List arguments, RedisProvider redisProvider, Logger log, final Promise promise) { @@ -48,7 +48,7 @@ public void exec(int executionCounter) { String message = event.cause().getMessage(); if (message != null && message.startsWith("NOSCRIPT")) { log.warn("RemoveExpiredQueuesRedisCommand script couldn't be found, reload it"); - log.warn("amount the script got loaded: " + String.valueOf(executionCounter)); + log.warn("amount the script got loaded: " + executionCounter); if (executionCounter > 10) { promise.fail("amount the script got loaded is higher than 10, we abort"); } else { diff --git a/gateleen-hook/src/main/java/org/swisspush/gateleen/hook/reducedpropagation/lua/StartQueueTimerRedisCommand.java b/gateleen-hook/src/main/java/org/swisspush/gateleen/hook/reducedpropagation/lua/StartQueueTimerRedisCommand.java index 13b0936d..629d7f8f 100644 --- a/gateleen-hook/src/main/java/org/swisspush/gateleen/hook/reducedpropagation/lua/StartQueueTimerRedisCommand.java +++ b/gateleen-hook/src/main/java/org/swisspush/gateleen/hook/reducedpropagation/lua/StartQueueTimerRedisCommand.java @@ -14,12 +14,12 @@ */ public class StartQueueTimerRedisCommand implements RedisCommand { - private LuaScriptState luaScriptState; - private List keys; - private List arguments; - private Promise promise; - private RedisProvider redisProvider; - private Logger log; + private final LuaScriptState luaScriptState; + private final List keys; + private final List arguments; + private final Promise promise; + private final RedisProvider redisProvider; + private final Logger log; public StartQueueTimerRedisCommand(LuaScriptState luaScriptState, List keys, List arguments, RedisProvider redisProvider, Logger log, final Promise promise) { @@ -43,7 +43,7 @@ public void exec(int executionCounter) { String message = event.cause().getMessage(); if (message != null && message.startsWith("NOSCRIPT")) { log.warn("StartQueueTimerRedisCommand script couldn't be found, reload it"); - log.warn("amount the script got loaded: " + String.valueOf(executionCounter)); + log.warn("amount the script got loaded: " + executionCounter); if (executionCounter > 10) { promise.fail("amount the script got loaded is higher than 10, we abort"); } else { diff --git a/gateleen-hook/src/test/java/org/swisspush/gateleen/hook/HookHandlerTest.java b/gateleen-hook/src/test/java/org/swisspush/gateleen/hook/HookHandlerTest.java index 6cdb534c..f49eaf75 100644 --- a/gateleen-hook/src/test/java/org/swisspush/gateleen/hook/HookHandlerTest.java +++ b/gateleen-hook/src/test/java/org/swisspush/gateleen/hook/HookHandlerTest.java @@ -853,7 +853,7 @@ private Buffer toBuffer(JsonObject jsonObject) { return buffer; } - class PUTRequest extends DummyHttpServerRequest { + static class PUTRequest extends DummyHttpServerRequest { MultiMap headers = MultiMap.caseInsensitiveMultiMap(); private String uri; diff --git a/gateleen-logging/src/test/java/org/swisspush/gateleen/logging/LoggingHandlerTest.java b/gateleen-logging/src/test/java/org/swisspush/gateleen/logging/LoggingHandlerTest.java index 403f6015..9db672dc 100644 --- a/gateleen-logging/src/test/java/org/swisspush/gateleen/logging/LoggingHandlerTest.java +++ b/gateleen-logging/src/test/java/org/swisspush/gateleen/logging/LoggingHandlerTest.java @@ -28,12 +28,6 @@ @RunWith(VertxUnitRunner.class) public class LoggingHandlerTest { - private static final String TYPE = "type"; - private static final String FILE = "file"; - private static final String METADATA = "metadata"; - private static final String TRANSMISSION = "transmission"; - private static final String ADDRESS = "address"; - private static final String EVENT_BUS = "eventBus"; private Vertx vertx; private ResourceStorage storage; diff --git a/gateleen-logging/src/test/java/org/swisspush/gateleen/logging/LoggingSchemaValidationTest.java b/gateleen-logging/src/test/java/org/swisspush/gateleen/logging/LoggingSchemaValidationTest.java index 22ad690c..88591511 100644 --- a/gateleen-logging/src/test/java/org/swisspush/gateleen/logging/LoggingSchemaValidationTest.java +++ b/gateleen-logging/src/test/java/org/swisspush/gateleen/logging/LoggingSchemaValidationTest.java @@ -46,10 +46,6 @@ private String extractErrorMessage(ValidationResult validationResult){ return validationResult.getValidationDetails().getJsonObject(0).getString("message"); } - private String extractErrorValue(ValidationResult validationResult){ - return validationResult.getValidationDetails().getJsonObject(0).getString("value"); - } - private ValidationResult validate(String loggingResource){ return Validator.validateStatic(Buffer.buffer(loggingResource), LOGGING_SCHEMA, logger); } diff --git a/gateleen-monitoring/src/main/java/org/swisspush/gateleen/monitoring/RedisMonitor.java b/gateleen-monitoring/src/main/java/org/swisspush/gateleen/monitoring/RedisMonitor.java index ba41511d..b4abb4fe 100644 --- a/gateleen-monitoring/src/main/java/org/swisspush/gateleen/monitoring/RedisMonitor.java +++ b/gateleen-monitoring/src/main/java/org/swisspush/gateleen/monitoring/RedisMonitor.java @@ -51,28 +51,26 @@ public RedisMonitor(Vertx vertx, RedisProvider redisProvider, String name, int p } public void start() { - timer = vertx.setPeriodic(period, timer -> { - redisProvider.redis().onSuccess(redisAPI -> { - redisAPI.info(new ArrayList<>()).onComplete(event -> { - if (event.succeeded()) { - collectMetrics(event.result().toBuffer()); + timer = vertx.setPeriodic(period, timer -> redisProvider.redis().onSuccess(redisAPI -> { + redisAPI.info(new ArrayList<>()).onComplete(event -> { + if (event.succeeded()) { + collectMetrics(event.result().toBuffer()); + } else { + log.warn("Cannot collect INFO from redis"); + } + }); + + if (metricName != null && elementCountKey != null) { + redisAPI.zcard(elementCountKey, reply -> { + if (reply.succeeded()) { + long value = reply.result().toLong(); + publisher.publishMetric(metricName, value); } else { - log.warn("Cannot collect INFO from redis"); + log.warn("Cannot collect zcard from redis for key {}", elementCountKey); } }); - - if (metricName != null && elementCountKey != null) { - redisAPI.zcard(elementCountKey, reply -> { - if (reply.succeeded()) { - long value = reply.result().toLong(); - publisher.publishMetric(metricName, value); - } else { - log.warn("Cannot collect zcard from redis for key {}", elementCountKey); - } - }); - } - }).onFailure(throwable -> log.warn("Cannot collect INFO from redis", throwable)); - }); + } + }).onFailure(throwable -> log.warn("Cannot collect INFO from redis", throwable))); } public void stop() { diff --git a/gateleen-monitoring/src/test/java/org/swisspush/gateleen/monitoring/MonitoringHandlerTest.java b/gateleen-monitoring/src/test/java/org/swisspush/gateleen/monitoring/MonitoringHandlerTest.java index 892efc61..3790f0e8 100644 --- a/gateleen-monitoring/src/test/java/org/swisspush/gateleen/monitoring/MonitoringHandlerTest.java +++ b/gateleen-monitoring/src/test/java/org/swisspush/gateleen/monitoring/MonitoringHandlerTest.java @@ -143,7 +143,7 @@ private Callable storageContainsData(String valueToLookFor) { }; } - class PUTRequest extends DummyHttpServerRequest { + static class PUTRequest extends DummyHttpServerRequest { MultiMap headers = MultiMap.caseInsensitiveMultiMap(); @Override public HttpMethod method() { diff --git a/gateleen-qos/src/main/java/org/swisspush/gateleen/qos/QoSHandler.java b/gateleen-qos/src/main/java/org/swisspush/gateleen/qos/QoSHandler.java index 42ce5a37..aab9f389 100644 --- a/gateleen-qos/src/main/java/org/swisspush/gateleen/qos/QoSHandler.java +++ b/gateleen-qos/src/main/java/org/swisspush/gateleen/qos/QoSHandler.java @@ -616,7 +616,7 @@ private void updateQoSSettings(final Buffer buffer) { if (!qosSentinels.isEmpty() && !qosRules.isEmpty()) { log.debug("Start periodic timer every {}s", globalQoSConfig.getPeriod()); // evaluation timer - timerId = vertx.setPeriodic(globalQoSConfig.getPeriod() * 1000, event -> { + timerId = vertx.setPeriodic(globalQoSConfig.getPeriod() * 1000L, event -> { log.debug("Timer fired: executing evaluateQoSActions"); evaluateQoSActions(); }); diff --git a/gateleen-qos/src/test/java/org/swisspush/gateleen/qos/QoSHandlerTest.java b/gateleen-qos/src/test/java/org/swisspush/gateleen/qos/QoSHandlerTest.java index c458bc88..0b4d4bb4 100644 --- a/gateleen-qos/src/test/java/org/swisspush/gateleen/qos/QoSHandlerTest.java +++ b/gateleen-qos/src/test/java/org/swisspush/gateleen/qos/QoSHandlerTest.java @@ -186,7 +186,7 @@ public void testQoSSettingsUpdateWithRulesButNoSentinels(TestContext context){ verify(response, times(1)).setStatusMessage(eq("Bad Request ValidationException: QoS settings contain rules without sentinels")); } - private class CustomHttpServerRequest extends DummyHttpServerRequest { + private static class CustomHttpServerRequest extends DummyHttpServerRequest { private String uri; private HttpMethod method; @@ -219,7 +219,7 @@ public HttpServerRequest bodyHandler(Handler bodyHandler) { @Override public HttpServerResponse response() { return response; } } - class CustomHttpServerResponse extends DummyHttpServerResponse { + static class CustomHttpServerResponse extends DummyHttpServerResponse { private MultiMap headers; diff --git a/gateleen-queue/src/main/java/org/swisspush/gateleen/queue/duplicate/DuplicateCheckHandler.java b/gateleen-queue/src/main/java/org/swisspush/gateleen/queue/duplicate/DuplicateCheckHandler.java index 02ee9e2e..6d276a80 100644 --- a/gateleen-queue/src/main/java/org/swisspush/gateleen/queue/duplicate/DuplicateCheckHandler.java +++ b/gateleen-queue/src/main/java/org/swisspush/gateleen/queue/duplicate/DuplicateCheckHandler.java @@ -46,7 +46,7 @@ public static void checkDuplicateRequest(RedisProvider redisProvider, String uri } private static Integer parseTimeToLive(String ttl) { - Integer timeToLive; + int timeToLive; try { timeToLive = Integer.parseInt(ttl); } catch (NumberFormatException e) { diff --git a/gateleen-queue/src/main/java/org/swisspush/gateleen/queue/queuing/circuitbreaker/lua/UpdateStatsRedisCommand.java b/gateleen-queue/src/main/java/org/swisspush/gateleen/queue/queuing/circuitbreaker/lua/UpdateStatsRedisCommand.java index f2581294..8481e33b 100644 --- a/gateleen-queue/src/main/java/org/swisspush/gateleen/queue/queuing/circuitbreaker/lua/UpdateStatsRedisCommand.java +++ b/gateleen-queue/src/main/java/org/swisspush/gateleen/queue/queuing/circuitbreaker/lua/UpdateStatsRedisCommand.java @@ -15,12 +15,12 @@ */ public class UpdateStatsRedisCommand implements RedisCommand { - private LuaScriptState luaScriptState; - private List keys; - private List arguments; - private Promise promise; - private RedisProvider redisProvider; - private Logger log; + private final LuaScriptState luaScriptState; + private final List keys; + private final List arguments; + private final Promise promise; + private final RedisProvider redisProvider; + private final Logger log; public UpdateStatsRedisCommand(LuaScriptState luaScriptState, List keys, List arguments, RedisProvider redisProvider, Logger log, final Promise promise) { @@ -46,7 +46,7 @@ public void exec(int executionCounter) { String message = event.cause().getMessage(); if (message != null && message.startsWith("NOSCRIPT")) { log.warn("UpdateStatsRedisCommand script couldn't be found, reload it"); - log.warn("amount the script got loaded: " + String.valueOf(executionCounter)); + log.warn("amount the script got loaded: " + executionCounter); if (executionCounter > 10) { promise.fail("amount the script got loaded is higher than 10, we abort"); } else { diff --git a/gateleen-queue/src/test/java/org/swisspush/gateleen/queue/queuing/QueueProcessorTest.java b/gateleen-queue/src/test/java/org/swisspush/gateleen/queue/queuing/QueueProcessorTest.java index 1893a41f..14889478 100644 --- a/gateleen-queue/src/test/java/org/swisspush/gateleen/queue/queuing/QueueProcessorTest.java +++ b/gateleen-queue/src/test/java/org/swisspush/gateleen/queue/queuing/QueueProcessorTest.java @@ -272,7 +272,7 @@ private JsonObject buildQueueEventBusMessage(String queueName, String payload) { return message; } - class ConfigurableQueueCircuitBreaker implements QueueCircuitBreaker { + static class ConfigurableQueueCircuitBreaker implements QueueCircuitBreaker { private QueueCircuitState state; private boolean circuitCheckEnabled; diff --git a/gateleen-queue/src/test/java/org/swisspush/gateleen/queue/queuing/circuitbreaker/configuration/QueueCircuitBreakerConfigurationResourceManagerTest.java b/gateleen-queue/src/test/java/org/swisspush/gateleen/queue/queuing/circuitbreaker/configuration/QueueCircuitBreakerConfigurationResourceManagerTest.java index d1eeca63..d73aa1a3 100644 --- a/gateleen-queue/src/test/java/org/swisspush/gateleen/queue/queuing/circuitbreaker/configuration/QueueCircuitBreakerConfigurationResourceManagerTest.java +++ b/gateleen-queue/src/test/java/org/swisspush/gateleen/queue/queuing/circuitbreaker/configuration/QueueCircuitBreakerConfigurationResourceManagerTest.java @@ -234,7 +234,7 @@ class ConfigResourcePUTRequest extends DummyHttpServerRequest { @Override public MultiMap headers() { return MultiMap.caseInsensitiveMultiMap(); } } - class MyRefreshable implements Refreshable { + static class MyRefreshable implements Refreshable { private boolean refreshed = false; private Async async; diff --git a/gateleen-routing/src/main/java/org/swisspush/gateleen/routing/Forwarder.java b/gateleen-routing/src/main/java/org/swisspush/gateleen/routing/Forwarder.java index a82f0c60..9d8469d1 100755 --- a/gateleen-routing/src/main/java/org/swisspush/gateleen/routing/Forwarder.java +++ b/gateleen-routing/src/main/java/org/swisspush/gateleen/routing/Forwarder.java @@ -275,9 +275,7 @@ public void handle(AsyncResult event) { } setProfileHeaders(log, profileHeaderMap, cReq); - authHeader.ifPresent(authHeaderValue -> { - cReq.headers().set(authHeaderValue.key(), authHeaderValue.value()); - }); + authHeader.ifPresent(authHeaderValue -> cReq.headers().set(authHeaderValue.key(), authHeaderValue.value())); final String errorMessage = applyHeaderFunctions(log, cReq.headers()); if (errorMessage != null) { diff --git a/gateleen-routing/src/main/java/org/swisspush/gateleen/routing/Translator.java b/gateleen-routing/src/main/java/org/swisspush/gateleen/routing/Translator.java index 885c76c0..1806e843 100644 --- a/gateleen-routing/src/main/java/org/swisspush/gateleen/routing/Translator.java +++ b/gateleen-routing/src/main/java/org/swisspush/gateleen/routing/Translator.java @@ -4,6 +4,7 @@ import org.swisspush.gateleen.core.util.StatusCodeTranslator; import java.util.Map; +import java.util.Objects; import java.util.regex.Pattern; /** @@ -50,13 +51,7 @@ public static int translateStatusCode(int statusCode, Rule rule, Logger log) { } } - // if something is found, return found value - if (translatedStatus != null) { - return translatedStatus; - } - // else return original value - else { - return statusCode; - } + // if something is found, return found value else return original value + return Objects.requireNonNullElse(translatedStatus, statusCode); } } diff --git a/gateleen-routing/src/test/java/org/swisspush/gateleen/routing/CustomHttpResponseHandlerTest.java b/gateleen-routing/src/test/java/org/swisspush/gateleen/routing/CustomHttpResponseHandlerTest.java index fe8be595..3156b790 100644 --- a/gateleen-routing/src/test/java/org/swisspush/gateleen/routing/CustomHttpResponseHandlerTest.java +++ b/gateleen-routing/src/test/java/org/swisspush/gateleen/routing/CustomHttpResponseHandlerTest.java @@ -99,7 +99,7 @@ public void testRequestHandledWithMissingStatus(TestContext context){ verify(response, times(1)).end(eq("400 Bad Request: missing, wrong or non-numeric status-code in request URL")); } - private class HttpServerRequest extends DummyHttpServerRequest { + private static class HttpServerRequest extends DummyHttpServerRequest { private String uri; private HttpServerResponse response; diff --git a/gateleen-security/src/main/java/org/swisspush/gateleen/security/authorization/RoleAuthorizer.java b/gateleen-security/src/main/java/org/swisspush/gateleen/security/authorization/RoleAuthorizer.java index 3aa3628e..4ff607df 100644 --- a/gateleen-security/src/main/java/org/swisspush/gateleen/security/authorization/RoleAuthorizer.java +++ b/gateleen-security/src/main/java/org/swisspush/gateleen/security/authorization/RoleAuthorizer.java @@ -65,11 +65,7 @@ public class RoleAuthorizer implements ConfigurationResource { this.roleExtractor = new RoleExtractor(rolePattern); this.aclFactory = new AclFactory(); // keep empty string if there is no prefix given. This way we could just use it later on without having to care about further. - if (rolePrefix != null) { - this.rolePrefix = rolePrefix; - } else { - this.rolePrefix = ""; - } + this.rolePrefix = Objects.requireNonNullElse(rolePrefix, ""); initialGrantedRoles = new HashMap<>(); initialGrantedRoles.put(aclUriPattern, new HashMap<>()); diff --git a/gateleen-security/src/test/java/org/swisspush/gateleen/security/authorization/AclFactoryTest.java b/gateleen-security/src/test/java/org/swisspush/gateleen/security/authorization/AclFactoryTest.java index 49775a44..f227e9b3 100755 --- a/gateleen-security/src/test/java/org/swisspush/gateleen/security/authorization/AclFactoryTest.java +++ b/gateleen-security/src/test/java/org/swisspush/gateleen/security/authorization/AclFactoryTest.java @@ -27,7 +27,6 @@ public class AclFactoryTest { private AclFactory aclFactory; - private RoleMapperFactory roleMapperFactory; @Rule public ExpectedException thrown = ExpectedException.none(); diff --git a/gateleen-security/src/test/java/org/swisspush/gateleen/security/authorization/RoleMapperTest.java b/gateleen-security/src/test/java/org/swisspush/gateleen/security/authorization/RoleMapperTest.java index 619f7fa7..c06dd1b2 100644 --- a/gateleen-security/src/test/java/org/swisspush/gateleen/security/authorization/RoleMapperTest.java +++ b/gateleen-security/src/test/java/org/swisspush/gateleen/security/authorization/RoleMapperTest.java @@ -63,8 +63,8 @@ public void checkMappingWithoutKeep(TestContext context) { Map mappedRoles = roleMapper.mapRoles(roles); context.assertNotNull(mappedRoles); context.assertTrue(mappedRoles.size() == 2); - context.assertTrue(mappedRoles.get("domain1").forward == true); - context.assertTrue(mappedRoles.get("domain1-user").forward == false); + context.assertTrue(mappedRoles.get("domain1").forward); + context.assertFalse(mappedRoles.get("domain1-user").forward); } @Test @@ -86,8 +86,8 @@ public void checkStageMappingWithoutFurtherHit(TestContext context) { Map mappedRoles = roleMapper.mapRoles(roles); context.assertNotNull(mappedRoles); context.assertTrue(mappedRoles.size() == 2); - context.assertTrue(mappedRoles.get("domain-user-stage-prod").forward == false); - context.assertTrue(mappedRoles.get("domain-user").forward == true); + context.assertFalse(mappedRoles.get("domain-user-stage-prod").forward); + context.assertTrue(mappedRoles.get("domain-user").forward); } @Test @@ -97,9 +97,9 @@ public void checkStageMappingWithFurtherHit(TestContext context) { Map mappedRoles = roleMapper.mapRoles(roles); context.assertNotNull(mappedRoles); context.assertTrue(mappedRoles.size() == 3); - context.assertTrue(mappedRoles.get("domain-admin-stage-prod").forward == false); - context.assertTrue(mappedRoles.get("domain-admin").forward == true); - context.assertTrue(mappedRoles.get("domain").forward == false); + context.assertFalse(mappedRoles.get("domain-admin-stage-prod").forward); + context.assertTrue(mappedRoles.get("domain-admin").forward); + context.assertFalse(mappedRoles.get("domain").forward); } @Test @@ -109,9 +109,9 @@ public void checkStageMappingWithoutAnyKeepOriginal(TestContext context) { Map mappedRoles = roleMapper.mapRoles(roles); context.assertNotNull(mappedRoles); context.assertTrue(mappedRoles.size() == 3); - context.assertTrue(mappedRoles.get("domain1-user-stage-prod").forward == false); - context.assertTrue(mappedRoles.get("domain1-user").forward == false); - context.assertTrue(mappedRoles.get("domain1").forward == true); + context.assertFalse(mappedRoles.get("domain1-user-stage-prod").forward); + context.assertFalse(mappedRoles.get("domain1-user").forward); + context.assertTrue(mappedRoles.get("domain1").forward); } @Test @@ -121,9 +121,9 @@ public void checkStageMappingWithKeepLastOriginal(TestContext context) { Map mappedRoles = roleMapper.mapRoles(roles); context.assertNotNull(mappedRoles); context.assertTrue(mappedRoles.size() == 3); - context.assertTrue(mappedRoles.get("domain2-user-stage-prod").forward == false); - context.assertTrue(mappedRoles.get("domain2-user").forward == true); - context.assertTrue(mappedRoles.get("domain2").forward == true); + context.assertFalse(mappedRoles.get("domain2-user-stage-prod").forward); + context.assertTrue(mappedRoles.get("domain2-user").forward); + context.assertTrue(mappedRoles.get("domain2").forward); } @@ -134,9 +134,9 @@ public void checkStageMappingWithKeepFirstOriginalAndEnvironementProperty(TestCo Map mappedRoles = roleMapper.mapRoles(roles); context.assertNotNull(mappedRoles); context.assertTrue(mappedRoles.size() == 3); - context.assertTrue(mappedRoles.get("domain1-user-stage-int").forward == true); - context.assertTrue(mappedRoles.get("domain1-user-int").forward == false); - context.assertTrue(mappedRoles.get("domain1").forward == true); + context.assertTrue(mappedRoles.get("domain1-user-stage-int").forward); + context.assertFalse(mappedRoles.get("domain1-user-int").forward); + context.assertTrue(mappedRoles.get("domain1").forward); } @Test @@ -166,9 +166,9 @@ public void checkLocalMappingPerformance(TestContext context) { if (i == 0) { // only necessary to be executed once context.assertNotNull(mappedRoles); context.assertTrue(mappedRoles.size() == 3); - context.assertTrue(mappedRoles.get("domain1-user-stage-prod").forward == false); - context.assertTrue(mappedRoles.get("domain1-user").forward == false); - context.assertTrue(mappedRoles.get("domain1").forward == true); + context.assertFalse(mappedRoles.get("domain1-user-stage-prod").forward); + context.assertFalse(mappedRoles.get("domain1-user").forward); + context.assertTrue(mappedRoles.get("domain1").forward); } } long endTime = System.currentTimeMillis(); diff --git a/gateleen-test/src/test/java/org/swisspush/gateleen/TestUtils.java b/gateleen-test/src/test/java/org/swisspush/gateleen/TestUtils.java index 578be2bb..efc604d8 100644 --- a/gateleen-test/src/test/java/org/swisspush/gateleen/TestUtils.java +++ b/gateleen-test/src/test/java/org/swisspush/gateleen/TestUtils.java @@ -109,7 +109,7 @@ public static String getHookListenersUrlSuffix() { */ public static void waitSomeTime(int seconds) { try { - Thread.sleep(seconds * 1000); + Thread.sleep(seconds * 1000L); } catch (InterruptedException e) { } } diff --git a/gateleen-test/src/test/java/org/swisspush/gateleen/core/property/PropertyHandlerTest.java b/gateleen-test/src/test/java/org/swisspush/gateleen/core/property/PropertyHandlerTest.java index d4e1fd0e..4b7436df 100755 --- a/gateleen-test/src/test/java/org/swisspush/gateleen/core/property/PropertyHandlerTest.java +++ b/gateleen-test/src/test/java/org/swisspush/gateleen/core/property/PropertyHandlerTest.java @@ -38,7 +38,7 @@ public void testChangeProperty_not_registered(TestContext context) { // put property to pros props.put(property, propertyValue); - Assert.assertTrue(props.get(property).equals(propertyValue)); + Assert.assertEquals(props.get(property), propertyValue); // register something for the handler propertyHandler.addProperty("/myprop/v1/id", "myPropId", "notmyprop.id"); @@ -47,7 +47,7 @@ public void testChangeProperty_not_registered(TestContext context) { with().body(getBody("myPropId", "test")).put("/myprop/v1/id").then().assertThat().statusCode(200); // check property - Assert.assertTrue(props.get(property).equals(propertyValue)); + Assert.assertEquals(props.get(property), propertyValue); context.async().complete(); } @@ -64,7 +64,7 @@ public void testChangeProperty_wrong_valueId(TestContext context) { // put property to pros props.put(property, propertyValue); - Assert.assertTrue(props.get(property).equals(propertyValue)); + Assert.assertEquals(props.get(property), propertyValue); // register something for the handler propertyHandler.addProperty("/myprop/v1/id", "myPropId", "myprop.id"); @@ -89,7 +89,7 @@ public void testChangeProperty_registered(TestContext context) { // put property to pros props.put(property, propertyValue); - Assert.assertTrue(props.get(property).equals(propertyValue)); + Assert.assertEquals(props.get(property), propertyValue); // register something for the handler propertyHandler.addProperty("/myprop/v1/id", "myPropId", "myprop.id"); @@ -113,7 +113,7 @@ public void testChangeProperty_registered_refresh(TestContext context) { // put property to pros props.put(property, propertyValue); - Assert.assertTrue(props.get(property).equals(propertyValue)); + Assert.assertEquals(props.get(property), propertyValue); // register something for the handler propertyHandler.addProperty("/myprop/v1/id", "myPropId", "myprop.id"); @@ -148,7 +148,7 @@ public void testChangeProperty_not_registered_refresh(TestContext context) { // put property to pros props.put(property, propertyValue); - Assert.assertTrue(props.get(property).equals(propertyValue)); + Assert.assertEquals(props.get(property), propertyValue); // register something for the handler propertyHandler.addProperty("/myprop/v1/id", "notMyPropId", "myprop.id"); @@ -162,7 +162,7 @@ public void testChangeProperty_not_registered_refresh(TestContext context) { with().body(getBody("myPropIdOther", "test")).put("/myprop/v1/id").then().assertThat().statusCode(200); // check property - Assert.assertTrue(props.get(property).equals(propertyValue)); + Assert.assertEquals(props.get(property), propertyValue); // wait 3 sec TestUtils.waitSomeTime(3); @@ -183,7 +183,7 @@ public void testChangeProperty_wrong_valueId_refresh(TestContext context) { // put property to pros props.put(property, propertyValue); - Assert.assertTrue(props.get(property).equals(propertyValue)); + Assert.assertEquals(props.get(property), propertyValue); // register something for the handler propertyHandler.addProperty("/myprop/v1/id", "myPropId", "myprop.id"); @@ -224,7 +224,7 @@ private String getBody(String valueId, String value) { * * @author ljucam */ - private class MyRefreshable implements Refreshable { + private static class MyRefreshable implements Refreshable { private boolean refreshed = false; @Override diff --git a/gateleen-test/src/test/java/org/swisspush/gateleen/core/storage/CleanupTest.java b/gateleen-test/src/test/java/org/swisspush/gateleen/core/storage/CleanupTest.java index a93f139e..e18d88de 100644 --- a/gateleen-test/src/test/java/org/swisspush/gateleen/core/storage/CleanupTest.java +++ b/gateleen-test/src/test/java/org/swisspush/gateleen/core/storage/CleanupTest.java @@ -4,9 +4,7 @@ import static io.restassured.RestAssured.get; import static io.restassured.RestAssured.put; import static io.restassured.RestAssured.with; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertFalse; -import static org.junit.Assert.assertTrue; +import static org.junit.Assert.*; import io.vertx.ext.unit.Async; import io.vertx.ext.unit.TestContext; @@ -115,7 +113,7 @@ public void testCleanup2050(TestContext context) throws InterruptedException { Integer cleanedResources = Integer.parseInt(cleanedResourcesStr); assertTrue("After (at least) two cleanup tasks we should not have cleaned more than 50 resources", cleanedResources <= 50); } catch (NumberFormatException ex) { - assertFalse("cleanedResources does not contain a numerical value but '" + cleanedResourcesStr + "'", true); + fail("cleanedResources does not contain a numerical value but '" + cleanedResourcesStr + "'"); } } finally { @@ -152,7 +150,7 @@ public void testCleanup1070CleanupResourceAmount1000(TestContext context) throws Integer cleanedResources = Integer.parseInt(cleanedResourcesStr); assertTrue("The cleanup task should not have cleaned more than 1000 resources", cleanedResources <= 1000); } catch (NumberFormatException ex) { - assertFalse("cleanedResources does not contain a numerical value but '" + cleanedResourcesStr + "'", true); + fail("cleanedResources does not contain a numerical value but '" + cleanedResourcesStr + "'"); } } finally { diff --git a/gateleen-test/src/test/java/org/swisspush/gateleen/hook/ListenerTest.java b/gateleen-test/src/test/java/org/swisspush/gateleen/hook/ListenerTest.java index d06e9db6..89a23423 100755 --- a/gateleen-test/src/test/java/org/swisspush/gateleen/hook/ListenerTest.java +++ b/gateleen-test/src/test/java/org/swisspush/gateleen/hook/ListenerTest.java @@ -791,7 +791,6 @@ public void testDetectLoopbacksInListener(TestContext context) { String registerUrl = requestUrlBase + "/" + subresource + TestUtils.getHookListenersUrlSuffix() + listenerName + "/" + listenerNo; String target = SERVER_ROOT + requestUrlBase + "/" + subresource + "/anySubResource"; - String[] methods = null; // register a listener - expect not accepted by Gateleen (expect http 400) String body = "{ \"destination\":\"" + target + "\"}"; From db6d858083425855a445451fee1dcdefb64362e8 Mon Sep 17 00:00:00 2001 From: Marc-Andre Weber Date: Wed, 21 Jun 2023 08:45:03 +0200 Subject: [PATCH 17/19] #514 Improve scheduler resource unit test --- .../gateleen/scheduler/SchedulerResourceManagerTest.java | 3 +++ 1 file changed, 3 insertions(+) diff --git a/gateleen-scheduler/src/test/java/org/swisspush/gateleen/scheduler/SchedulerResourceManagerTest.java b/gateleen-scheduler/src/test/java/org/swisspush/gateleen/scheduler/SchedulerResourceManagerTest.java index 152f8b9b..547ac14d 100644 --- a/gateleen-scheduler/src/test/java/org/swisspush/gateleen/scheduler/SchedulerResourceManagerTest.java +++ b/gateleen-scheduler/src/test/java/org/swisspush/gateleen/scheduler/SchedulerResourceManagerTest.java @@ -69,6 +69,9 @@ public void testReadSchedulersResource(TestContext context){ // on initialization, the schedulers must be read from storage verify(storage, timeout(100).times(1)).get(eq(schedulersUri), any()); + // reset the mock to start new count after eventbus message + reset(storage); + vertx.eventBus().publish("gateleen.schedulers-updated", true); // after eventbus message, the schedulers must be read from storage again From b63121adaedcbf87feb56ce5b115e00cb1d27711 Mon Sep 17 00:00:00 2001 From: Marc-Andre Weber Date: Wed, 21 Jun 2023 13:27:46 +0200 Subject: [PATCH 18/19] #514 Made some variables final (but not all that could be) --- .../gateleen/delta/DeltaHandler.java | 2 +- .../gateleen/monitoring/RedisMonitor.java | 8 +-- .../queue/queuing/QueuingHandler.java | 8 +-- .../impl/RedisQueueCircuitBreakerStorage.java | 16 ++--- .../gateleen/runconfig/RunConfig.java | 58 +++++++++---------- .../gateleen/scheduler/Scheduler.java | 8 +-- .../gateleen/scheduler/SchedulerFactory.java | 12 ++-- .../scheduler/SchedulerResourceManager.java | 15 +++-- 8 files changed, 63 insertions(+), 64 deletions(-) diff --git a/gateleen-delta/src/main/java/org/swisspush/gateleen/delta/DeltaHandler.java b/gateleen-delta/src/main/java/org/swisspush/gateleen/delta/DeltaHandler.java index f272e60b..352dfa7a 100755 --- a/gateleen-delta/src/main/java/org/swisspush/gateleen/delta/DeltaHandler.java +++ b/gateleen-delta/src/main/java/org/swisspush/gateleen/delta/DeltaHandler.java @@ -450,7 +450,7 @@ private Long getExpireAfterValue(HttpServerRequest request, Logger log) { } } - private class DeltaResourcesContainer { + private static class DeltaResourcesContainer { private final long maxUpdateId; private final List resourceNames; diff --git a/gateleen-monitoring/src/main/java/org/swisspush/gateleen/monitoring/RedisMonitor.java b/gateleen-monitoring/src/main/java/org/swisspush/gateleen/monitoring/RedisMonitor.java index b4abb4fe..e0f8c214 100644 --- a/gateleen-monitoring/src/main/java/org/swisspush/gateleen/monitoring/RedisMonitor.java +++ b/gateleen-monitoring/src/main/java/org/swisspush/gateleen/monitoring/RedisMonitor.java @@ -18,11 +18,11 @@ */ public class RedisMonitor { - private Vertx vertx; - private RedisProvider redisProvider; - private int period; + private final Vertx vertx; + private final RedisProvider redisProvider; + private final int period; private long timer; - private Logger log = LoggerFactory.getLogger(RedisMonitor.class); + private final Logger log = LoggerFactory.getLogger(RedisMonitor.class); private String metricName; private String elementCountKey; diff --git a/gateleen-queue/src/main/java/org/swisspush/gateleen/queue/queuing/QueuingHandler.java b/gateleen-queue/src/main/java/org/swisspush/gateleen/queue/queuing/QueuingHandler.java index 46dc1837..a44fb731 100755 --- a/gateleen-queue/src/main/java/org/swisspush/gateleen/queue/queuing/QueuingHandler.java +++ b/gateleen-queue/src/main/java/org/swisspush/gateleen/queue/queuing/QueuingHandler.java @@ -24,16 +24,16 @@ public class QueuingHandler implements Handler { public static final String QUEUE_HEADER = "x-queue"; public static final String DUPLICATE_CHECK_HEADER = "x-duplicate-check"; - private RequestQueue requestQueue; + private final RequestQueue requestQueue; public static boolean isQueued(HttpServerRequest request) { String queue = request.headers().get(QUEUE_HEADER); return HttpMethod.GET != request.method() && queue != null && !queue.trim().isEmpty(); } - private HttpServerRequest request; - private Vertx vertx; - private RedisProvider redisProvider; + private final HttpServerRequest request; + private final Vertx vertx; + private final RedisProvider redisProvider; public QueuingHandler(Vertx vertx, RedisProvider redisProvider, HttpServerRequest request, MonitoringHandler monitoringHandler) { this(vertx, redisProvider, request, new QueueClient(vertx, monitoringHandler)); diff --git a/gateleen-queue/src/main/java/org/swisspush/gateleen/queue/queuing/circuitbreaker/impl/RedisQueueCircuitBreakerStorage.java b/gateleen-queue/src/main/java/org/swisspush/gateleen/queue/queuing/circuitbreaker/impl/RedisQueueCircuitBreakerStorage.java index ede5d59a..49ac4900 100644 --- a/gateleen-queue/src/main/java/org/swisspush/gateleen/queue/queuing/circuitbreaker/impl/RedisQueueCircuitBreakerStorage.java +++ b/gateleen-queue/src/main/java/org/swisspush/gateleen/queue/queuing/circuitbreaker/impl/RedisQueueCircuitBreakerStorage.java @@ -26,8 +26,8 @@ */ public class RedisQueueCircuitBreakerStorage implements QueueCircuitBreakerStorage { - private RedisProvider redisProvider; - private Logger log = LoggerFactory.getLogger(RedisQueueCircuitBreakerStorage.class); + private final RedisProvider redisProvider; + private final Logger log = LoggerFactory.getLogger(RedisQueueCircuitBreakerStorage.class); public static final String STORAGE_PREFIX = "gateleen.queue-circuit-breaker:"; public static final String STORAGE_INFOS_SUFFIX = ":infos"; @@ -40,12 +40,12 @@ public class RedisQueueCircuitBreakerStorage implements QueueCircuitBreakerStora public static final String FIELD_FAILRATIO = "failRatio"; public static final String FIELD_CIRCUIT = "circuit"; - private LuaScriptState openCircuitLuaScriptState; - private LuaScriptState closeCircuitLuaScriptState; - private LuaScriptState reOpenCircuitLuaScriptState; - private LuaScriptState halfOpenCircuitLuaScriptState; - private LuaScriptState unlockSampleQueuesLuaScriptState; - private LuaScriptState getAllCircuitsLuaScriptState; + private final LuaScriptState openCircuitLuaScriptState; + private final LuaScriptState closeCircuitLuaScriptState; + private final LuaScriptState reOpenCircuitLuaScriptState; + private final LuaScriptState halfOpenCircuitLuaScriptState; + private final LuaScriptState unlockSampleQueuesLuaScriptState; + private final LuaScriptState getAllCircuitsLuaScriptState; public RedisQueueCircuitBreakerStorage(RedisProvider redisProvider) { this.redisProvider = redisProvider; diff --git a/gateleen-runconfig/src/main/java/org/swisspush/gateleen/runconfig/RunConfig.java b/gateleen-runconfig/src/main/java/org/swisspush/gateleen/runconfig/RunConfig.java index cf311aa8..4d6e273b 100755 --- a/gateleen-runconfig/src/main/java/org/swisspush/gateleen/runconfig/RunConfig.java +++ b/gateleen-runconfig/src/main/java/org/swisspush/gateleen/runconfig/RunConfig.java @@ -80,35 +80,35 @@ public class RunConfig { private Random random; private final Class verticleClass; - private Vertx vertx; - private RedisProvider redisProvider; - private Router router; - private CacheHandler cacheHandler; - private CORSHandler corsHandler; - private ContentTypeConstraintHandler contentTypeConstraintHandler; - private SchedulerResourceManager schedulerResourceManager; - private ValidationResourceManager validationResourceManager; - private LoggingResourceManager loggingResourceManager; - private ConfigurationResourceManager configurationResourceManager; - private QueueCircuitBreakerConfigurationResourceManager queueCircuitBreakerConfigurationResourceManager; - private EventBusHandler eventBusHandler; - private ValidationHandler validationHandler; - private HookHandler hookHandler; - private UserProfileHandler userProfileHandler; - private RoleProfileHandler roleProfileHandler; - private ExpansionHandler expansionHandler; - private DeltaHandler deltaHandler; - private MonitoringHandler monitoringHandler; - private QueueBrowser queueBrowser; - private Authorizer authorizer; - private CopyResourceHandler copyResourceHandler; - private QoSHandler qosHandler; - private PropertyHandler propertyHandler; - private ZipExtractHandler zipExtractHandler; - private DelegateHandler delegateHandler; - private MergeHandler mergeHandler; - private KafkaHandler kafkaHandler; - private CustomHttpResponseHandler customHttpResponseHandler; + private final Vertx vertx; + private final RedisProvider redisProvider; + private final Router router; + private final CacheHandler cacheHandler; + private final CORSHandler corsHandler; + private final ContentTypeConstraintHandler contentTypeConstraintHandler; + private final SchedulerResourceManager schedulerResourceManager; + private final ValidationResourceManager validationResourceManager; + private final LoggingResourceManager loggingResourceManager; + private final ConfigurationResourceManager configurationResourceManager; + private final QueueCircuitBreakerConfigurationResourceManager queueCircuitBreakerConfigurationResourceManager; + private final EventBusHandler eventBusHandler; + private final ValidationHandler validationHandler; + private final HookHandler hookHandler; + private final UserProfileHandler userProfileHandler; + private final RoleProfileHandler roleProfileHandler; + private final ExpansionHandler expansionHandler; + private final DeltaHandler deltaHandler; + private final MonitoringHandler monitoringHandler; + private final QueueBrowser queueBrowser; + private final Authorizer authorizer; + private final CopyResourceHandler copyResourceHandler; + private final QoSHandler qosHandler; + private final PropertyHandler propertyHandler; + private final ZipExtractHandler zipExtractHandler; + private final DelegateHandler delegateHandler; + private final MergeHandler mergeHandler; + private final KafkaHandler kafkaHandler; + private final CustomHttpResponseHandler customHttpResponseHandler; public RunConfig(Vertx vertx, RedisProvider redisProvider, Class verticleClass, Router router, MonitoringHandler monitoringHandler, QueueBrowser queueBrowser, CORSHandler corsHandler, SchedulerResourceManager schedulerResourceManager, diff --git a/gateleen-scheduler/src/main/java/org/swisspush/gateleen/scheduler/Scheduler.java b/gateleen-scheduler/src/main/java/org/swisspush/gateleen/scheduler/Scheduler.java index 5abe6fab..2ef8da95 100755 --- a/gateleen-scheduler/src/main/java/org/swisspush/gateleen/scheduler/Scheduler.java +++ b/gateleen-scheduler/src/main/java/org/swisspush/gateleen/scheduler/Scheduler.java @@ -30,10 +30,10 @@ */ public class Scheduler { - private Vertx vertx; - private RedisProvider redisProvider; - private String redisquesAddress; - private String name; + private final Vertx vertx; + private final RedisProvider redisProvider; + private final String redisquesAddress; + private final String name; private CronExpression cronExpression; private List requests; private long timer; diff --git a/gateleen-scheduler/src/main/java/org/swisspush/gateleen/scheduler/SchedulerFactory.java b/gateleen-scheduler/src/main/java/org/swisspush/gateleen/scheduler/SchedulerFactory.java index 9093f4d1..5de530d2 100755 --- a/gateleen-scheduler/src/main/java/org/swisspush/gateleen/scheduler/SchedulerFactory.java +++ b/gateleen-scheduler/src/main/java/org/swisspush/gateleen/scheduler/SchedulerFactory.java @@ -38,13 +38,13 @@ public class SchedulerFactory { private final Map properties; private final JsonArray defaultRequestHeaders; - private Vertx vertx; - private RedisProvider redisProvider; - private MonitoringHandler monitoringHandler; - private String schedulersSchema; - private String redisquesAddress; + private final Vertx vertx; + private final RedisProvider redisProvider; + private final MonitoringHandler monitoringHandler; + private final String schedulersSchema; + private final String redisquesAddress; - private Logger log = LoggerFactory.getLogger(SchedulerFactory.class); + private final Logger log = LoggerFactory.getLogger(SchedulerFactory.class); public SchedulerFactory(Map properties, Map defaultRequestHeaders, Vertx vertx, RedisProvider redisProvider, MonitoringHandler monitoringHandler, String schedulersSchema, diff --git a/gateleen-scheduler/src/main/java/org/swisspush/gateleen/scheduler/SchedulerResourceManager.java b/gateleen-scheduler/src/main/java/org/swisspush/gateleen/scheduler/SchedulerResourceManager.java index 40020af9..b52559b5 100755 --- a/gateleen-scheduler/src/main/java/org/swisspush/gateleen/scheduler/SchedulerResourceManager.java +++ b/gateleen-scheduler/src/main/java/org/swisspush/gateleen/scheduler/SchedulerResourceManager.java @@ -6,7 +6,6 @@ import io.vertx.core.eventbus.Message; import io.vertx.core.http.HttpMethod; import io.vertx.core.http.HttpServerRequest; -import io.vertx.redis.client.RedisAPI; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.swisspush.gateleen.core.logging.LoggableResource; @@ -31,14 +30,14 @@ public class SchedulerResourceManager implements Refreshable, LoggableResource { private static final String UPDATE_ADDRESS = "gateleen.schedulers-updated"; - private String schedulersUri; - private ResourceStorage storage; - private Logger log = LoggerFactory.getLogger(SchedulerResourceManager.class); - private Vertx vertx; + private final String schedulersUri; + private final ResourceStorage storage; + private final Logger log = LoggerFactory.getLogger(SchedulerResourceManager.class); + private final Vertx vertx; private List schedulers; - private Map properties; - private SchedulerFactory schedulerFactory; - private String schedulersSchema; + private final Map properties; + private final SchedulerFactory schedulerFactory; + private final String schedulersSchema; private boolean logConfigurationResourceChanges = false; public SchedulerResourceManager(Vertx vertx, RedisProvider redisProvider, final ResourceStorage storage, From 0f11afb7b8f106e05fd1ae65028b1db758dd6373 Mon Sep 17 00:00:00 2001 From: Marc-Andre Weber Date: Wed, 21 Jun 2023 14:40:32 +0200 Subject: [PATCH 19/19] #514 Changed major version since we break the API by switching from RedisAPI to RedisProvider --- gateleen-cache/pom.xml | 2 +- gateleen-core/pom.xml | 2 +- gateleen-delegate/pom.xml | 2 +- gateleen-delta/pom.xml | 2 +- gateleen-expansion/pom.xml | 2 +- gateleen-hook-js/pom.xml | 2 +- gateleen-hook/pom.xml | 2 +- gateleen-kafka/pom.xml | 2 +- gateleen-logging/pom.xml | 2 +- gateleen-merge/pom.xml | 2 +- gateleen-monitoring/pom.xml | 2 +- gateleen-packing/pom.xml | 2 +- gateleen-player/pom.xml | 2 +- gateleen-playground/pom.xml | 2 +- gateleen-qos/pom.xml | 2 +- gateleen-queue/pom.xml | 2 +- gateleen-routing/pom.xml | 2 +- gateleen-runconfig/pom.xml | 2 +- gateleen-scheduler/pom.xml | 2 +- gateleen-security/pom.xml | 2 +- gateleen-test/pom.xml | 2 +- gateleen-testhelper/pom.xml | 2 +- gateleen-user/pom.xml | 2 +- gateleen-validation/pom.xml | 2 +- pom.xml | 2 +- 25 files changed, 25 insertions(+), 25 deletions(-) diff --git a/gateleen-cache/pom.xml b/gateleen-cache/pom.xml index f6d9aef4..c5b5fe06 100644 --- a/gateleen-cache/pom.xml +++ b/gateleen-cache/pom.xml @@ -6,7 +6,7 @@ org.swisspush.gateleen gateleen - 1.3.30-SNAPSHOT + 2.0.0-SNAPSHOT gateleen-cache diff --git a/gateleen-core/pom.xml b/gateleen-core/pom.xml index 58fe365a..0090f172 100644 --- a/gateleen-core/pom.xml +++ b/gateleen-core/pom.xml @@ -6,7 +6,7 @@ org.swisspush.gateleen gateleen - 1.3.30-SNAPSHOT + 2.0.0-SNAPSHOT gateleen-core diff --git a/gateleen-delegate/pom.xml b/gateleen-delegate/pom.xml index e48742e1..ca38b1bf 100644 --- a/gateleen-delegate/pom.xml +++ b/gateleen-delegate/pom.xml @@ -6,7 +6,7 @@ org.swisspush.gateleen gateleen - 1.3.30-SNAPSHOT + 2.0.0-SNAPSHOT gateleen-delegate diff --git a/gateleen-delta/pom.xml b/gateleen-delta/pom.xml index cba97954..69993167 100644 --- a/gateleen-delta/pom.xml +++ b/gateleen-delta/pom.xml @@ -6,7 +6,7 @@ org.swisspush.gateleen gateleen - 1.3.30-SNAPSHOT + 2.0.0-SNAPSHOT gateleen-delta diff --git a/gateleen-expansion/pom.xml b/gateleen-expansion/pom.xml index bee0d3e8..09f9a0e1 100644 --- a/gateleen-expansion/pom.xml +++ b/gateleen-expansion/pom.xml @@ -6,7 +6,7 @@ org.swisspush.gateleen gateleen - 1.3.30-SNAPSHOT + 2.0.0-SNAPSHOT gateleen-expansion diff --git a/gateleen-hook-js/pom.xml b/gateleen-hook-js/pom.xml index 6880fd9e..56cebdea 100644 --- a/gateleen-hook-js/pom.xml +++ b/gateleen-hook-js/pom.xml @@ -4,7 +4,7 @@ org.swisspush.gateleen gateleen - 1.3.30-SNAPSHOT + 2.0.0-SNAPSHOT gateleen-hook-js jar diff --git a/gateleen-hook/pom.xml b/gateleen-hook/pom.xml index f01878ac..cca67361 100644 --- a/gateleen-hook/pom.xml +++ b/gateleen-hook/pom.xml @@ -6,7 +6,7 @@ org.swisspush.gateleen gateleen - 1.3.30-SNAPSHOT + 2.0.0-SNAPSHOT gateleen-hook diff --git a/gateleen-kafka/pom.xml b/gateleen-kafka/pom.xml index 6349d069..f61f5813 100644 --- a/gateleen-kafka/pom.xml +++ b/gateleen-kafka/pom.xml @@ -6,7 +6,7 @@ org.swisspush.gateleen gateleen - 1.3.30-SNAPSHOT + 2.0.0-SNAPSHOT gateleen-kafka diff --git a/gateleen-logging/pom.xml b/gateleen-logging/pom.xml index 91f075f8..88ee2628 100644 --- a/gateleen-logging/pom.xml +++ b/gateleen-logging/pom.xml @@ -6,7 +6,7 @@ org.swisspush.gateleen gateleen - 1.3.30-SNAPSHOT + 2.0.0-SNAPSHOT gateleen-logging diff --git a/gateleen-merge/pom.xml b/gateleen-merge/pom.xml index 7638220e..ee2c46fa 100644 --- a/gateleen-merge/pom.xml +++ b/gateleen-merge/pom.xml @@ -6,7 +6,7 @@ org.swisspush.gateleen gateleen - 1.3.30-SNAPSHOT + 2.0.0-SNAPSHOT gateleen-merge diff --git a/gateleen-monitoring/pom.xml b/gateleen-monitoring/pom.xml index 0f6fc053..68e57465 100644 --- a/gateleen-monitoring/pom.xml +++ b/gateleen-monitoring/pom.xml @@ -6,7 +6,7 @@ org.swisspush.gateleen gateleen - 1.3.30-SNAPSHOT + 2.0.0-SNAPSHOT gateleen-monitoring diff --git a/gateleen-packing/pom.xml b/gateleen-packing/pom.xml index 8930f2f3..129eaff1 100644 --- a/gateleen-packing/pom.xml +++ b/gateleen-packing/pom.xml @@ -6,7 +6,7 @@ org.swisspush.gateleen gateleen - 1.3.30-SNAPSHOT + 2.0.0-SNAPSHOT gateleen-packing diff --git a/gateleen-player/pom.xml b/gateleen-player/pom.xml index bc9ff1bc..8e21f036 100644 --- a/gateleen-player/pom.xml +++ b/gateleen-player/pom.xml @@ -6,7 +6,7 @@ org.swisspush.gateleen gateleen - 1.3.30-SNAPSHOT + 2.0.0-SNAPSHOT gateleen-player diff --git a/gateleen-playground/pom.xml b/gateleen-playground/pom.xml index bd7b5f3b..9fd92b72 100644 --- a/gateleen-playground/pom.xml +++ b/gateleen-playground/pom.xml @@ -6,7 +6,7 @@ org.swisspush.gateleen gateleen - 1.3.30-SNAPSHOT + 2.0.0-SNAPSHOT gateleen-playground diff --git a/gateleen-qos/pom.xml b/gateleen-qos/pom.xml index 96de0fce..c60bfbcf 100644 --- a/gateleen-qos/pom.xml +++ b/gateleen-qos/pom.xml @@ -6,7 +6,7 @@ org.swisspush.gateleen gateleen - 1.3.30-SNAPSHOT + 2.0.0-SNAPSHOT gateleen-qos diff --git a/gateleen-queue/pom.xml b/gateleen-queue/pom.xml index 8c51f92b..c55e052c 100644 --- a/gateleen-queue/pom.xml +++ b/gateleen-queue/pom.xml @@ -6,7 +6,7 @@ org.swisspush.gateleen gateleen - 1.3.30-SNAPSHOT + 2.0.0-SNAPSHOT gateleen-queue diff --git a/gateleen-routing/pom.xml b/gateleen-routing/pom.xml index c8250abf..50933a51 100644 --- a/gateleen-routing/pom.xml +++ b/gateleen-routing/pom.xml @@ -6,7 +6,7 @@ org.swisspush.gateleen gateleen - 1.3.30-SNAPSHOT + 2.0.0-SNAPSHOT gateleen-routing diff --git a/gateleen-runconfig/pom.xml b/gateleen-runconfig/pom.xml index 7b50abd0..52abc9e7 100644 --- a/gateleen-runconfig/pom.xml +++ b/gateleen-runconfig/pom.xml @@ -6,7 +6,7 @@ org.swisspush.gateleen gateleen - 1.3.30-SNAPSHOT + 2.0.0-SNAPSHOT gateleen-runconfig diff --git a/gateleen-scheduler/pom.xml b/gateleen-scheduler/pom.xml index 1ed31793..80f144a6 100644 --- a/gateleen-scheduler/pom.xml +++ b/gateleen-scheduler/pom.xml @@ -6,7 +6,7 @@ org.swisspush.gateleen gateleen - 1.3.30-SNAPSHOT + 2.0.0-SNAPSHOT gateleen-scheduler diff --git a/gateleen-security/pom.xml b/gateleen-security/pom.xml index 29416b78..dcc5fdff 100644 --- a/gateleen-security/pom.xml +++ b/gateleen-security/pom.xml @@ -6,7 +6,7 @@ org.swisspush.gateleen gateleen - 1.3.30-SNAPSHOT + 2.0.0-SNAPSHOT gateleen-security diff --git a/gateleen-test/pom.xml b/gateleen-test/pom.xml index 8934decd..154884fd 100644 --- a/gateleen-test/pom.xml +++ b/gateleen-test/pom.xml @@ -6,7 +6,7 @@ org.swisspush.gateleen gateleen - 1.3.30-SNAPSHOT + 2.0.0-SNAPSHOT gateleen-test jar diff --git a/gateleen-testhelper/pom.xml b/gateleen-testhelper/pom.xml index 1513a853..57d7a186 100644 --- a/gateleen-testhelper/pom.xml +++ b/gateleen-testhelper/pom.xml @@ -6,7 +6,7 @@ org.swisspush.gateleen gateleen - 1.3.30-SNAPSHOT + 2.0.0-SNAPSHOT gateleen-testhelper diff --git a/gateleen-user/pom.xml b/gateleen-user/pom.xml index 6eb0dbbe..3612c6d8 100644 --- a/gateleen-user/pom.xml +++ b/gateleen-user/pom.xml @@ -6,7 +6,7 @@ org.swisspush.gateleen gateleen - 1.3.30-SNAPSHOT + 2.0.0-SNAPSHOT gateleen-user diff --git a/gateleen-validation/pom.xml b/gateleen-validation/pom.xml index b9585560..a73e09f4 100644 --- a/gateleen-validation/pom.xml +++ b/gateleen-validation/pom.xml @@ -6,7 +6,7 @@ org.swisspush.gateleen gateleen - 1.3.30-SNAPSHOT + 2.0.0-SNAPSHOT gateleen-validation diff --git a/pom.xml b/pom.xml index e229d50d..44472971 100644 --- a/pom.xml +++ b/pom.xml @@ -6,7 +6,7 @@ org.swisspush.gateleen gateleen - 1.3.30-SNAPSHOT + 2.0.0-SNAPSHOT pom gateleen Middleware library based on Vert.x to build advanced JSON/REST communication servers