Skip to content

Commit

Permalink
Merge pull request #17 from OSGP/feature/FDP-2607-update-commons-comp…
Browse files Browse the repository at this point in the history
…ress

FDP-2607: update dependencies
  • Loading branch information
loesimmens authored Sep 23, 2024
2 parents e547f0d + ba4e037 commit bf778ee
Show file tree
Hide file tree
Showing 6 changed files with 37 additions and 40 deletions.
12 changes: 6 additions & 6 deletions .github/workflows/gradle.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
#
# SPDX-License-Identifier: Apache-2.0

name: Gradle Pipeline
name: Build Pipeline

on:
push:
Expand All @@ -19,21 +19,21 @@ jobs:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Set up JDK 17
uses: actions/setup-java@v3
- name: Set up JDK 21
uses: actions/setup-java@v4
with:
java-version: '17'
java-version: '21'
distribution: 'temurin'
- name: Setup Gradle to generate and submit dependency graphs
uses: gradle/[email protected]
uses: gradle/actions/setup-gradle@v4
with:
dependency-graph: generate-and-submit
- name: Build with Gradle
run: ./gradlew build integrationTest bootBuildImage
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Run sonar analysis with Gradle
run: ./gradlew sonar
run: ./gradlew testCodeCoverageReport integrationTestCodeCoverageReport sonar
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
Expand Down
5 changes: 4 additions & 1 deletion application/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,9 @@ dependencies {
implementation("org.springframework:spring-aspects")

runtimeOnly("io.micrometer:micrometer-registry-prometheus")

// Generate test and integration test reports
jacocoAggregation(project(":application"))
}

tasks.withType<org.springframework.boot.gradle.tasks.bundling.BootBuildImage> {
Expand All @@ -39,7 +42,7 @@ testing {
implementation(project())
implementation("org.springframework.boot:spring-boot-starter-test")
implementation("org.springframework.kafka:spring-kafka-test")
implementation(integrationTestLibs.kafkaTestContainers)
implementation("org.testcontainers:kafka")
}
}
}
Expand Down
30 changes: 14 additions & 16 deletions build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -3,16 +3,16 @@
// SPDX-License-Identifier: Apache-2.0

import io.spring.gradle.dependencymanagement.internal.dsl.StandardDependencyManagementExtension
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
import org.jetbrains.kotlin.gradle.dsl.KotlinJvmProjectExtension

plugins {
id("org.springframework.boot") version "3.2.2" apply false
id("io.spring.dependency-management") version "1.1.4" apply false
kotlin("jvm") version "1.9.22" apply false
kotlin("plugin.spring") version "1.9.22" apply false
kotlin("plugin.jpa") version "1.9.22" apply false
id("org.springframework.boot") version "3.3.4" apply false
id("io.spring.dependency-management") version "1.1.6" apply false
kotlin("jvm") version "2.0.20" apply false
kotlin("plugin.spring") version "2.0.20" apply false
kotlin("plugin.jpa") version "2.0.20" apply false
id("com.github.davidmc24.gradle.plugin.avro") version "1.9.1" apply false
id("org.sonarqube") version "4.4.1.3373"
id("org.sonarqube") version "5.1.0.4882"
id("eclipse")
}

Expand All @@ -32,6 +32,8 @@ subprojects {
apply(plugin = "io.spring.dependency-management")
apply(plugin = "org.jetbrains.kotlin.plugin.jpa")
apply(plugin = "eclipse")
apply(plugin = "jacoco")
apply(plugin = "jacoco-report-aggregation")

group = "org.gxf.template"
version = rootProject.version
Expand All @@ -48,22 +50,18 @@ subprojects {
}
}

extensions.configure<JavaPluginExtension> {
toolchain {
languageVersion.set(JavaLanguageVersion.of(21))
}
}

extensions.configure<StandardDependencyManagementExtension> {
imports {
mavenBom(org.springframework.boot.gradle.plugin.SpringBootPlugin.BOM_COORDINATES)
}
}

tasks.withType<KotlinCompile> {
kotlinOptions {
extensions.configure<KotlinJvmProjectExtension> {
jvmToolchain {
languageVersion = JavaLanguageVersion.of(21)
}
compilerOptions {
freeCompilerArgs = listOf("-Xjsr305=strict")
jvmTarget = "21"
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
package org.gxf.servicetemplate.kafka

import io.github.oshai.kotlinlogging.KotlinLogging
import org.gxf.service.Measurement
import org.apache.avro.specific.SpecificRecordBase
import org.springframework.kafka.core.KafkaTemplate
import org.springframework.scheduling.annotation.Scheduled
import org.springframework.stereotype.Service
Expand All @@ -14,7 +14,7 @@ import kotlin.random.Random

@Service
class GxfKafkaProducer(
private val kafkaTemplate: KafkaTemplate<String, Measurement>,
private val kafkaTemplate: KafkaTemplate<String, SpecificRecordBase>,
private val measurementGenerator: MeasurementGenerator
) {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ package org.gxf.servicetemplate.kafka.configuration

import com.gxf.utilities.kafka.avro.AvroDeserializer
import com.gxf.utilities.kafka.avro.AvroSerializer
import org.apache.avro.specific.SpecificRecordBase
import org.gxf.service.Measurement
import org.apache.kafka.common.serialization.StringDeserializer
import org.apache.kafka.common.serialization.StringSerializer
Expand All @@ -21,27 +22,27 @@ import org.springframework.kafka.core.*
class KafkaConfiguration(val kafkaProperties: KafkaProperties, private val sslBundles: SslBundles) {

@Bean
fun kafkaListenerContainerFactory(consumerFactory: ConsumerFactory<String, Measurement>): ConcurrentKafkaListenerContainerFactory<String, Measurement> =
ConcurrentKafkaListenerContainerFactory<String, Measurement>()
fun kafkaListenerContainerFactory(consumerFactory: ConsumerFactory<String, SpecificRecordBase>): ConcurrentKafkaListenerContainerFactory<String, SpecificRecordBase> =
ConcurrentKafkaListenerContainerFactory<String, SpecificRecordBase>()
.apply { this.consumerFactory = consumerFactory }

@Bean
fun kafkaTemplate(producerFactory: ProducerFactory<String, Measurement>) =
fun kafkaTemplate(producerFactory: ProducerFactory<String, SpecificRecordBase>) =
KafkaTemplate(producerFactory)

@Bean
fun consumerFactory(): ConsumerFactory<String, Measurement> =
fun consumerFactory(): ConsumerFactory<String, SpecificRecordBase> =
DefaultKafkaConsumerFactory(
kafkaProperties.buildConsumerProperties(sslBundles),
StringDeserializer(),
AvroDeserializer(Measurement.getDecoder())
AvroDeserializer(listOf(Measurement.getClassSchema()))
)

@Bean
fun producerFactory(): ProducerFactory<String, Measurement> =
fun producerFactory(): ProducerFactory<String, SpecificRecordBase> =
DefaultKafkaProducerFactory(
kafkaProperties.buildProducerProperties(sslBundles),
StringSerializer(),
AvroSerializer(Measurement.getEncoder())
AvroSerializer()
)
}
11 changes: 3 additions & 8 deletions settings.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -12,22 +12,17 @@ include("components:mqtt")
dependencyResolutionManagement {
versionCatalogs {
create("libs") {
library("logging", "io.github.oshai", "kotlin-logging-jvm").version("6.0.1")
library("logging", "io.github.oshai", "kotlin-logging-jvm").version("7.0.0")

version("mapstruct", "1.5.5.Final")
library("mapstruct", "org.mapstruct", "mapstruct").versionRef("mapstruct")
library("mapstructannotation", "org.mapstruct", "mapstruct-processor").versionRef("mapstruct")

library("avro", "org.apache.avro", "avro").version("1.11.3")
library("avro", "org.apache.avro", "avro").version("1.12.0")

version("gxfUtils", "0.2")
version("gxfUtils", "2.0")
library("kafkaAvro", "com.gxf.utilities", "kafka-avro").versionRef("gxfUtils")
library("kafkaAzureOAuth", "com.gxf.utilities", "kafka-azure-oauth").versionRef("gxfUtils")
}
create("integrationTestLibs") {
version("testContainers", "1.19.3")
library("kafkaTestContainers", "org.testcontainers", "kafka").versionRef("testContainers")

}
}
}

0 comments on commit bf778ee

Please sign in to comment.