Skip to content

Commit

Permalink
Fix linting errors
Browse files Browse the repository at this point in the history
  • Loading branch information
Bdegraaf1234 committed Jun 11, 2024
1 parent 553e02a commit ed609ee
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 18 deletions.
6 changes: 2 additions & 4 deletions buildSrc/src/main/kotlin/Versions.kt
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
@Suppress("ConstPropertyName")
object Versions {
const val project = "0.7.1-SNAPSHOT"
const val project = "0.7.2-SNAPSHOT"

const val java = 17
const val kotlin = "1.9.22"
Expand All @@ -9,7 +9,7 @@ object Versions {
const val ktor = "2.3.10"
const val radarJersey = "0.11.1"
const val radarCommons = "1.1.2"
const val radarSchemas = "0.8.7"
const val radarSchemas = "0.8.8"
const val jackson = "2.15.3"
const val slf4j = "2.0.13"
const val log4j2 = "2.23.1"
Expand All @@ -22,6 +22,4 @@ object Versions {
const val mockitoKotlin = "5.3.1"
const val grizzly = "4.0.2"
const val hamcrest = "2.2"

const val wrapper = "8.4"
}
2 changes: 1 addition & 1 deletion radar-gateway/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import com.github.jk1.license.filter.ExcludeTransitiveDependenciesFilter
import java.time.Duration
import com.github.jk1.license.filter.*

plugins {
application
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,20 +3,15 @@ package org.radarbase.gateway.inject
import io.confluent.kafka.schemaregistry.client.SchemaRegistryClientConfig.USER_INFO_CONFIG
import io.confluent.kafka.serializers.AbstractKafkaSchemaSerDeConfig.SCHEMA_REGISTRY_URL_CONFIG
import io.confluent.kafka.serializers.AbstractKafkaSchemaSerDeConfig.SCHEMA_REGISTRY_USER_INFO_CONFIG
import io.ktor.client.HttpClient
import io.ktor.client.engine.cio.CIO
import io.ktor.client.plugins.auth.Auth
import io.ktor.client.plugins.auth.providers.BasicAuthCredentials
import io.ktor.client.plugins.auth.providers.basic
import jakarta.ws.rs.core.Context
import java.util.function.Supplier
import kotlin.time.Duration.Companion.seconds
import org.radarbase.config.ServerConfig
import org.radarbase.gateway.config.GatewayConfig
import org.radarbase.producer.io.timeout
import org.radarbase.producer.schema.SchemaRetriever
import org.radarbase.producer.schema.SchemaRetriever.Companion.schemaRetriever
import org.slf4j.LoggerFactory
import java.util.function.Supplier
import kotlin.time.Duration.Companion.seconds

Expand All @@ -37,25 +32,26 @@ class SchemaRetrieverFactory(
?: config.kafka.serialization[USER_INFO_CONFIG].asNonEmptyString()

return schemaRetriever(baseUrl = server.urlString) {
if (basicCredentials != null && basicCredentials.contains(':')) {
val (apiKey, apiSecret) = basicCredentials.split(':', limit = 2)
httpClient = HttpClient(CIO) {
timeout(30.seconds)
httpClient {
if (basicCredentials != null && basicCredentials.contains(':')) {
install(Auth) {
basic {
sendWithoutRequest { true }
credentials {
BasicAuthCredentials(username = apiKey, password = apiSecret)
val (username, password) = basicCredentials.split(':', limit = 2)
BasicAuthCredentials(
username = username,
password = password,
)
}
}
}
timeout(30.seconds)
}
}
}
}

companion object {
private fun Any?.asNonEmptyString(): String? = (this as? String)?.takeIf { it.isNotEmpty() }
private val logger = LoggerFactory.getLogger(SchemaRetrieverFactory::class.java)
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ class AvroProcessor(
"Schema ID not found in subject",
)
} else {
throw HttpBadGatewayException("cannot get data from schema registry: ${ex.javaClass.simpleName}")
throw HttpBadGatewayException("cannot get data from schema registry: $ex")
}
}
createMapping(topic, ofValue, parsedSchema.schema)
Expand Down

0 comments on commit ed609ee

Please sign in to comment.