-
Notifications
You must be signed in to change notification settings - Fork 20
feat: Datafile parsing + audience evaluation for ODP integration #305
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
mikechu-optimizely
merged 45 commits into
master
from
mike/datafile-parsing-audience-evaluation
Aug 4, 2022
Merged
Changes from all commits
Commits
Show all changes
45 commits
Select commit
Hold shift + click to select a range
3d20b51
Updated user context
mikechu-optimizely 0b4d1b9
Added ref to SDK from DemoApp so solution builds.
mikechu-optimizely 7542ca6
Merge branch 'master' into mike/datafile-parsing-audience-evaluation
mikechu-optimizely b80966d
(Datafile)ProjectConfig & Integration added
mikechu-optimizely bac1f1d
Update Condition interface & implementing classes
mikechu-optimizely b8022ae
Add copyright notice
mikechu-optimizely 15f5b63
Add AttributeType
mikechu-optimizely 7915232
Implement changes from DoesUserMeetAudienceConditions
mikechu-optimizely af97fcc
Correct accessibility & missing interface item
mikechu-optimizely cdc6c29
Bring AttributeType into BaseCondition
mikechu-optimizely 4c415b3
Add missing reference
mikechu-optimizely 5cd1eeb
Fix parsing
mikechu-optimizely d998b57
Add test for Integration parsing
mikechu-optimizely 7fedccb
Move reference to Integration
mikechu-optimizely a9295d2
Correction to NetStandard 2.0 project reference
mikechu-optimizely dd62705
Add empty Integration test
mikechu-optimizely 5420bf6
Test for empty integration and non "odp" integration
mikechu-optimizely e29a61a
Fix missed Copyright update
mikechu-optimizely ecbd7ec
Fix copyright notice
mikechu-optimizely 4d5bba9
Merge branch 'master' into mike/datafile-parsing-audience-evaluation
mikechu-optimizely c0bcf38
Add additional line to eof
mikechu-optimizely a7e0b19
Refactor `user` to `context` for OptimizelyUserContext param
mikechu-optimizely 67d28cf
Refactor: use static array of valid types
mikechu-optimizely 2cf6fb4
Oops use `userContext` instead of `context`
mikechu-optimizely 3957c22
Merge branch 'master' into mike/datafile-parsing-audience-evaluation
mikechu-optimizely 2d033eb
Update OptimizelySDK/AudienceConditions/ICondition.cs
mikechu-optimizely 3ab49f8
Update OptimizelySDK/AudienceConditions/EmptyCondition.cs
mikechu-optimizely ee72d48
Support Copy() including QualifiedSegments
mikechu-optimizely d91c00b
Move datafile Integration tests
mikechu-optimizely fa56206
Merge branch 'master' into mike/datafile-parsing-audience-evaluation
mikechu-optimizely aeff581
Integration ToString made generic + tests
mikechu-optimizely f08359e
Minor refactor and doc to userconext
mikechu-optimizely 92f38f8
Lock UserContext before determining IsQualifiedFor
mikechu-optimizely 845cc30
Separate integration test datafile content
mikechu-optimizely 3aa98ba
Add good integration config but also has other key-values
mikechu-optimizely 006e63a
Add copyright and EOL
mikechu-optimizely 514e5d5
Correction to Qualified Segments check + Add tests
mikechu-optimizely 18b8085
Update OptimizelySDK/OptimizelyUserContext.cs
mikechu-optimizely b96a009
Update OptimizelySDK.Tests/ProjectConfigTest.cs
mikechu-optimizely 9ec3300
Add thread-safe getter+setter; fix formatting
mikechu-optimizely a8581a7
Use third party dimension in qualified segments test
mikechu-optimizely 2e97a8e
Fixing Mike's sloppiness
mikechu-optimizely 3336c0c
Correct parameter order
mikechu-optimizely 847ba3e
Rename tests
mikechu-optimizely e094199
Maintain previous constructor signature
mikechu-optimizely 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
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
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
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
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
365 changes: 213 additions & 152 deletions
365
OptimizelySDK.Tests/AudienceConditionsTests/ConditionEvaluationTest.cs
Large diffs are not rendered by default.
Oops, something went wrong.
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
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,97 @@ | ||
/* | ||
* Copyright 2022, Optimizely | ||
* | ||
* 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 | ||
* | ||
* https://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. | ||
*/ | ||
|
||
using NUnit.Framework; | ||
using OptimizelySDK.Entity; | ||
|
||
namespace OptimizelySDK.Tests.EntityTests | ||
{ | ||
[TestFixture] | ||
public class IntegrationTest | ||
{ | ||
private const string KEY = "test-key"; | ||
|
||
private const string HOST = "api.example.com"; | ||
private const string PUBLIC_KEY = "FAk3-pUblic-K3y"; | ||
|
||
[Test] | ||
public void ToStringWithNoHostShouldSucceed() | ||
{ | ||
var integration = new Integration() | ||
{ | ||
Key = KEY, | ||
PublicKey = PUBLIC_KEY, | ||
}; | ||
|
||
var stringValue = integration.ToString(); | ||
|
||
Assert.True(stringValue.Contains($@"key='{KEY}'")); | ||
Assert.True(stringValue.Contains($@"publicKey='{PUBLIC_KEY}'")); | ||
Assert.False(stringValue.Contains("host")); | ||
Assert.False(stringValue.Contains(HOST)); | ||
} | ||
|
||
[Test] | ||
public void ToStringWithNoPublicKeyShouldSucceed() | ||
{ | ||
var integration = new Integration() | ||
{ | ||
Key = KEY, | ||
Host = HOST, | ||
}; | ||
|
||
var stringValue = integration.ToString(); | ||
|
||
Assert.True(stringValue.Contains($@"key='{KEY}'")); | ||
Assert.True(stringValue.Contains($@"host='{HOST}'")); | ||
Assert.False(stringValue.Contains("publicKey")); | ||
Assert.False(stringValue.Contains(PUBLIC_KEY)); | ||
} | ||
|
||
[Test] | ||
public void ToStringWithAllPropertiesShouldSucceed() | ||
{ | ||
var integration = new Integration() | ||
{ | ||
Key = KEY, | ||
Host = HOST, | ||
PublicKey = PUBLIC_KEY, | ||
}; | ||
|
||
var stringValue = integration.ToString(); | ||
|
||
Assert.True( | ||
stringValue.Contains($@"key='{KEY}', host='{HOST}', publicKey='{PUBLIC_KEY}'")); | ||
} | ||
|
||
[Test] | ||
public void ToStringWithOnlyKeyShouldSucceed() | ||
{ | ||
var integration = new Integration() | ||
{ | ||
Key = KEY, | ||
}; | ||
|
||
var stringValue = integration.ToString(); | ||
|
||
Assert.True(stringValue.Contains($@"key='{KEY}'")); | ||
Assert.False(stringValue.Contains("host")); | ||
Assert.False(stringValue.Contains(HOST)); | ||
Assert.False(stringValue.Contains("publicKey")); | ||
Assert.False(stringValue.Contains(PUBLIC_KEY)); | ||
} | ||
} | ||
} |
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,18 @@ | ||
{ | ||
"version": "4", | ||
"rollouts": [], | ||
"anonymizeIP": true, | ||
"projectId": "20441150641", | ||
"variables": [], | ||
"featureFlags": [], | ||
"experiments": [], | ||
"audiences": [], | ||
"groups": [], | ||
"integrations": [], | ||
"attributes": [], | ||
"accountId": "11467598500", | ||
"events": [], | ||
"revision": "241", | ||
"sdkKey": "EmptyIntegrationDatafile", | ||
"environmentKey": "Production" | ||
} |
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,65 @@ | ||
{ | ||
"version": "4", | ||
"rollouts": [ | ||
{ | ||
"experiments": [ | ||
], | ||
"id": "18309384009" | ||
} | ||
], | ||
"typedAudiences": [], | ||
"anonymizeIP": true, | ||
"projectId": "18326250003", | ||
"variables": [], | ||
"featureFlags": [ | ||
{ | ||
"experimentIds": [], | ||
"rolloutId": "18309384009", | ||
"variables": [ | ||
{ | ||
"defaultValue": "", | ||
"type": "string", | ||
"id": "18323951833", | ||
"key": "var_1" | ||
} | ||
], | ||
"id": "18244658520", | ||
"key": "empty_rollout" | ||
}, | ||
{ | ||
"experimentIds": [], | ||
"rolloutId": "", | ||
"variables": [ | ||
{ | ||
"defaultValue": "", | ||
"type": "string", | ||
"id": "2832355113", | ||
"key": "var_2" | ||
} | ||
], | ||
"id": "24246538512", | ||
"key": "empty_rollout_id" | ||
} | ||
], | ||
"experiments": [], | ||
"audiences": [ | ||
{ | ||
"conditions": "[\"or\", {\"match\": \"exact\", \"name\": \"$opt_dummy_attribute\", \"type\": \"custom_attribute\", \"value\": \"$opt_dummy_value\"}]", | ||
"id": "$opt_dummy_audience", | ||
"name": "Optimizely-Generated Audience for Backwards Compatibility" | ||
} | ||
], | ||
"groups": [], | ||
"integrations": [ | ||
{ | ||
"key": "not-odp", | ||
"host": "https://example.com", | ||
"publicKey": "CleAr1y-!a-R3a7-pUbl1c-k3y" | ||
} | ||
], | ||
"attributes": [], | ||
"botFiltering": false, | ||
"accountId": "8272261422", | ||
"events": [], | ||
"revision": "2" | ||
} |
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.