Skip to content

Release version 1.4.1 (#71) #72

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 1 commit into from
Feb 2, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
## 1.4.1

February 1, 2017

- Default `null` status in datafile to `Not started`

## 1.4.0

January 31, 2017
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ public Experiment(@JsonProperty("id") String id,

public Experiment(@Nonnull String id,
@Nonnull String key,
@Nonnull String status,
@Nullable String status,
@Nullable String layerId,
@Nonnull List<String> audienceIds,
@Nonnull List<Variation> variations,
Expand All @@ -92,7 +92,7 @@ public Experiment(@Nonnull String id,
@Nonnull String groupId) {
this.id = id;
this.key = key;
this.status = status;
this.status = status == null ? ExperimentStatus.NOT_STARTED.toString() : status;
this.layerId = layerId;
this.audienceIds = Collections.unmodifiableList(audienceIds);
this.variations = Collections.unmodifiableList(variations);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
import com.google.gson.reflect.TypeToken;

import com.optimizely.ab.config.Experiment;
import com.optimizely.ab.config.Experiment.ExperimentStatus;
import com.optimizely.ab.config.LiveVariableUsageInstance;
import com.optimizely.ab.config.TrafficAllocation;
import com.optimizely.ab.config.Variation;
Expand Down Expand Up @@ -86,7 +87,10 @@ static List<TrafficAllocation> parseTrafficAllocation(JsonArray trafficAllocatio
static Experiment parseExperiment(JsonObject experimentJson, String groupId, JsonDeserializationContext context) {
String id = experimentJson.get("id").getAsString();
String key = experimentJson.get("key").getAsString();
String status = experimentJson.get("status").getAsString();
JsonElement experimentStatusJson = experimentJson.get("status");
String status = experimentStatusJson.isJsonNull() ?
ExperimentStatus.NOT_STARTED.toString() : experimentStatusJson.getAsString();

JsonElement layerIdJson = experimentJson.get("layerId");
String layerId = layerIdJson == null ? null : layerIdJson.getAsString();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
import com.optimizely.ab.config.audience.UserAttribute;
import com.optimizely.ab.config.EventType;
import com.optimizely.ab.config.Experiment;
import com.optimizely.ab.config.Experiment.ExperimentStatus;
import com.optimizely.ab.config.Group;
import com.optimizely.ab.config.LiveVariable;
import com.optimizely.ab.config.LiveVariableUsageInstance;
Expand Down Expand Up @@ -101,7 +102,8 @@ private List<Experiment> parseExperiments(JSONArray experimentJson, String group
JSONObject experimentObject = (JSONObject)obj;
String id = experimentObject.getString("id");
String key = experimentObject.getString("key");
String status = experimentObject.getString("status");
String status = experimentObject.isNull("status") ?
ExperimentStatus.NOT_STARTED.toString() : experimentObject.getString("status");
String layerId = experimentObject.has("layerId") ? experimentObject.getString("layerId") : null;

JSONArray audienceIdsJson = experimentObject.getJSONArray("audienceIds");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
import com.optimizely.ab.config.audience.UserAttribute;
import com.optimizely.ab.config.EventType;
import com.optimizely.ab.config.Experiment;
import com.optimizely.ab.config.Experiment.ExperimentStatus;
import com.optimizely.ab.config.Group;
import com.optimizely.ab.config.LiveVariable;
import com.optimizely.ab.config.LiveVariableUsageInstance;
Expand Down Expand Up @@ -103,7 +104,9 @@ private List<Experiment> parseExperiments(JSONArray experimentJson, String group
JSONObject experimentObject = (JSONObject)obj;
String id = (String)experimentObject.get("id");
String key = (String)experimentObject.get("key");
String status = (String)experimentObject.get("status");
Object statusJson = experimentObject.get("status");
String status = statusJson == null ? ExperimentStatus.NOT_STARTED.toString() :
(String)experimentObject.get("status");
Object layerIdObject = experimentObject.get("layerId");
String layerId = layerIdObject == null ? null : (String)layerIdObject;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -197,6 +197,14 @@ private static ProjectConfig generateValidProjectConfigV2() {
Collections.singletonMap("testUser3", "vtag3"),
asList(new TrafficAllocation("278", 4500),
new TrafficAllocation("279", 9000)),
""),
new Experiment("119", "etag3", "Not started", null,
singletonList("100"),
asList(new Variation("280", "vtag5"),
new Variation("281", "vtag6")),
Collections.singletonMap("testUser4", "vtag5"),
asList(new TrafficAllocation("280", 4500),
new TrafficAllocation("281", 9000)),
"")
);

Expand Down
26 changes: 26 additions & 0 deletions core-api/src/test/resources/config/valid-project-config-v2.json
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,32 @@
"entityId": "279",
"endOfRange": 9000
}]
},
{
"id": "119",
"key": "etag3",
"status": null,
"layerId": "2",
"audienceIds": [
"100"
],
"variations": [{
"id": "280",
"key": "vtag5"
}, {
"id": "281",
"key": "vtag6"
}],
"forcedVariations": {
"testUser4": "vtag5"
},
"trafficAllocation": [{
"entityId": "280",
"endOfRange": 4500
}, {
"entityId": "281",
"endOfRange": 9000
}]
}
],
"groups": [{
Expand Down
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# Maven version
version = 1.4.0-SNAPSHOT
version = 1.4.1-SNAPSHOT

# Artifact paths
mavenS3Bucket = optimizely-maven
Expand Down