Skip to content

Commit 0957f71

Browse files
committed
Update executor service handling
1 parent 97b92f2 commit 0957f71

File tree

69 files changed

+630
-89
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

69 files changed

+630
-89
lines changed

src/test/java/com/epam/reportportal/junit/CodeReferenceTest.java

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,11 +24,13 @@
2424
import com.epam.reportportal.util.test.CommonUtils;
2525
import com.epam.ta.reportportal.ws.model.StartTestItemRQ;
2626
import org.junit.jupiter.api.BeforeEach;
27+
import org.junit.jupiter.api.AfterEach;
2728
import org.junit.jupiter.api.Test;
2829
import org.mockito.ArgumentCaptor;
2930
import org.mockito.ArgumentMatchers;
3031

3132
import java.util.Arrays;
33+
import java.util.concurrent.ExecutorService;
3234
import java.util.List;
3335

3436
import static com.epam.reportportal.junit.utils.TestUtils.PROCESSING_TIMEOUT;
@@ -42,14 +44,20 @@ public class CodeReferenceTest {
4244
private final String methodId = CommonUtils.namedId("method_");
4345

4446
private final ReportPortalClient client = mock(ReportPortalClient.class);
47+
private final ExecutorService executor = CommonUtils.testExecutor();
4548

4649
@BeforeEach
4750
public void setupMock() {
4851
TestUtils.mockLaunch(client, null, null, classId, methodId);
4952
TestUtils.mockBatchLogging(client);
50-
ReportPortalListener.setReportPortal(ReportPortal.create(client, TestUtils.standardParameters(), TestUtils.testExecutor()));
53+
ReportPortalListener.setReportPortal(ReportPortal.create(client, TestUtils.standardParameters(), executor));
5154
}
5255

56+
@AfterEach
57+
public void tearDown() {
58+
CommonUtils.shutdownExecutorService(executor);
59+
}
60+
5361
@Test
5462
public void verify_static_test_code_reference_generation() {
5563
TestUtils.runClasses(CodeRefTest.class);

src/test/java/com/epam/reportportal/junit/ItemTimeOrderTest.java

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,11 +26,13 @@
2626
import io.reactivex.Maybe;
2727
import org.apache.commons.lang3.tuple.Pair;
2828
import org.junit.jupiter.api.BeforeEach;
29+
import org.junit.jupiter.api.AfterEach;
2930
import org.junit.jupiter.api.Test;
3031
import org.mockito.ArgumentCaptor;
3132
import org.mockito.ArgumentMatchers;
3233

3334
import java.time.Instant;
35+
import java.util.concurrent.ExecutorService;
3436
import java.util.List;
3537
import java.util.stream.Collectors;
3638
import java.util.stream.IntStream;
@@ -58,6 +60,7 @@ public class ItemTimeOrderTest {
5860
.collect(Collectors.toList());
5961

6062
private final ReportPortalClient client = mock(ReportPortalClient.class);
63+
private final ExecutorService executor = CommonUtils.testExecutor();
6164

6265
@BeforeEach
6366
public void setupMock() {
@@ -69,9 +72,14 @@ public void setupMock() {
6972
info.setBuild(build);
7073
build.setVersion("5.13.2");
7174
when(client.getApiInfo()).thenReturn(Maybe.just(info));
72-
ReportPortalListener.setReportPortal(ReportPortal.create(client, TestUtils.standardParameters(), TestUtils.testExecutor()));
75+
ReportPortalListener.setReportPortal(ReportPortal.create(client, TestUtils.standardParameters(), executor));
7376
}
7477

78+
@AfterEach
79+
public void tearDown() {
80+
CommonUtils.shutdownExecutorService(executor);
81+
}
82+
7583
@Test
7684
public void verify_test_hierarchy_on_suite_of_suites() {
7785
TestUtils.runClasses(SuiteOfSuitesClass.class);

src/test/java/com/epam/reportportal/junit/assumption/AssumptionSkipTest.java

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,10 +28,12 @@
2828
import com.epam.ta.reportportal.ws.model.log.SaveLogRQ;
2929
import okhttp3.MultipartBody;
3030
import org.junit.jupiter.api.BeforeEach;
31+
import org.junit.jupiter.api.AfterEach;
3132
import org.junit.jupiter.api.Test;
3233
import org.mockito.ArgumentCaptor;
3334

3435
import java.util.List;
36+
import java.util.concurrent.ExecutorService;
3537
import java.util.stream.Collectors;
3638

3739
import static com.epam.reportportal.junit.utils.TestUtils.PROCESSING_TIMEOUT;
@@ -47,11 +49,18 @@ public class AssumptionSkipTest {
4749

4850
private final ReportPortalClient client = mock(ReportPortalClient.class);
4951

52+
private final ExecutorService executor = CommonUtils.testExecutor();
53+
5054
@BeforeEach
5155
public void setupMock() {
5256
TestUtils.mockLaunch(client, null, null, classId, methodId);
5357
TestUtils.mockBatchLogging(client);
54-
ReportPortalListener.setReportPortal(ReportPortal.create(client, TestUtils.standardParameters(), TestUtils.testExecutor()));
58+
ReportPortalListener.setReportPortal(ReportPortal.create(client, TestUtils.standardParameters(), executor));
59+
}
60+
61+
@AfterEach
62+
public void tearDown() {
63+
CommonUtils.shutdownExecutorService(executor);
5564
}
5665

5766
@Test

src/test/java/com/epam/reportportal/junit/assumption/AssumptionViolatedInBeforeTest.java

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,10 +28,12 @@
2828
import com.epam.ta.reportportal.ws.model.FinishTestItemRQ;
2929
import com.epam.ta.reportportal.ws.model.StartTestItemRQ;
3030
import org.junit.jupiter.api.BeforeEach;
31+
import org.junit.jupiter.api.AfterEach;
3132
import org.junit.jupiter.api.Test;
3233
import org.mockito.ArgumentCaptor;
3334

3435
import java.util.List;
36+
import java.util.concurrent.ExecutorService;
3537
import java.util.stream.Collectors;
3638
import java.util.stream.Stream;
3739

@@ -51,11 +53,18 @@ public class AssumptionViolatedInBeforeTest {
5153

5254
private final ReportPortalClient client = mock(ReportPortalClient.class);
5355

56+
private final ExecutorService executor = CommonUtils.testExecutor();
57+
5458
@BeforeEach
5559
public void setupMock() {
5660
TestUtils.mockLaunch(client, null, null, classId, methodIds);
5761
TestUtils.mockBatchLogging(client);
58-
ReportPortalListener.setReportPortal(ReportPortal.create(client, TestUtils.standardParameters(), TestUtils.testExecutor()));
62+
ReportPortalListener.setReportPortal(ReportPortal.create(client, TestUtils.standardParameters(), executor));
63+
}
64+
65+
@AfterEach
66+
public void tearDown() {
67+
CommonUtils.shutdownExecutorService(executor);
5968
}
6069

6170
@Test

src/test/java/com/epam/reportportal/junit/assumption/ParameterizedAssumptionSkipTest.java

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,10 +28,12 @@
2828
import com.epam.ta.reportportal.ws.model.log.SaveLogRQ;
2929
import okhttp3.MultipartBody;
3030
import org.junit.jupiter.api.BeforeEach;
31+
import org.junit.jupiter.api.AfterEach;
3132
import org.junit.jupiter.api.Test;
3233
import org.mockito.ArgumentCaptor;
3334

3435
import java.util.List;
36+
import java.util.concurrent.ExecutorService;
3537
import java.util.stream.Collectors;
3638
import java.util.stream.Stream;
3739

@@ -48,11 +50,18 @@ public class ParameterizedAssumptionSkipTest {
4850

4951
private final ReportPortalClient client = mock(ReportPortalClient.class);
5052

53+
private final ExecutorService executor = CommonUtils.testExecutor();
54+
5155
@BeforeEach
5256
public void setupMock() {
5357
TestUtils.mockLaunch(client, null, null, classId, methodIds);
5458
TestUtils.mockBatchLogging(client);
55-
ReportPortalListener.setReportPortal(ReportPortal.create(client, TestUtils.standardParameters(), TestUtils.testExecutor()));
59+
ReportPortalListener.setReportPortal(ReportPortal.create(client, TestUtils.standardParameters(), executor));
60+
}
61+
62+
@AfterEach
63+
public void tearDown() {
64+
CommonUtils.shutdownExecutorService(executor);
5665
}
5766

5867
@Test

src/test/java/com/epam/reportportal/junit/attribute/ClassKvAttributeTest.java

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@
2525
import com.epam.ta.reportportal.ws.model.StartTestItemRQ;
2626
import com.epam.ta.reportportal.ws.model.attribute.ItemAttributesRQ;
2727
import org.junit.jupiter.api.BeforeEach;
28+
import org.junit.jupiter.api.AfterEach;
2829
import org.junit.jupiter.api.Test;
2930
import org.mockito.ArgumentCaptor;
3031
import org.mockito.ArgumentMatchers;
@@ -40,12 +41,18 @@ public class ClassKvAttributeTest {
4041
private final String methodId = CommonUtils.namedId("method_");
4142

4243
private final ReportPortalClient client = mock(ReportPortalClient.class);
44+
private final java.util.concurrent.ExecutorService executor = CommonUtils.testExecutor();
4345

4446
@BeforeEach
4547
public void setupMock() {
4648
TestUtils.mockLaunch(client, null, null, classId, methodId);
4749
TestUtils.mockBatchLogging(client);
48-
ReportPortalListener.setReportPortal(ReportPortal.create(client, TestUtils.standardParameters(), TestUtils.testExecutor()));
50+
ReportPortalListener.setReportPortal(ReportPortal.create(client, TestUtils.standardParameters(), executor));
51+
}
52+
53+
@AfterEach
54+
public void tearDown() {
55+
CommonUtils.shutdownExecutorService(executor);
4956
}
5057

5158
@Test

src/test/java/com/epam/reportportal/junit/attribute/KvAttributeTest.java

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@
2525
import com.epam.ta.reportportal.ws.model.StartTestItemRQ;
2626
import com.epam.ta.reportportal.ws.model.attribute.ItemAttributesRQ;
2727
import org.junit.jupiter.api.BeforeEach;
28+
import org.junit.jupiter.api.AfterEach;
2829
import org.junit.jupiter.api.Test;
2930
import org.mockito.ArgumentCaptor;
3031

@@ -40,11 +41,18 @@ public class KvAttributeTest {
4041

4142
private final ReportPortalClient client = mock(ReportPortalClient.class);
4243

44+
private final java.util.concurrent.ExecutorService executor = CommonUtils.testExecutor();
45+
4346
@BeforeEach
4447
public void setupMock() {
4548
TestUtils.mockLaunch(client, null, null, classId, methodId);
4649
TestUtils.mockBatchLogging(client);
47-
ReportPortalListener.setReportPortal(ReportPortal.create(client, TestUtils.standardParameters(), TestUtils.testExecutor()));
50+
ReportPortalListener.setReportPortal(ReportPortal.create(client, TestUtils.standardParameters(), executor));
51+
}
52+
53+
@AfterEach
54+
public void tearDown() {
55+
CommonUtils.shutdownExecutorService(executor);
4856
}
4957

5058
@Test

src/test/java/com/epam/reportportal/junit/attribute/MultipleKvAttributeTest.java

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,10 +25,12 @@
2525
import com.epam.ta.reportportal.ws.model.StartTestItemRQ;
2626
import com.epam.ta.reportportal.ws.model.attribute.ItemAttributesRQ;
2727
import org.junit.jupiter.api.BeforeEach;
28+
import org.junit.jupiter.api.AfterEach;
2829
import org.junit.jupiter.api.Test;
2930
import org.mockito.ArgumentCaptor;
3031

3132
import java.util.Set;
33+
import java.util.concurrent.ExecutorService;
3234

3335
import static org.hamcrest.MatcherAssert.assertThat;
3436
import static org.hamcrest.Matchers.*;
@@ -41,11 +43,18 @@ public class MultipleKvAttributeTest {
4143

4244
private final ReportPortalClient client = mock(ReportPortalClient.class);
4345

46+
private final ExecutorService executor = CommonUtils.testExecutor();
47+
4448
@BeforeEach
4549
public void setupMock() {
4650
TestUtils.mockLaunch(client, null, null, classId, methodId);
4751
TestUtils.mockBatchLogging(client);
48-
ReportPortalListener.setReportPortal(ReportPortal.create(client, TestUtils.standardParameters(), TestUtils.testExecutor()));
52+
ReportPortalListener.setReportPortal(ReportPortal.create(client, TestUtils.standardParameters(), executor));
53+
}
54+
55+
@AfterEach
56+
public void tearDown() {
57+
CommonUtils.shutdownExecutorService(executor);
4958
}
5059

5160
@Test

src/test/java/com/epam/reportportal/junit/attribute/MultipleVAttributeTest.java

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,10 +25,12 @@
2525
import com.epam.ta.reportportal.ws.model.StartTestItemRQ;
2626
import com.epam.ta.reportportal.ws.model.attribute.ItemAttributesRQ;
2727
import org.junit.jupiter.api.BeforeEach;
28+
import org.junit.jupiter.api.AfterEach;
2829
import org.junit.jupiter.api.Test;
2930
import org.mockito.ArgumentCaptor;
3031

3132
import java.util.Set;
33+
import java.util.concurrent.ExecutorService;
3234

3335
import static org.hamcrest.MatcherAssert.assertThat;
3436
import static org.hamcrest.Matchers.*;
@@ -41,11 +43,18 @@ public class MultipleVAttributeTest {
4143

4244
private final ReportPortalClient client = mock(ReportPortalClient.class);
4345

46+
private final ExecutorService executor = CommonUtils.testExecutor();
47+
4448
@BeforeEach
4549
public void setupMock() {
4650
TestUtils.mockLaunch(client, null, null, classId, methodId);
4751
TestUtils.mockBatchLogging(client);
48-
ReportPortalListener.setReportPortal(ReportPortal.create(client, TestUtils.standardParameters(), TestUtils.testExecutor()));
52+
ReportPortalListener.setReportPortal(ReportPortal.create(client, TestUtils.standardParameters(), executor));
53+
}
54+
55+
@AfterEach
56+
public void tearDown() {
57+
CommonUtils.shutdownExecutorService(executor);
4958
}
5059

5160
@Test

src/test/java/com/epam/reportportal/junit/attribute/SystemAttributesFetchTest.java

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,10 +26,12 @@
2626
import com.epam.ta.reportportal.ws.model.attribute.ItemAttributesRQ;
2727
import com.epam.ta.reportportal.ws.model.launch.StartLaunchRQ;
2828
import org.junit.jupiter.api.BeforeEach;
29+
import org.junit.jupiter.api.AfterEach;
2930
import org.junit.jupiter.api.Test;
3031
import org.mockito.ArgumentCaptor;
3132

3233
import java.util.List;
34+
import java.util.concurrent.ExecutorService;
3335
import java.util.Set;
3436
import java.util.stream.Collectors;
3537

@@ -45,11 +47,18 @@ public class SystemAttributesFetchTest {
4547

4648
private final ReportPortalClient client = mock(ReportPortalClient.class);
4749

50+
private final ExecutorService executor = CommonUtils.testExecutor();
51+
4852
@BeforeEach
4953
public void setupMock() {
5054
TestUtils.mockLaunch(client, null, null, classId, methodId);
5155
TestUtils.mockBatchLogging(client);
52-
ReportPortalListener.setReportPortal(ReportPortal.create(client, TestUtils.standardParameters(), TestUtils.testExecutor()));
56+
ReportPortalListener.setReportPortal(ReportPortal.create(client, TestUtils.standardParameters(), executor));
57+
}
58+
59+
@AfterEach
60+
public void tearDown() {
61+
CommonUtils.shutdownExecutorService(executor);
5362
}
5463

5564
@Test

0 commit comments

Comments
 (0)