Skip to content

Commit

Permalink
Merge pull request #16 from OSGP/feature/FDP-2428
Browse files Browse the repository at this point in the history
FDP-2428: Update Gradle and dependencies
  • Loading branch information
jasperkamerling authored Jul 4, 2024
2 parents 732907f + 248a937 commit 10fb05c
Show file tree
Hide file tree
Showing 12 changed files with 74 additions and 49 deletions.
12 changes: 6 additions & 6 deletions .github/workflows/gradle.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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@v3
with:
dependency-graph: generate-and-submit
- name: Build with Gradle
run: ./gradlew build integrationTest bootBuildImage
run: ./gradlew build testCodeCoverageReport integrationTestCodeCoverageReport integrationTest bootBuildImage
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Run sonar analysis with Gradle
run: ./gradlew testCodeCoverageReport integrationTestCodeCoverageReport sonar
run: ./gradlew sonar
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
Expand Down
10 changes: 6 additions & 4 deletions application/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,12 @@ dependencies {
implementation("org.springframework.boot:spring-boot-starter-security")
implementation("org.springframework.boot:spring-boot-starter-logging")
implementation("org.springframework.kafka:spring-kafka")
implementation("com.gxf.utilities:kafka-azure-oauth:0.2")
implementation("org.apache.httpcomponents:httpclient:4.5.14") {
implementation(libs.kafkaAzureOAuth)
implementation(libs.apacheHttpClient) {
exclude("commons-logging")
}
implementation(kotlin("reflect"))
implementation("io.github.microutils:kotlin-logging-jvm:3.0.5")
implementation(libs.logging)

implementation("org.springframework:spring-aspects")

Expand All @@ -30,6 +30,8 @@ dependencies {
testImplementation("org.mockito:mockito-junit-jupiter")
testImplementation("org.assertj:assertj-core")

testRuntimeOnly("org.junit.platform:junit-platform-launcher")

// Generate test and integration test reports
jacocoAggregation(project(":application"))
}
Expand Down Expand Up @@ -57,7 +59,7 @@ testing {
implementation("org.springframework.kafka:spring-kafka-test")
implementation("org.assertj:assertj-core")
implementation("org.springframework.boot:spring-boot-starter-webflux")
implementation("org.wiremock:wiremock-standalone:3.3.1")
implementation(testLibs.mockServer)
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

package org.gxf.soapbridge.configuration.properties

import mu.KotlinLogging
import io.github.oshai.kotlinlogging.KotlinLogging
import org.springframework.boot.context.properties.ConfigurationProperties
import java.io.IOException
import java.nio.file.Files
Expand Down Expand Up @@ -55,7 +55,7 @@ class SigningConfigurationProperties(
val privateKeyFactory = KeyFactory.getInstance(keyType, provider)
privateKeyFactory.generatePrivate(privateKeySpec)
} catch (e: Exception) {
logger.error("Unexpected exception during private key creation", e)
logger.error(e) { "Unexpected exception during private key creation" }
null
}
}
Expand All @@ -69,7 +69,7 @@ class SigningConfigurationProperties(
val publicKeyFactory = KeyFactory.getInstance(keyType, provider)
publicKeyFactory.generatePublic(publicKeySpec)
} catch (e: Exception) {
logger.error("Unexpected exception during public key creation", e)
logger.error(e) { "Unexpected exception during public key creation" }
null
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

package org.gxf.soapbridge.kafka.listeners

import mu.KotlinLogging
import io.github.oshai.kotlinlogging.KotlinLogging
import org.apache.kafka.clients.consumer.ConsumerRecord
import org.gxf.soapbridge.application.services.PlatformCommunicationService
import org.gxf.soapbridge.valueobjects.ProxyServerRequestMessage
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

package org.gxf.soapbridge.kafka.listeners

import mu.KotlinLogging
import io.github.oshai.kotlinlogging.KotlinLogging
import org.apache.kafka.clients.consumer.ConsumerRecord
import org.gxf.soapbridge.application.services.ClientCommunicationService
import org.gxf.soapbridge.valueobjects.ProxyServerResponseMessage
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

package org.gxf.soapbridge.kafka.senders

import mu.KotlinLogging
import io.github.oshai.kotlinlogging.KotlinLogging
import org.gxf.soapbridge.kafka.properties.TopicsConfigurationProperties
import org.gxf.soapbridge.valueobjects.ProxyServerRequestMessage
import org.springframework.kafka.core.KafkaTemplate
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

package org.gxf.soapbridge.kafka.senders

import mu.KotlinLogging
import io.github.oshai.kotlinlogging.KotlinLogging
import org.gxf.soapbridge.kafka.properties.TopicsConfigurationProperties
import org.gxf.soapbridge.valueobjects.ProxyServerResponseMessage
import org.springframework.kafka.core.KafkaTemplate
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

package org.gxf.soapbridge.valueobjects

import mu.KotlinLogging
import io.github.oshai.kotlinlogging.KotlinLogging
import org.gxf.soapbridge.exceptions.ProxyMessageException
import java.util.*

Expand Down Expand Up @@ -43,7 +43,7 @@ class ProxyServerRequestMessage(
"Invalid number of tokens, not trying to create ProxyServerRequestMessage."
)
}
if (LOGGER.isDebugEnabled) {
if (LOGGER.isDebugEnabled()) {
printValues(numTokens, split)
}
val connectionId = split[0]
Expand All @@ -67,16 +67,16 @@ class ProxyServerRequestMessage(
}

private fun printValues(numTokens: Int, split: List<String?>) {
if (LOGGER.isDebugEnabled) {
LOGGER.debug("split[0] connection-id: {}", split[0])
LOGGER.debug("split[2] context : {}", decode(split[1]))
LOGGER.debug("split[3] encoded soap-request length: {}", split[2]!!.length)
LOGGER.debug("split[3] soap-request : {}", decode(split[2]))
if (LOGGER.isDebugEnabled()) {
LOGGER.debug { "split[0] connection-id: ${split[0]}" }
LOGGER.debug { "split[2] context : ${decode(split[1])}" }
LOGGER.debug { "split[3] encoded soap-request length: ${split[2]!!.length}" }
LOGGER.debug { "split[3] soap-request : ${decode(split[2])}" }
if (numTokens == 5) {
LOGGER.debug("split[4] security-key : {}", split[3])
LOGGER.debug { "split[4] security-key : ${split[3]}" }
} else {
LOGGER.debug("split[4] common-name : {}", decode(split[3]))
LOGGER.debug("split[5] security-signature : {}", split[4])
LOGGER.debug { "split[4] common-name : ${decode(split[3])}" }
LOGGER.debug { "split[5] security-signature : ${split[4]}" }
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

package org.gxf.soapbridge.valueobjects

import mu.KotlinLogging
import io.github.oshai.kotlinlogging.KotlinLogging
import org.gxf.soapbridge.exceptions.ProxyMessageException
import java.util.*

Expand Down Expand Up @@ -38,11 +38,11 @@ class ProxyServerResponseMessage(connectionId: String, val soapResponse: String)
"Invalid number of tokens, don't try to create ProxyServerResponseMessage"
)
}
if (logger.isDebugEnabled) {
logger.debug("split[0] connection-id: {}", split[0])
logger.debug("split[1] encoded soap-response length: {}", split[1].length)
logger.debug("split[1] soap-response: {}", decode(split[1]))
logger.debug("split[2] security-key : {}", split[2])
if (logger.isDebugEnabled()) {
logger.debug { "split[0] connection-id: ${split[0]}" }
logger.debug { "split[1] encoded soap-response length: ${split[1].length}" }
logger.debug { "split[1] soap-response: ${decode(split[1])}" }
logger.debug { "split[2] security-key : ${split[2]}" }
}
val proxyServerResponseMessage = ProxyServerResponseMessage(split[0], decode(split[1]))
proxyServerResponseMessage.signature = split[2]
Expand Down
32 changes: 17 additions & 15 deletions build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,16 +1,18 @@
// Copyright 2023 Alliander N.V.

import com.github.davidmc24.gradle.plugin.avro.GenerateAvroJavaTask
import io.spring.gradle.dependencymanagement.internal.dsl.StandardDependencyManagementExtension
import org.jetbrains.kotlin.gradle.dsl.KotlinJvmProjectExtension
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile

plugins {
id("org.springframework.boot") version "3.2.1" 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.1" apply false
id("io.spring.dependency-management") version "1.1.5" apply false
kotlin("jvm") version "2.0.0" apply false
kotlin("plugin.spring") version "2.0.0" apply false
kotlin("plugin.jpa") version "2.0.0" 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.0.0.4638"
id("eclipse")
}

Expand Down Expand Up @@ -48,25 +50,25 @@ 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"
}
}

tasks.withType<KotlinCompile> {
dependsOn(tasks.withType<GenerateAvroJavaTask>())
}

tasks.withType<Test> {
useJUnitPlatform()
}
Expand Down
2 changes: 1 addition & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-8.5-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-8.8-bin.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
21 changes: 21 additions & 0 deletions settings.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,24 @@
rootProject.name = "gxf-soap-bridge"

include("application")

dependencyResolutionManagement {
versionCatalogs {
create("libs") {
version("kotlinLogging", "7.0.0")
version("gxfUtils", "0.3.7")
version("apacheHttpClient", "4.5.14")


library("logging", "io.github.oshai", "kotlin-logging-jvm").versionRef("kotlinLogging")

library("kafkaAzureOAuth", "com.gxf.utilities", "kafka-azure-oauth").versionRef("gxfUtils")
library("apacheHttpClient", "org.apache.httpcomponents", "httpclient").versionRef("apacheHttpClient")
}
create("testLibs") {
version("wiremock", "3.6.0")

library("mockServer", "org.wiremock", "wiremock-standalone").versionRef("wiremock")
}
}
}

0 comments on commit 10fb05c

Please sign in to comment.