Skip to content

Commit

Permalink
Include log_id in the LogEvent entity (#372)
Browse files Browse the repository at this point in the history
  • Loading branch information
jimmyjames authored Aug 27, 2021
1 parent 820b5fd commit 98b0a9a
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 3 deletions.
14 changes: 13 additions & 1 deletion src/main/java/com/auth0/json/mgmt/logevents/LogEvent.java
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@ public class LogEvent {

@JsonProperty("_id")
private String id;
@JsonProperty("log_id")
private String logId;
@JsonFormat(shape = JsonFormat.Shape.STRING)
@JsonProperty("date")
private Date date;
Expand Down Expand Up @@ -46,6 +48,16 @@ public String getId() {
return id;
}

/**
* Getter for the log_id of this event.
*
* @return the log_id of this event.
*/
@JsonProperty("log_id")
public String getLogId() {
return logId;
}

/**
* Getter for the date of this event.
*
Expand Down Expand Up @@ -126,4 +138,4 @@ public Map<String, Object> getLocationInfo() {
public Map<String, Object> getDetails() {
return details;
}
}
}
5 changes: 3 additions & 2 deletions src/test/java/com/auth0/json/mgmt/logevents/LogEventTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,15 @@

public class LogEventTest extends JsonTest<LogEvent> {

private static final String json = "{\"_id\":\"123\", \"date\":\"2016-02-23T19:57:29.532Z\",\"type\":\"thetype\",\"location_info\":{},\"details\":{},\"client_id\":\"clientId\",\"client_name\":\"clientName\",\"ip\":\"233.233.233.11\",\"user_id\":\"userId\"}";
private static final String json = "{\"_id\":\"123\", \"log_id\":\"123\", \"date\":\"2016-02-23T19:57:29.532Z\",\"type\":\"thetype\",\"location_info\":{},\"details\":{},\"client_id\":\"clientId\",\"client_name\":\"clientName\",\"ip\":\"233.233.233.11\",\"user_id\":\"userId\"}";

@Test
public void shouldDeserialize() throws Exception {
LogEvent logEvent = fromJSON(json, LogEvent.class);

assertThat(logEvent, is(notNullValue()));
assertThat(logEvent.getId(), is("123"));
assertThat(logEvent.getLogId(), is("123"));
assertThat(logEvent.getDate(), is(parseJSONDate("2016-02-23T19:57:29.532Z")));
assertThat(logEvent.getType(), is("thetype"));
assertThat(logEvent.getClientId(), is("clientId"));
Expand All @@ -26,4 +27,4 @@ public void shouldDeserialize() throws Exception {
assertThat(logEvent.getLocationInfo(), is(notNullValue()));
assertThat(logEvent.getDetails(), is(notNullValue()));
}
}
}

0 comments on commit 98b0a9a

Please sign in to comment.