Skip to content

Commit 96bdccc

Browse files
authored
fix: Fix sending limit param in EventLog (#977)
1 parent 2c69360 commit 96bdccc

2 files changed

Lines changed: 5 additions & 6 deletions

File tree

src/main/java/com/box/sdk/EventLog.java

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -253,6 +253,8 @@ private static EventLog getEnterpriseEventsForStreamType(
253253
}
254254

255255
private static void addParamsToQuery(EventLogRequest request, QueryStringBuilder queryBuilder) {
256+
queryBuilder.appendParam("limit", request.getLimit());
257+
256258
if (request.getAfter() != null) {
257259
queryBuilder.appendParam("created_after", BoxDateFormat.format(request.getAfter()));
258260
}
@@ -262,9 +264,6 @@ private static void addParamsToQuery(EventLogRequest request, QueryStringBuilder
262264
if (request.getPosition() != null) {
263265
queryBuilder.appendParam("stream_position", request.getPosition());
264266
}
265-
if (request.getLimit() != ENTERPRISE_LIMIT) {
266-
queryBuilder.appendParam("limit", request.getLimit());
267-
}
268267
if (request.getTypes().size() > 0) {
269268
StringBuilder filterBuilder = new StringBuilder();
270269
for (BoxEvent.EventType filterType : request.getTypes()) {

src/test/java/com/box/sdk/EventLogTest.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ public String getJSON() {
2626
public void getEnterpriseEvents() {
2727
final Date after = new Date(0L);
2828
final Date before = new Date(System.currentTimeMillis());
29-
final int limit = 100;
29+
final int limit = 500;
3030
final String position = "1152923110369165138";
3131
BoxEvent.EventType[] eventTypes = {LOGIN, FAILED_LOGIN};
3232
BoxAPIConnection api = new BoxAPIConnection("");
@@ -65,7 +65,7 @@ public void getEnterpriseEventsWithoutAnyParams() {
6565
public BoxAPIResponse onRequest(BoxAPIRequest request) {
6666
try {
6767
String query = URLDecoder.decode(request.getUrl().getQuery(), "UTF-8");
68-
assertThat(query, is("stream_type=admin_logs"));
68+
assertThat(query, is("stream_type=admin_logs&limit=500"));
6969
return EMPTY_RESPONSE;
7070
} catch (Exception e) {
7171
throw new RuntimeException(e);
@@ -135,7 +135,7 @@ public void getEnterpriseEventsStreamWithoutAnyParams() {
135135
public BoxAPIResponse onRequest(BoxAPIRequest request) {
136136
try {
137137
String query = URLDecoder.decode(request.getUrl().getQuery(), "UTF-8");
138-
assertThat(query, is("stream_type=admin_logs_streaming"));
138+
assertThat(query, is("stream_type=admin_logs_streaming&limit=500"));
139139
return EMPTY_RESPONSE;
140140
} catch (Exception e) {
141141
throw new RuntimeException(e);

0 commit comments

Comments
 (0)