Skip to content

Commit

Permalink
Update dependencies. Fix issue with event ID access (#31)
Browse files Browse the repository at this point in the history
* Update dependencies and migrate to th2 gradle plugin

* Update chanage log

* Add nvd api key to workflows

* add missing plugins

* Remove duplicated workflow

* Update gradle version in workflow files

* Update action versions
  • Loading branch information
OptimumCode authored Jul 26, 2024
1 parent 859f99c commit aea5ac0
Show file tree
Hide file tree
Showing 18 changed files with 74 additions and 81 deletions.
3 changes: 2 additions & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,4 +20,5 @@ jobs:
sonatypeUsername: ${{ secrets.SONATYPE_NEXUS_USERNAME }}
sonatypePassword: ${{ secrets.SONATYPE_NEXUS_PASSWORD }}
sonatypeSigningKey: ${{ secrets.SONATYPE_GPG_ARMORED_KEY }}
sonatypeSigningPassword: ${{ secrets.SONATYPE_SIGNING_PASSWORD }}
sonatypeSigningPassword: ${{ secrets.SONATYPE_SIGNING_PASSWORD }}
nvd-api-key: ${{ secrets.NVD_APIKEY }}
4 changes: 2 additions & 2 deletions .github/workflows/ci-unwelcome-words.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,11 @@ jobs:
test:
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
with:
ref: ${{ github.sha }}
- name: Checkout tool
uses: actions/checkout@v3
uses: actions/checkout@v4
with:
repository: exactpro-th2/ci-github-action
ref: master
Expand Down
3 changes: 2 additions & 1 deletion .github/workflows/dev-build.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Dev build and publish Docker distributions to Github Container Registry ghcr.io
name: Dev build and publish Docker and Sonatype distributions

on:
push:
Expand All @@ -21,3 +21,4 @@ jobs:
sonatypePassword: ${{ secrets.SONATYPE_NEXUS_PASSWORD }}
sonatypeSigningKey: ${{ secrets.SONATYPE_GPG_ARMORED_KEY }}
sonatypeSigningPassword: ${{ secrets.SONATYPE_SIGNING_PASSWORD }}
nvd-api-key: ${{ secrets.NVD_APIKEY }}
31 changes: 0 additions & 31 deletions .github/workflows/dev-java-publish-sonatype-and-docker.yml

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ jobs:
with:
build-target: 'Sonatype,Docker'
runsOn: ubuntu-latest
gradleVersion: '7'
gradleVersion: '8'
docker-username: ${{ github.actor }}
devRelease: true
secrets:
Expand All @@ -24,3 +24,4 @@ jobs:
sonatypeSigningKey: ${{ secrets.SONATYPE_GPG_ARMORED_KEY }}
sonatypeSigningPassword: ${{ secrets.SONATYPE_SIGNING_PASSWORD }}
docker-password: ${{ secrets.GITHUB_TOKEN }}
nvd-api-key: ${{ secrets.NVD_APIKEY }}
6 changes: 3 additions & 3 deletions .github/workflows/integration-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,15 +11,15 @@ jobs:
steps:
- uses: actions/checkout@v4
- name: Set up JDK 'zulu' '11'
uses: actions/setup-java@v3
uses: actions/setup-java@v4
with:
distribution: 'zulu'
java-version: '11'
- name: Setup Gradle
uses: gradle/gradle-build-action@v2
uses: gradle/actions/setup-gradle@v3
- name: Build with Gradle
run: ./gradlew --info clean integrationTest
- uses: actions/upload-artifact@v3
- uses: actions/upload-artifact@v4
if: failure()
with:
name: integration-test-results
Expand Down
3 changes: 2 additions & 1 deletion .github/workflows/java-publish-sonatype-and-docker.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,12 @@ jobs:
with:
build-target: 'Sonatype,Docker'
runsOn: ubuntu-latest
gradleVersion: '7'
gradleVersion: '8'
docker-username: ${{ github.actor }}
secrets:
sonatypeUsername: ${{ secrets.SONATYPE_NEXUS_USERNAME }}
sonatypePassword: ${{ secrets.SONATYPE_NEXUS_PASSWORD }}
sonatypeSigningKey: ${{ secrets.SONATYPE_GPG_ARMORED_KEY }}
sonatypeSigningPassword: ${{ secrets.SONATYPE_SIGNING_PASSWORD }}
docker-password: ${{ secrets.GITHUB_TOKEN }}
nvd-api-key: ${{ secrets.NVD_APIKEY }}
6 changes: 2 additions & 4 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,10 +1,8 @@
FROM gradle:7.6-jdk11 AS build
FROM gradle:8.7-jdk11 AS build
ARG release_version
ARG vcs_url
COPY ./ .
RUN gradle --no-daemon clean build dockerPrepare \
-Prelease_version=${release_version} \
-Pvcs_url=${vcs_url}
-Prelease_version=${release_version}

FROM adoptopenjdk/openjdk11:alpine
WORKDIR /home
Expand Down
8 changes: 7 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# HTTP Client v2.2.1
# HTTP Client v2.3.0

This microservice allows performing HTTP requests and receive HTTP responses. It also can perform basic authentication

Expand Down Expand Up @@ -177,6 +177,12 @@ spec:

## Changelog

### v2.3.0

+ Update common to `5.14.0-dev`
+ Update common utils to `2.2.3-dev`
+ Migrate to th2 gradle plugin `0.1.1`

### v2.2.1

* Fixed problem - connect reorders sequence numbers when sending messages in parallel mode by one session alias.
Expand Down
57 changes: 37 additions & 20 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -1,28 +1,41 @@
buildscript {
repositories {
gradlePluginPortal()
maven {
url = "https://s01.oss.sonatype.org/content/repositories/snapshots/"
}
plugins {
id 'org.jetbrains.kotlin.jvm' version '1.8.22'
id 'org.jetbrains.kotlin.kapt' version '1.8.22'
id 'application'
id 'signing'
id 'maven-publish'
id 'com.exactpro.th2.gradle.component' version '0.1.1'
id 'com.exactpro.th2.gradle.publish' version '0.1.1'
}

group = 'com.exactpro.th2'
version = release_version

repositories {
mavenCentral()
maven {
name 'Sonatype_snapshots'
url 'https://s01.oss.sonatype.org/content/repositories/snapshots/'
}
dependencies {
classpath "com.exactpro.th2:th2-gradle-plugin:0.0.1-dev-5915968839-41381e5-SNAPSHOT"
maven {
name 'Sonatype_releases'
url 'https://s01.oss.sonatype.org/content/repositories/releases/'
}
}

apply plugin: "com.exactpro.th2.common-conventions"
apply plugin: "com.exactpro.th2.artifacts-conventions"
apply plugin: "com.exactpro.th2.docker-conventions"
}

apply plugin: 'kotlin-kapt'
configurations.configureEach {
resolutionStrategy.cacheChangingModulesFor 0, 'seconds'
resolutionStrategy.cacheDynamicVersionsFor 0, 'seconds'
}

dependencies {
api platform('com.exactpro.th2:bom:4.5.0')

implementation("com.exactpro.th2:common:5.4.0-dev") {
implementation("com.exactpro.th2:common:5.14.0-dev") {
exclude group: 'com.exactpro.th2', module: 'task-utils'
}
implementation "com.exactpro.th2:common-utils:2.2.0-dev"
implementation "com.exactpro.th2:common-utils:2.2.3-dev"

implementation "io.github.oshai:kotlin-logging:5.1.4"

implementation "com.athaydes.rawhttp:rawhttp-core:2.4.1"
implementation "com.fasterxml.jackson.module:jackson-module-kotlin"
Expand All @@ -31,7 +44,11 @@ dependencies {
annotationProcessor "com.google.auto.service:auto-service:1.1.1"
kapt "com.google.auto.service:auto-service:1.1.1"

testImplementation 'com.exactpro.th2:junit-jupiter-integration:0.0.1-master-6956603819-5241ee5-SNAPSHOT'
testImplementation "org.junit.jupiter:junit-jupiter"
testImplementation "org.jetbrains.kotlin:kotlin-test-junit5"
testImplementation 'com.exactpro.th2:junit-jupiter-integration:0.0.1'
testImplementation 'io.strikt:strikt-core:0.34.1'
testImplementation 'io.strikt:strikt-jackson:0.34.1'
}

test {
Expand All @@ -47,6 +64,6 @@ tasks.register('integrationTest', Test) {
}
}

dependencyLocking {
lockAllConfigurations()
application {
mainClass = 'com.exactpro.th2.http.client.Main'
}
5 changes: 2 additions & 3 deletions gradle.properties
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
kotlin.code.style=official
release_version=2.2.1
release_version=2.3.0
description='HTTP Client'
vcs_url=https://github.com/th2-net/th2-conn-http-client
app_main_class=com.exactpro.th2.http.client.Main
vcs_url=https://github.com/th2-net/th2-conn-http-client
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 @@
#Mon May 25 11:22:24 MSK 2020
distributionUrl=https\://services.gradle.org/distributions/gradle-7.6-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-8.7-bin.zip
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStorePath=wrapper/dists
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ import com.fasterxml.jackson.databind.module.SimpleModule
import com.fasterxml.jackson.module.kotlin.KotlinFeature
import com.fasterxml.jackson.module.kotlin.KotlinModule
import com.google.common.util.concurrent.ThreadFactoryBuilder
import mu.KotlinLogging
import io.github.oshai.kotlinlogging.KotlinLogging
import rawhttp.core.RawHttpRequest
import rawhttp.core.RawHttpResponse
import java.security.PrivateKey
Expand Down
8 changes: 4 additions & 4 deletions src/main/kotlin/com/exactpro/th2/http/client/ClientOptions.kt
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@

package com.exactpro.th2.http.client

import mu.KLogger
import mu.KotlinLogging
import io.github.oshai.kotlinlogging.KLogger
import io.github.oshai.kotlinlogging.KotlinLogging
import rawhttp.core.EagerHttpResponse
import rawhttp.core.RawHttpRequest
import rawhttp.core.RawHttpResponse
Expand Down Expand Up @@ -179,8 +179,8 @@ internal class ClientOptions(
debugMsg: (() -> Any?)? = null,
) {
when {
debugMsg != null && isDebugEnabled -> debug(debugMsg)
infoMsg != null && isInfoEnabled -> info(infoMsg)
debugMsg != null && isDebugEnabled() -> debug(debugMsg)
infoMsg != null && isInfoEnabled() -> info(infoMsg)
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/main/kotlin/com/exactpro/th2/http/client/HttpClient.kt
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ package com.exactpro.th2.http.client

import com.exactpro.th2.http.client.util.Certificate
import com.exactpro.th2.http.client.util.getSocketFactory
import mu.KotlinLogging
import io.github.oshai.kotlinlogging.KotlinLogging
import rawhttp.core.HttpVersion
import rawhttp.core.IOSupplier
import rawhttp.core.RawHttp
Expand Down
2 changes: 1 addition & 1 deletion src/main/kotlin/com/exactpro/th2/http/client/Main.kt
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
package com.exactpro.th2.http.client

import com.exactpro.th2.common.schema.factory.CommonFactory
import mu.KotlinLogging
import io.github.oshai.kotlinlogging.KotlinLogging
import java.util.concurrent.ConcurrentLinkedDeque
import java.util.concurrent.locks.ReentrantLock
import kotlin.concurrent.thread
Expand Down
8 changes: 4 additions & 4 deletions src/test/kotlin/com/exactpro/th2/http/client/ClientTest.kt
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ package com.exactpro.th2.http.client
import com.exactpro.th2.common.grpc.EventID
import com.exactpro.th2.http.client.api.decorators.Th2RawHttpRequest
import com.exactpro.th2.http.client.util.CONTENT_LENGTH_HEADER
import mu.KotlinLogging
import io.github.oshai.kotlinlogging.KotlinLogging
import org.junit.jupiter.api.AfterAll
import org.junit.jupiter.api.Assertions
import org.junit.jupiter.api.BeforeAll
Expand Down Expand Up @@ -99,7 +99,7 @@ class ClientTest {

val onResponse = { _: RawHttpRequest, response: RawHttpResponse<*> ->
requestFlag.countDown()
LOGGER.debug("Response handled: ${response.statusCode}")
LOGGER.debug { "Response handled: ${response.statusCode}" }
}

val client = HttpClient(
Expand Down Expand Up @@ -160,12 +160,12 @@ class ClientTest {
}.build()

val onRequest = { request: RawHttpRequest ->
LOGGER.info("Request submitted: ${request.startLine}")
LOGGER.info { "Request submitted: ${request.startLine}" }
}

val onResponse = { _: RawHttpRequest, response: RawHttpResponse<*> ->
requestFlag.countDown()
LOGGER.info("Response handled: ${response.statusCode}")
LOGGER.info { "Response handled: ${response.statusCode}" }
}

val client = HttpClient(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ import com.exactpro.th2.test.spec.pin
import com.exactpro.th2.test.spec.pins
import com.exactpro.th2.test.spec.publishers
import com.exactpro.th2.test.spec.subscribers
import mu.KotlinLogging
import io.github.oshai.kotlinlogging.KotlinLogging
import org.junit.jupiter.api.AfterAll
import org.junit.jupiter.api.BeforeAll
import org.junit.jupiter.api.Test
Expand Down

0 comments on commit aea5ac0

Please sign in to comment.