From b9613c6fc77d04bc2ab63ae07e09c50acac06061 Mon Sep 17 00:00:00 2001 From: Oleg Date: Mon, 10 Oct 2022 14:40:27 +0400 Subject: [PATCH] [TS-1168] Migrate to sf 3.3. Update dependencies with vulnerabilities --- README.md | 2 + build.gradle | 44 +++++++++++++------ .../java/com/exactpro/th2/conn/TestEvent.java | 9 ++-- 3 files changed, 38 insertions(+), 17 deletions(-) diff --git a/README.md b/README.md index 2319e7a..28e6bed 100644 --- a/README.md +++ b/README.md @@ -124,6 +124,8 @@ spec: ### 3.11.0 + Added `maxMessageFlushTime` option ++ Dependencies with vulnerabilities were updated: + + Sailfish updated from `3.2.1741` to `3.3.13` ### 3.10.2 diff --git a/build.gradle b/build.gradle index 7e90ed1..2fc87e9 100644 --- a/build.gradle +++ b/build.gradle @@ -1,12 +1,12 @@ plugins { id 'com.palantir.docker' version '0.25.0' - id 'org.jetbrains.kotlin.jvm' version '1.5.30' + id 'org.jetbrains.kotlin.jvm' version '1.6.21' id 'application' } ext { sharedDir = file("${project.rootDir}/shared") - sailfishVersion = '3.2.1741' + sailfishVersion = '3.3.13' } group = 'com.exactpro.th2' @@ -17,19 +17,35 @@ repositories { name 'MavenLocal' url sharedDir } - - mavenCentral() + + // ignoreGradleMetadataRedirection is used for sonatype because + // Sailfish dependencies have constrains that interfere with our BOM + // so we exclude Gradle metadata for this repositories 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/' + metadataSources { + mavenPom() + artifact() + ignoreGradleMetadataRedirection() + } + } + mavenCentral { + metadataSources { + mavenPom() + artifact() + } } - mavenLocal() configurations.all { @@ -64,12 +80,11 @@ compileTestKotlin { } dependencies { - api platform('com.exactpro.th2:bom:3.0.0') + api platform('com.exactpro.th2:bom:4.0.1') - implementation 'com.exactpro.th2:common:3.33.0' - implementation "com.exactpro.th2:sailfish-utils:3.8.0" + implementation 'com.exactpro.th2:common:3.42.0-dev-3174619150-SNAPSHOT' + implementation 'com.exactpro.th2:sailfish-utils:3.13.0-dev-3204703314-SNAPSHOT' - implementation "org.slf4j:slf4j-log4j12" implementation "org.slf4j:slf4j-api" implementation group: 'io.reactivex.rxjava3', name: 'rxjava', version: '3.0.4' @@ -78,7 +93,10 @@ dependencies { implementation("com.exactpro.sf:sailfish-core:${sailfishVersion}") - testImplementation 'org.junit.jupiter:junit-jupiter:5.7.1' + testImplementation('org.apache.logging.log4j:log4j-slf4j-impl') { + because('logging in testing') + } + testImplementation 'org.junit.jupiter:junit-jupiter:5.9.0' } test { @@ -86,13 +104,13 @@ test { } application { - mainClassName 'com.exactpro.th2.conn.MicroserviceMain' + mainClass.set('com.exactpro.th2.conn.MicroserviceMain') } applicationName = 'service' distTar { - archiveName "${applicationName}.tar" + archiveFileName.set("${applicationName}.tar") } dockerPrepare { diff --git a/src/test/java/com/exactpro/th2/conn/TestEvent.java b/src/test/java/com/exactpro/th2/conn/TestEvent.java index 555da05..3518a86 100644 --- a/src/test/java/com/exactpro/th2/conn/TestEvent.java +++ b/src/test/java/com/exactpro/th2/conn/TestEvent.java @@ -56,8 +56,9 @@ public class TestEvent { private static String parentId; @BeforeAll - public static void initMessages() throws IOException { + static void initMessages() throws IOException { serviceProxy = mock(IServiceProxy.class); + @SuppressWarnings("unchecked") MessageRouter router = mock(MessageRouter.class); doAnswer(invocation -> { @@ -72,7 +73,7 @@ public static void initMessages() throws IOException { EventType eventType = eventHolder.getType(); eventDispatcher.store(eventHolder.getEvent(), - parentIds.get(eventType) != null ? parentIds.get(eventType) : rootID); + parentIds.get(eventType) == null ? rootID : parentIds.get(eventType)); return null; }).when(eventDispatcher).store(any()); @@ -88,7 +89,7 @@ public static void initMessages() throws IOException { } @AfterEach - public void clear() { + void clear() { event = null; parentId = null; } @@ -147,7 +148,7 @@ public void sentMessageWithoutParentEventIDTest() throws Exception { } @AfterAll - private static void close() throws IOException { + static void close() throws IOException { messageSender.stop(); } } \ No newline at end of file