-
Notifications
You must be signed in to change notification settings - Fork 32
feat(ForcedDecisions): add forced-decisions APIs to OptimizelyUserContext #451
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
Merged
Merged
Changes from all commits
Commits
Show all changes
43 commits
Select commit
Hold shift + click to select a range
cdaa2e0
Addition of ForcedDecisions
The-inside-man bd41dd1
Update constructor to use ? instead of object - reverting
The-inside-man 25dfa07
Update constructor to use ? instead of object - reverting
The-inside-man 35ff0ce
Merge branch 'master' into jbrown/forcedDecisions
The-inside-man 00fbc21
Update dodgy tests.
The-inside-man 9079018
Add additional test to OptimizelyTest.java
The-inside-man f75c04a
Add tests to OptimizelyUserContextTest.java
The-inside-man 225cd1e
Update tests for more coverage.
The-inside-man 2a47e23
Revert javadoc comment test.
The-inside-man 881f802
Update javadocs with titles.
The-inside-man 5cec109
Update deprecations.
The-inside-man 4964852
Remove deprecations for set and get forcedVariations.
The-inside-man 31de5d5
Simplify the way flagVariationsMap is built
The-inside-man 34cc766
Fix removeForcedDecision when no object in map
The-inside-man 65fe3ad
cleanup and remove deprecation warnings.
The-inside-man 8f03cf3
Change forcedDecisions to use a map of Strings to Strings based on a …
The-inside-man a968525
Add license header
The-inside-man 3e415ca
Dont append ruleKey to key object toString method if null.
The-inside-man 06b12b0
Update logic in decide method.
The-inside-man bf8a6c7
Merge branch 'master' into jbrown/forcedDecisions
The-inside-man 1d416c8
Change logic to decide and adjust logic for getVariationForFeature.
The-inside-man 443830c
Update logic for forcedDecisions, add in missing methods for Decision…
The-inside-man 2161c00
Update coverage and remove unused class
The-inside-man b9f4338
Add comment to method
The-inside-man 10b05c1
Remove unused import - cleanup.
The-inside-man 7b6e869
Remove null from findValidatedForcedDecisions call in decide method s…
The-inside-man 2c79e6d
Switch to String.format for info.
The-inside-man 3d0f887
Adding in new classes for forcedDecisionsAPI
The-inside-man 55c0757
Addressing changes and new API implementations.
The-inside-man d1943f6
Update to fix issue with java PAIR to test.
The-inside-man d0aced2
Revert to Map for now.
The-inside-man 8bf6faf
Update OptimizelyUserContext to copy FD, update DecisionService to us…
The-inside-man 66cb22f
Updated tests and license headers
The-inside-man 743f913
Added test case to confirm no duplicate variations added to the falgs…
The-inside-man 80b7fb0
Update tests to cover decide with FD and confirm usage.
The-inside-man 81d1c54
Update tests and add logging to match FSC requirement for findValidat…
The-inside-man 88470c5
Updated Test cases
The-inside-man 37323c4
Address comments for OptimizelyDecisionContext and OptimizelyUserContext
The-inside-man ff79031
Added test cases and fixed Null case when experiment is null during U…
The-inside-man f236148
Fix OptimizelyDecisionContext tests to use -569XZilms as the divider …
The-inside-man cef2c13
Revert attributes map back to synchronizedMap.
The-inside-man 39a9ae1
Update core-api/src/main/java/com/optimizely/ab/OptimizelyUserContext…
The-inside-man 2eb2fd2
Fix indenting from auto-commit
The-inside-man File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
49 changes: 49 additions & 0 deletions
49
core-api/src/main/java/com/optimizely/ab/OptimizelyDecisionContext.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
/** | ||
* | ||
* Copyright 2021, Optimizely and contributors | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
package com.optimizely.ab; | ||
|
||
import javax.annotation.Nonnull; | ||
import javax.annotation.Nullable; | ||
|
||
public class OptimizelyDecisionContext { | ||
public static final String OPTI_NULL_RULE_KEY = "$opt-null-rule-key"; | ||
public static final String OPTI_KEY_DIVIDER = "-$opt$-"; | ||
|
||
private String flagKey; | ||
private String ruleKey; | ||
|
||
public OptimizelyDecisionContext(@Nonnull String flagKey, @Nullable String ruleKey) { | ||
this.flagKey = flagKey; | ||
this.ruleKey = ruleKey; | ||
} | ||
|
||
public String getFlagKey() { | ||
return flagKey; | ||
} | ||
|
||
public String getRuleKey() { | ||
return ruleKey != null ? ruleKey : OPTI_NULL_RULE_KEY; | ||
} | ||
|
||
public String getKey() { | ||
StringBuilder keyBuilder = new StringBuilder(); | ||
keyBuilder.append(flagKey); | ||
keyBuilder.append(OPTI_KEY_DIVIDER); | ||
keyBuilder.append(getRuleKey()); | ||
return keyBuilder.toString(); | ||
} | ||
} |
31 changes: 31 additions & 0 deletions
31
core-api/src/main/java/com/optimizely/ab/OptimizelyForcedDecision.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
/** | ||
* | ||
* Copyright 2021, Optimizely and contributors | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
package com.optimizely.ab; | ||
|
||
import javax.annotation.Nonnull; | ||
|
||
public class OptimizelyForcedDecision { | ||
private String variationKey; | ||
|
||
public OptimizelyForcedDecision(@Nonnull String variationKey) { | ||
this.variationKey = variationKey; | ||
} | ||
|
||
public String getVariationKey() { | ||
return variationKey; | ||
} | ||
} |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.