Skip to content

Commit

Permalink
Merge pull request #229 from reportportal/develop
Browse files Browse the repository at this point in the history
Release
  • Loading branch information
HardNorth authored Jan 11, 2024
2 parents ee6f0b8 + db71802 commit 39dde65
Show file tree
Hide file tree
Showing 33 changed files with 323 additions and 441 deletions.
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
- Guava library dependency was removed, by @HardNorth
### Removed
- Deprecated code, by @HardNorth

## [5.1.27]
### Changed
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ value will be used.
| rp.attributes | String | Set of attributes for specifying additional meta information for current launch. Format: key:value;value;build:12345-6. Attributes should be separated by “;”, keys and values - “:”. | No |
| rp.reporting.async | Boolean | Enables asynchronous reporting. Available values - `true` (by default) or `false`. Supported only in 5+ version. | No |
| rp.reporting.callback | Boolean | Enables [callback reporting](https://github.com/reportportal/client-java/wiki/Callback-reporting-usefulness). Available values - `true` or `false`(by default). Supported only in 5+ vesion | No |
| rp.rerun | Boolean | Enables [rerun mode](https://github.com/reportportal/documentation/blob/master/src/md/src/DevGuides/rerun.md). Available values - `true` or `false`(by default). Supported only in 5+ version | No |
| rp.rerun | Boolean | Enables [rerun mode](https://reportportal.io/docs/dev-guides/RerunDevelopersGuide/). Available values - `true` or `false`(by default). Supported only in 5+ version | No |
| rp.rerun.of | String | Specifies UUID of launch that has to be rerun. | No |
| rp.convertimage | Boolean | Colored log images can be converted to grayscale for reducing image size. Values: ‘true’ – will be converted. Any other value means ‘false’. | No |
| rp.mode | Enum | ReportPortal provides possibility to specify visibility of executing launch. Currently two modes are supported: DEFAULT - all users from project can see this launch; DEBUG - all users except of Customer role can see this launch (in debug sub tab). Note: for all java based clients (TestNG, Junit) mode will be set automatically to "DEFAULT" if it is not specified. | No |
Expand Down
1 change: 0 additions & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,6 @@ dependencies {
}
api 'io.reactivex.rxjava2:rxjava:2.2.10'
api 'com.google.code.findbugs:jsr305:3.0.2'
api 'com.google.guava:guava:33.0.0-android'

api ("com.squareup.retrofit2:retrofit:${project.retrofit_version}") {
exclude module: 'okhttp'
Expand Down
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
version=5.1.28-SNAPSHOT
version=5.2.0-SNAPSHOT
description=EPAM ReportPortal. Client
retrofit_version=2.9.0
okhttp_version=4.12.0
Expand Down
8 changes: 0 additions & 8 deletions src/main/java/com/epam/reportportal/annotations/Step.java
Original file line number Diff line number Diff line change
Expand Up @@ -56,14 +56,6 @@
*/
boolean isIgnored() default false;

/**
* Step template configuration.
*
* @return template configuration
* @deprecated Use more generic {@link #config()} method
*/
@Deprecated StepTemplateConfig templateConfig() default @StepTemplateConfig;

/**
* Step template configuration.
*
Expand Down

This file was deleted.

9 changes: 0 additions & 9 deletions src/main/java/com/epam/reportportal/aspect/StepNameUtils.java
Original file line number Diff line number Diff line change
Expand Up @@ -53,16 +53,7 @@ public static String getStepName(@Nonnull Step step, @Nonnull MethodSignature si
return signature.getMethod().getName();
}

TemplateConfiguration defaultConfig = new TemplateConfiguration();
@SuppressWarnings("deprecation")
TemplateConfiguration deprecatedConfig = new TemplateConfiguration(step.templateConfig());
TemplateConfiguration config = new TemplateConfiguration(step.config());
if (!deprecatedConfig.equals(defaultConfig)) {
if (config.equals(defaultConfig)) {
config = deprecatedConfig;
}
}

return getStepName(nameTemplate, config, signature, joinPoint);
}

Expand Down
122 changes: 9 additions & 113 deletions src/main/java/com/epam/reportportal/listeners/ListenerParameters.java
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,6 @@
import com.epam.reportportal.utils.properties.PropertiesLoader;
import com.epam.ta.reportportal.ws.model.attribute.ItemAttributesRQ;
import com.epam.ta.reportportal.ws.model.launch.Mode;
import org.apache.commons.lang3.StringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import javax.annotation.Nonnull;
import javax.annotation.Nullable;
Expand All @@ -43,11 +40,6 @@
* ReportPortal client parameters. The class is a placeholder for client and agent parameters.
*/
public class ListenerParameters implements Cloneable {

private static final Logger LOGGER = LoggerFactory.getLogger(ListenerParameters.class);

private static final String PROPERTY_WILL_BE_REMOVED = "Property '{}' will be removed in the next major version, please use '{}' instead";

private static final int DEFAULT_REPORTING_TIMEOUT = 5 * 60;
private static final int DEFAULT_IO_POOL_SIZE = 100;
private static final boolean DEFAULT_ENABLE = true;
Expand Down Expand Up @@ -260,88 +252,28 @@ public ListenerParameters(PropertiesLoader properties) {
properties.getProperty(CLIENT_JOIN_TIMEOUT_UNIT, DEFAULT_CLIENT_JOIN_TIMEOUT_UNIT))
.toMillis(Long.parseLong(t))).orElse(DEFAULT_CLIENT_JOIN_TIMEOUT);

lockFileName = properties.getProperty(LOCK_FILE_NAME);
if (lockFileName != null) {
LOGGER.warn(PROPERTY_WILL_BE_REMOVED, LOCK_FILE_NAME.getPropertyName(), FILE_LOCK_NAME.getPropertyName());
lockFileName = properties.getProperty(FILE_LOCK_NAME, lockFileName);
} else {
lockFileName = properties.getProperty(FILE_LOCK_NAME, DEFAULT_LOCK_FILE_NAME);
}
syncFileName = properties.getProperty(SYNC_FILE_NAME);
if (syncFileName != null) {
LOGGER.warn(PROPERTY_WILL_BE_REMOVED, SYNC_FILE_NAME.getPropertyName(), FILE_SYNC_NAME.getPropertyName());
syncFileName = properties.getProperty(FILE_SYNC_NAME, syncFileName);
} else {
syncFileName = properties.getProperty(FILE_SYNC_NAME, DEFAULT_SYNC_FILE_NAME);
}
lockFileName = properties.getProperty(FILE_LOCK_NAME, DEFAULT_LOCK_FILE_NAME);
syncFileName = properties.getProperty(FILE_SYNC_NAME, DEFAULT_SYNC_FILE_NAME);

String fileWaitTimeoutStr = properties.getProperty(FILE_WAIT_TIMEOUT_MS);
if (fileWaitTimeoutStr != null) {
LOGGER.warn(PROPERTY_WILL_BE_REMOVED,
FILE_WAIT_TIMEOUT_MS.getPropertyName(),
CLIENT_JOIN_LOCK_TIMEOUT_VALUE.getPropertyName() + ","
+ CLIENT_JOIN_LOCK_TIMEOUT_UNIT.getPropertyName()
);
lockWaitTimeout = Long.parseLong(fileWaitTimeoutStr);
}
String waitTimeoutStr = properties.getProperty(CLIENT_JOIN_LOCK_TIMEOUT_VALUE);
if (waitTimeoutStr != null) {
TimeUnit waitTimeUnit = TimeUnit.valueOf(properties.getProperty(CLIENT_JOIN_LOCK_TIMEOUT_UNIT,
DEFAULT_CLIENT_JOIN_LOCK_TIMEOUT_UNIT
));
lockWaitTimeout = waitTimeUnit.toMillis(Long.parseLong(waitTimeoutStr));
}
if (fileWaitTimeoutStr == null && waitTimeoutStr == null) {
} else {
lockWaitTimeout = DEFAULT_FILE_WAIT_TIMEOUT_MS;
}

lockPortNumber = properties.getPropertyAsInt(CLIENT_JOIN_LOCK_PORT, DEFAULT_CLIENT_JOIN_LOCK_PORT);

this.rxBufferSize = properties.getPropertyAsInt(RX_BUFFER_SIZE, DEFAULT_RX_BUFFER_SIZE);

String truncateLegacy = properties.getProperty(TRUNCATE_ITEM_NAMES);
if (StringUtils.isNotBlank(truncateLegacy)) {
LOGGER.warn(PROPERTY_WILL_BE_REMOVED,
TRUNCATE_ITEM_NAMES.getPropertyName(),
TRUNCATE_FIELDS.getPropertyName()
);
this.truncateFields = properties.getPropertyAsBoolean(TRUNCATE_FIELDS,
Boolean.parseBoolean(truncateLegacy)
);
} else {
this.truncateFields = properties.getPropertyAsBoolean(TRUNCATE_FIELDS, DEFAULT_TRUNCATE);
}

String legacyTruncateItemNamesLimit = properties.getProperty(TRUNCATE_ITEM_LIMIT);
if (StringUtils.isNotBlank(legacyTruncateItemNamesLimit)) {
LOGGER.warn(PROPERTY_WILL_BE_REMOVED,
TRUNCATE_ITEM_LIMIT.getPropertyName(),
TRUNCATE_ITEM_NAME_LIMIT.getPropertyName()
);
this.truncateItemNamesLimit = properties.getPropertyAsInt(TRUNCATE_ITEM_NAME_LIMIT,
Integer.parseInt(legacyTruncateItemNamesLimit)
);
} else {
this.truncateItemNamesLimit = properties.getPropertyAsInt(TRUNCATE_ITEM_NAME_LIMIT,
DEFAULT_TRUNCATE_ITEM_NAMES_LIMIT
);
}

String legacyTruncateReplacement = properties.getProperty(TRUNCATE_ITEM_REPLACEMENT);
if (StringUtils.isNotBlank(legacyTruncateReplacement)) {
LOGGER.warn(PROPERTY_WILL_BE_REMOVED,
TRUNCATE_ITEM_REPLACEMENT.getPropertyName(),
TRUNCATE_REPLACEMENT.getPropertyName()
);
this.truncateReplacement = properties.getProperty(TRUNCATE_REPLACEMENT, legacyTruncateReplacement);
} else {
this.truncateReplacement = properties.getProperty(TRUNCATE_REPLACEMENT, DEFAULT_TRUNCATE_REPLACEMENT);
}

this.attributeLengthLimit = properties.getPropertyAsInt(
TRUNCATE_ATTRIBUTE_LIMIT,
DEFAULT_TRUNCATE_ATTRIBUTE_LIMIT
);
this.truncateFields = properties.getPropertyAsBoolean(TRUNCATE_FIELDS, DEFAULT_TRUNCATE);
this.truncateItemNamesLimit = properties.getPropertyAsInt(TRUNCATE_ITEM_NAME_LIMIT,
DEFAULT_TRUNCATE_ITEM_NAMES_LIMIT);
this.truncateReplacement = properties.getProperty(TRUNCATE_REPLACEMENT, DEFAULT_TRUNCATE_REPLACEMENT);
this.attributeLengthLimit = properties.getPropertyAsInt(TRUNCATE_ATTRIBUTE_LIMIT,
DEFAULT_TRUNCATE_ATTRIBUTE_LIMIT);

this.printLaunchUuid = properties.getPropertyAsBoolean(LAUNCH_UUID_PRINT, DEFAULT_LAUNCH_UUID_PRINT);
this.printLaunchUuidOutput =
Expand Down Expand Up @@ -636,24 +568,6 @@ public void setRxBufferSize(int size) {
rxBufferSize = size;
}

/**
* @return to truncate or not truncate
* @deprecated use {@link #isTruncateFields} instead
*/
@Deprecated
public boolean isTruncateItemNames() {
return truncateFields;
}

/**
* @param truncate to truncate or not truncate
* @deprecated use {@link #setTruncateFields} instead
*/
@Deprecated
public void setTruncateItemNames(boolean truncate) {
this.truncateFields = truncate;
}

public boolean isTruncateFields() {
return truncateFields;
}
Expand All @@ -670,24 +584,6 @@ public void setTruncateItemNamesLimit(int limit) {
this.truncateItemNamesLimit = limit;
}

/**
* @return truncation replacement
* @deprecated Use {@link #getTruncateReplacement} instead
*/
@Deprecated
public String getTruncateItemNamesReplacement() {
return truncateReplacement;
}

/**
* @param replacement truncation replacement
* @deprecated Use {@link #setTruncateReplacement} instead
*/
@Deprecated
public void setTruncateItemNamesReplacement(String replacement) {
this.truncateReplacement = replacement;
}

public String getTruncateReplacement() {
return truncateReplacement;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,10 @@
*/
package com.epam.reportportal.message;

import com.google.common.io.ByteSource;
import com.google.common.io.Resources;
import com.epam.reportportal.utils.files.ByteSource;

import java.io.File;
import java.io.IOException;
import java.net.URL;
import java.util.ArrayList;
import java.util.Base64;
import java.util.List;
Expand All @@ -29,7 +27,7 @@

import static com.epam.reportportal.utils.MimeTypeDetector.detect;
import static com.epam.reportportal.utils.files.Utils.getFile;
import static java.util.Optional.ofNullable;
import static com.epam.reportportal.utils.files.Utils.getResource;

/**
* Colon separated message parser. Expects string in the following format:<br>
Expand Down Expand Up @@ -70,13 +68,7 @@ public TypeAwareByteSource toByteSource(final String data) throws IOException {
RESOURCE {
@Override
public TypeAwareByteSource toByteSource(String resourceName) throws IOException {
URL resource = ofNullable(Thread.currentThread()
.getContextClassLoader()
.getResource(resourceName)).orElseGet(() -> HashMarkSeparatedMessageParser.class.getResource(resourceName));
if (null == resource) {
return null;
}
final ByteSource source = Resources.asByteSource(resource);
ByteSource source = new ByteSource(getResource(resourceName));
return new TypeAwareByteSource(source, detect(source, resourceName));
}
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
*/
package com.epam.reportportal.message;

import com.google.common.io.ByteSource;
import com.epam.reportportal.utils.files.ByteSource;

import java.io.File;
import java.io.IOException;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,32 +15,31 @@
*/
package com.epam.reportportal.message;

import com.google.common.io.ByteSource;
import com.epam.reportportal.utils.files.ByteSource;

import javax.annotation.Nonnull;
import java.io.IOException;
import java.io.InputStream;
import java.util.Objects;

/**
* {@link ByteSource} which knows about content mime type
*
* @author Andrei Varabyeu
*/
public class TypeAwareByteSource extends ByteSource {

private final ByteSource delegate;
private final String mediaType;

public TypeAwareByteSource(ByteSource delegate, String mediaType) {
this.delegate = Objects.requireNonNull(delegate);
public TypeAwareByteSource(@Nonnull ByteSource delegate, @Nonnull String mediaType) {
super(delegate);
this.mediaType = mediaType;
}

@Override
@Nonnull
public InputStream openStream() throws IOException {
return delegate.openStream();
return super.openStream();
}

@Nonnull
public String getMediaType() {
return mediaType;
}
Expand Down
Loading

0 comments on commit 39dde65

Please sign in to comment.