-
Notifications
You must be signed in to change notification settings - Fork 32
feat(ats): add support for android ODP events #502
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Overall lgtm. Left few suggestions.
@@ -63,6 +66,16 @@ public ODPEventManager(@Nonnull ODPApiManager apiManager, @Nullable Integer batc | |||
this.flushInterval = (flushInterval != null && flushInterval > 0) ? flushInterval : DEFAULT_FLUSH_INTERVAL; | |||
} | |||
|
|||
// these user-provided common data are included in all ODP events in addition to the SDK-generated common data. | |||
public void setUserCommonData(@Nullable Map<String, Object> commonData) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It looks confusing, at line 42 and 43 there is a NonNull tag and here it is nullable. I think it should be NonNull to keep it consistent. Same goes for line 75.
// sdk-generated common data | ||
assertNotNull(merged.get("idempotence_id")); | ||
assertEquals(merged.get("data_source_type"), "sdk"); | ||
assertNotNull(merged.get("data_source")); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can we verify here that the datasource is java sdk and in android we can add a unit test that will verify that it is android sdk?
@@ -26,7 +26,7 @@ public class ODPEvent { | |||
|
|||
private String type; | |||
private String action; | |||
private Map<String, String > identifiers; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should we update the header as this is nit fix?
@@ -63,6 +63,8 @@ public String getKey() { | |||
|
|||
/** | |||
* @deprecated use {@link #getExperimentRules()} and {@link #getDeliveryRules()} instead | |||
* | |||
* @return a map of ExperimentKey to OptimizelyExperiment |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Update header.
@@ -255,6 +255,157 @@ public void validateEventData() { | |||
assertFalse(event.isDataValid()); | |||
} | |||
|
|||
@Test | |||
public void validateAugmentCommonData() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
update the header of this file.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We have to find a way to automate these header updates :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That sounds right, every new year same old hassle :D
import java.util.Arrays; | ||
import java.util.HashSet; | ||
import java.util.List; | ||
import java.util.*; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
header.
@mnoman09 all suggestions addressed. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Overall lgtm. Added one comment, that needs to be addressed. Approving this PR, so we can merge once that comment is resolved.
@@ -182,6 +212,8 @@ public ODPManager build() { | |||
if (eventManager == null) { | |||
eventManager = new ODPEventManager(apiManager); | |||
} | |||
eventManager.setUserCommonData(userCommonData != null ? userCommonData : Collections.emptyMap()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can we move this null check inside the setUserCommonData to ensure the null pointer exception won't occur inside odpEventManger line 137.
force-merged with FSC failures for android development support since they will be fixed in other ODP PRs. |
Summary
Add support for Android-SDK ODP integration, which may not be implemented in the Android-SDK.
Test plan
Unit tests covering builder interface and generated events.
Issues