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 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/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() 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) - } diff --git a/src/test/resources/test.zip b/src/test/resources/test.zip new file mode 100644 index 00000000..590ead5c Binary files /dev/null and b/src/test/resources/test.zip differ