Skip to content

Conversation

jaeopt
Copy link
Contributor

@jaeopt jaeopt commented Jan 9, 2023

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:

  • OptimizelyClient.createUserContext() without userId
  • OptimizelyClient.sendOdpEvent()

ODP Configuration (OptimizelyManager.Builder)

  • SegmentCache configuration
  • ODPClient timeout configuration
  • Disable ODP

Test plan

  • Add new unit tests covering new APIs

Issues

  • FSSDK-8549
  • FSSDK-8695

Copy link
Contributor

@mnoman09 mnoman09 left a 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;
Copy link
Contributor

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?

Copy link
Contributor Author

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.

@Nullable private DatafileConfig datafileConfig = null;
@Nullable private List<OptimizelyDecideOption> defaultDecideOptions = null;

private long odpSegmentCacheSize = 100L;
Copy link
Contributor

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

Copy link
Contributor Author

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 {
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
public void testBuildWithODP_defautSegmentFetchTimeout() throws Exception {
public void testBuildWithODP_defaultSegmentFetchTimeout() throws Exception {

}

@Test
public void testBuildWithODP_defaultCache() throws Exception {
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
public void testBuildWithODP_defaultCache() throws Exception {
public void testBuildWithODP_defaultCacheSize() throws Exception {

verify(mockDatafileHandler).stopBackgroundUpdates(any(), any());
verify(mockDatafileHandler, never()).startBackgroundUpdates(any(), any(), any(), any());
}

Copy link
Contributor

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.

companion object {
// easy way to set the connection timeout
// configurable connection timeout
var CONNECTION_TIMEOUT = 10 * 1000
Copy link
Contributor

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".

*/

if (isValid()) {
if (this.vuid != null) {
Copy link
Contributor

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?

Copy link
Contributor Author

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.

@jaeopt
Copy link
Contributor Author

jaeopt commented Jan 12, 2023

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?

@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.

@jaeopt jaeopt requested a review from mnoman09 January 12, 2023 19:27
@jaeopt
Copy link
Contributor Author

jaeopt commented Jan 12, 2023

@mnoman09 all suggestions addressed. Please review again.

Copy link
Contributor

@mnoman09 mnoman09 left a comment

Choose a reason for hiding this comment

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

lgtm.

@jaeopt jaeopt merged commit 2b0dc02 into master Jan 17, 2023
@jaeopt jaeopt deleted the jae/odp-integration branch January 17, 2023 17:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants