Skip to content

Commit

Permalink
Additional constructor with Socket argument in `SocketUtils.ServerC…
Browse files Browse the repository at this point in the history
…allable` class
  • Loading branch information
HardNorth committed Apr 2, 2024
1 parent cfb6194 commit e2e13f0
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 2 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
# Changelog

## [Unreleased]
### Added
- Additional constructor with `Socket` argument in `SocketUtils.ServerCallable` class, by @HardNorth

## [0.0.4]
### Changed
Expand Down
14 changes: 12 additions & 2 deletions src/main/java/com/epam/reportportal/util/test/SocketUtils.java
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@
import org.apache.commons.io.IOUtils;
import org.apache.commons.lang3.tuple.Pair;

import javax.annotation.Nonnull;
import javax.annotation.Nullable;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
Expand Down Expand Up @@ -46,13 +48,21 @@ public static final class ServerCallable implements Callable<List<String>> {
private final List<String> responseFiles;
private Socket s;

public ServerCallable(ServerSocket serverSocket, Map<String, Object> replacementValues, List<String> responseFilePaths) {
public ServerCallable(@Nonnull ServerSocket serverSocket, @Nullable Socket socket, @Nonnull Map<String, Object> replacementValues,
@Nonnull List<String> responseFilePaths) {
ss = serverSocket;
s = socket;
model = replacementValues;
responseFiles = responseFilePaths;
}

public ServerCallable(ServerSocket serverSocket, Map<String, Object> replacementValues, String responseFilePath) {
public ServerCallable(@Nonnull ServerSocket serverSocket, @Nonnull Map<String, Object> replacementValues,
@Nonnull List<String> responseFilePaths) {
this(serverSocket, null, replacementValues, responseFilePaths);
}

public ServerCallable(@Nonnull ServerSocket serverSocket, @Nonnull Map<String, Object> replacementValues,
@Nonnull String responseFilePath) {
this(serverSocket, replacementValues, Collections.singletonList(responseFilePath));
}

Expand Down

0 comments on commit e2e13f0

Please sign in to comment.