Skip to content

Commit

Permalink
[Th2 5143] problem when codec publishes event for book A with attac…
Browse files Browse the repository at this point in the history
…hed messages for book `B` (#16)

* [TH2-4934] th2 transport protocol support

---------

Co-authored-by: Oleg Smelov <[email protected]>
  • Loading branch information
Nikita-Smirnov-Exactpro and Oleg Smelov authored Dec 29, 2023
1 parent 33acea5 commit 8525c1a
Show file tree
Hide file tree
Showing 11 changed files with 483 additions and 163 deletions.
22 changes: 22 additions & 0 deletions .github/workflows/dev-release-java-publish-sonatype-and-docker.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
name: Build and release Java distributions to sonatype.

on:
push:
tags:
- \d+.\d+.\d+-dev

jobs:
build:
uses: th2-net/.github/.github/workflows/compound-java.yml@main
with:
build-target: 'Docker'
runsOn: ubuntu-latest
gradleVersion: '7'
docker-username: ${{ github.actor }}
devRelease: true
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 }}
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM gradle:7.5-jdk11 AS build
FROM gradle:7.6-jdk11 AS build
ARG release_version
COPY ./ .
RUN gradle --no-daemon clean build dockerPrepare -Prelease_version=${release_version}
Expand Down
49 changes: 27 additions & 22 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# HTTP Codec v0.2.0
# HTTP Codec v0.4.0

This microservice can encode and decode HTTP messages

Expand Down Expand Up @@ -27,32 +27,33 @@ This codec processes parsed messages with `http` protocol in metadata field
1. HTTP message - `Message` with `Request` or `Response` type (protocol = `http`)
2. HTTP message body - `RawMessage` with a raw message body (if present)

If decoded message was an HTTP request, message body metadata would contain `method` and `uri` properties with HTTP request method name and URI respectively
If decoded message was an HTTP request, message body metadata would contain `method` and `uri` properties with HTTP
request method name and URI respectively

## Message types

* Request

|Field|Type|Description|
|:---:|:---:|:---:|
|method|String|HTTP method name (e.g. GET, POST, etc.)|
|uri|String|Request URI (e.g. /some/request/path?param1=value1&param2=value2...)|
|headers|List\<Header>|HTTP headers (e.g. Host, Content-Length, etc.)|
| Field | Type | Description |
|:-------:|:-------------:|:--------------------------------------------------------------------:|
| method | String | HTTP method name (e.g. GET, POST, etc.) |
| uri | String | Request URI (e.g. /some/request/path?param1=value1&param2=value2...) |
| headers | List\<Header> | HTTP headers (e.g. Host, Content-Length, etc.) |

* Response

|Field|Type|Description|
|:---:|:---:|:---:|
|statusCode|String|HTTP status code (e.g. 200, 403, 500, etc)|
|reason|String|HTTP status reason (e.g. OK, Forbidden, Internal Server Error, etc.)|
|headers|List\<Header>|HTTP headers (e.g. Set-Cookie, Content-Length, etc.)|
| Field | Type | Description |
|:----------:|:-------------:|:--------------------------------------------------------------------:|
| statusCode | String | HTTP status code (e.g. 200, 403, 500, etc) |
| reason | String | HTTP status reason (e.g. OK, Forbidden, Internal Server Error, etc.) |
| headers | List\<Header> | HTTP headers (e.g. Set-Cookie, Content-Length, etc.) |

* Header

|Field|Type|Description|
|:---:|:---:|:---:|
|name|String|HTTP header name|
|value|String|HTTP header value|
| Field | Type | Description |
|:-----:|:------:|:-----------------:|
| name | String | HTTP header name |
| value | String | HTTP header value |

## Deployment via `infra-mgr`

Expand Down Expand Up @@ -119,16 +120,20 @@ spec:
enabled: false
```
### Gradle metadata note
ignoreGradleMetadataRedirection is used for sonatype because Sailfish dependencies have constrains that interfere with BOM,
so we exclude Gradle metadata for these repositories.
It's been verified that Sailfish itself is compatible with versions from BOM and therefore safe to use.
# Release notes
## 0.4.0
# Release notes
+ th2 transport protocol support
+ Updated bom: `4.5.0-dev`
+ Updated common: `5.7.2-dev`
+ Updated common-utils: `2.2.2-dev`
+ Updated codec: `5.4.1-dev`
+ Updated kotlin: `1.8.22`
+ Removed sailfish-utils

## 0.3.0

* th2-common upgrade to `3.44.0`
* th2-bom upgrade to `4.1.0`
* th2-codec upgrade to `4.7.6`
Expand Down
99 changes: 31 additions & 68 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -2,18 +2,8 @@ plugins {
id 'com.palantir.docker' version '0.25.0'
id 'org.jetbrains.kotlin.jvm' version "${kotlin_version}"
id 'application'
id "org.owasp.dependencycheck" version "7.2.0"
id 'org.jetbrains.kotlin.kapt' version "${kotlin_version}"
}

dependencyCheck {
format='HTML'
failBuildOnCVSS=5
}

ext {
sharedDir = file("${project.rootDir}/shared")
sailfishVersion = '3.3.54'
id "org.owasp.dependencycheck" version "8.2.1"
}

group = 'com.exactpro.th2'
Expand All @@ -22,60 +12,19 @@ version = release_version
sourceCompatibility = 11
targetCompatibility = 11

ext.excludeSailfish = { rcd ->
rcd.excludeModule("com.exactpro.sf", "sailfish-core")
rcd.excludeModule("com.exactpro.sf", "sailfish-common")
rcd.excludeModule("com.exactpro.sf", "sailfish-rest-api-client")
rcd.excludeModule("com.exactpro.sf", "service-http")
}

repositories {
maven {
name 'MavenLocal'
url sharedDir
}

maven {
name 'Sonatype_snapshots'
url 'https://s01.oss.sonatype.org/content/repositories/snapshots/'
content {
excludeSailfish(it)
}
}

// ignoreGradleMetadataRedirection is used for sonatype because
// Sailfish dependencies have constrains that interfere with our BOM
// so we exclude Gradle metadata for this repositories.
// We've checked these versions - they are compatible and safe to use
mavenCentral()
maven {
name 'Sonatype_snapshots'
url 'https://s01.oss.sonatype.org/content/repositories/snapshots/'
metadataSources {
mavenPom()
artifact()
ignoreGradleMetadataRedirection()
}
}
maven {
name 'Sonatype_releases'
url 'https://s01.oss.sonatype.org/content/repositories/releases/'
content {
excludeSailfish(it)
}
}
maven {
name 'Sonatype_releases'
url 'https://s01.oss.sonatype.org/content/repositories/releases/'
metadataSources {
mavenPom()
artifact()
ignoreGradleMetadataRedirection()
}
}
mavenCentral()
mavenLocal()

configurations.all {
configurations.configureEach {
resolutionStrategy.cacheChangingModulesFor 0, 'seconds'
resolutionStrategy.cacheDynamicVersionsFor 0, 'seconds'
}
Expand All @@ -96,24 +45,21 @@ jar {
}

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

implementation 'com.exactpro.th2:common:5.1.0-dev-version-5+'
implementation 'com.exactpro.th2:codec:5.0.0-dev-version-5+'
implementation "com.exactpro.th2:common:5.7.2-dev"
implementation "com.exactpro.th2:common-utils:2.2.2-dev"
implementation "com.exactpro.th2:codec:5.4.1-dev"

implementation 'com.exactpro.th2:sailfish-utils:3.14.0'

compileOnly 'com.google.auto.service:auto-service:1.0.1'
annotationProcessor 'com.google.auto.service:auto-service:1.0.1'
compileOnly "com.google.auto.service:auto-service:1.1.1"
annotationProcessor "com.google.auto.service:auto-service:1.1.1"
kapt "com.google.auto.service:auto-service:1.1.1"

implementation group: 'org.jetbrains.kotlin', name: 'kotlin-stdlib-jdk8', version: kotlin_version
implementation group: 'org.jetbrains.kotlin', name: 'kotlin-reflect', version: kotlin_version
implementation group: 'io.github.microutils', name: 'kotlin-logging', version: '1.7.9'
implementation group: 'com.athaydes.rawhttp', name: 'rawhttp-core', version: '2.4.1'
implementation "io.github.microutils:kotlin-logging:3.0.5"
implementation "com.athaydes.rawhttp:rawhttp-core:2.4.1"

testImplementation group: 'org.jetbrains.kotlin', name: 'kotlin-test-junit5', version: kotlin_version
testImplementation 'org.junit.jupiter:junit-jupiter:5.9.0'
kapt 'com.google.auto.service:auto-service:1.0.1'
testImplementation "org.jetbrains.kotlin:kotlin-test-junit5"
testImplementation "org.junit.jupiter:junit-jupiter:5.10.0"
}

application {
Expand Down Expand Up @@ -149,3 +95,20 @@ compileTestKotlin {
test {
useJUnitPlatform()
}

configurations {
compileClasspath {
resolutionStrategy.activateDependencyLocking()
}
}

dependencyCheck {
formats = ['SARIF', 'JSON', 'HTML']
failBuildOnCVSS = 5
suppressionFile = file('suppressions.xml')
analyzers {
assemblyEnabled = false
nugetconfEnabled = false
nodeEnabled = false
}
}
4 changes: 2 additions & 2 deletions gradle.properties
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
kotlin.code.style=official
kotlin_version=1.6.21
release_version=0.3.0
kotlin_version=1.8.22
release_version=0.4.0
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.5-all.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-7.6-all.zip
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStorePath=wrapper/dists
Expand Down
Loading

0 comments on commit 8525c1a

Please sign in to comment.