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 79c69ed commit 64c47b9
Show file tree
Hide file tree
Showing 15 changed files with 104 additions and 74 deletions.
2 changes: 2 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -20,3 +20,5 @@ indent_size = 4
[*.{kt,kts}]
ij_kotlin_allow_trailing_comma_on_call_site = true
ij_kotlin_allow_trailing_comma = true
# To satisfy ktlint rules, see: https://stackoverflow.com/questions/59849619/intellij-does-not-sort-kotlin-imports-according-to-ktlints-expectations
ij_kotlin_imports_layout = *,java.**,javax.**,kotlin.**,^
2 changes: 1 addition & 1 deletion .env
Original file line number Diff line number Diff line change
@@ -1 +1 @@
KAFKA_CONFLUENT_VERSION=7.6.0
KAFKA_CONFLUENT_VERSION=7.5.0
2 changes: 2 additions & 0 deletions buildSrc/src/main/kotlin/Versions.kt
Original file line number Diff line number Diff line change
Expand Up @@ -22,4 +22,6 @@ object Versions {
const val mockitoKotlin = "5.3.1"
const val grizzly = "4.0.2"
const val hamcrest = "2.2"

const val wrapper = "8.4"
}
55 changes: 55 additions & 0 deletions gateway.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
# Resource config class
#resourceConfig: org.radarbase.gateway.inject.ManagementPortalEnhancerFactory

server:
# URI to serve data to
baseUri: http://0.0.0.0:8090/radar-gateway/
# Maximum number of simultaneous requests to Kafka.
#maxRequests: 200
# Maximum request content length, also when decompressed.
# This protects against memory overflows.
#maxRequestSize: 25165824
# Whether JMX should be enabled. Disable if not needed, for higher performance.
#isJmxEnabled: true

kafka:
# Number of Kafka brokers to keep in a pool for reuse in multiple requests.
# poolSize: 20
# Kafka producer settings. Read from https://kafka.apache.org/documentation/#producerconfigs.
producer:
bootstrap.servers: kafka-1:9092
security.protocol: PLAINTEXT
# Kafka Admin Client settings. Read from https://kafka.apache.org/documentation/#adminclientconfigs.
#admin:
# bootstrap server property is copied from the producer settings if none is provided.
#bootstrap.servers: kafka-1:9092
# Kafka serialization settings, used in KafkaAvroSerializer. Read from [io.confluent.kafka.serializers.AbstractKafkaSchemaSerDeConfig].
serialization:
schema.registry.url: http://schema-registry:8081

# Authorization settings
auth:
# ManagementPortal URL. If available, this is used to read the public key from
# ManagementPortal directly. This is the recommended method of getting public key.
managementPortalUrl: http://managementportal:8080/managementportal
# Whether to check that the user that submits data has the reported source ID registered
# in the ManagementPortal.
#checkSourceId: true
# OAuth 2.0 resource name.
#resourceName: res_gateway
# OAuth 2.0 token issuer. If null, this is not checked.
#issuer: null
# Key store for checking the digital signature of OAuth 2.0 JWTs.
#keyStore:
# Path to the p12 key store.
#path: null
# Alias in the key store to use
#alias: null
# Password of the key store
#password: null
# Plain-text PEM public keys
#publicKeys:
# ECDSA public keys
#ecdsa: []
# RSA public keys
#rsa: []
55 changes: 0 additions & 55 deletions radar-gateway/gateway.yml

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
package org.radarbase.gateway.resource

import io.ktor.client.*
import io.ktor.client.engine.cio.*
import io.ktor.client.request.*
import io.ktor.http.*
import io.ktor.client.HttpClient
import io.ktor.client.engine.cio.CIO
import io.ktor.client.request.get
import io.ktor.client.request.head
import io.ktor.http.HttpStatusCode
import io.ktor.http.Url
import kotlinx.coroutines.runBlocking
import org.hamcrest.MatcherAssert.assertThat
import org.hamcrest.Matchers.equalTo
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,11 @@ import org.radarbase.gateway.io.AvroProcessor
import org.radarbase.gateway.io.AvroProcessorFactory
import org.radarbase.gateway.io.BinaryToAvroConverter
import org.radarbase.gateway.io.LzfseEncoder
import org.radarbase.gateway.kafka.*
import org.radarbase.gateway.kafka.KafkaAdminService
import org.radarbase.gateway.kafka.KafkaAdminServiceFactory
import org.radarbase.gateway.kafka.KafkaHealthMetric
import org.radarbase.gateway.kafka.ProducerPool
import org.radarbase.gateway.kafka.ProducerPoolFactory
import org.radarbase.gateway.service.SchedulingService
import org.radarbase.gateway.service.SchedulingServiceFactory
import org.radarbase.jersey.enhancer.JerseyResourceEnhancer
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,20 +3,20 @@ 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.engine.cio.CIO
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.basic
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

/** Creates a Schema Retriever based on the current schema registry configuration. */
class SchemaRetrieverFactory(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,10 @@ import com.fasterxml.jackson.databind.JsonNode
import com.fasterxml.jackson.databind.ObjectMapper
import com.fasterxml.jackson.databind.node.ObjectNode
import kotlinx.coroutines.async
import kotlinx.coroutines.channels.*
import kotlinx.coroutines.channels.Channel
import kotlinx.coroutines.channels.Channel.Factory.UNLIMITED
import kotlinx.coroutines.channels.SendChannel
import kotlinx.coroutines.channels.consume
import kotlinx.coroutines.coroutineScope
import kotlinx.coroutines.isActive
import org.apache.avro.Schema
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,11 @@
package org.radarbase.gateway.io

import jakarta.ws.rs.core.Context
import kotlinx.coroutines.*
import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.async
import kotlinx.coroutines.coroutineScope
import kotlinx.coroutines.isActive
import kotlinx.coroutines.withContext
import org.apache.avro.Schema
import org.apache.avro.generic.GenericData
import org.apache.avro.generic.GenericDatumReader
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@ package org.radarbase.gateway.kafka

import io.confluent.kafka.schemaregistry.client.SchemaRegistryClient
import io.confluent.kafka.serializers.KafkaAvroSerializer
import kotlinx.coroutines.*
import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.withContext
import org.apache.avro.generic.GenericRecord
import org.apache.kafka.clients.producer.KafkaProducer
import org.apache.kafka.clients.producer.Producer
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,12 @@ import kotlinx.coroutines.sync.Semaphore
import kotlinx.coroutines.sync.withPermit
import org.apache.avro.generic.GenericRecord
import org.apache.kafka.common.KafkaException
import org.apache.kafka.common.errors.*
import org.apache.kafka.common.errors.AuthenticationException
import org.apache.kafka.common.errors.AuthorizationException
import org.apache.kafka.common.errors.OutOfOrderSequenceException
import org.apache.kafka.common.errors.ProducerFencedException
import org.apache.kafka.common.errors.SerializationException
import org.apache.kafka.common.errors.TimeoutException
import org.radarbase.gateway.config.GatewayConfig
import org.radarbase.jersey.exception.HttpApplicationException
import org.radarbase.jersey.exception.HttpBadGatewayException
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,13 @@ package org.radarbase.gateway.resource
import com.fasterxml.jackson.annotation.JsonProperty
import com.fasterxml.jackson.databind.JsonNode
import jakarta.inject.Singleton
import jakarta.ws.rs.*
import jakarta.ws.rs.Consumes
import jakarta.ws.rs.GET
import jakarta.ws.rs.OPTIONS
import jakarta.ws.rs.POST
import jakarta.ws.rs.Path
import jakarta.ws.rs.PathParam
import jakarta.ws.rs.Produces
import jakarta.ws.rs.container.AsyncResponse
import jakarta.ws.rs.container.Suspended
import jakarta.ws.rs.core.Context
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,9 @@ import com.fasterxml.jackson.databind.ObjectMapper
import org.apache.avro.Schema
import org.apache.avro.generic.GenericArray
import org.apache.avro.generic.GenericRecord
import org.hamcrest.CoreMatchers.*
import org.hamcrest.CoreMatchers.`is`
import org.hamcrest.CoreMatchers.not
import org.hamcrest.CoreMatchers.nullValue
import org.hamcrest.MatcherAssert.assertThat
import org.junit.jupiter.api.Test
import org.radarbase.producer.avro.AvroDataMapperFactory.IDENTITY_MAPPER
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
package org.radarbase.gateway.io

import io.ktor.http.content.*
import io.ktor.utils.io.*
import io.ktor.utils.io.jvm.javaio.*
import io.ktor.http.content.OutgoingContent
import io.ktor.utils.io.ByteChannel
import io.ktor.utils.io.jvm.javaio.toInputStream
import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.runBlocking
import org.apache.avro.generic.GenericRecordBuilder
Expand Down

0 comments on commit 64c47b9

Please sign in to comment.