From abda7bffd13e9796b252e4f63f7e791666a8032b Mon Sep 17 00:00:00 2001 From: Vincent Carluer Date: Fri, 12 May 2023 11:27:36 +0200 Subject: [PATCH 1/6] No more references to CosmosDB in configuration and specific CosmosDB utils. --- .../api/config/CsmPlatformProperties.kt | 58 ------------------- .../com/cosmotech/api/utils/ObjectMappers.kt | 15 ----- 2 files changed, 73 deletions(-) diff --git a/src/main/kotlin/com/cosmotech/api/config/CsmPlatformProperties.kt b/src/main/kotlin/com/cosmotech/api/config/CsmPlatformProperties.kt index df49745e..3e835e19 100644 --- a/src/main/kotlin/com/cosmotech/api/config/CsmPlatformProperties.kt +++ b/src/main/kotlin/com/cosmotech/api/config/CsmPlatformProperties.kt @@ -208,8 +208,6 @@ data class CsmPlatformProperties( val dataWarehouseCluster: CsmPlatformAzureDataWarehouseCluster, val keyVault: String, val analytics: CsmPlatformAzureAnalytics, - /** Azure Cosmos DB */ - val cosmos: CsmPlatformAzureCosmos, val appIdUri: String, val claimToAuthorityPrefix: Map = mutableMapOf("roles" to "") ) { @@ -318,62 +316,6 @@ data class CsmPlatformProperties( val instrumentationKey: String, val connectionString: String ) - - data class CsmPlatformAzureCosmos( - - /** DNS URI of the Azure Cosmos DB account */ - val uri: String, - - /** Azure Cosmos DB Database used for Phoenix */ - val coreDatabase: CoreDatabase, - - /** Access Key of the Azure Cosmos DB database */ - val key: String, - - /** Consistency level. See com.azure.cosmos.ConsistencyLevel for the possible values. */ - val consistencyLevel: String?, - - /** Whether to populate Diagnostics Strings and Query metrics */ - val populateQueryMetrics: Boolean, - - /** - * The connection mode to be used by the clients to Azure Cosmos DB. See - * com.azure.cosmos.ConnectionMode for the possible values. - */ - val connectionMode: String? - ) { - data class CoreDatabase( - /** The core database name in Azure Cosmos DB. Must already exist there. */ - val name: String, - - /** The Connectors configuration */ - val connectors: Connectors, - - /** The Organizations configuration */ - val organizations: Organizations, - - /** The Users configuration */ - val users: Users - ) { - data class Connectors( - - /** Container name for storing all Connectors */ - val container: String - ) - - data class Organizations( - - /** Container name for storing all Organizations */ - val container: String - ) - - data class Users( - - /** Container name for storing all Users */ - val container: String - ) - } - } } enum class Vendor { diff --git a/src/main/kotlin/com/cosmotech/api/utils/ObjectMappers.kt b/src/main/kotlin/com/cosmotech/api/utils/ObjectMappers.kt index c726a648..333db7f1 100644 --- a/src/main/kotlin/com/cosmotech/api/utils/ObjectMappers.kt +++ b/src/main/kotlin/com/cosmotech/api/utils/ObjectMappers.kt @@ -4,7 +4,6 @@ package com.cosmotech.api.utils import com.fasterxml.jackson.core.JsonFactory import com.fasterxml.jackson.databind.DeserializationFeature -import com.fasterxml.jackson.databind.JsonNode import com.fasterxml.jackson.databind.ObjectMapper import com.fasterxml.jackson.databind.SerializationFeature import com.fasterxml.jackson.dataformat.yaml.YAMLFactory @@ -19,17 +18,3 @@ fun objectMapper(jsonFactory: JsonFactory? = null): ObjectMapper = .disable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES) fun yamlObjectMapper(): ObjectMapper = objectMapper(YAMLFactory()) - -/** - * Convert any JsonNode as an object of the domain type specified. - * - * This is a workaround due to Azure Cosmos SDK not being able to deserialize Kotlin data classes - * [1]. - * - * @see [1] https://github.com/Azure/azure-sdk-for-java/issues/12269 - */ -inline fun JsonNode?.toDomain(objectMapper: ObjectMapper? = null): T? = - if (this == null) null - else { - (objectMapper ?: objectMapper()).treeToValue(this, T::class.java) - } From 70ba20ae059bf26064683be86fdceada16b22907 Mon Sep 17 00:00:00 2001 From: Vincent Carluer Date: Fri, 12 May 2023 11:36:03 +0200 Subject: [PATCH 2/6] Removed unecessary check --- src/main/kotlin/com/cosmotech/api/redis/JedisConfig.kt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/main/kotlin/com/cosmotech/api/redis/JedisConfig.kt b/src/main/kotlin/com/cosmotech/api/redis/JedisConfig.kt index b55882dd..44c60395 100644 --- a/src/main/kotlin/com/cosmotech/api/redis/JedisConfig.kt +++ b/src/main/kotlin/com/cosmotech/api/redis/JedisConfig.kt @@ -23,7 +23,7 @@ open class JedisConfig { @Bean // JedisPool must be use with .use autocloseable method open fun csmJedisPool(csmPlatformProperties: CsmPlatformProperties): JedisPool { - val twincacheProperties = csmPlatformProperties.twincache!! + val twincacheProperties = csmPlatformProperties.twincache val password = twincacheProperties.password val host = twincacheProperties.host val port = twincacheProperties.port.toInt() @@ -40,7 +40,7 @@ open class JedisConfig { @Bean open fun csmRedisTimeSeries(csmPlatformProperties: CsmPlatformProperties): RedisTimeSeries { - val twincacheProperties = csmPlatformProperties.twincache!! + val twincacheProperties = csmPlatformProperties.twincache val password = twincacheProperties.password val host = twincacheProperties.host val port = twincacheProperties.port.toInt() From faadfd2f46570279f6ddc1cb37b9cc2df049bb36 Mon Sep 17 00:00:00 2001 From: Vincent Carluer Date: Fri, 12 May 2023 15:20:34 +0200 Subject: [PATCH 3/6] Missing zip file --- ...uild assemble publishToMavenLocal].run.xml | 27 +++++++++++++++++++ 1 file changed, 27 insertions(+) create mode 100644 .run/cosmotech-api-common [clean spotlessApply build assemble publishToMavenLocal].run.xml diff --git a/.run/cosmotech-api-common [clean spotlessApply build assemble publishToMavenLocal].run.xml b/.run/cosmotech-api-common [clean spotlessApply build assemble publishToMavenLocal].run.xml new file mode 100644 index 00000000..956885e8 --- /dev/null +++ b/.run/cosmotech-api-common [clean spotlessApply build assemble publishToMavenLocal].run.xml @@ -0,0 +1,27 @@ + + + + + + + true + true + false + + + \ No newline at end of file From b4d74438f8ae350b5fcb67c9c5629e2a978b89cc Mon Sep 17 00:00:00 2001 From: Vincent Carluer Date: Fri, 12 May 2023 15:20:53 +0200 Subject: [PATCH 4/6] Missing zip file --- src/test/resources/test.zip | Bin 0 -> 314 bytes 1 file changed, 0 insertions(+), 0 deletions(-) create mode 100644 src/test/resources/test.zip diff --git a/src/test/resources/test.zip b/src/test/resources/test.zip new file mode 100644 index 0000000000000000000000000000000000000000..590ead5c7e179e93c0ef8f540dd24ec1d8253ab3 GIT binary patch literal 314 zcmWIWW@h1H00HN!HDO=|l;C8LVMxo&Nj20iLD-I)!;6_XYY6oEqBN& Date: Fri, 12 May 2023 15:27:26 +0200 Subject: [PATCH 5/6] github gradle build action v2 to 2.4.2 https://github.com/Cosmo-Tech/cosmotech-api-common/security/dependabot/3 --- .github/workflows/detekt.yml | 2 +- .github/workflows/lint.yml | 2 +- .github/workflows/publish.yml | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/detekt.yml b/.github/workflows/detekt.yml index f8051114..cedcdd62 100644 --- a/.github/workflows/detekt.yml +++ b/.github/workflows/detekt.yml @@ -33,7 +33,7 @@ jobs: - name: Check with Detekt env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - uses: gradle/gradle-build-action@v2 + uses: gradle/gradle-build-action@2.4.2 with: cache-disabled: false # Cache storage space is limited for GitHub actions diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml index e6228e8f..1adcc9fc 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yml @@ -29,7 +29,7 @@ jobs: - name: Check with Spotless env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - uses: gradle/gradle-build-action@v2 + uses: gradle/gradle-build-action@2.4.2 with: cache-disabled: false # Cache storage space is limited for GitHub actions diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index d5510a0e..22755a32 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -29,7 +29,7 @@ jobs: - name: Build with Gradle env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - uses: gradle/gradle-build-action@v2 + uses: gradle/gradle-build-action@2.4.2 with: cache-disabled: true arguments: | From 719f45898f211a12e55da29d06bae3b3fe78ac1f Mon Sep 17 00:00:00 2001 From: Vincent Carluer Date: Fri, 12 May 2023 15:33:18 +0200 Subject: [PATCH 6/6] github gradle build action v2 (do not find 2.4.2...) --- .github/workflows/detekt.yml | 2 +- .github/workflows/lint.yml | 2 +- .github/workflows/publish.yml | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/detekt.yml b/.github/workflows/detekt.yml index cedcdd62..f8051114 100644 --- a/.github/workflows/detekt.yml +++ b/.github/workflows/detekt.yml @@ -33,7 +33,7 @@ jobs: - name: Check with Detekt env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - uses: gradle/gradle-build-action@2.4.2 + uses: gradle/gradle-build-action@v2 with: cache-disabled: false # Cache storage space is limited for GitHub actions diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml index 1adcc9fc..e6228e8f 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yml @@ -29,7 +29,7 @@ jobs: - name: Check with Spotless env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - uses: gradle/gradle-build-action@2.4.2 + uses: gradle/gradle-build-action@v2 with: cache-disabled: false # Cache storage space is limited for GitHub actions diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index 22755a32..d5510a0e 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -29,7 +29,7 @@ jobs: - name: Build with Gradle env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - uses: gradle/gradle-build-action@2.4.2 + uses: gradle/gradle-build-action@v2 with: cache-disabled: true arguments: |