-
Notifications
You must be signed in to change notification settings - Fork 39
feat(ATS): update OptimizelyManager/OptimizelyClient for ODP integration #444
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 looks good. Added few comments. I am not seeing custom cache support in this PR, so are we going to add it in a separate PR?
|
||
@Nullable private OptimizelyStartListener optimizelyStartListener; | ||
|
||
@Nullable private final List<OptimizelyDecideOption> defaultDecideOptions; | ||
@NonNull private final List<OptimizelyDecideOption> defaultDecideOptions; |
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.
Why did we change it to Nonnull, because I am still seeing it nullable at other places?
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.
A good catch. I might be confused. It has been restored back to Nullable.
@@ -724,6 +741,13 @@ public static class Builder { | |||
@Nullable private DatafileConfig datafileConfig = null; | |||
@Nullable private List<OptimizelyDecideOption> defaultDecideOptions = null; | |||
|
|||
private long odpSegmentCacheSize = 100L; |
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.
I think instead of long we should use int data type because eventually we are parsing it to int. Same goes for odpSegmentCacheTimeoutInSecs
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.
I changed all odp numbers to int.
} | ||
|
||
@Test | ||
public void testBuildWithODP_defautSegmentFetchTimeout() throws Exception { |
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.
public void testBuildWithODP_defautSegmentFetchTimeout() throws Exception { | |
public void testBuildWithODP_defaultSegmentFetchTimeout() throws Exception { |
} | ||
|
||
@Test | ||
public void testBuildWithODP_defaultCache() throws Exception { |
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.
public void testBuildWithODP_defaultCache() throws Exception { | |
public void testBuildWithODP_defaultCacheSize() throws Exception { |
@@ -191,4 +228,145 @@ public void testBuildWithDatafileDownloadInterval_workerCancelledWhenNoIntervalP | |||
verify(mockDatafileHandler, never()).startBackgroundUpdates(any(), any(), any(), any()); | |||
} | |||
|
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.
@@ -79,7 +79,7 @@ open class ODPSegmentClient(private val client: Client, private val logger: Logg | |||
} | |||
|
|||
companion object { | |||
// easy way to set the connection timeout | |||
// configurable connection timeout | |||
var CONNECTION_TIMEOUT = 10 * 1000 |
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 add comment here to show its unit, "ms".
/* | ||
OptimizelyManager is initialized with an OptimizelyClient with a null optimizely property: | ||
https://github.com/optimizely/android-sdk/blob/master/android-sdk/src/main/java/com/optimizely/ab/android/sdk/OptimizelyManager.java#L63 | ||
optimizely will remain null until OptimizelyManager#initialize has been called, so isValid checks for that. Otherwise apps would crash if | ||
the public methods here were called before initialize. | ||
So, we start with an empty map of default attributes until the manager is initialized. | ||
*/ | ||
|
||
if (isValid()) { | ||
if (this.vuid != null) { |
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.
Are we only going to trigger sendOdpEvent for client_intialized when vuid is given instead of user id or is it for both cases? Also if the vuid will be inserted by java sdk then what will this check ensure?
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.
A good catch. I remove vuid null checking.
@mnoman09 it's not expected that android-sdk clients will customize the cache (other than size and timeout), so not supported until we see demands. |
@mnoman09 all suggestions addressed. Please review again. |
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.
lgtm.
Summary
Extends top level (OptimizelyManager/OptimizelyClient) to provide public APIs and connect to the core ATS features provided by the integrated Java-SDK.
Add new APIs:
ODP Configuration (OptimizelyManager.Builder)
Test plan
Issues