Skip to content

Commit 83153a3

Browse files
zhu-xiaoweixiaoweii
andauthored
feat: add long type for ClickstreamEvent (#22)
Co-authored-by: xiaoweii <[email protected]>
1 parent e18ffc1 commit 83153a3

File tree

4 files changed

+18
-2
lines changed

4 files changed

+18
-2
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ Add the following dependency to your `app` module's `build.gradle` file.
2020

2121
```groovy
2222
dependencies {
23-
implementation 'software.aws.solution:clickstream:0.5.0'
23+
implementation 'software.aws.solution:clickstream:0.5.1'
2424
}
2525
```
2626

clickstream/src/main/java/software/aws/solution/clickstream/ClickstreamEvent.java

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -167,6 +167,20 @@ public Builder add(@NonNull @Size(min = 1L, max = MAX_NAME_LENGTH) String name,
167167
return this;
168168
}
169169

170+
/**
171+
* Adds an Long property to the {@link ClickstreamEvent} under construction.
172+
*
173+
* @param name The name of the property
174+
* @param value The Long value of the property
175+
* @return Current Builder instance, for fluent method chaining
176+
*/
177+
@NonNull
178+
public Builder add(@NonNull @Size(min = 1L, max = MAX_NAME_LENGTH) String name,
179+
@NonNull Long value) {
180+
this.propertiesBuilder.add(name, AnalyticsLongProperty.from(value));
181+
return this;
182+
}
183+
170184
/**
171185
* Returns the built {@link ClickstreamEvent}.
172186
*

clickstream/src/test/java/software/aws/solution/clickstream/IntegrationTest.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -145,6 +145,7 @@ public void testRecordOneEvent() throws Exception {
145145
.add("Channel", "SMS")
146146
.add("Successful", true)
147147
.add("ProcessDuration", 792)
148+
.add("Timestamp", 169823889238L)
148149
.add("UserAge", 120.3)
149150
.build();
150151
ClickstreamAnalytics.recordEvent(event);
@@ -160,6 +161,7 @@ public void testRecordOneEvent() throws Exception {
160161
Assert.assertTrue(attribute.getBoolean("Successful"));
161162
Assert.assertEquals(792, attribute.getInt("ProcessDuration"));
162163
Assert.assertEquals(120.3, attribute.getDouble("UserAge"), 0.01);
164+
Assert.assertEquals(169823889238L, attribute.getLong("Timestamp"));
163165

164166
Thread.sleep(1500);
165167
assertEquals(0, dbUtil.getTotalNumber());

gradle.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ org.gradle.jvmargs=-Xmx4g
1212
# http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects
1313
org.gradle.parallel=true
1414

15-
VERSION_NAME=0.5.0
15+
VERSION_NAME=0.5.1
1616

1717
POM_GROUP=software.aws.solution
1818
POM_ARTIFACT_ID=clickstream

0 commit comments

Comments
 (0)