Skip to content

Commit

Permalink
Use log.file instead of file
Browse files Browse the repository at this point in the history
  • Loading branch information
felixbarny committed Apr 23, 2020
1 parent a2549ff commit 61cbbc8
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -236,13 +236,16 @@ public void serializeFileMetaData(File file) {
jw.writeByte(JsonWriter.OBJECT_START);
writeFieldName("metadata");
jw.writeByte(JsonWriter.OBJECT_START);
writeFieldName("log");
jw.writeByte(JsonWriter.OBJECT_START);
writeFieldName("file");
jw.writeByte(JsonWriter.OBJECT_START);
writeField("path", file.getAbsolutePath());
writeLastField("name", file.getName());
jw.writeByte(JsonWriter.OBJECT_END);
jw.writeByte(JsonWriter.OBJECT_END);
jw.writeByte(JsonWriter.OBJECT_END);
jw.writeByte(JsonWriter.OBJECT_END);
jw.writeByte(NEW_LINE);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ public void testSendLogs() throws Exception {
List<String> events = getEvents();
mockApmServer.verify(postRequestedFor(urlEqualTo(ApmServerLogShipper.LOGS_ENDPOINT)));
assertThat(events).hasSize(3);
JsonNode fileMetadata = new ObjectMapper().readTree(events.get(1)).get("metadata").get("file");
JsonNode fileMetadata = new ObjectMapper().readTree(events.get(1)).get("metadata").get("log").get("file");
assertThat(fileMetadata.get("name").textValue()).isEqualTo(logFile.getName());
assertThat(fileMetadata.get("path").textValue()).isEqualTo(logFile.getAbsolutePath());
assertThat(events.get(2)).isEqualTo("foo");
Expand Down

0 comments on commit 61cbbc8

Please sign in to comment.