From 55611ea947827b2ba697beb9b70767f0cba432e3 Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Thu, 24 Nov 2022 15:17:11 +0000 Subject: [PATCH 01/11] Update dependencies --- .../ch-covidcertificate-backend-verifier-data/pom.xml | 4 ++-- .../ch-covidcertificate-backend-verifier-sync/pom.xml | 4 ++-- .../ch-covidcertificate-backend-verifier-ws/pom.xml | 2 +- ch-covidcertificate-backend-verifier/pom.xml | 6 +++--- 4 files changed, 8 insertions(+), 8 deletions(-) diff --git a/ch-covidcertificate-backend-verifier/ch-covidcertificate-backend-verifier-data/pom.xml b/ch-covidcertificate-backend-verifier/ch-covidcertificate-backend-verifier-data/pom.xml index 4e691476..ce321413 100644 --- a/ch-covidcertificate-backend-verifier/ch-covidcertificate-backend-verifier-data/pom.xml +++ b/ch-covidcertificate-backend-verifier/ch-covidcertificate-backend-verifier-data/pom.xml @@ -50,7 +50,7 @@ org.postgresql postgresql - 42.5.0 + 42.5.1 org.flywaydb @@ -65,7 +65,7 @@ org.testcontainers junit-jupiter - 1.17.5 + 1.17.6 test diff --git a/ch-covidcertificate-backend-verifier/ch-covidcertificate-backend-verifier-sync/pom.xml b/ch-covidcertificate-backend-verifier/ch-covidcertificate-backend-verifier-sync/pom.xml index e2582e2f..78f922c2 100644 --- a/ch-covidcertificate-backend-verifier/ch-covidcertificate-backend-verifier-sync/pom.xml +++ b/ch-covidcertificate-backend-verifier/ch-covidcertificate-backend-verifier-sync/pom.xml @@ -82,13 +82,13 @@ org.testcontainers postgresql - 1.17.5 + 1.17.6 test org.testcontainers junit-jupiter - 1.17.5 + 1.17.6 test diff --git a/ch-covidcertificate-backend-verifier/ch-covidcertificate-backend-verifier-ws/pom.xml b/ch-covidcertificate-backend-verifier/ch-covidcertificate-backend-verifier-ws/pom.xml index 665341f3..72a8b7f2 100644 --- a/ch-covidcertificate-backend-verifier/ch-covidcertificate-backend-verifier-ws/pom.xml +++ b/ch-covidcertificate-backend-verifier/ch-covidcertificate-backend-verifier-ws/pom.xml @@ -26,7 +26,7 @@ 1.0.0-SNAPSHOT - 1.17.5 + 1.17.6 ${env.SONAR_PROJECTKEY} diff --git a/ch-covidcertificate-backend-verifier/pom.xml b/ch-covidcertificate-backend-verifier/pom.xml index d0f98c4a..35e3c305 100644 --- a/ch-covidcertificate-backend-verifier/pom.xml +++ b/ch-covidcertificate-backend-verifier/pom.xml @@ -25,11 +25,11 @@ UTF-8 UTF-8 - 2.7.4 - 3.1.4 + 2.7.6 + 3.1.5 2.11.1 0.11.5 - 1.17.5 + 1.17.6 4.42.0 2.2.13.RELEASE From 8b8e06b92dcb2b386baa16487628f932e5ead127 Mon Sep 17 00:00:00 2001 From: Daniel Gstoehl Date: Tue, 29 Nov 2022 10:31:11 +0100 Subject: [PATCH 02/11] Update to Java 17 --- ch-covidcertificate-backend-verifier/pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ch-covidcertificate-backend-verifier/pom.xml b/ch-covidcertificate-backend-verifier/pom.xml index 35e3c305..6803e9d6 100644 --- a/ch-covidcertificate-backend-verifier/pom.xml +++ b/ch-covidcertificate-backend-verifier/pom.xml @@ -20,7 +20,7 @@ CH Covidcertificate Verifier Backend - 11 + 17 UTF-8 UTF-8 From 5a17edc804d587dd7e8d27192a80a1b0b027fed9 Mon Sep 17 00:00:00 2001 From: Daniel Gstoehl Date: Tue, 29 Nov 2022 10:39:04 +0100 Subject: [PATCH 03/11] Update workflows for Java 17 --- .github/workflows/build.yml | 4 ++-- .github/workflows/tagged_release.yaml | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 993f51d3..c3875af7 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -12,10 +12,10 @@ jobs: - uses: actions/checkout@v3 with: fetch-depth: 0 # Shallow clones should be disabled for a better relevancy of analysis - - name: Set up JDK 11 + - name: Set up JDK 17 uses: actions/setup-java@v3 with: - java-version: 11 + java-version: 17 distribution: 'zulu' - name: Cache SonarCloud packages uses: actions/cache@v3 diff --git a/.github/workflows/tagged_release.yaml b/.github/workflows/tagged_release.yaml index dd4463a0..cbc1e549 100644 --- a/.github/workflows/tagged_release.yaml +++ b/.github/workflows/tagged_release.yaml @@ -13,10 +13,10 @@ jobs: - uses: actions/checkout@v3 - run: | git fetch --no-tags --prune --depth=1 origin +refs/heads/*:refs/remotes/origin/* - - name: Set up JDK 11 + - name: Set up JDK 17 uses: actions/setup-java@v3 with: - java-version: 11.0.7 + java-version: 17 server-id: github # Value of the distributionManagement/repository/id field of the pom.xml settings-path: ${{ github.workspace }} # location for the settings.xml file: : distribution: 'zulu' From cd843a54ce23278e14e7de075016981afb53fdfb Mon Sep 17 00:00:00 2001 From: Daniel Gstoehl Date: Thu, 15 Dec 2022 10:12:06 +0000 Subject: [PATCH 04/11] sqlite with index for android --- .../src/main/resources/revocation_metadata.json | 2 +- update_resources.sh | 6 ++++++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/ch-covidcertificate-backend-verifier/ch-covidcertificate-backend-verifier-ws/src/main/resources/revocation_metadata.json b/ch-covidcertificate-backend-verifier/ch-covidcertificate-backend-verifier-ws/src/main/resources/revocation_metadata.json index 60c95668..183005b7 100644 --- a/ch-covidcertificate-backend-verifier/ch-covidcertificate-backend-verifier-ws/src/main/resources/revocation_metadata.json +++ b/ch-covidcertificate-backend-verifier/ch-covidcertificate-backend-verifier-ws/src/main/resources/revocation_metadata.json @@ -1 +1 @@ -{"validDuration": 172800000, "lastDownload": 1665473995987, "nextSince": "11843609"} \ No newline at end of file +{"validDuration": 172800000, "lastDownload": 1670858784137, "nextSince": "11856236"} \ No newline at end of file diff --git a/update_resources.sh b/update_resources.sh index a0942ab2..2a776123 100755 --- a/update_resources.sh +++ b/update_resources.sh @@ -5,8 +5,14 @@ python3 ch-covidcertificate-backend-verifier/ch-covidcertificate-backend-verifie sqlite3 revocations.sqlite "CREATE TABLE revocations ( uvci text NOT NULL );" ".mode csv" ".import revocations.csv revocations" sqlite3 revocations.sqlite "CREATE TABLE \"metadata\" (\"validDuration\" integer NOT NULL DEFAULT '0',\"lastDownload\" integer NOT NULL DEFAULT '0',\"nextSince\" text);" sqlite3 revocations.sqlite "INSERT INTO \"metadata\" (validDuration, lastDownload, nextSince) VALUES ($(cat revocation_metadata.json | jq .validDuration), $(cat revocation_metadata.json | jq .lastDownload), $(cat revocation_metadata.json | jq .nextSince));" + +sqlite3 revocations-android.sqlite "CREATE TABLE revocations ( uvci text NOT NULL ,PRIMARY KEY (uvci));" ".mode csv" ".import revocations.csv revocations" +sqlite3 revocations-android.sqlite "CREATE TABLE \"metadata\" (\"validDuration\" integer NOT NULL DEFAULT '0',\"lastDownload\" integer NOT NULL DEFAULT '0',\"nextSince\" text NOT NULL DEFAULT '' , PRIMARY KEY (nextSince, validDuration, lastDownload));" +sqlite3 revocations-android.sqlite "INSERT INTO \"metadata\" (validDuration, lastDownload, nextSince) VALUES ($(cat revocation_metadata.json | jq .validDuration), $(cat revocation_metadata.json | jq .lastDownload), $(cat revocation_metadata.json | jq .nextSince));" + rm revocations.csv mv revocations.sqlite ch-covidcertificate-backend-verifier/ch-covidcertificate-backend-verifier-ws/src/main/resources/ +mv revocations-android.sqlite ch-covidcertificate-backend-verifier/ch-covidcertificate-backend-verifier-ws/src/main/resources/ mv revocation_metadata.json ch-covidcertificate-backend-verifier/ch-covidcertificate-backend-verifier-ws/src/main/resources/ ./ch-covidcertificate-backend-verifier/ch-covidcertificate-backend-verifier-valuesets/src/main/resources/test_rules.sh \ No newline at end of file From ef9c6764cab1a53ebeef4daa1ec6ddc45de25628 Mon Sep 17 00:00:00 2001 From: Daniel Gstoehl Date: Wed, 14 Dec 2022 09:05:05 +0000 Subject: [PATCH 05/11] replace cloud connectors with cfenv --- .../pom.xml | 12 ++++---- .../verifier/sync/config/SyncBaseConfig.java | 2 -- .../sync/config/SyncCloudBaseConfig.java | 28 +++++++++---------- .../pom.xml | 8 +++--- .../verifier/ws/config/WsCloudBaseConfig.java | 8 ++---- ch-covidcertificate-backend-verifier/pom.xml | 1 - 6 files changed, 26 insertions(+), 33 deletions(-) diff --git a/ch-covidcertificate-backend-verifier/ch-covidcertificate-backend-verifier-sync/pom.xml b/ch-covidcertificate-backend-verifier/ch-covidcertificate-backend-verifier-sync/pom.xml index 78f922c2..8375ea53 100644 --- a/ch-covidcertificate-backend-verifier/ch-covidcertificate-backend-verifier-sync/pom.xml +++ b/ch-covidcertificate-backend-verifier/ch-covidcertificate-backend-verifier-sync/pom.xml @@ -73,12 +73,6 @@ io.micrometer micrometer-registry-prometheus - - - org.springframework.boot - spring-boot-starter-cloud-connectors - ${spring-cloud-connectors-version} - org.testcontainers postgresql @@ -91,6 +85,12 @@ 1.17.6 test + + + io.pivotal.cfenv + java-cfenv-jdbc + 2.4.1 + diff --git a/ch-covidcertificate-backend-verifier/ch-covidcertificate-backend-verifier-sync/src/main/java/ch/admin/bag/covidcertificate/backend/verifier/sync/config/SyncBaseConfig.java b/ch-covidcertificate-backend-verifier/ch-covidcertificate-backend-verifier-sync/src/main/java/ch/admin/bag/covidcertificate/backend/verifier/sync/config/SyncBaseConfig.java index d1dc0bd3..4e1c4fc1 100644 --- a/ch-covidcertificate-backend-verifier/ch-covidcertificate-backend-verifier-sync/src/main/java/ch/admin/bag/covidcertificate/backend/verifier/sync/config/SyncBaseConfig.java +++ b/ch-covidcertificate-backend-verifier/ch-covidcertificate-backend-verifier-sync/src/main/java/ch/admin/bag/covidcertificate/backend/verifier/sync/config/SyncBaseConfig.java @@ -73,8 +73,6 @@ public abstract class SyncBaseConfig { @Value("${ws.keys.batch-size:1000}") protected Integer dscBatchSize; - public abstract DataSource dataSource(); - public abstract Flyway flyway(); public abstract String getDbType(); diff --git a/ch-covidcertificate-backend-verifier/ch-covidcertificate-backend-verifier-sync/src/main/java/ch/admin/bag/covidcertificate/backend/verifier/sync/config/SyncCloudBaseConfig.java b/ch-covidcertificate-backend-verifier/ch-covidcertificate-backend-verifier-sync/src/main/java/ch/admin/bag/covidcertificate/backend/verifier/sync/config/SyncCloudBaseConfig.java index 9ef74792..f5b40a9a 100644 --- a/ch-covidcertificate-backend-verifier/ch-covidcertificate-backend-verifier-sync/src/main/java/ch/admin/bag/covidcertificate/backend/verifier/sync/config/SyncCloudBaseConfig.java +++ b/ch-covidcertificate-backend-verifier/ch-covidcertificate-backend-verifier-sync/src/main/java/ch/admin/bag/covidcertificate/backend/verifier/sync/config/SyncCloudBaseConfig.java @@ -14,12 +14,12 @@ import javax.sql.DataSource; import org.flywaydb.core.Flyway; import org.springframework.beans.factory.annotation.Value; -import org.springframework.cloud.CloudFactory; -import org.springframework.cloud.service.PooledServiceConnectorConfig.PoolConfig; -import org.springframework.cloud.service.relational.DataSourceConfig; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; +import io.pivotal.cfenv.jdbc.CfJdbcEnv; +import io.pivotal.cfenv.jdbc.CfJdbcService; + @Configuration public abstract class SyncCloudBaseConfig extends SyncBaseConfig { @@ -31,22 +31,20 @@ public abstract class SyncCloudBaseConfig extends SyncBaseConfig { @Value("${datasource.leakDetectionThreshold:0}") int dataSourceLeakDetectionThreshold; - +/* @Bean @Override public DataSource dataSource() { - PoolConfig poolConfig = - new PoolConfig(dataSourceMaximumPoolSize, dataSourceConnectionTimeout); - DataSourceConfig dbConfig = - new DataSourceConfig( - poolConfig, - null, - null, - Map.of("leakDetectionThreshold", dataSourceLeakDetectionThreshold)); - CloudFactory factory = new CloudFactory(); - return factory.getCloud().getSingletonServiceConnector(DataSource.class, dbConfig); - } + CfJdbcEnv cfJdbcEnv = new CfJdbcEnv(); + CfJdbcService cfJdbcService = cfJdbcEnv.findJdbcService(); + String jdbcUrl = cfJdbcService.getJdbcUrl(); + String username = cfJdbcService.getUsername(); + String password = cfJdbcService.getPassword(); + String driverClassName = cfJdbcService.getDriverClassName(); + + } +*/ @Bean @Override public Flyway flyway() { diff --git a/ch-covidcertificate-backend-verifier/ch-covidcertificate-backend-verifier-ws/pom.xml b/ch-covidcertificate-backend-verifier/ch-covidcertificate-backend-verifier-ws/pom.xml index 72a8b7f2..19cdae8a 100644 --- a/ch-covidcertificate-backend-verifier/ch-covidcertificate-backend-verifier-ws/pom.xml +++ b/ch-covidcertificate-backend-verifier/ch-covidcertificate-backend-verifier-ws/pom.xml @@ -57,10 +57,10 @@ spring-boot-starter-actuator - org.springframework.boot - spring-boot-starter-cloud-connectors - ${spring-cloud-connectors-version} - + io.pivotal.cfenv + java-cfenv-boot + 2.4.0 + org.springframework.boot spring-boot-starter-validation diff --git a/ch-covidcertificate-backend-verifier/ch-covidcertificate-backend-verifier-ws/src/main/java/ch/admin/bag/covidcertificate/backend/verifier/ws/config/WsCloudBaseConfig.java b/ch-covidcertificate-backend-verifier/ch-covidcertificate-backend-verifier-ws/src/main/java/ch/admin/bag/covidcertificate/backend/verifier/ws/config/WsCloudBaseConfig.java index 8eb2c2e9..b578c7cc 100644 --- a/ch-covidcertificate-backend-verifier/ch-covidcertificate-backend-verifier-ws/src/main/java/ch/admin/bag/covidcertificate/backend/verifier/ws/config/WsCloudBaseConfig.java +++ b/ch-covidcertificate-backend-verifier/ch-covidcertificate-backend-verifier-ws/src/main/java/ch/admin/bag/covidcertificate/backend/verifier/ws/config/WsCloudBaseConfig.java @@ -14,9 +14,6 @@ import javax.sql.DataSource; import org.flywaydb.core.Flyway; import org.springframework.beans.factory.annotation.Value; -import org.springframework.cloud.CloudFactory; -import org.springframework.cloud.service.PooledServiceConnectorConfig.PoolConfig; -import org.springframework.cloud.service.relational.DataSourceConfig; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; @@ -35,7 +32,7 @@ public abstract class WsCloudBaseConfig extends WsBaseConfig { @Bean @Override public DataSource dataSource() { - PoolConfig poolConfig = + /* PoolConfig poolConfig = new PoolConfig(dataSourceMaximumPoolSize, dataSourceConnectionTimeout); DataSourceConfig dbConfig = new DataSourceConfig( @@ -44,7 +41,8 @@ public DataSource dataSource() { null, Map.of("leakDetectionThreshold", dataSourceLeakDetectionThreshold)); CloudFactory factory = new CloudFactory(); - return factory.getCloud().getSingletonServiceConnector(DataSource.class, dbConfig); + return factory.getCloud().getSingletonServiceConnector(DataSource.class, dbConfig);*/ + } @Bean diff --git a/ch-covidcertificate-backend-verifier/pom.xml b/ch-covidcertificate-backend-verifier/pom.xml index 6803e9d6..a6974cff 100644 --- a/ch-covidcertificate-backend-verifier/pom.xml +++ b/ch-covidcertificate-backend-verifier/pom.xml @@ -31,7 +31,6 @@ 0.11.5 1.17.6 4.42.0 - 2.2.13.RELEASE From fbbf91217013fda3b387fbd27f5ff079ba0dde50 Mon Sep 17 00:00:00 2001 From: Daniel Gstoehl Date: Wed, 14 Dec 2022 10:26:57 +0000 Subject: [PATCH 06/11] remove explicit datasource from config --- .../backend/verifier/sync/config/SyncBaseConfig.java | 2 +- .../verifier/sync/config/SyncCloudBaseConfig.java | 6 ++++-- .../backend/verifier/sync/config/SyncProdConfig.java | 4 ++-- .../backend/verifier/ws/config/WsBaseConfig.java | 3 +-- .../backend/verifier/ws/config/WsCloudBaseConfig.java | 10 +++++----- .../backend/verifier/ws/config/WsProdConfig.java | 4 ++-- 6 files changed, 15 insertions(+), 14 deletions(-) diff --git a/ch-covidcertificate-backend-verifier/ch-covidcertificate-backend-verifier-sync/src/main/java/ch/admin/bag/covidcertificate/backend/verifier/sync/config/SyncBaseConfig.java b/ch-covidcertificate-backend-verifier/ch-covidcertificate-backend-verifier-sync/src/main/java/ch/admin/bag/covidcertificate/backend/verifier/sync/config/SyncBaseConfig.java index 4e1c4fc1..55f64911 100644 --- a/ch-covidcertificate-backend-verifier/ch-covidcertificate-backend-verifier-sync/src/main/java/ch/admin/bag/covidcertificate/backend/verifier/sync/config/SyncBaseConfig.java +++ b/ch-covidcertificate-backend-verifier/ch-covidcertificate-backend-verifier-sync/src/main/java/ch/admin/bag/covidcertificate/backend/verifier/sync/config/SyncBaseConfig.java @@ -73,7 +73,7 @@ public abstract class SyncBaseConfig { @Value("${ws.keys.batch-size:1000}") protected Integer dscBatchSize; - public abstract Flyway flyway(); + public abstract Flyway flyway(DataSource dataSource); public abstract String getDbType(); diff --git a/ch-covidcertificate-backend-verifier/ch-covidcertificate-backend-verifier-sync/src/main/java/ch/admin/bag/covidcertificate/backend/verifier/sync/config/SyncCloudBaseConfig.java b/ch-covidcertificate-backend-verifier/ch-covidcertificate-backend-verifier-sync/src/main/java/ch/admin/bag/covidcertificate/backend/verifier/sync/config/SyncCloudBaseConfig.java index f5b40a9a..f9540943 100644 --- a/ch-covidcertificate-backend-verifier/ch-covidcertificate-backend-verifier-sync/src/main/java/ch/admin/bag/covidcertificate/backend/verifier/sync/config/SyncCloudBaseConfig.java +++ b/ch-covidcertificate-backend-verifier/ch-covidcertificate-backend-verifier-sync/src/main/java/ch/admin/bag/covidcertificate/backend/verifier/sync/config/SyncCloudBaseConfig.java @@ -12,6 +12,8 @@ import java.util.Map; import javax.sql.DataSource; +import javax.xml.crypto.Data; + import org.flywaydb.core.Flyway; import org.springframework.beans.factory.annotation.Value; import org.springframework.context.annotation.Bean; @@ -47,10 +49,10 @@ public DataSource dataSource() { */ @Bean @Override - public Flyway flyway() { + public Flyway flyway(DataSource dataSource) { Flyway flyWay = Flyway.configure() - .dataSource(dataSource()) + .dataSource(dataSource) .locations("classpath:/db/migration/pgsql_cluster") .load(); flyWay.migrate(); diff --git a/ch-covidcertificate-backend-verifier/ch-covidcertificate-backend-verifier-sync/src/main/java/ch/admin/bag/covidcertificate/backend/verifier/sync/config/SyncProdConfig.java b/ch-covidcertificate-backend-verifier/ch-covidcertificate-backend-verifier-sync/src/main/java/ch/admin/bag/covidcertificate/backend/verifier/sync/config/SyncProdConfig.java index caa26621..31b0945f 100644 --- a/ch-covidcertificate-backend-verifier/ch-covidcertificate-backend-verifier-sync/src/main/java/ch/admin/bag/covidcertificate/backend/verifier/sync/config/SyncProdConfig.java +++ b/ch-covidcertificate-backend-verifier/ch-covidcertificate-backend-verifier-sync/src/main/java/ch/admin/bag/covidcertificate/backend/verifier/sync/config/SyncProdConfig.java @@ -69,10 +69,10 @@ public DataSource dataSource() { @Bean @Override - public Flyway flyway() { + public Flyway flyway(DataSource dataSource) { Flyway flyWay = Flyway.configure() - .dataSource(dataSource()) + .dataSource(dataSource) .locations("classpath:/db/migration/pgsql") .load(); flyWay.migrate(); diff --git a/ch-covidcertificate-backend-verifier/ch-covidcertificate-backend-verifier-ws/src/main/java/ch/admin/bag/covidcertificate/backend/verifier/ws/config/WsBaseConfig.java b/ch-covidcertificate-backend-verifier/ch-covidcertificate-backend-verifier-ws/src/main/java/ch/admin/bag/covidcertificate/backend/verifier/ws/config/WsBaseConfig.java index 1540c44e..2af74a51 100644 --- a/ch-covidcertificate-backend-verifier/ch-covidcertificate-backend-verifier-ws/src/main/java/ch/admin/bag/covidcertificate/backend/verifier/ws/config/WsBaseConfig.java +++ b/ch-covidcertificate-backend-verifier/ch-covidcertificate-backend-verifier-ws/src/main/java/ch/admin/bag/covidcertificate/backend/verifier/ws/config/WsBaseConfig.java @@ -92,9 +92,8 @@ protected String[] getDisabledVerificationModes() { return disabledVerificationModes; } - public abstract DataSource dataSource(); - public abstract Flyway flyway(); + public abstract Flyway flyway(DataSource dataSource); @Value("${ws.keys.release-bucket-duration:PT6H}") public void setKeysBucketDuration(Duration bucketDuration) { diff --git a/ch-covidcertificate-backend-verifier/ch-covidcertificate-backend-verifier-ws/src/main/java/ch/admin/bag/covidcertificate/backend/verifier/ws/config/WsCloudBaseConfig.java b/ch-covidcertificate-backend-verifier/ch-covidcertificate-backend-verifier-ws/src/main/java/ch/admin/bag/covidcertificate/backend/verifier/ws/config/WsCloudBaseConfig.java index b578c7cc..e2131bd1 100644 --- a/ch-covidcertificate-backend-verifier/ch-covidcertificate-backend-verifier-ws/src/main/java/ch/admin/bag/covidcertificate/backend/verifier/ws/config/WsCloudBaseConfig.java +++ b/ch-covidcertificate-backend-verifier/ch-covidcertificate-backend-verifier-ws/src/main/java/ch/admin/bag/covidcertificate/backend/verifier/ws/config/WsCloudBaseConfig.java @@ -29,7 +29,7 @@ public abstract class WsCloudBaseConfig extends WsBaseConfig { @Value("${datasource.leakDetectionThreshold:0}") int dataSourceLeakDetectionThreshold; - @Bean + /*@Bean @Override public DataSource dataSource() { /* PoolConfig poolConfig = @@ -41,16 +41,16 @@ public DataSource dataSource() { null, Map.of("leakDetectionThreshold", dataSourceLeakDetectionThreshold)); CloudFactory factory = new CloudFactory(); - return factory.getCloud().getSingletonServiceConnector(DataSource.class, dbConfig);*/ + return factory.getCloud().getSingletonServiceConnector(DataSource.class, dbConfig); - } + }*/ @Bean @Override - public Flyway flyway() { + public Flyway flyway(DataSource dataSource) { Flyway flyWay = Flyway.configure() - .dataSource(dataSource()) + .dataSource(dataSource) .locations("classpath:/db/migration/pgsql_cluster") .load(); flyWay.migrate(); diff --git a/ch-covidcertificate-backend-verifier/ch-covidcertificate-backend-verifier-ws/src/main/java/ch/admin/bag/covidcertificate/backend/verifier/ws/config/WsProdConfig.java b/ch-covidcertificate-backend-verifier/ch-covidcertificate-backend-verifier-ws/src/main/java/ch/admin/bag/covidcertificate/backend/verifier/ws/config/WsProdConfig.java index 08bca859..5e2ebb1d 100644 --- a/ch-covidcertificate-backend-verifier/ch-covidcertificate-backend-verifier-ws/src/main/java/ch/admin/bag/covidcertificate/backend/verifier/ws/config/WsProdConfig.java +++ b/ch-covidcertificate-backend-verifier/ch-covidcertificate-backend-verifier-ws/src/main/java/ch/admin/bag/covidcertificate/backend/verifier/ws/config/WsProdConfig.java @@ -75,10 +75,10 @@ public DataSource dataSource() { @Bean @Override - public Flyway flyway() { + public Flyway flyway(DataSource dataSource) { Flyway flyWay = Flyway.configure() - .dataSource(dataSource()) + .dataSource(dataSource) .locations("classpath:/db/migration/pgsql") .load(); flyWay.migrate(); From 4b4db337e675782a80fb085742755fea460a400e Mon Sep 17 00:00:00 2001 From: Daniel Gstoehl Date: Wed, 14 Dec 2022 10:43:39 +0000 Subject: [PATCH 07/11] fix test config --- .../backend/verifier/ws/config/TestConfig.java | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/ch-covidcertificate-backend-verifier/ch-covidcertificate-backend-verifier-ws/src/test/java/ch/admin/bag/covidcertificate/backend/verifier/ws/config/TestConfig.java b/ch-covidcertificate-backend-verifier/ch-covidcertificate-backend-verifier-ws/src/test/java/ch/admin/bag/covidcertificate/backend/verifier/ws/config/TestConfig.java index a19f8033..832a5c46 100644 --- a/ch-covidcertificate-backend-verifier/ch-covidcertificate-backend-verifier-ws/src/test/java/ch/admin/bag/covidcertificate/backend/verifier/ws/config/TestConfig.java +++ b/ch-covidcertificate-backend-verifier/ch-covidcertificate-backend-verifier-ws/src/test/java/ch/admin/bag/covidcertificate/backend/verifier/ws/config/TestConfig.java @@ -47,14 +47,13 @@ public class TestConfig extends WsBaseConfig { @Autowired DataSource dataSource; - @Override public DataSource dataSource() { return dataSource; } @Bean @Override - public Flyway flyway() { + public Flyway flyway(DataSource dataSource) { final var flyway = Flyway.configure() .dataSource(dataSource) From 731bbbac30c5dc7d9c94d04e994d7a8a722930cf Mon Sep 17 00:00:00 2001 From: Daniel Gstoehl Date: Wed, 14 Dec 2022 14:48:43 +0000 Subject: [PATCH 08/11] cfenv-boot in sync service --- .../ch-covidcertificate-backend-verifier-sync/pom.xml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/ch-covidcertificate-backend-verifier/ch-covidcertificate-backend-verifier-sync/pom.xml b/ch-covidcertificate-backend-verifier/ch-covidcertificate-backend-verifier-sync/pom.xml index 8375ea53..d6176120 100644 --- a/ch-covidcertificate-backend-verifier/ch-covidcertificate-backend-verifier-sync/pom.xml +++ b/ch-covidcertificate-backend-verifier/ch-covidcertificate-backend-verifier-sync/pom.xml @@ -85,10 +85,10 @@ 1.17.6 test - + io.pivotal.cfenv - java-cfenv-jdbc + java-cfenv-boot 2.4.1 From 12d8df8ebbb058bca7f35d48d929f9ad7de09fbb Mon Sep 17 00:00:00 2001 From: gstoehld Date: Fri, 16 Dec 2022 10:27:39 +0100 Subject: [PATCH 09/11] Remove commented out code --- .../sync/config/SyncCloudBaseConfig.java | 22 ------------------- 1 file changed, 22 deletions(-) diff --git a/ch-covidcertificate-backend-verifier/ch-covidcertificate-backend-verifier-sync/src/main/java/ch/admin/bag/covidcertificate/backend/verifier/sync/config/SyncCloudBaseConfig.java b/ch-covidcertificate-backend-verifier/ch-covidcertificate-backend-verifier-sync/src/main/java/ch/admin/bag/covidcertificate/backend/verifier/sync/config/SyncCloudBaseConfig.java index f9540943..0884a5ae 100644 --- a/ch-covidcertificate-backend-verifier/ch-covidcertificate-backend-verifier-sync/src/main/java/ch/admin/bag/covidcertificate/backend/verifier/sync/config/SyncCloudBaseConfig.java +++ b/ch-covidcertificate-backend-verifier/ch-covidcertificate-backend-verifier-sync/src/main/java/ch/admin/bag/covidcertificate/backend/verifier/sync/config/SyncCloudBaseConfig.java @@ -25,28 +25,6 @@ @Configuration public abstract class SyncCloudBaseConfig extends SyncBaseConfig { - @Value("${datasource.maximumPoolSize:5}") - int dataSourceMaximumPoolSize; - - @Value("${datasource.connectionTimeout:30000}") - int dataSourceConnectionTimeout; - - @Value("${datasource.leakDetectionThreshold:0}") - int dataSourceLeakDetectionThreshold; -/* - @Bean - @Override - public DataSource dataSource() { - CfJdbcEnv cfJdbcEnv = new CfJdbcEnv(); - CfJdbcService cfJdbcService = cfJdbcEnv.findJdbcService(); - - String jdbcUrl = cfJdbcService.getJdbcUrl(); - String username = cfJdbcService.getUsername(); - String password = cfJdbcService.getPassword(); - String driverClassName = cfJdbcService.getDriverClassName(); - - } -*/ @Bean @Override public Flyway flyway(DataSource dataSource) { From c1d84060a41a07976ea016936372205322465b6f Mon Sep 17 00:00:00 2001 From: gstoehld Date: Fri, 16 Dec 2022 10:28:37 +0100 Subject: [PATCH 10/11] Delete more commented code --- .../verifier/ws/config/WsCloudBaseConfig.java | 26 ------------------- 1 file changed, 26 deletions(-) diff --git a/ch-covidcertificate-backend-verifier/ch-covidcertificate-backend-verifier-ws/src/main/java/ch/admin/bag/covidcertificate/backend/verifier/ws/config/WsCloudBaseConfig.java b/ch-covidcertificate-backend-verifier/ch-covidcertificate-backend-verifier-ws/src/main/java/ch/admin/bag/covidcertificate/backend/verifier/ws/config/WsCloudBaseConfig.java index e2131bd1..3262945a 100644 --- a/ch-covidcertificate-backend-verifier/ch-covidcertificate-backend-verifier-ws/src/main/java/ch/admin/bag/covidcertificate/backend/verifier/ws/config/WsCloudBaseConfig.java +++ b/ch-covidcertificate-backend-verifier/ch-covidcertificate-backend-verifier-ws/src/main/java/ch/admin/bag/covidcertificate/backend/verifier/ws/config/WsCloudBaseConfig.java @@ -19,32 +19,6 @@ @Configuration public abstract class WsCloudBaseConfig extends WsBaseConfig { - - @Value("${datasource.maximumPoolSize:5}") - int dataSourceMaximumPoolSize; - - @Value("${datasource.connectionTimeout:30000}") - int dataSourceConnectionTimeout; - - @Value("${datasource.leakDetectionThreshold:0}") - int dataSourceLeakDetectionThreshold; - - /*@Bean - @Override - public DataSource dataSource() { - /* PoolConfig poolConfig = - new PoolConfig(dataSourceMaximumPoolSize, dataSourceConnectionTimeout); - DataSourceConfig dbConfig = - new DataSourceConfig( - poolConfig, - null, - null, - Map.of("leakDetectionThreshold", dataSourceLeakDetectionThreshold)); - CloudFactory factory = new CloudFactory(); - return factory.getCloud().getSingletonServiceConnector(DataSource.class, dbConfig); - - }*/ - @Bean @Override public Flyway flyway(DataSource dataSource) { From 7da5edf0adda3b64f9853d68a95199833e349b2e Mon Sep 17 00:00:00 2001 From: gstoehld Date: Fri, 16 Dec 2022 10:29:12 +0100 Subject: [PATCH 11/11] Remove outdated config --- .../backend/verifier/ws/config/TestConfig.java | 6 ------ 1 file changed, 6 deletions(-) diff --git a/ch-covidcertificate-backend-verifier/ch-covidcertificate-backend-verifier-ws/src/test/java/ch/admin/bag/covidcertificate/backend/verifier/ws/config/TestConfig.java b/ch-covidcertificate-backend-verifier/ch-covidcertificate-backend-verifier-ws/src/test/java/ch/admin/bag/covidcertificate/backend/verifier/ws/config/TestConfig.java index 832a5c46..d843861e 100644 --- a/ch-covidcertificate-backend-verifier/ch-covidcertificate-backend-verifier-ws/src/test/java/ch/admin/bag/covidcertificate/backend/verifier/ws/config/TestConfig.java +++ b/ch-covidcertificate-backend-verifier/ch-covidcertificate-backend-verifier-ws/src/test/java/ch/admin/bag/covidcertificate/backend/verifier/ws/config/TestConfig.java @@ -45,12 +45,6 @@ public class TestConfig extends WsBaseConfig { @Value("${revocationList.baseurl}") String baseurl = "https://covidcertificate-management-d.bag.admin.ch/api"; - @Autowired DataSource dataSource; - - public DataSource dataSource() { - return dataSource; - } - @Bean @Override public Flyway flyway(DataSource dataSource) {