Skip to content

feat(OptimizelyConfig): Add new fields to OptimizelyConfig #266

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 26 commits into from
Aug 2, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
98dcba5
Added new Optimizely config fields
mnoman09 Jun 30, 2021
41e684b
Added delivery rules
mnoman09 Jul 2, 2021
c6ad489
Added optimizelyAudience and rollout featureVariables fix
mnoman09 Jul 6, 2021
9973794
Added new line at end
mnoman09 Jul 6, 2021
665c553
Added audiences and fixed tests
mnoman09 Jul 8, 2021
3c04342
Net 3.5 deserializing fix
mnoman09 Jul 9, 2021
1c0bf1a
Used string builder instead of string
mnoman09 Jul 13, 2021
ef6218b
Added OptimizelyProjectConfigTest file in tests
mnoman09 Jul 13, 2021
9fc9d54
Moved getEvent After GetFeaturesMap
mnoman09 Jul 13, 2021
53fbc69
Resolved comments and refactored logic
mnoman09 Jul 15, 2021
c8ccfca
Fixed space was added before NOT condition in audiences
mnoman09 Jul 26, 2021
b85ae86
Resolved comments
mnoman09 Jul 26, 2021
22a2039
Resolved unitTest issue
mnoman09 Jul 26, 2021
9ace97f
removed two additional tests for testing
mnoman09 Jul 27, 2021
621e62c
Merge branch 'master' into mnoman/optimizelyConfigNewFields
mnoman09 Jul 27, 2021
ce2505b
Audience array merge fix Unit test fix
mnoman09 Jul 27, 2021
b362593
Condition simplified
mnoman09 Jul 27, 2021
cb47e3c
Added OptimizelyEvent and OptimizelyAttribute Class
mnoman09 Jul 27, 2021
8ba7fe5
Added $opt_dummy_audience in datafile to verify that it is getting ig…
mnoman09 Jul 28, 2021
62ed97f
Added serializedAudiences Tests cases
mnoman09 Jul 28, 2021
c685c61
refactored little bit.
msohailhussain Jul 29, 2021
7351048
Refactored comments
mnoman09 Jul 29, 2021
f1e684f
added unit tests for multiple experiment and removed sdk and env key.
msohailhussain Jul 29, 2021
b5d3383
Setting sdkKey and environment key default value as empty string
mnoman09 Jul 30, 2021
1e9d40f
fixed sorting issue
msohailhussain Jul 30, 2021
6a8dafa
corrected sequence of audiences
msohailhussain Aug 2, 2021
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions OptimizelySDK.Net35/OptimizelySDK.Net35.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -284,9 +284,18 @@
<Compile Include="..\OptimizelySDK\OptlyConfig\OptimizelyConfig.cs">
<Link>OptlyConfig\OptimizelyConfig.cs</Link>
</Compile>
<Compile Include="..\OptimizelySDK\OptlyConfig\OptimizelyAttribute.cs">
<Link>OptlyConfig\OptimizelyAttribute.cs</Link>
</Compile>
<Compile Include="..\OptimizelySDK\OptlyConfig\OptimizelyEvent.cs">
<Link>OptlyConfig\OptimizelyEvent.cs</Link>
</Compile>
<Compile Include="..\OptimizelySDK\OptlyConfig\OptimizelyExperiment.cs">
<Link>OptlyConfig\OptimizelyExperiment.cs</Link>
</Compile>
<Compile Include="..\OptimizelySDK\OptlyConfig\OptimizelyAudience.cs">
<Link>OptlyConfig\OptimizelyAudience.cs</Link>
</Compile>
<Compile Include="..\OptimizelySDK\OptlyConfig\OptimizelyFeature.cs">
<Link>OptlyConfig\OptimizelyFeature.cs</Link>
</Compile>
Expand Down
9 changes: 9 additions & 0 deletions OptimizelySDK.Net40/OptimizelySDK.Net40.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -300,6 +300,12 @@
</Compile>
<Compile Include="..\OptimizelySDK\OptlyConfig\OptimizelyConfig.cs">
<Link>OptlyConfig\OptimizelyConfig.cs</Link>
</Compile>
<Compile Include="..\OptimizelySDK\OptlyConfig\OptimizelyAttribute.cs">
<Link>OptlyConfig\OptimizelyAttribute.cs</Link>
</Compile>
<Compile Include="..\OptimizelySDK\OptlyConfig\OptimizelyEvent.cs">
<Link>OptlyConfig\OptimizelyEvent.cs</Link>
</Compile>
<Compile Include="..\OptimizelySDK\OptlyConfig\OptimizelyExperiment.cs">
<Link>OptlyConfig\OptimizelyExperiment.cs</Link>
Expand All @@ -312,6 +318,9 @@
</Compile>
<Compile Include="..\OptimizelySDK\OptlyConfig\OptimizelyVariation.cs">
<Link>OptlyConfig\OptimizelyVariation.cs</Link>
</Compile>
<Compile Include="..\OptimizelySDK\OptlyConfig\OptimizelyAudience.cs">
<Link>OptlyConfig\OptimizelyAudience.cs</Link>
</Compile>
<Compile Include="..\OptimizelySDK\OptlyConfig\OptimizelyConfigService.cs">
<Link>OptlyConfig\OptimizelyConfigService.cs</Link>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -82,10 +82,13 @@
<Compile Include="..\OptimizelySDK\Config\PollingProjectConfigManager.cs" />
<Compile Include="..\OptimizelySDK\Config\HttpProjectConfigManager.cs" />
<Compile Include="..\OptimizelySDK\OptlyConfig\OptimizelyConfig.cs" />
<Compile Include="..\OptimizelySDK\OptlyConfig\OptimizelyAttribute.cs" />
<Compile Include="..\OptimizelySDK\OptlyConfig\OptimizelyEvent.cs" />
<Compile Include="..\OptimizelySDK\OptlyConfig\OptimizelyExperiment.cs" />
<Compile Include="..\OptimizelySDK\OptlyConfig\OptimizelyFeature.cs" />
<Compile Include="..\OptimizelySDK\OptlyConfig\OptimizelyVariable.cs" />
<Compile Include="..\OptimizelySDK\OptlyConfig\OptimizelyVariation.cs" />
<Compile Include="..\OptimizelySDK\OptlyConfig\OptimizelyAudience.cs" />
<Compile Include="..\OptimizelySDK\OptlyConfig\OptimizelyConfigService.cs" />
<Compile Include="..\OptimizelySDK\OptlyConfig\IOptimizelyConfigManager.cs" />
<Compile Include="..\OptimizelySDK\OptimizelyDecisions\DecisionMessage.cs" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -258,9 +258,15 @@
</Compile>
<Compile Include="..\OptimizelySDK\Event\EventProcessor.cs">
<Link>Event\EventProcessor.cs</Link>
</Compile>
<Compile Include="..\OptimizelySDK\OptlyConfig\OptimizelyAttribute.cs">
<Link>OptlyConfig\OptimizelyAttribute.cs</Link>
</Compile>
<Compile Include="..\OptimizelySDK\OptlyConfig\OptimizelyConfig.cs">
<Link>OptlyConfig\OptimizelyConfig.cs</Link>
</Compile>
<Compile Include="..\OptimizelySDK\OptlyConfig\OptimizelyEvent.cs">
<Link>OptlyConfig\OptimizelyEvent.cs</Link>
</Compile>
<Compile Include="..\OptimizelySDK\OptlyConfig\OptimizelyExperiment.cs">
<Link>OptlyConfig\OptimizelyExperiment.cs</Link>
Expand All @@ -270,6 +276,9 @@
</Compile>
<Compile Include="..\OptimizelySDK\OptlyConfig\OptimizelyVariable.cs">
<Link>OptlyConfig\OptimizelyVariable.cs</Link>
</Compile>
<Compile Include="..\OptimizelySDK\OptlyConfig\OptimizelyAudience.cs">
<Link>OptlyConfig\OptimizelyAudience.cs</Link>
</Compile>
<Compile Include="..\OptimizelySDK\OptlyConfig\OptimizelyVariation.cs">
<Link>OptlyConfig\OptimizelyVariation.cs</Link>
Expand Down
369 changes: 308 additions & 61 deletions OptimizelySDK.Tests/OptimizelyConfigTests/OptimizelyConfigTest.cs

Large diffs are not rendered by default.

3 changes: 3 additions & 0 deletions OptimizelySDK.Tests/OptimizelySDK.Tests.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,7 @@
<Compile Include="DecisionServiceTest.cs" />
<Compile Include="DefaultErrorHandlerTest.cs" />
<Compile Include="EventTests\EventProcessorProps.cs" />
<Compile Include="OptimizelyConfigTests\OptimizelyConfigTest.cs" />
<Compile Include="OptimizelyDecisions\OptimizelyDecisionTest.cs" />
<Compile Include="OptimizelyJSONTest.cs" />
<Compile Include="EventTests\BatchEventProcessorTest.cs" />
Expand Down Expand Up @@ -123,6 +124,8 @@
<EmbeddedResource Include="simple_ab_experiments.json" />
<EmbeddedResource Include="EmptyRolloutRule.json" />
<EmbeddedResource Include="emptydatafile.json" />
<EmbeddedResource Include="similar_exp_keys.json" />
<EmbeddedResource Include="similar_rule_keys_bucketing.json" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\OptimizelySDK\OptimizelySDK.csproj">
Expand Down
14 changes: 14 additions & 0 deletions OptimizelySDK.Tests/Utils/TestData.cs
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,8 @@ public class TestData
private static string typedAudienceDatafile = null;
private static string emptyRolloutDatafile = null;
private static string emptyDatafile = null;
private static string duplicateExpKeysDatafile = null;
private static string duplicateRuleKeysDatafile = null;

public static string Datafile
{
Expand All @@ -38,6 +40,18 @@ public static string Datafile
}
}

public static string DuplicateExpKeysDatafile {
get {
return duplicateExpKeysDatafile ?? (duplicateExpKeysDatafile = LoadJsonData("similar_exp_keys.json"));
}
}

public static string DuplicateRuleKeysDatafile {
get {
return duplicateRuleKeysDatafile ?? (duplicateRuleKeysDatafile = LoadJsonData("similar_rule_keys_bucketing.json"));
}
}

public static string SimpleABExperimentsDatafile
{
get
Expand Down
125 changes: 125 additions & 0 deletions OptimizelySDK.Tests/similar_exp_keys.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,125 @@
{
"version": "4",
"rollouts": [],
"typedAudiences": [
{
"id": "20415611520",
"conditions": [
"and",
[
"or",
[
"or",
{
"value": true,
"type": "custom_attribute",
"name": "hiddenLiveEnabled",
"match": "exact"
}
]
]
],
"name": "test1"
},
{
"id": "20406066925",
"conditions": [
"and",
[
"or",
[
"or",
{
"value": false,
"type": "custom_attribute",
"name": "hiddenLiveEnabled",
"match": "exact"
}
]
]
],
"name": "test2"
}
],
"anonymizeIP": true,
"projectId": "20430981610",
"variables": [],
"featureFlags": [
{
"experimentIds": ["9300000007569"],
"rolloutId": "",
"variables": [],
"id": "3045",
"key": "flag1"
},
{
"experimentIds": ["9300000007573"],
"rolloutId": "",
"variables": [],
"id": "3046",
"key": "flag2"
}
],
"experiments": [
{
"status": "Running",
"audienceConditions": ["or", "20415611520"],
"audienceIds": ["20415611520"],
"variations": [
{
"variables": [],
"id": "8045",
"key": "variation1",
"featureEnabled": true
}
],
"forcedVariations": {},
"key": "targeted_delivery",
"layerId": "9300000007569",
"trafficAllocation": [{ "entityId": "8045", "endOfRange": 10000 }],
"id": "9300000007569"
},
{
"status": "Running",
"audienceConditions": ["or", "20406066925"],
"audienceIds": ["20406066925"],
"variations": [
{
"variables": [],
"id": "8048",
"key": "variation2",
"featureEnabled": true
}
],
"forcedVariations": {},
"key": "targeted_delivery",
"layerId": "9300000007573",
"trafficAllocation": [{ "entityId": "8048", "endOfRange": 10000 }],
"id": "9300000007573"
}
],
"audiences": [
{
"id": "20415611520",
"conditions": "[\"or\", {\"match\": \"exact\", \"name\": \"$opt_dummy_attribute\", \"type\": \"custom_attribute\", \"value\": \"$opt_dummy_value\"}]",
"name": "test1"
},
{
"id": "20406066925",
"conditions": "[\"or\", {\"match\": \"exact\", \"name\": \"$opt_dummy_attribute\", \"type\": \"custom_attribute\", \"value\": \"$opt_dummy_value\"}]",
"name": "test2"
},
{
"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": [],
"attributes": [{ "id": "20408641883", "key": "hiddenLiveEnabled" }],
"botFiltering": false,
"accountId": "17882702980",
"events": [],
"revision": "25",
"sendFlagDecisions": true
}
Loading