Skip to content

Commit 21ef58c

Browse files
Corrected after review
1 parent 94e2951 commit 21ef58c

File tree

3 files changed

+34
-18
lines changed

3 files changed

+34
-18
lines changed

build.gradle

Lines changed: 9 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,13 @@
11
plugins {
22
id "application"
33
id "maven-publish"
4-
id "com.exactpro.th2.gradle.publish" version "0.2.4"
5-
id "com.exactpro.th2.gradle.component" version "0.2.4"
4+
alias(libs.plugins.th2.publish)
5+
alias(libs.plugins.th2.component)
66
}
77

88
group = 'com.exactpro.th2'
99
version = release_version
1010

11-
ext {
12-
cradleVersion = '5.4.4-dev'
13-
}
14-
1511
repositories {
1612
mavenCentral()
1713
maven {
@@ -31,16 +27,16 @@ javadoc {
3127
}
3228

3329
dependencies {
34-
implementation('com.exactpro.th2:common:5.14.0-dev') {
30+
implementation(libs.th2.common) {
3531
exclude group: 'com.exactpro.th2', module: 'cradle-core'
3632
exclude group: 'com.exactpro.th2', module: 'cradle-cassandra'
3733
}
38-
implementation("com.exactpro.th2:common-utils:2.3.0-dev") {
34+
implementation(libs.th2.common.utils) {
3935
because("executor service utils is used")
4036
}
41-
implementation 'com.exactpro.th2:task-utils:0.1.3'
42-
implementation "com.exactpro.th2:cradle-core:$cradleVersion"
43-
implementation "com.exactpro.th2:cradle-cassandra:$cradleVersion"
37+
implementation(libs.th2.task.utils)
38+
implementation(libs.cradle.core)
39+
implementation(libs.cradle.cassandra)
4440

4541
// FIXME: Added as API dependency to common com.exactpro.th2.common.event.Event.toProto(...) throws `JsonProcessingException`
4642
implementation 'com.fasterxml.jackson.core:jackson-core'
@@ -55,8 +51,8 @@ dependencies {
5551
}
5652

5753
testImplementation 'org.apache.commons:commons-lang3'
58-
testImplementation 'org.junit.jupiter:junit-jupiter:5.12.0'
59-
testImplementation 'org.mockito:mockito-junit-jupiter:5.15.2'
54+
testImplementation(libs.junit.jupiter)
55+
testImplementation(libs.mockito.junit.jupiter)
6056
testRuntimeOnly('org.junit.platform:junit-platform-launcher') {
6157
because 'This artifact will not be added automatically since gradle 9.0. You can read more information here:' +
6258
'https://docs.gradle.org/8.3/userguide/upgrading_version_8.html#test_framework_implementation_dependencies'

gradle/libs.versions.toml

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
[versions]
2+
th2-plugin = "0.2.4"
3+
cradle = "5.4.4-dev"
4+
5+
[libraries]
6+
th2-common-utils = { group = "com.exactpro.th2", name = "common-utils", version = "2.3.0-dev" }
7+
th2-common = { group = "com.exactpro.th2", name = "common", version = "5.14.0-dev" }
8+
th2-task-utils = { group = "com.exactpro.th2", name = "task-utils", version = "0.1.3" }
9+
10+
cradle-core = { group = "com.exactpro.th2", name = "cradle-core", version.ref = "cradle" }
11+
cradle-cassandra = { group = "com.exactpro.th2", name = "cradle-cassandra", version.ref = "cradle" }
12+
13+
junit-jupiter = { group = "org.junit.jupiter", name = "junit-jupiter", version = "5.12.0" }
14+
mockito-junit-jupiter = { group = "org.mockito", name = "mockito-junit-jupiter", version = "5.16.0" }
15+
16+
[plugins]
17+
th2-publish = { id = "com.exactpro.th2.gradle.publish", version.ref = "th2-plugin" }
18+
th2-component = { id = "com.exactpro.th2.gradle.component", version.ref = "th2-plugin" }

src/test/java/com/exactpro/th2/estore/TestEventPersistor.java

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -50,11 +50,11 @@
5050
import java.util.concurrent.TimeUnit;
5151
import java.util.stream.Collectors;
5252

53-
import static com.exactpro.th2.common.utils.ExecutorServiceUtilsKt.shutdownGracefully;
5453
import static org.junit.jupiter.api.Assertions.assertArrayEquals;
5554
import static org.junit.jupiter.api.Assertions.assertEquals;
5655
import static org.junit.jupiter.api.Assertions.assertNotNull;
5756
import static org.junit.jupiter.api.Assertions.assertNull;
57+
import static org.junit.jupiter.api.Assertions.assertTrue;
5858
import static org.mockito.ArgumentMatchers.any;
5959
import static org.mockito.Mockito.after;
6060
import static org.mockito.Mockito.doReturn;
@@ -206,7 +206,7 @@ public void testEventResubmittedLimitedTimes() throws IOException, CradleStorage
206206

207207
@Test
208208
@DisplayName("Event persistence is queued by count")
209-
public void testEventCountQueueing() throws IOException, CradleStorageException {
209+
public void testEventCountQueueing() throws IOException, CradleStorageException, InterruptedException {
210210

211211
final long storeExecutionTime = EVENT_PERSIST_TIMEOUT * 3;
212212
final long totalExecutionTime = EVENT_PERSIST_TIMEOUT * 5;
@@ -236,13 +236,14 @@ public void testEventCountQueueing() throws IOException, CradleStorageException
236236
verify(callback, after(totalExecutionTime).times(totalEvents)).onSuccess(any());
237237
verify(callback, after(totalExecutionTime).times(0)).onFail(any());
238238

239-
shutdownGracefully(executor, 1, TimeUnit.SECONDS);
239+
executor.shutdown();
240+
assertTrue(executor.awaitTermination(1, TimeUnit.SECONDS), "Executor didn't terminate according to a timeout");
240241
}
241242

242243

243244
@Test
244245
@DisplayName("Event persistence is queued by event sizes")
245-
public void testEventSizeQueueing() throws IOException, CradleStorageException {
246+
public void testEventSizeQueueing() throws IOException, CradleStorageException, InterruptedException {
246247

247248
final long storeExecutionTime = EVENT_PERSIST_TIMEOUT * 3;
248249
final long totalExecutionTime = EVENT_PERSIST_TIMEOUT * 6;
@@ -283,7 +284,8 @@ public void testEventSizeQueueing() throws IOException, CradleStorageException {
283284
verify(callback, after(totalExecutionTime).times(totalEvents)).onSuccess(any());
284285
verify(callback, after(totalExecutionTime).times(0)).onFail(any());
285286

286-
shutdownGracefully(executor, 1, TimeUnit.SECONDS);
287+
executor.shutdown();
288+
assertTrue(executor.awaitTermination(1, TimeUnit.SECONDS), "Executor didn't terminate according to a timeout");
287289
}
288290

289291

0 commit comments

Comments
 (0)