Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,11 @@ public GetActivitiesRemoteOperation(long fileId, long lastGiven) {
this.lastGiven = lastGiven;
}

/**
* @deprecated an int cannot hold all activity IDs, use {@link #GetActivitiesRemoteOperation(long, long)}
* with a fileId of -1 instead
*/
@Deprecated
public GetActivitiesRemoteOperation(int lastGiven) {

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Better to break existing usage thus we can update client code?

this.lastGiven = lastGiven;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,9 @@ import java.util.Date
* Activity Data Model
*/
data class Activity(
// Accepts both a JSON number and a numeric string; Snowflake IDs need more than 32 bits
@SerializedName("activity_id")
val activityId: Int,
val activityId: Long,
val datetime: Date,
// legacy purposes
val date: Date,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,22 @@ public void testParseActivities() {
assertEquals("0", firstItem.getObjectId());
}

@Test
public void testParseActivityIdsBeyondInt() {
String activities = "{\"ocs\":{\"meta\":{\"status\":\"ok\",\"statuscode\":200,\"message\":\"OK\"}," +
"\"data\":[{\"activity_id\":130000000000000123,\"user\":\"test\"}," +
"{\"activity_id\":\"130000000000000124\",\"user\":\"test\"}," +
"{\"activity_id\":\"42\",\"user\":\"test\"}]}}";

GetActivitiesRemoteOperation sut = new GetActivitiesRemoteOperation();
ArrayList<Activity> activityList = sut.parseResult(activities);

assertEquals(3, activityList.size());
assertEquals(130000000000000123L, activityList.get(0).getActivityId());
assertEquals(130000000000000124L, activityList.get(1).getActivityId());
assertEquals(42L, activityList.get(2).getActivityId());
}

@Test
public void testEmptyString() {
String activities = "";
Expand Down
Loading