From 8b2f2ddc505ebfca1b07ac7a14e07f0205965aaf Mon Sep 17 00:00:00 2001 From: wangjoshuah Date: Sat, 17 Jun 2017 16:36:26 -0700 Subject: [PATCH 1/3] first draft of test v4 datafile --- .../config/valid-project-config-v4.json | 342 ++++++++++++++++++ 1 file changed, 342 insertions(+) create mode 100644 core-api/src/test/resources/config/valid-project-config-v4.json diff --git a/core-api/src/test/resources/config/valid-project-config-v4.json b/core-api/src/test/resources/config/valid-project-config-v4.json new file mode 100644 index 000000000..409841ab3 --- /dev/null +++ b/core-api/src/test/resources/config/valid-project-config-v4.json @@ -0,0 +1,342 @@ +{ + "accountId": "2360254204", + "anonymizeIP": true, + "projectId": "3918735994", + "revision": "1480511547", + "version": "4", + "audiences": [ + { + "id": "3468206642", + "name": "Gryffindors", + "conditions": "[\"and\", [\"or\", [\"or\", {\"name\": \"house\", \"type\": \"custom_dimension\", \"value\":\"Gryffindor\"}]]]" + } + ], + "attributes": [ + { + "id": "334265546", + "key": "Gryffindor" + } + ], + "events": [], + "groups": [ + { + "id": "1015968292", + "policy": "random", + "trafficAllocation": [ + { + "entityId": "2738374745", + "endOfRange": 5000 + }, + { + "entityId": "3042640549", + "endOfRange": 10000 + } + ] + } + ], + "features": [ + { + "id": "4195505407", + "key": "boolean_feature", + "layerId": "", + "experimentIds": [], + "variables": [] + }, + { + "id": "3926744821", + "key": "double_single_variable_feature", + "layerId": "", + "experimentIds": [], + "variables": [ + { + "id": "4111654444", + "key": "double_variable", + "type": "double", + "defaultValue": "14.99" + } + ] + }, + { + "id": "3281420120", + "key": "integer_single_variable_feature", + "layerId": "", + "experimentIds": [], + "variables": [ + { + "id": "593964691", + "key": "integer_variable", + "type": "integer", + "defaultValue": "7" + } + ] + }, + { + "id": "2591051011", + "key": "boolean_single_variable_feature", + "layerId": "", + "experimentIds": [], + "variables": [ + { + "id": "3974680341", + "key": "boolean_variable", + "type": "boolean", + "defaultValue": "true" + } + ] + }, + { + "id": "2079378557", + "key": "string_single_variable_feature", + "layerId": "", + "experimentIds": [], + "variables": [ + { + "id": "2077511132", + "key": "string_variable", + "type": "string", + "defaultValue": "wingardium leviosa" + } + ] + }, + { + "id": "3263342226", + "key": "multi_variate_feature", + "layerId": "", + "experimentIds": [], + "variables": [ + { + "id": "675244127", + "key": "first_letter", + "type": "string", + "defaultValue": "H" + }, + { + "id": "4052219963", + "key": "rest_of_name", + "type": "string", + "defaultValue": "arry" + } + ] + } + ], + "layers": [ + { + "id": "1630555626", + "policy": "single_experiment", + "experiments": [ + { + "id": "1323241596", + "key": "basic_experiment", + "status": "Running", + "variations": [ + { + "id": "1423767502", + "key": "A", + "variables": [] + }, + { + "id": "3433458314", + "key": "B", + "variables": [] + } + ], + "trafficAllocation": [ + { + "entityId": "1423767502", + "endOfRange": 5000 + }, + { + "entityId": "3433458314", + "endOfRange": 10000 + } + ], + "audienceIds": [ + "3468206642" + ], + "forcedVariations": { + "Harry Potter": "A", + "Tom Riddle": "B" + } + } + ] + }, + { + "id": "3301900159", + "policy": "single_experiment", + "experiments": [ + { + "id": "2738374745", + "key": "first_grouped_experiment", + "status": "Running", + "groupId": "1015968292", + "variations": [ + { + "id": "2377378132", + "key": "A", + "variables": [] + }, + { + "id": "1179171250", + "key": "B", + "variables": [] + } + ], + "trafficAllocation": [ + { + "entityId": "2377378132", + "endOfRange": 5000 + }, + { + "entityId": "1179171250", + "endOfRange": 10000 + } + ], + "audienceIds": [ + "3468206642" + ], + "forcedVariations": { + "Harry Potter": "A", + "Tom Riddle": "B" + } + } + ] + }, + { + "id": "2625300442", + "policy": "single_experiment", + "experiments": [ + { + "id": "3042640549", + "key": "second_grouped_experiment", + "status": "Running", + "groupId": "1015968292", + "variations": [ + { + "id": "1558539439", + "key": "A", + "variables": [] + }, + { + "id": "2142748370", + "key": "B", + "variables": [] + } + ], + "trafficAllocation": [ + { + "entityId": "1558539439", + "endOfRange": 5000 + }, + { + "entityId": "2142748370", + "endOfRange": 10000 + } + ], + "audienceIds": [ + "3468206642" + ], + "forcedVariations": { + "Hermione Granger": "A", + "Ronald Weasley": "B" + } + } + ] + }, + { + "id": "3780747876", + "policy": "single_experiment", + "experiments": [ + { + "id": "3262035800", + "key": "multivariate_experiment", + "status": "Running", + "variations": [ + { + "id": "1880281238", + "key": "Fred", + "variables": [ + { + "id": "675244127", + "value": "F" + }, + { + "id": "4052219963", + "value": "red" + } + ] + }, + { + "id": "3631049532", + "key": "Feorge", + "variables": [ + { + "id": "675244127", + "value": "F" + }, + { + "id": "4052219963", + "value": "eorge" + } + ] + }, + { + "id": "4204375027", + "key": "Gred", + "variables": [ + { + "id": "675244127", + "value": "G" + }, + { + "id": "4052219963", + "value": "red" + } + ] + }, + { + "id": "2099211198", + "key": "George", + "variables": [ + { + "id": "675244127", + "value": "G" + }, + { + "id": "4052219963", + "value": "eorge" + } + ] + } + ], + "trafficAllocation": [ + { + "entityId": "1880281238", + "endOfRange": 2500 + }, + { + "entityId": "3631049532", + "endOfRange": 5000 + }, + { + "entityId": "4204375027", + "endOfRange": 7500 + }, + { + "entityId": "2099211198", + "endOfRange": 10000 + } + ], + "audienceIds": [ + "3468206642" + ], + "forcedVariations": { + "Fred": "Fred", + "Feorge": "Feorge", + "Gred": "Gred", + "George": "George" + } + } + ] + } + ] +} \ No newline at end of file From 89aa447393aca9450281aed2f680e24a6d9b4eae Mon Sep 17 00:00:00 2001 From: wangjoshuah Date: Sat, 17 Jun 2017 16:43:26 -0700 Subject: [PATCH 2/3] finish v4 datafile --- .../com/optimizely/ab/config/ProjectConfigTestUtils.java | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/core-api/src/test/java/com/optimizely/ab/config/ProjectConfigTestUtils.java b/core-api/src/test/java/com/optimizely/ab/config/ProjectConfigTestUtils.java index 0cc3ba1dd..4058a0ca5 100644 --- a/core-api/src/test/java/com/optimizely/ab/config/ProjectConfigTestUtils.java +++ b/core-api/src/test/java/com/optimizely/ab/config/ProjectConfigTestUtils.java @@ -377,6 +377,11 @@ private static ProjectConfig generateNoAudienceProjectConfigV3() { events, Collections.emptyList(), true, Collections.emptyList()); } + private static final ProjectConfig VALID_PROJECT_CONFIG_V4 = generateValidProjectCOnfigV4(); + private static ProjectConfig generateValidProjectCOnfigV4() { + return null; + } + private ProjectConfigTestUtils() { } public static String validConfigJsonV2() throws IOException { @@ -423,6 +428,10 @@ public static ProjectConfig noAudienceProjectConfigV3() { return NO_AUDIENCE_PROJECT_CONFIG_V3; } + public static ProjectConfig validProjectConfigV4() { + return VALID_PROJECT_CONFIG_V4; + } + /** * Asserts that the provided project configs are equivalent. */ From e41bf12d0d16aea050507a62c31213bc51479d31 Mon Sep 17 00:00:00 2001 From: wangjoshuah Date: Mon, 19 Jun 2017 16:37:01 -0700 Subject: [PATCH 3/3] fix method name --- .../java/com/optimizely/ab/config/ProjectConfigTestUtils.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/core-api/src/test/java/com/optimizely/ab/config/ProjectConfigTestUtils.java b/core-api/src/test/java/com/optimizely/ab/config/ProjectConfigTestUtils.java index 4058a0ca5..d73efeb23 100644 --- a/core-api/src/test/java/com/optimizely/ab/config/ProjectConfigTestUtils.java +++ b/core-api/src/test/java/com/optimizely/ab/config/ProjectConfigTestUtils.java @@ -377,8 +377,8 @@ private static ProjectConfig generateNoAudienceProjectConfigV3() { events, Collections.emptyList(), true, Collections.emptyList()); } - private static final ProjectConfig VALID_PROJECT_CONFIG_V4 = generateValidProjectCOnfigV4(); - private static ProjectConfig generateValidProjectCOnfigV4() { + private static final ProjectConfig VALID_PROJECT_CONFIG_V4 = generateValidProjectConfigV4(); + private static ProjectConfig generateValidProjectConfigV4() { return null; }