Skip to content
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

Audiences, Attributes and Events implementation #438

Merged
merged 65 commits into from
Aug 12, 2021

Conversation

The-inside-man
Copy link
Contributor

@The-inside-man The-inside-man commented Jul 19, 2021

Summary

  • Audiences Implementation
  • Audience Support added in OptimizelyConfigService
  • Modification of Experiments to support serialize functionality from Conditions
  • Attributes and Events added to OptimizelyConfig
  • Cleanup of parsing functions to reuse code
  • Additional test cases added
  • Add Deprecation for OptimizelyFeature.experimentsMap

Test plan

  • FSC

Issues

  • "OASIS-7813"

…hange lists to use OptimizelyAttribute and OptimizelyEvent. Convert Attribute and EventTypes to lists of OptimizleyAttribute and OptimizelyEvent lists before calling OptimizelyConfig constructor.
 switch statement, same for conditionUtils. Audience implementation and addition of
 OptimizelyAudience class. Updated OptimizelyConfig with Audiences and added implementation in OptimizelyConfigService. Updated OptimizelyExperiment to get the serialized audienceConditions list from experiment. Test cases will come in additional Commits.
@The-inside-man The-inside-man requested a review from a team as a code owner July 19, 2021 18:42
@The-inside-man The-inside-man removed the request for review from a team July 19, 2021 18:42
@keppel2 keppel2 self-requested a review July 19, 2021 19:32
@keppel2 keppel2 marked this pull request as draft July 19, 2021 19:34
@The-inside-man The-inside-man removed the request for review from keppel2 July 19, 2021 21:03
@keppel2
Copy link

keppel2 commented Jul 19, 2021

if ( and if( seem to intermix.

@keppel2
Copy link

keppel2 commented Jul 19, 2021

Might be something that can be automatically checked. Don't let it gate a merge.

@The-inside-man
Copy link
Contributor Author

if ( and if( seem to intermix.

good catch! thanks

@coveralls
Copy link

coveralls commented Jul 20, 2021

@The-inside-man
Copy link
Contributor Author

Testing the serialize portion of the audienceConditions as part of Experiments is a bit different in this one since each condition is actually based off an interface and many of the checks pertaining to edge cases (ie. empty list, or a list of just audienceId's) are covered during the parsing of the datafile and creates either an EmptyCondition or and AudienceIdCondition, both which implement Condition, so when its time to actually serialize we can check if an empty condition or an AudienceIdCondition. If a list of AudienceId's is present in the datafile parsing then it already creates an OrCondition with a list of AudienceIdConditions, meaning we will never have a case in the Experiment that we only have a list of AudienceId's as it will always be an OrCondition object with a list of those ID's.

@The-inside-man
Copy link
Contributor Author

The-inside-man commented Aug 10, 2021

@The-inside-man The-inside-man marked this pull request as ready for review August 10, 2021 16:43
@The-inside-man
Copy link
Contributor Author

Passing all test cases for FSC: https://travis-ci.com/github/optimizely/fullstack-sdk-compatibility-suite/builds/235065614 @msohailhussain would you mind a final review/approval on this please

@The-inside-man The-inside-man removed their assignment Aug 11, 2021
Copy link
Contributor

@msohailhussain msohailhussain left a comment

Choose a reason for hiding this comment

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

all looks good but just have few suggestions, want to discuss before approving it.

return "{name='" + name + "\'" +
", type='" + type + "\'" +
", match='" + match + "\'" +
", value=" + valueStr +
", value=" + ((value instanceof String) ? ("'" + getValueStr() + "'") : getValueStr()) +
Copy link
Contributor

Choose a reason for hiding this comment

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

why single quote here?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This was part of the original logic that I didn't want to change (Line 127) but don't need for the function above and wanted to reuse the same code minus those quotes. We can chat offline if you like.

this(experimentsMap, featuresMap, revision, sdkKey, environmentKey, attributes, events, audiences, null);
}

public OptimizelyConfig(Map<String, OptimizelyExperiment> experimentsMap,
Copy link
Contributor

Choose a reason for hiding this comment

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

in case we are supposed to use it internally, can we set access modifier accordingly?

Copy link
Contributor

@msohailhussain msohailhussain left a comment

Choose a reason for hiding this comment

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

lgtm

Copy link
Contributor

@jaeopt jaeopt left a comment

Choose a reason for hiding this comment

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

One comment about deprecation notation

* @Deprecated The experimentsMap has been deprecated. </br>
* Use experimentRules and deliveryRules instead.
* */
@Deprecated()
private Map<String, OptimizelyExperiment> experimentsMap;
Copy link
Contributor

Choose a reason for hiding this comment

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

This does not show deprecation note when I open the doc. Can you check? Also it use different deprecation notation. You can make it consistent (for compatibility issue for android support?).

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Sure, let me take a look.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@jaeopt Updated to follow suite with Android.

@keppel2 keppel2 self-requested a review August 12, 2021 18:39
@keppel2 keppel2 self-requested a review August 12, 2021 18:47
@The-inside-man The-inside-man removed their assignment Aug 12, 2021
Copy link
Contributor

@jaeopt jaeopt left a comment

Choose a reason for hiding this comment

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

LGTM

@The-inside-man The-inside-man merged commit 6ce2581 into master Aug 12, 2021
@The-inside-man The-inside-man deleted the jbrown/oasis-7813 branch August 12, 2021 20:57
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.

5 participants