Skip to content

Commit

Permalink
[TH2-2212] mq subscriptions recovery (#20)
Browse files Browse the repository at this point in the history
  • Loading branch information
lumber1000 authored Aug 12, 2024
1 parent fbd525c commit e5c77f3
Show file tree
Hide file tree
Showing 16 changed files with 91 additions and 215 deletions.
15 changes: 15 additions & 0 deletions .github/workflows/build-dev-release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
name: Build and publish dev release Docker image to Github Container Registry ghcr.io

on: workflow_dispatch

jobs:
build:
uses: th2-net/.github/.github/workflows/compound-java.yml@main
with:
build-target: 'Docker'
devRelease: true
createTag: true
docker-username: ${{ github.actor }}
secrets:
docker-password: ${{ secrets.GITHUB_TOKEN }}
nvd-api-key: ${{ secrets.NVD_APIKEY }}
Original file line number Diff line number Diff line change
@@ -1,20 +1,15 @@
name: Build and publish Docker distributions to Github Container Registry ghcr.io
name: Build and publish release Docker image to Github Container Registry ghcr.io

on:
push:
branches:
- master
- version-*
paths:
- gradle.properties
# - package_info.json
on: workflow_dispatch

jobs:
build-job:
build:
uses: th2-net/.github/.github/workflows/compound-java.yml@main
with:
build-target: 'Docker'
devRelease: false
createTag: true
docker-username: ${{ github.actor }}
secrets:
docker-password: ${{ secrets.GITHUB_TOKEN }}

nvd-api-key: ${{ secrets.NVD_APIKEY }}
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: Build and publish Docker image to Github Container Registry ghcr.io

on:
push:
Expand All @@ -17,3 +17,4 @@ jobs:
docker-username: ${{ github.actor }}
secrets:
docker-password: ${{ secrets.GITHUB_TOKEN }}
nvd-api-key: ${{ secrets.NVD_APIKEY }}
28 changes: 14 additions & 14 deletions .github/workflows/ci-unwelcome-words.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,17 +7,17 @@ jobs:
test:
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v2
with:
ref: ${{ github.sha }}
- name: Checkout tool
uses: actions/checkout@v2
with:
repository: exactpro-th2/ci-github-action
ref: master
token: ${{ secrets.PAT_CI_ACTION }}
path: ci-github-action
- name: Run CI action
uses: ./ci-github-action
with:
ref: ${{ github.sha }}
- uses: actions/checkout@v4
with:
ref: ${{ github.sha }}
- name: Checkout tool
uses: actions/checkout@v4
with:
repository: exactpro-th2/ci-github-action
ref: master
token: ${{ secrets.PAT_CI_ACTION }}
path: ci-github-action
- name: Run CI action
uses: ./ci-github-action
with:
ref: ${{ github.sha }}
22 changes: 0 additions & 22 deletions .github/workflows/dev-release-java-publish-sonatype-and-docker.yml

This file was deleted.

2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM gradle:7.6-jdk11 AS build
FROM gradle:8.7-jdk11 AS build
ARG release_version
COPY ./ .
RUN gradle --no-daemon clean build dockerPrepare -Prelease_version=${release_version}
Expand Down
10 changes: 9 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Codec Xml via Xsd (2.2.0)
# Codec Xml via Xsd (2.3.0)
![version](https://img.shields.io/badge/version-0.0.4-blue.svg)

# How it works:
Expand Down Expand Up @@ -142,6 +142,14 @@ spec:

## Changelog

### v2.3.0

* Migrated to th2 gradle plugin `0.1.1` (bom: `4.6.1`)
* Updated common: `5.14.0-dev`
* Updated common-utils `2.2.3-dev`
* Updated codec `5.5.0-dev`
* Updated workflows

### v2.2.0

* Migrate to StAX parser
Expand Down
138 changes: 14 additions & 124 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -1,54 +1,14 @@
/*
* Copyright 2021-2023 Exactpro (Exactpro Systems Limited)
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

import com.github.jk1.license.filter.LicenseBundleNormalizer
import com.github.jk1.license.render.JsonReportRenderer
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
import org.jetbrains.kotlin.gradle.dsl.JvmTarget

plugins {
id "com.palantir.docker" version "0.25.0"
id "org.jetbrains.kotlin.jvm" version "$kotlin_version"
id "org.jetbrains.kotlin.kapt" version "$kotlin_version"
id "application"
id "org.owasp.dependencycheck" version "8.4.0"
id "com.gorylenko.gradle-git-properties" version "2.4.1"
id "com.github.jk1.dependency-license-report" version "2.5"
id "de.undercouch.download" version "5.5.0"
}

ext {
sharedDir = file("${project.rootDir}/shared")
id "com.exactpro.th2.gradle.component" version "0.1.1"
}

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

sourceCompatibility = JavaVersion.VERSION_11
targetCompatibility = JavaVersion.VERSION_11

ext {
junitVersion = '5.10.0'
}

repositories {
maven {
name 'MavenLocal'
url sharedDir
}

maven {
name 'Sonatype_snapshots'
url 'https://s01.oss.sonatype.org/content/repositories/snapshots/'
Expand All @@ -62,10 +22,12 @@ repositories {
artifact()
}
}

maven {
name 'Sonatype_releases'
url 'https://s01.oss.sonatype.org/content/repositories/releases/'
}

maven {
name 'Sonatype_releases'
url 'https://s01.oss.sonatype.org/content/repositories/releases/'
Expand All @@ -74,6 +36,7 @@ repositories {
artifact()
}
}

mavenCentral()
mavenLocal()

Expand All @@ -83,100 +46,27 @@ repositories {
}
}

jar {
manifest {
attributes(
'Created-By': "${System.getProperty('java.version')} (${System.getProperty('java.vendor')})",
'Specification-Title': '',
'Specification-Vendor': 'Exactpro Systems LLC',
'Implementation-Title': project.archivesBaseName,
'Implementation-Vendor': 'Exactpro Systems LLC',
'Implementation-Vendor-Id': 'com.exactpro',
'Implementation-Version': project.version
)
}
}

dependencies {
api platform("com.exactpro.th2:bom:4.5.0")
implementation "com.exactpro.th2:common:5.4.0-dev"
implementation "com.exactpro.th2:codec:5.3.0-dev"
implementation "com.exactpro.th2:common-utils:2.2.0-dev"
implementation "com.exactpro.th2:common:5.14.0-dev"
implementation "com.exactpro.th2:common-utils:2.2.3-dev"
implementation "com.exactpro.th2:codec:5.5.0-dev"

implementation "org.slf4j:slf4j-api"
implementation "io.github.microutils:kotlin-logging:3.0.5"

implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk8"
implementation "org.jetbrains.kotlin:kotlin-reflect"
implementation "io.github.oshai:kotlin-logging:5.1.4"

implementation "com.fasterxml.jackson.core:jackson-core"
implementation "com.github.javadev:underscore:1.93"
implementation "com.github.javadev:underscore:1.104"
implementation "commons-io:commons-io"

implementation group: 'org.apache.ws.xmlschema', name: 'xmlschema-core', version: '2.3.0'

testImplementation "org.jetbrains.kotlin:kotlin-test-junit5:$kotlin_version"
implementation "org.apache.ws.xmlschema:xmlschema-core:2.3.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"
}

application {
mainClassName 'com.exactpro.th2.codec.MainKt'
}

applicationName = 'service'

dockerPrepare {
dependsOn distTar
}

docker {
copySpec.from(tarTree("$buildDir/distributions/${applicationName}.tar"))
}

sourceSets {
main.kotlin.srcDirs += "src/main/kotlin"
}

tasks.withType(KotlinCompile).configureEach {
compilerOptions.jvmTarget.set(JvmTarget.JVM_11)
}

clean {
delete sharedDir
}

dependencyCheck {
formats = ['SARIF', 'JSON', 'HTML']
failBuildOnCVSS = 5
suppressionFile = file('suppressions.xml')
analyzers {
assemblyEnabled = false
nugetconfEnabled = false
nodeEnabled = false
}
}

licenseReport {
def licenseNormalizerBundlePath = "$buildDir/license-normalizer-bundle.json"

if (!file(licenseNormalizerBundlePath).exists()) {
download.run {
src 'https://raw.githubusercontent.com/th2-net/.github/main/license-compliance/gradle-license-report/license-normalizer-bundle.json'
dest "$buildDir/license-normalizer-bundle.json"
overwrite false
}
}

filters = [new LicenseBundleNormalizer(licenseNormalizerBundlePath, false)]
renderers = [new JsonReportRenderer('licenses.json', false)]
excludeOwnGroup = false
allowedLicensesFile = new URL("https://raw.githubusercontent.com/th2-net/.github/main/license-compliance/gradle-license-report/allowed-licenses.json")
testImplementation "org.jetbrains.kotlin:kotlin-test-junit5"
}

test {
useJUnitPlatform()
//exclude 'com/exactpro/th2/codec/xml'
}
test.useJUnitPlatform()
application.mainClass = "com.exactpro.th2.codec.MainKt"
dependencyCheck.suppressionFile = file('suppressions.xml')
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
# limitations under the License.
#

release_version=2.2.0
release_version=2.3.0
kotlin_version=1.8.22
description = 'th2 codec xml via xsd'

Expand Down
4 changes: 2 additions & 2 deletions gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#
# Copyright 2021-2023 Exactpro (Exactpro Systems Limited)
# Copyright 2021-2024 Exactpro (Exactpro Systems Limited)
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
Expand All @@ -13,7 +13,7 @@
# limitations under the License.
#

distributionUrl=https\://services.gradle.org/distributions/gradle-7.6-all.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
@@ -1,5 +1,5 @@
/*
* Copyright 2021-2023 Exactpro (Exactpro Systems Limited)
* Copyright 2021-2024 Exactpro (Exactpro Systems Limited)
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
Expand Down Expand Up @@ -37,13 +37,12 @@ import com.exactpro.th2.common.utils.message.transport.getField
import com.github.underscore.Xml
import com.google.protobuf.UnsafeByteOperations
import io.netty.buffer.Unpooled
import mu.KotlinLogging
import io.github.oshai.kotlinlogging.KotlinLogging
import java.io.InputStream
import java.nio.charset.Charset
import java.util.Locale

open class XmlPipelineCodec(settings: XmlPipelineCodecSettings, xsdMap: Map<String, () -> InputStream> = emptyMap()) : IPipelineCodec {

private val pointer: List<String> = settings.typePointer
?.split("/")?.filter(String::isNotBlank)
?: listOf()
Expand Down Expand Up @@ -214,6 +213,5 @@ open class XmlPipelineCodec(settings: XmlPipelineCodecSettings, xsdMap: Map<Stri

companion object {
private val LOGGER = KotlinLogging.logger {}

}
}
Loading

0 comments on commit e5c77f3

Please sign in to comment.