> responseOrders = parentNestedPairs.stream()
@@ -148,6 +150,33 @@ public static void mockNestedSteps(final ReportPortalClient client, final List>) invocation -> createMaybe(new OperationCompletionRS())));
}
+ public static List toSaveLogRQ(List> rqs) {
+ return rqs.stream()
+ .flatMap(List::stream)
+ .filter(p -> ofNullable(p.headers()).map(headers -> headers.get("Content-Disposition"))
+ .map(h -> h.contains(Constants.LOG_REQUEST_JSON_PART))
+ .orElse(false))
+ .map(MultipartBody.Part::body)
+ .map(b -> {
+ Buffer buf = new Buffer();
+ try {
+ b.writeTo(buf);
+ } catch (IOException ignore) {
+ }
+ return buf.readByteArray();
+ })
+ .map(b -> {
+ try {
+ return HttpRequestUtils.MAPPER.readValue(b, new TypeReference>() {
+ });
+ } catch (IOException e) {
+ return Collections.emptyList();
+ }
+ })
+ .flatMap(Collection::stream)
+ .collect(Collectors.toList());
+ }
+
public static ListenerParameters standardParameters() {
ListenerParameters result = new ListenerParameters();
result.setClientJoin(false);