Skip to content

Commit

Permalink
Minor DRYing up of attachment processor tests (#65975) (#68294)
Browse files Browse the repository at this point in the history
  • Loading branch information
danhermann authored Feb 1, 2021
1 parent 0dba407 commit 8a0dddd
Showing 1 changed file with 1 addition and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -287,16 +287,7 @@ private Map<String, Object> parseDocument(String file, AttachmentProcessor proce

private Map<String, Object> parseDocument(String file, AttachmentProcessor processor, Map<String, Object> optionalFields)
throws Exception {
Map<String, Object> document = new HashMap<>();
document.put("source_field", getAsBinaryOrBase64(file));
document.putAll(optionalFields);

IngestDocument ingestDocument = RandomDocumentPicks.randomIngestDocument(random(), document);
processor.execute(ingestDocument);

@SuppressWarnings("unchecked")
Map<String, Object> attachmentData = (Map<String, Object>) ingestDocument.getSourceAndMetadata().get("target_field");
return attachmentData;
return parseDocument(file, processor, optionalFields, false);
}

private Map<String, Object> parseDocument(String file, AttachmentProcessor processor, Map<String, Object> optionalFields,
Expand Down

0 comments on commit 8a0dddd

Please sign in to comment.