Skip to content

Commit

Permalink
Minor DRYing up of attachment processor tests (#65975)
Browse files Browse the repository at this point in the history
  • Loading branch information
danhermann authored Dec 8, 2020
1 parent 5cad64c commit 149f1f9
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 149f1f9

Please sign in to comment.