From a511bc2199712100a6304d264e3f3ae5020006cb Mon Sep 17 00:00:00 2001 From: Vadzim Hushchanskou Date: Thu, 23 Dec 2021 12:00:16 +0300 Subject: [PATCH 1/6] Client version update --- CHANGELOG.md | 2 ++ build.gradle | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 4f2bdae..b0f8d0a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,8 @@ # Changelog ## [Unreleased] +### Changed +- Client version updated on [5.1.1](https://github.com/reportportal/client-java/releases/tag/5.1.1) ## [5.1.0] ### Added diff --git a/build.gradle b/build.gradle index 5fc124b..2439c9d 100644 --- a/build.gradle +++ b/build.gradle @@ -38,7 +38,7 @@ repositories { } dependencies { - api 'com.epam.reportportal:client-java:5.1.0' + api 'com.epam.reportportal:client-java:5.1.1' api 'com.epam.reportportal:commons-model:5.0.0' api 'com.google.code.findbugs:jsr305:3.0.2' api 'info.cukes:gherkin:2.12.2' From 4c5213be7f1274030361c736993ef5956fb4b25d Mon Sep 17 00:00:00 2001 From: Vadzim Hushchanskou Date: Fri, 31 Dec 2021 11:17:12 +0300 Subject: [PATCH 2/6] Client version update, Slf4j version update --- CHANGELOG.md | 3 ++- build.gradle | 10 ++++---- .../CallbackReportingIntegrationTest.java | 3 ++- .../cucumber/integration/util/TestUtils.java | 23 +++++++++---------- 4 files changed, 20 insertions(+), 19 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index b0f8d0a..aabaf97 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,7 +2,8 @@ ## [Unreleased] ### Changed -- Client version updated on [5.1.1](https://github.com/reportportal/client-java/releases/tag/5.1.1) +- Client version updated on [5.1.3](https://github.com/reportportal/client-java/releases/tag/5.1.3) +- Slf4j version updated on 1.7.32 to support newer versions of Logback with security fixes ## [5.1.0] ### Added diff --git a/build.gradle b/build.gradle index 2439c9d..57b1786 100644 --- a/build.gradle +++ b/build.gradle @@ -38,23 +38,23 @@ repositories { } dependencies { - api 'com.epam.reportportal:client-java:5.1.1' + api 'com.epam.reportportal:client-java:5.1.3' api 'com.epam.reportportal:commons-model:5.0.0' api 'com.google.code.findbugs:jsr305:3.0.2' api 'info.cukes:gherkin:2.12.2' - implementation 'org.slf4j:slf4j-api:1.7.25' + implementation 'org.slf4j:slf4j-api:1.7.32' implementation 'org.apache.commons:commons-text:1.9' - testImplementation 'com.github.reportportal:agent-java-test-utils:ddcf50ee20' + testImplementation 'com.github.reportportal:agent-java-test-utils:236a68c' testImplementation 'org.aspectj:aspectjweaver:1.9.2' testImplementation "io.cucumber:cucumber-java:${project.cucumber_version}" testImplementation "io.cucumber:cucumber-testng:${project.cucumber_version}" testImplementation 'org.hamcrest:hamcrest-core:2.2' testImplementation 'org.mockito:mockito-core:3.3.3' testImplementation 'org.mockito:mockito-junit-jupiter:3.3.3' - testImplementation 'ch.qos.logback:logback-classic:1.2.3' - testImplementation 'com.epam.reportportal:logger-java-logback:5.0.3' + testImplementation 'ch.qos.logback:logback-classic:1.2.10' + testImplementation 'com.epam.reportportal:logger-java-logback:5.1.0' testImplementation ("org.junit.platform:junit-platform-runner:${project.junit_runner_version}") { exclude module: 'junit' diff --git a/src/test/java/com/epam/reportportal/cucumber/CallbackReportingIntegrationTest.java b/src/test/java/com/epam/reportportal/cucumber/CallbackReportingIntegrationTest.java index b706ef9..e299fd4 100644 --- a/src/test/java/com/epam/reportportal/cucumber/CallbackReportingIntegrationTest.java +++ b/src/test/java/com/epam/reportportal/cucumber/CallbackReportingIntegrationTest.java @@ -28,6 +28,7 @@ import com.epam.ta.reportportal.ws.model.log.SaveLogRQ; import cucumber.api.CucumberOptions; import cucumber.api.testng.AbstractTestNGCucumberTests; +import io.reactivex.Maybe; import org.apache.commons.lang3.tuple.Pair; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; @@ -98,7 +99,7 @@ public void setup() { TestScenarioReporter.RP.set(reportPortal); TestStepReporter.addReportPortal(reportPortal); TestStepReporter.RP.set(reportPortal); - when(client.log(any(SaveLogRQ.class))).thenReturn(CommonUtils.createMaybe(new EntryCreatedAsyncRS())); + when(client.log(any(SaveLogRQ.class))).thenReturn(Maybe.just(new EntryCreatedAsyncRS())); } @Test diff --git a/src/test/java/com/epam/reportportal/cucumber/integration/util/TestUtils.java b/src/test/java/com/epam/reportportal/cucumber/integration/util/TestUtils.java index f55263d..7cd5477 100644 --- a/src/test/java/com/epam/reportportal/cucumber/integration/util/TestUtils.java +++ b/src/test/java/com/epam/reportportal/cucumber/integration/util/TestUtils.java @@ -23,7 +23,6 @@ import java.util.function.Predicate; import java.util.stream.Collectors; -import static com.epam.reportportal.util.test.CommonUtils.createMaybe; import static com.epam.reportportal.util.test.CommonUtils.generateUniqueId; import static java.util.Optional.ofNullable; import static org.mockito.ArgumentMatchers.*; @@ -58,14 +57,14 @@ public static void mockLaunch(ReportPortalClient client, String launchUuid, Stri @SuppressWarnings("unchecked") public static > void mockLaunch(ReportPortalClient client, String launchUuid, String suiteUuid, Collection> testSteps) { - when(client.startLaunch(any())).thenReturn(createMaybe(new StartLaunchRS(launchUuid, 1L))); + when(client.startLaunch(any())).thenReturn(Maybe.just(new StartLaunchRS(launchUuid, 1L))); - Maybe suiteMaybe = createMaybe(new ItemCreatedRS(suiteUuid, suiteUuid)); + Maybe suiteMaybe = Maybe.just(new ItemCreatedRS(suiteUuid, suiteUuid)); when(client.startTestItem(any())).thenReturn(suiteMaybe); List> testResponses = testSteps.stream() .map(Pair::getKey) - .map(uuid -> createMaybe(new ItemCreatedRS(uuid, uuid))) + .map(uuid -> Maybe.just(new ItemCreatedRS(uuid, uuid))) .collect(Collectors.toList()); Maybe first = testResponses.get(0); @@ -76,26 +75,26 @@ public static > void mockLaunch(ReportPortalClient String testClassUuid = test.getKey(); List> stepResponses = test.getValue() .stream() - .map(uuid -> createMaybe(new ItemCreatedRS(uuid, uuid))) + .map(uuid -> Maybe.just(new ItemCreatedRS(uuid, uuid))) .collect(Collectors.toList()); Maybe myFirst = stepResponses.get(0); Maybe[] myOther = stepResponses.subList(1, stepResponses.size()).toArray(new Maybe[0]); when(client.startTestItem(same(testClassUuid), any())).thenReturn(myFirst, myOther); new HashSet<>(test.getValue()).forEach(testMethodUuid -> when(client.finishTestItem(same(testMethodUuid), any())).thenReturn( - createMaybe(new OperationCompletionRS()))); - when(client.finishTestItem(same(testClassUuid), any())).thenReturn(createMaybe(new OperationCompletionRS())); + Maybe.just(new OperationCompletionRS()))); + when(client.finishTestItem(same(testClassUuid), any())).thenReturn(Maybe.just(new OperationCompletionRS())); }); - Maybe suiteFinishMaybe = createMaybe(new OperationCompletionRS()); + Maybe suiteFinishMaybe = Maybe.just(new OperationCompletionRS()); when(client.finishTestItem(eq(suiteUuid), any())).thenReturn(suiteFinishMaybe); - when(client.finishLaunch(eq(launchUuid), any())).thenReturn(createMaybe(new OperationCompletionRS())); + when(client.finishLaunch(eq(launchUuid), any())).thenReturn(Maybe.just(new OperationCompletionRS())); } @SuppressWarnings("unchecked") public static void mockLogging(ReportPortalClient client) { - when(client.log(any(List.class))).thenReturn(createMaybe(new BatchSaveOperatingRS())); + when(client.log(any(List.class))).thenReturn(Maybe.just(new BatchSaveOperatingRS())); } public static void mockNestedSteps(ReportPortalClient client, Pair parentNestedPair) { @@ -108,7 +107,7 @@ public static void mockNestedSteps(final ReportPortalClient client, final List

{ List> responses = v.stream() - .map(uuid -> createMaybe(new ItemCreatedRS(uuid, uuid))) + .map(uuid -> Maybe.just(new ItemCreatedRS(uuid, uuid))) .collect(Collectors.toList()); Maybe first = responses.get(0); @@ -118,7 +117,7 @@ public static void mockNestedSteps(final ReportPortalClient client, final List

when(client.finishTestItem( same(p.getValue()), any() - )).thenAnswer((Answer>) invocation -> createMaybe(new OperationCompletionRS()))); + )).thenAnswer((Answer>) invocation -> Maybe.just(new OperationCompletionRS()))); } public static ListenerParameters standardParameters() { From 87912f67e6c227d073de0520671314eb23dde79e Mon Sep 17 00:00:00 2001 From: Vadzim Hushchanskou Date: Thu, 6 Jan 2022 16:38:46 +0300 Subject: [PATCH 3/6] Client version update --- CHANGELOG.md | 2 +- build.gradle | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index aabaf97..0f0083d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,7 +2,7 @@ ## [Unreleased] ### Changed -- Client version updated on [5.1.3](https://github.com/reportportal/client-java/releases/tag/5.1.3) +- Client version updated on [5.1.4](https://github.com/reportportal/client-java/releases/tag/5.1.4) - Slf4j version updated on 1.7.32 to support newer versions of Logback with security fixes ## [5.1.0] diff --git a/build.gradle b/build.gradle index 57b1786..a21d829 100644 --- a/build.gradle +++ b/build.gradle @@ -38,7 +38,7 @@ repositories { } dependencies { - api 'com.epam.reportportal:client-java:5.1.3' + api 'com.epam.reportportal:client-java:5.1.4' api 'com.epam.reportportal:commons-model:5.0.0' api 'com.google.code.findbugs:jsr305:3.0.2' api 'info.cukes:gherkin:2.12.2' From b659179ea1294e1886acbebfd83674ce78ad9c9e Mon Sep 17 00:00:00 2001 From: Vadzim Hushchanskou Date: Mon, 10 Jan 2022 16:43:24 +0300 Subject: [PATCH 4/6] Logger version update --- build.gradle | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build.gradle b/build.gradle index a21d829..403879f 100644 --- a/build.gradle +++ b/build.gradle @@ -54,7 +54,7 @@ dependencies { testImplementation 'org.mockito:mockito-core:3.3.3' testImplementation 'org.mockito:mockito-junit-jupiter:3.3.3' testImplementation 'ch.qos.logback:logback-classic:1.2.10' - testImplementation 'com.epam.reportportal:logger-java-logback:5.1.0' + testImplementation 'com.epam.reportportal:logger-java-logback:5.1.1' testImplementation ("org.junit.platform:junit-platform-runner:${project.junit_runner_version}") { exclude module: 'junit' From 815ee8366191711bde6788a409234f1ac33a4f50 Mon Sep 17 00:00:00 2001 From: Vadzim Hushchanskou Date: Wed, 23 Feb 2022 12:19:07 +0300 Subject: [PATCH 5/6] Remove java installation from promote pipeline --- .github/workflows/promote.yml | 5 ----- 1 file changed, 5 deletions(-) diff --git a/.github/workflows/promote.yml b/.github/workflows/promote.yml index 9f124a5..c314f26 100644 --- a/.github/workflows/promote.yml +++ b/.github/workflows/promote.yml @@ -33,11 +33,6 @@ jobs: steps: - - name: Set up JDK 1.8 - uses: actions/setup-java@v1 - with: - java-version: 1.8 - - name: Get variables run: | echo "ARTIFACT=`echo ${{ github.repository }} | cut -d/ -f2- | awk '{print tolower($0)}'`" >> $GITHUB_ENV From 11785f9e54a9cf78255cf6f5a7bda1cfab03e3cc Mon Sep 17 00:00:00 2001 From: Vadzim Hushchanskou Date: Wed, 23 Feb 2022 12:22:42 +0300 Subject: [PATCH 6/6] Fix: Invalid Data Tables format for some Report Portal versions --- CHANGELOG.md | 2 ++ .../com/epam/reportportal/cucumber/Utils.java | 22 ++++++++++++++----- .../ParameterScenarioReporterTest.java | 4 ++-- .../feature/ReportsTestWithParameters.java | 2 +- 4 files changed, 22 insertions(+), 8 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 0f0083d..e866733 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,8 @@ # Changelog ## [Unreleased] +### Fixed +- Invalid Data Tables format for some Report Portal versions ### Changed - Client version updated on [5.1.4](https://github.com/reportportal/client-java/releases/tag/5.1.4) - Slf4j version updated on 1.7.32 to support newer versions of Logback with security fixes diff --git a/src/main/java/com/epam/reportportal/cucumber/Utils.java b/src/main/java/com/epam/reportportal/cucumber/Utils.java index f42b688..9eeaf73 100644 --- a/src/main/java/com/epam/reportportal/cucumber/Utils.java +++ b/src/main/java/com/epam/reportportal/cucumber/Utils.java @@ -36,10 +36,11 @@ public class Utils { private static final String STEP_DEFINITION_FIELD_NAME = "stepDefinition"; private static final String METHOD_FIELD_NAME = "method"; - private static final String ONE_SPACE = " "; + public static final String ONE_SPACE = "\u00A0"; private static final String NEW_LINE = "\r\n"; - private static final String TABLE_INDENT = "    "; - private static final String TABLE_SEPARATOR = "|"; + public static final String TABLE_INDENT = "\u00A0\u00A0\u00A0\u00A0"; + public static final String TABLE_COLUMN_SEPARATOR = "|"; + public static final String TABLE_ROW_SEPARATOR = "-"; //@formatter:off public static final Map STATUS_MAPPING = ImmutableMap.builder() @@ -103,8 +104,9 @@ public static String formatDataTable(@Nonnull final List> table) { .map(col -> col.stream().mapToInt(String::length).max().orElse(0)) .collect(Collectors.toList()); + boolean header = true; for (List row : table) { - result.append(TABLE_INDENT).append(TABLE_SEPARATOR); + result.append(TABLE_INDENT).append(TABLE_COLUMN_SEPARATOR); for (int i = 0; i < row.size(); i++) { String cell = row.get(i); int maxSize = colSizes.get(i) - cell.length() + 2; @@ -113,7 +115,17 @@ public static String formatDataTable(@Nonnull final List> table) { IntStream.range(0, lSpace).forEach(j -> result.append(ONE_SPACE)); result.append(cell); IntStream.range(0, rSpace).forEach(j -> result.append(ONE_SPACE)); - result.append(TABLE_SEPARATOR); + result.append(TABLE_COLUMN_SEPARATOR); + } + if (header) { + header = false; + result.append(NEW_LINE); + result.append(TABLE_INDENT).append(TABLE_COLUMN_SEPARATOR); + for (int i = 0; i < row.size(); i++) { + int maxSize = colSizes.get(i) + 2; + IntStream.range(0, maxSize).forEach(j -> result.append(TABLE_ROW_SEPARATOR)); + result.append(TABLE_COLUMN_SEPARATOR); + } } result.append(NEW_LINE); } diff --git a/src/test/java/com/epam/reportportal/cucumber/ParameterScenarioReporterTest.java b/src/test/java/com/epam/reportportal/cucumber/ParameterScenarioReporterTest.java index 7565020..112c345 100644 --- a/src/test/java/com/epam/reportportal/cucumber/ParameterScenarioReporterTest.java +++ b/src/test/java/com/epam/reportportal/cucumber/ParameterScenarioReporterTest.java @@ -40,7 +40,7 @@ public class ParameterScenarioReporterTest { @CucumberOptions(features = "src/test/resources/features/OneSimpleAndOneScenarioOutline.feature", glue = { "com.epam.reportportal.cucumber.integration.feature" }, plugin = { "pretty", "com.epam.reportportal.cucumber.integration.TestScenarioReporter" }) - public static class OneSimpleAndOneScenarioOutlineScenarioReporter extends AbstractTestNGCucumberTests { + public static class OneSimpleAndOneScenarioOutlineScenarioReporterTest extends AbstractTestNGCucumberTests { } @@ -97,7 +97,7 @@ public void initLaunch() { @Test public void verify_agent_creates_correct_step_names() { - TestUtils.runTests(OneSimpleAndOneScenarioOutlineScenarioReporter.class); + TestUtils.runTests(OneSimpleAndOneScenarioOutlineScenarioReporterTest.class); verify(client, times(1)).startTestItem(any()); verify(client, times(1)).startTestItem(same(suiteId), any()); diff --git a/src/test/java/com/epam/reportportal/cucumber/integration/feature/ReportsTestWithParameters.java b/src/test/java/com/epam/reportportal/cucumber/integration/feature/ReportsTestWithParameters.java index 5cef5b3..95d2d04 100644 --- a/src/test/java/com/epam/reportportal/cucumber/integration/feature/ReportsTestWithParameters.java +++ b/src/test/java/com/epam/reportportal/cucumber/integration/feature/ReportsTestWithParameters.java @@ -50,7 +50,7 @@ public void iHaveANamedStrInlineParameter(@ParameterKey("my name") String str) { @Given("a step with a data table:") public void testStep(DataTable dataTable) throws InterruptedException { - LOGGER.info("DataTable parameter: {}", dataTable.toString()); + LOGGER.info("DataTable parameter:\r\n{}", dataTable.toString()); Thread.sleep(CommonUtils.MINIMAL_TEST_PAUSE); } }