From 326caa3307b362baaeaee05655ba56d7ca33bfae Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Gst=C3=B6hl?= Date: Fri, 25 Mar 2022 10:06:30 +0100 Subject: [PATCH] change foreign rules sync schedule --- .../verifier/sync/config/SyncSchedulingBaseConfig.java | 2 +- .../verifier/ws/controller/ForeignRulesControllerV2.java | 5 ++++- .../verifier/ws/controller/ForeignRulesControllerV2Test.java | 2 +- 3 files changed, 6 insertions(+), 3 deletions(-) diff --git a/ch-covidcertificate-backend-verifier/ch-covidcertificate-backend-verifier-sync/src/main/java/ch/admin/bag/covidcertificate/backend/verifier/sync/config/SyncSchedulingBaseConfig.java b/ch-covidcertificate-backend-verifier/ch-covidcertificate-backend-verifier-sync/src/main/java/ch/admin/bag/covidcertificate/backend/verifier/sync/config/SyncSchedulingBaseConfig.java index 55fe652f..01071f34 100644 --- a/ch-covidcertificate-backend-verifier/ch-covidcertificate-backend-verifier-sync/src/main/java/ch/admin/bag/covidcertificate/backend/verifier/sync/config/SyncSchedulingBaseConfig.java +++ b/ch-covidcertificate-backend-verifier/ch-covidcertificate-backend-verifier-sync/src/main/java/ch/admin/bag/covidcertificate/backend/verifier/sync/config/SyncSchedulingBaseConfig.java @@ -86,7 +86,7 @@ public void valueSetCleanCron() { valueSetDataService.deleteOldValueSets(); } - @Scheduled(cron = "${foreign-rules.sync.cron:0 0 0 ? * *}") + @Scheduled(cron = "${foreign-rules.sync.cron:0 39 * ? * *}") @SchedulerLock(name = "foreign_rules_sync", lockAtLeastFor = "PT15S") public void foreignRulesSyncCron() { LockAssert.assertLocked(); diff --git a/ch-covidcertificate-backend-verifier/ch-covidcertificate-backend-verifier-ws/src/main/java/ch/admin/bag/covidcertificate/backend/verifier/ws/controller/ForeignRulesControllerV2.java b/ch-covidcertificate-backend-verifier/ch-covidcertificate-backend-verifier-ws/src/main/java/ch/admin/bag/covidcertificate/backend/verifier/ws/controller/ForeignRulesControllerV2.java index 97425d18..e33de50d 100644 --- a/ch-covidcertificate-backend-verifier/ch-covidcertificate-backend-verifier-ws/src/main/java/ch/admin/bag/covidcertificate/backend/verifier/ws/controller/ForeignRulesControllerV2.java +++ b/ch-covidcertificate-backend-verifier/ch-covidcertificate-backend-verifier-ws/src/main/java/ch/admin/bag/covidcertificate/backend/verifier/ws/controller/ForeignRulesControllerV2.java @@ -48,7 +48,7 @@ public ForeignRulesControllerV2( this.valueSetDataService = valueSetDataService; } - @GetMapping(value = "/countries") + @GetMapping(value = "/foreignRules") public @ResponseBody ResponseEntity> getCountries(WebRequest request) { return ResponseEntity.ok(foreignRulesDataService.getCountries()); } @@ -62,6 +62,9 @@ public ForeignRulesControllerV2( // Add rules to output var foreignRules = foreignRulesDataService.getRulesForCountry(country); + if(foreignRules.isEmpty()){ + return ResponseEntity.notFound().build(); + } var rules = foreignRules.stream() diff --git a/ch-covidcertificate-backend-verifier/ch-covidcertificate-backend-verifier-ws/src/test/java/ch/admin/bag/covidcertificate/backend/verifier/ws/controller/ForeignRulesControllerV2Test.java b/ch-covidcertificate-backend-verifier/ch-covidcertificate-backend-verifier-ws/src/test/java/ch/admin/bag/covidcertificate/backend/verifier/ws/controller/ForeignRulesControllerV2Test.java index 35fa2eed..425f713e 100644 --- a/ch-covidcertificate-backend-verifier/ch-covidcertificate-backend-verifier-ws/src/test/java/ch/admin/bag/covidcertificate/backend/verifier/ws/controller/ForeignRulesControllerV2Test.java +++ b/ch-covidcertificate-backend-verifier/ch-covidcertificate-backend-verifier-ws/src/test/java/ch/admin/bag/covidcertificate/backend/verifier/ws/controller/ForeignRulesControllerV2Test.java @@ -25,7 +25,7 @@ public class ForeignRulesControllerV2Test extends BaseControllerTest { protected MediaType acceptMediaType = MediaType.APPLICATION_JSON; private String atRulesUrl = "/trust/v2/foreignRules/AT"; - private String countryListUrl = "/trust/v2/countries"; + private String countryListUrl = "/trust/v2/foreignRules"; @BeforeAll static void setup(){