Skip to content

Commit

Permalink
Merge pull request #89 from reportportal/develop
Browse files Browse the repository at this point in the history
Release
  • Loading branch information
HardNorth authored Feb 8, 2024
2 parents 3469a6e + e82485b commit 39980a7
Show file tree
Hide file tree
Showing 7 changed files with 38 additions and 35 deletions.
8 changes: 5 additions & 3 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,10 +35,10 @@ jobs:

steps:
- name: Checkout repository
uses: actions/checkout@v3
uses: actions/checkout@v4

- name: Set up JDK 1.8
uses: actions/setup-java@v3
uses: actions/setup-java@v4
with:
distribution: 'temurin'
java-version: '8'
Expand All @@ -47,4 +47,6 @@ jobs:
run: ./gradlew build

- name: Codecov upload
run: bash <(curl -s https://codecov.io/bash)
uses: codecov/codecov-action@v4
with:
token: ${{ secrets.CODECOV_TOKEN }}
6 changes: 3 additions & 3 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v3
uses: actions/checkout@v4

- name: Generate versions
uses: HardNorth/github-version-generate@v1
Expand All @@ -47,7 +47,7 @@ jobs:
version-file-extraction-pattern: ${{ env.VERSION_EXTRACT_PATTERN }}

- name: Set up JDK 1.8
uses: actions/setup-java@v3
uses: actions/setup-java@v4
with:
distribution: 'temurin'
java-version: '8'
Expand Down Expand Up @@ -98,7 +98,7 @@ jobs:

- name: Checkout develop branch
if: ${{github.ref}} == 'master'
uses: actions/checkout@v3
uses: actions/checkout@v4
with:
ref: 'develop'
fetch-depth: 0
Expand Down
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
# Changelog

## [Unreleased]
### Changed
- Client version updated on [5.2.4](https://github.com/reportportal/client-java/releases/tag/5.2.4), by @HardNorth
### Removed
- `commons-model` dependency to rely on `clinet-java` exclusions in security fixes, by @HardNorth

## [5.2.0]
### Changed
Expand Down
3 changes: 1 addition & 2 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,7 @@ repositories {
}

dependencies {
api 'com.epam.reportportal:client-java:5.2.1'
api 'com.epam.reportportal:commons-model:5.0.0'
api 'com.epam.reportportal:client-java:5.2.4'
api 'com.google.code.findbugs:jsr305:3.0.2'
api "io.cucumber:cucumber-java:${project.cucumber_version}"

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,7 @@ protected TestCaseIdEntry getTestCaseId(@Nonnull TestStep testStep, @Nullable St
List<cucumber.api.Argument> arguments = ((PickleStepTestStep) testStep).getDefinitionArgument();
if (definitionMatch != null) {
try {
Method method = retrieveMethod((StepDefinitionMatch) definitionMatch);
Method method = retrieveMethod(definitionMatch);
return TestCaseIdUtils.getTestCaseId(method.getAnnotation(TestCaseId.class),
method,
codeRef,
Expand Down Expand Up @@ -332,7 +332,7 @@ protected void afterScenario(TestCaseFinished event) {
currentScenarioContextMap.remove(Pair.of(context.getLine(), featureUri));
Date endTime = finishTestItem(context.getId(), event.result.getStatus());
featureEndTime.put(featureUri, endTime);
currentScenarioContext.set(null);
currentScenarioContext.remove();
removeFromTree(currentFeatureContextMap.get(context.getFeatureUri()), context);
}

Expand All @@ -342,7 +342,7 @@ protected void afterScenario(TestCaseFinished event) {
protected void startLaunch() {
launch = new MemoizingSupplier<>(new Supplier<Launch>() {

/* should no be lazy */
/* should not be lazy */
private final Date startTime = Calendar.getInstance().getTime();

@Override
Expand Down Expand Up @@ -912,7 +912,7 @@ protected Set<ItemAttributesRQ> getAttributes(@Nonnull TestStep testStep) {
Object definitionMatch = getDefinitionMatch(testStep);
if (definitionMatch != null) {
try {
Method method = retrieveMethod((StepDefinitionMatch) definitionMatch);
Method method = retrieveMethod(definitionMatch);
Attributes attributesAnnotation = method.getAnnotation(Attributes.class);
if (attributesAnnotation != null) {
return AttributeParser.retrieveAttributes(attributesAnnotation);
Expand Down
16 changes: 7 additions & 9 deletions src/main/java/com/epam/reportportal/cucumber/Utils.java
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,7 @@
import com.epam.reportportal.utils.reflect.Accessible;
import cucumber.api.Result;
import cucumber.api.TestStep;
import cucumber.runtime.StepDefinitionMatch;

import java.lang.reflect.Field;
import java.lang.reflect.Method;
import java.util.*;
import java.util.stream.Collectors;
Expand Down Expand Up @@ -82,13 +80,13 @@ public static String buildName(String prefix, String infix, String argument) {
return (prefix == null ? EMPTY : prefix) + infix + argument;
}

public static Method retrieveMethod(StepDefinitionMatch stepDefinitionMatch) throws IllegalAccessException, NoSuchFieldException {
Field stepDefinitionField = stepDefinitionMatch.getClass().getDeclaredField(STEP_DEFINITION_FIELD_NAME);
stepDefinitionField.setAccessible(true);
Object javaStepDefinition = stepDefinitionField.get(stepDefinitionMatch);
Field methodField = javaStepDefinition.getClass().getDeclaredField(METHOD_FIELD_NAME);
methodField.setAccessible(true);
return (Method) methodField.get(javaStepDefinition);
public static Method retrieveMethod(Object stepDefinitionMatch) throws IllegalAccessException, NoSuchFieldException {
Object javaStepDefinition = Accessible.on(stepDefinitionMatch).field(STEP_DEFINITION_FIELD_NAME).getValue();
Method method = null;
if (javaStepDefinition != null) {
method = (Method) Accessible.on(javaStepDefinition).field(METHOD_FIELD_NAME).getValue();
}
return method;
}

public static final java.util.function.Function<List<cucumber.api.Argument>, List<?>> ARGUMENTS_TRANSFORM = arguments -> ofNullable(
Expand Down
28 changes: 14 additions & 14 deletions src/test/java/com/epam/reportportal/cucumber/EmbeddingTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -54,42 +54,42 @@ public class EmbeddingTest {
@CucumberOptions(features = "src/test/resources/features/embedding/ImageEmbeddingFeature.feature", glue = {
"com.epam.reportportal.cucumber.integration.embed.image" }, plugin = { "pretty",
"com.epam.reportportal.cucumber.integration.TestStepReporter" })
public static class ImageStepReporter extends AbstractTestNGCucumberTests {
public static class ImageStepReporterTest extends AbstractTestNGCucumberTests {

}

@CucumberOptions(features = "src/test/resources/features/embedding/TextEmbeddingFeature.feature", glue = {
"com.epam.reportportal.cucumber.integration.embed.text" }, plugin = { "pretty",
"com.epam.reportportal.cucumber.integration.TestStepReporter" })
public static class TextStepReporter extends AbstractTestNGCucumberTests {
public static class TextStepReporterTest extends AbstractTestNGCucumberTests {

}

@CucumberOptions(features = "src/test/resources/features/embedding/PdfEmbeddingFeature.feature", glue = {
"com.epam.reportportal.cucumber.integration.embed.pdf" }, plugin = { "pretty",
"com.epam.reportportal.cucumber.integration.TestStepReporter" })
public static class PdfStepReporter extends AbstractTestNGCucumberTests {
public static class PdfStepReporterTest extends AbstractTestNGCucumberTests {

}

@CucumberOptions(features = "src/test/resources/features/embedding/ArchiveEmbeddingFeature.feature", glue = {
"com.epam.reportportal.cucumber.integration.embed.zip" }, plugin = { "pretty",
"com.epam.reportportal.cucumber.integration.TestStepReporter" })
public static class ZipStepReporter extends AbstractTestNGCucumberTests {
public static class ZipStepReporterTest extends AbstractTestNGCucumberTests {

}

@CucumberOptions(features = "src/test/resources/features/embedding/EmbedImageWithoutName.feature", glue = {
"com.epam.reportportal.cucumber.integration.embed.image" }, plugin = { "pretty",
"com.epam.reportportal.cucumber.integration.TestStepReporter" })
public static class ImageNoNameStepReporter extends AbstractTestNGCucumberTests {
public static class ImageNoNameStepReporterTest extends AbstractTestNGCucumberTests {

}

@CucumberOptions(features = "src/test/resources/features/embedding/EmbedImageWithEmptyName.feature", glue = {
"com.epam.reportportal.cucumber.integration.embed.image" }, plugin = { "pretty",
"com.epam.reportportal.cucumber.integration.TestStepReporter" })
public static class ImageEmptyNameStepReporter extends AbstractTestNGCucumberTests {
public static class ImageEmptyNameStepReporterTest extends AbstractTestNGCucumberTests {

}

Expand Down Expand Up @@ -132,7 +132,7 @@ public void setup() {

@Test
public void verify_image_embedding() {
TestUtils.runTests(ImageStepReporter.class);
TestUtils.runTests(ImageStepReporterTest.class);

ArgumentCaptor<List<MultipartBody.Part>> logCaptor = ArgumentCaptor.forClass(List.class);
verify(client, atLeastOnce()).log(logCaptor.capture());
Expand All @@ -147,7 +147,7 @@ public void verify_image_embedding() {

@Test
public void verify_text_embedding() {
TestUtils.runTests(TextStepReporter.class);
TestUtils.runTests(TextStepReporterTest.class);

ArgumentCaptor<List<MultipartBody.Part>> logCaptor = ArgumentCaptor.forClass(List.class);
verify(client, atLeastOnce()).log(logCaptor.capture());
Expand All @@ -161,7 +161,7 @@ public void verify_text_embedding() {

@Test
public void verify_pfd_embedding() {
TestUtils.runTests(PdfStepReporter.class);
TestUtils.runTests(PdfStepReporterTest.class);

ArgumentCaptor<List<MultipartBody.Part>> logCaptor = ArgumentCaptor.forClass(List.class);
verify(client, atLeastOnce()).log(logCaptor.capture());
Expand All @@ -170,25 +170,25 @@ public void verify_pfd_embedding() {
List<String> types = getTypes(logCaptor, logs);

assertThat(types, hasSize(3));
assertThat(types, containsInAnyOrder("application/pdf", "image/png", "application/octet-stream"));
assertThat(types, containsInAnyOrder("application/pdf", "image/png", "application/pdf"));
}

@Test
public void verify_archive_embedding() {
TestUtils.runTests(ZipStepReporter.class);
TestUtils.runTests(ZipStepReporterTest.class);

ArgumentCaptor<List<MultipartBody.Part>> logCaptor = ArgumentCaptor.forClass(List.class);
verify(client, atLeastOnce()).log(logCaptor.capture());
List<SaveLogRQ> logs = filterLogs(logCaptor, l -> Objects.nonNull(l.getFile()));

List<String> types = getTypes(logCaptor, logs);
assertThat(types, hasSize(3));
assertThat(types, containsInAnyOrder("application/zip", "image/png", "application/octet-stream"));
assertThat(types, containsInAnyOrder("application/zip", "image/png", "application/zip"));
}

@Test
public void verify_image_no_name_embedding() {
TestUtils.runTests(ImageNoNameStepReporter.class);
TestUtils.runTests(ImageNoNameStepReporterTest.class);

ArgumentCaptor<List<MultipartBody.Part>> logCaptor = ArgumentCaptor.forClass(List.class);
verify(client, atLeastOnce()).log(logCaptor.capture());
Expand All @@ -203,7 +203,7 @@ public void verify_image_no_name_embedding() {

@Test
public void verify_image_empty_name_embedding() {
TestUtils.runTests(ImageEmptyNameStepReporter.class);
TestUtils.runTests(ImageEmptyNameStepReporterTest.class);

ArgumentCaptor<List<MultipartBody.Part>> logCaptor = ArgumentCaptor.forClass(List.class);
verify(client, atLeastOnce()).log(logCaptor.capture());
Expand Down

0 comments on commit 39980a7

Please sign in to comment.