Skip to content

Commit

Permalink
Remove deprecated code
Browse files Browse the repository at this point in the history
  • Loading branch information
HardNorth committed Jan 11, 2024
1 parent 79e06f8 commit fd3ce4a
Show file tree
Hide file tree
Showing 12 changed files with 19 additions and 316 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
## [Unreleased]
### Changed
- Guava library dependency was removed, by @HardNorth
- Deprecated code remove, by @HardNorth

## [5.1.27]
### Changed
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 @@ -25,7 +25,9 @@
public class DummyClient implements Statistics {

@Override
@SuppressWarnings("deprecation")
public Maybe<Response<ResponseBody>> send(StatisticsItem item) {
// Deprecated method call left here till the very end for backward compatibility
return Maybe.create(e -> e.onSuccess(Response.success(ResponseBody.create(MediaType.get("text/plain"), ""))));
}

Expand Down
60 changes: 0 additions & 60 deletions src/main/java/com/epam/reportportal/utils/StepTemplateUtils.java

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -57,11 +57,13 @@ private HttpRequestUtils() {
throw new IllegalStateException("Static only class. No instances should exist for the class!");
}

@SuppressWarnings("deprecation")
public static List<MultipartBody.Part> buildLogMultiPartRequest(List<SaveLogRQ> rqs) {
List<MultipartBody.Part> result = new ArrayList<>();
try {
result.add(MultipartBody.Part.createFormData(Constants.LOG_REQUEST_JSON_PART,
null,
// Deprecated method call left here till the very end for backward compatibility
RequestBody.create(okhttp3.MediaType.get("application/json; charset=utf-8"),
MAPPER.writerFor(new TypeReference<List<SaveLogRQ>>() {
}).writeValueAsString(rqs)
Expand All @@ -85,6 +87,7 @@ public static List<MultipartBody.Part> buildLogMultiPartRequest(List<SaveLogRQ>
}
result.add(MultipartBody.Part.createFormData(Constants.LOG_REQUEST_BINARY_PART,
file.getName(),
// Deprecated method call left here till the very end for backward compatibility
RequestBody.create(type, file.getContent())
));
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -92,15 +92,6 @@ public enum ListenerProperty {
*/
CLIENT_JOIN_MODE("rp.client.join", false),
CLIENT_JOIN_MODE_VALUE("rp.client.join.mode", false),
@SuppressWarnings("DeprecatedIsStillUsed")
@Deprecated
LOCK_FILE_NAME("rp.client.join.lock.file.name", false),
@SuppressWarnings("DeprecatedIsStillUsed")
@Deprecated
SYNC_FILE_NAME("rp.client.join.sync.file.name", false),
@SuppressWarnings("DeprecatedIsStillUsed")
@Deprecated
FILE_WAIT_TIMEOUT_MS("rp.client.join.file.wait.timeout.ms", false),
FILE_LOCK_NAME("rp.client.join.file.lock.name", false),
FILE_SYNC_NAME("rp.client.join.file.sync.name", false),
CLIENT_JOIN_LOCK_PORT("rp.client.join.port", false),
Expand All @@ -119,13 +110,6 @@ public enum ListenerProperty {

RX_BUFFER_SIZE("rp.rx.buffer.size", false),

@Deprecated
TRUNCATE_ITEM_NAMES("rp.item.name.truncate", false),
@Deprecated
TRUNCATE_ITEM_LIMIT("rp.item.name.truncate.limit", false),
@Deprecated
TRUNCATE_ITEM_REPLACEMENT("rp.item.name.truncate.replacement", false),

TRUNCATE_FIELDS("rp.truncation.field", false),
TRUNCATE_REPLACEMENT("rp.truncation.replacement", false),
TRUNCATE_ITEM_NAME_LIMIT("rp.truncation.item.name.limit", false),
Expand Down
Loading

0 comments on commit fd3ce4a

Please sign in to comment.