Skip to content

Conversation

aliabbasrizvi
Copy link
Contributor

Summary

This change fixes:

  • Optimizely.close() which currently checks that eventHandler and projectConfigManager are instances of Closeable. Changing that to check if they are instances of AutoCloseable.
  • ProjectConfig is refetched every time in getVariation. Using the passing in config itself.
  • ProjectConfig is fetched multiple times when getEnabledFeatures is called. Updating isFeatureEnabled.

Test plan

  • Unit tests.

@aliabbasrizvi
Copy link
Contributor Author

I realize I have to fix 2 tests in OptimizelyTest.java. Following up with that.

@aliabbasrizvi aliabbasrizvi requested a review from mikecdavis June 7, 2019 18:29
@Nonnull String userId,
@Nonnull Map<String, ?> attributes,
@Nonnull ProjectConfig projectConfig) throws UnknownExperimentException {
private Variation getVariation(@Nonnull ProjectConfig projectConfig,
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Making this private as public methods are not supposed to take projectConfig

Copy link
Contributor

Choose a reason for hiding this comment

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

Technically backwards incompatible, but I'm fine with it.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Backwards incompatible because it was public in an alpha release? I think we should be comfortable removing this right away.

Copy link
Contributor

@mikecdavis mikecdavis left a comment

Choose a reason for hiding this comment

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

Consider keeping tests for Closeable implementations as well.

@Nonnull String userId,
@Nonnull Map<String, ?> attributes,
@Nonnull ProjectConfig projectConfig) throws UnknownExperimentException {
private Variation getVariation(@Nonnull ProjectConfig projectConfig,
Copy link
Contributor

Choose a reason for hiding this comment

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

Technically backwards incompatible, but I'm fine with it.

@coveralls
Copy link

Pull Request Test Coverage Report for Build 1091

  • 11 of 12 (91.67%) changed or added relevant lines in 1 file are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage increased (+0.003%) to 89.647%

Changes Missing Coverage Covered Lines Changed/Added Lines %
core-api/src/main/java/com/optimizely/ab/Optimizely.java 11 12 91.67%
Totals Coverage Status
Change from base Build 1080: 0.003%
Covered Lines: 3299
Relevant Lines: 3680

💛 - Coveralls

1 similar comment
@coveralls
Copy link

Pull Request Test Coverage Report for Build 1091

  • 11 of 12 (91.67%) changed or added relevant lines in 1 file are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage increased (+0.003%) to 89.647%

Changes Missing Coverage Covered Lines Changed/Added Lines %
core-api/src/main/java/com/optimizely/ab/Optimizely.java 11 12 91.67%
Totals Coverage Status
Change from base Build 1080: 0.003%
Covered Lines: 3299
Relevant Lines: 3680

💛 - Coveralls

@aliabbasrizvi aliabbasrizvi merged commit c742246 into master Jun 8, 2019
@aliabbasrizvi aliabbasrizvi deleted the ali/update_close branch June 8, 2019 02:21
mikecdavis pushed a commit that referenced this pull request Jun 26, 2019
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