Skip to content

Commit

Permalink
feat: add long type for ClickstreamEvent (#22)
Browse files Browse the repository at this point in the history
Co-authored-by: xiaoweii <xiaoweii@amazom.com>
  • Loading branch information
zhu-xiaowei and xiaoweii authored Jun 15, 2023
1 parent e18ffc1 commit 83153a3
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 2 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ Add the following dependency to your `app` module's `build.gradle` file.

```groovy
dependencies {
implementation 'software.aws.solution:clickstream:0.5.0'
implementation 'software.aws.solution:clickstream:0.5.1'
}
```

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -167,6 +167,20 @@ public Builder add(@NonNull @Size(min = 1L, max = MAX_NAME_LENGTH) String name,
return this;
}

/**
* Adds an Long property to the {@link ClickstreamEvent} under construction.
*
* @param name The name of the property
* @param value The Long value of the property
* @return Current Builder instance, for fluent method chaining
*/
@NonNull
public Builder add(@NonNull @Size(min = 1L, max = MAX_NAME_LENGTH) String name,
@NonNull Long value) {
this.propertiesBuilder.add(name, AnalyticsLongProperty.from(value));
return this;
}

/**
* Returns the built {@link ClickstreamEvent}.
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -145,6 +145,7 @@ public void testRecordOneEvent() throws Exception {
.add("Channel", "SMS")
.add("Successful", true)
.add("ProcessDuration", 792)
.add("Timestamp", 169823889238L)
.add("UserAge", 120.3)
.build();
ClickstreamAnalytics.recordEvent(event);
Expand All @@ -160,6 +161,7 @@ public void testRecordOneEvent() throws Exception {
Assert.assertTrue(attribute.getBoolean("Successful"));
Assert.assertEquals(792, attribute.getInt("ProcessDuration"));
Assert.assertEquals(120.3, attribute.getDouble("UserAge"), 0.01);
Assert.assertEquals(169823889238L, attribute.getLong("Timestamp"));

Thread.sleep(1500);
assertEquals(0, dbUtil.getTotalNumber());
Expand Down
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ org.gradle.jvmargs=-Xmx4g
# http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects
org.gradle.parallel=true

VERSION_NAME=0.5.0
VERSION_NAME=0.5.1

POM_GROUP=software.aws.solution
POM_ARTIFACT_ID=clickstream
Expand Down

0 comments on commit 83153a3

Please sign in to comment.