load tester beta
This commit is contained in:
@@ -14,7 +14,7 @@ import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
@Mapper(componentModel = "spring",
|
||||
unmappedTargetPolicy = ReportingPolicy.IGNORE)
|
||||
unmappedTargetPolicy = ReportingPolicy.IGNORE)
|
||||
public class CommonMapper {
|
||||
|
||||
public String map(boolean value) {
|
||||
@@ -22,17 +22,23 @@ public class CommonMapper {
|
||||
}
|
||||
|
||||
public boolean map(String value) {
|
||||
if (value == null) return false;
|
||||
if (value == null) {
|
||||
return false;
|
||||
}
|
||||
return value.equals("Y");
|
||||
}
|
||||
|
||||
public String map(List<String> values) {
|
||||
if (values == null) return "";
|
||||
if (values == null) {
|
||||
return "";
|
||||
}
|
||||
return String.join(",", values);
|
||||
}
|
||||
|
||||
public List<String> toList(String value) {
|
||||
if (StringUtils.hasLength(value)) return new ArrayList<>();
|
||||
if (StringUtils.hasLength(value)) {
|
||||
return new ArrayList<>();
|
||||
}
|
||||
|
||||
return Arrays.asList(value.split(","));
|
||||
}
|
||||
@@ -44,7 +50,9 @@ public class CommonMapper {
|
||||
}
|
||||
|
||||
public String mapKeyValue(List<ApiRequestKeyValueDTO> list) {
|
||||
if (list == null) return "";
|
||||
if (list == null) {
|
||||
return "";
|
||||
}
|
||||
StringBuilder result = new StringBuilder();
|
||||
for (ApiRequestKeyValueDTO dto : list) {
|
||||
result.append(dto.toString()).append("||");
|
||||
@@ -58,22 +66,19 @@ public class CommonMapper {
|
||||
public List<ApiRequestKeyValueDTO> keyValueToList(String keyValue) {
|
||||
List<ApiRequestKeyValueDTO> list = new ArrayList<>();
|
||||
|
||||
if (!StringUtils.hasLength(keyValue)) return list;
|
||||
if (!StringUtils.hasLength(keyValue)) {
|
||||
return list;
|
||||
}
|
||||
|
||||
String[] pairs = keyValue.split("\\|\\|");
|
||||
for (String pair : pairs) {
|
||||
ApiRequestKeyValueDTO dto = new ApiRequestKeyValueDTO();
|
||||
if (pair.startsWith("//")) {
|
||||
dto.setEnabled(false);
|
||||
boolean isEnabled = pair.startsWith("//");
|
||||
if (isEnabled) {
|
||||
pair = pair.substring(2);
|
||||
} else {
|
||||
dto.setEnabled(true);
|
||||
}
|
||||
String[] keyValueArray = pair.split("::");
|
||||
if (keyValueArray.length == 2) {
|
||||
dto.setKey(keyValueArray[0]);
|
||||
dto.setValue(keyValueArray[1]);
|
||||
list.add(dto);
|
||||
list.add(new ApiRequestKeyValueDTO(isEnabled, keyValueArray[0], keyValueArray[1]));
|
||||
}
|
||||
}
|
||||
return list;
|
||||
|
||||
Reference in New Issue
Block a user