Skip to content

style: rename custom dimensions as custom attributes #210

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 2 commits into from
Sep 6, 2018
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
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ public void verifyGetExperimentsForInvalidEvent() throws Exception {
@Test
public void verifyGetAudienceConditionsFromValidId() throws Exception {
List<Condition> userAttributes = new ArrayList<Condition>();
userAttributes.add(new UserAttribute("browser_type", "custom_dimension", "firefox"));
userAttributes.add(new UserAttribute("browser_type", "custom_attribute", "firefox"));

OrCondition orInner = new OrCondition(userAttributes);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ private static ProjectConfig generateValidProjectConfigV2() {
new EventType("100", "no_running_experiments", singletonList("118")));

List<Condition> userAttributes = new ArrayList<Condition>();
userAttributes.add(new UserAttribute("browser_type", "custom_dimension", "firefox"));
userAttributes.add(new UserAttribute("browser_type", "custom_attribute", "firefox"));

OrCondition orInner = new OrCondition(userAttributes);

Expand Down Expand Up @@ -245,7 +245,7 @@ private static ProjectConfig generateValidProjectConfigV3() {
new EventType("100", "no_running_experiments", singletonList("118")));

List<Condition> userAttributes = new ArrayList<Condition>();
userAttributes.add(new UserAttribute("browser_type", "custom_dimension", "firefox"));
userAttributes.add(new UserAttribute("browser_type", "custom_attribute", "firefox"));

OrCondition orInner = new OrCondition(userAttributes);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ public class ValidProjectConfigV4 {
private static final Attribute ATTRIBUTE_DOUBLE = new Attribute(ATTRIBUTE_DOUBLE_ID, ATTRIBUTE_DOUBLE_KEY);

// audiences
private static final String CUSTOM_DIMENSION_TYPE = "custom_dimension";
private static final String CUSTOM_ATTRIBUTE_TYPE = "custom_attribute";
private static final String AUDIENCE_GRYFFINDOR_ID = "3468206642";
private static final String AUDIENCE_GRYFFINDOR_KEY = "Gryffindors";
public static final String AUDIENCE_GRYFFINDOR_VALUE = "Gryffindor";
Expand All @@ -72,7 +72,7 @@ public class ValidProjectConfigV4 {
new AndCondition(Collections.<Condition>singletonList(
new OrCondition(Collections.<Condition>singletonList(
new OrCondition(Collections.singletonList((Condition) new UserAttribute(ATTRIBUTE_HOUSE_KEY,
CUSTOM_DIMENSION_TYPE,
CUSTOM_ATTRIBUTE_TYPE,
AUDIENCE_GRYFFINDOR_VALUE)))))))
);
private static final String AUDIENCE_SLYTHERIN_ID = "3988293898";
Expand All @@ -84,7 +84,7 @@ public class ValidProjectConfigV4 {
new AndCondition(Collections.<Condition>singletonList(
new OrCondition(Collections.<Condition>singletonList(
new OrCondition(Collections.singletonList((Condition) new UserAttribute(ATTRIBUTE_HOUSE_KEY,
CUSTOM_DIMENSION_TYPE,
CUSTOM_ATTRIBUTE_TYPE,
AUDIENCE_SLYTHERIN_VALUE)))))))
);

Expand All @@ -97,20 +97,20 @@ public class ValidProjectConfigV4 {
new AndCondition(Collections.<Condition>singletonList(
new OrCondition(Collections.<Condition>singletonList(
new OrCondition(Collections.singletonList((Condition) new UserAttribute(ATTRIBUTE_NATIONALITY_KEY,
CUSTOM_DIMENSION_TYPE,
CUSTOM_ATTRIBUTE_TYPE,
AUDIENCE_ENGLISH_CITIZENS_VALUE)))))))
);
private static final String AUDIENCE_WITH_MISSING_VALUE_ID = "2196265320";
private static final String AUDIENCE_WITH_MISSING_VALUE_KEY = "audience_with_missing_value";
public static final String AUDIENCE_WITH_MISSING_VALUE_VALUE = "English";
private static final UserAttribute ATTRIBUTE_WITH_VALUE = new UserAttribute(
ATTRIBUTE_NATIONALITY_KEY,
CUSTOM_DIMENSION_TYPE,
CUSTOM_ATTRIBUTE_TYPE,
AUDIENCE_WITH_MISSING_VALUE_VALUE
);
private static final UserAttribute ATTRIBUTE_WITHOUT_VALUE = new UserAttribute(
ATTRIBUTE_NATIONALITY_KEY,
CUSTOM_DIMENSION_TYPE,
CUSTOM_ATTRIBUTE_TYPE,
null
);
private static final Audience AUDIENCE_WITH_MISSING_VALUE = new Audience(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ public void initialize() {
*/
@Test
public void userAttributeEvaluateTrue() throws Exception {
UserAttribute testInstance = new UserAttribute("browser_type", "custom_dimension", "chrome");
UserAttribute testInstance = new UserAttribute("browser_type", "custom_attribute", "chrome");
assertTrue(testInstance.evaluate(testUserAttributes));
}

Expand All @@ -73,10 +73,10 @@ public void userAttributeEvaluateTrue() throws Exception {
*/
@Test
public void typedUserAttributeEvaluateTrue() throws Exception {
UserAttribute testInstance = new UserAttribute("meta_data", "custom_dimension", testUserAttributes);
UserAttribute testInstance2 = new UserAttribute("is_firefox", "custom_dimension", true);
UserAttribute testInstance3 = new UserAttribute("num_counts", "custom_dimension", 3.55);
UserAttribute testInstance4 = new UserAttribute("num_size", "custom_dimension", 3);
UserAttribute testInstance = new UserAttribute("meta_data", "custom_attribute", testUserAttributes);
UserAttribute testInstance2 = new UserAttribute("is_firefox", "custom_attribute", true);
UserAttribute testInstance3 = new UserAttribute("num_counts", "custom_attribute", 3.55);
UserAttribute testInstance4 = new UserAttribute("num_size", "custom_attribute", 3);

assertTrue(testInstance.evaluate(testTypedUserAttributes));
assertTrue(testInstance2.evaluate(testTypedUserAttributes));
Expand All @@ -89,7 +89,7 @@ public void typedUserAttributeEvaluateTrue() throws Exception {
*/
@Test
public void userAttributeEvaluateFalse() throws Exception {
UserAttribute testInstance = new UserAttribute("browser_type", "custom_dimension", "firefox");
UserAttribute testInstance = new UserAttribute("browser_type", "custom_attribute", "firefox");
assertFalse(testInstance.evaluate(testUserAttributes));
}

Expand All @@ -98,7 +98,7 @@ public void userAttributeEvaluateFalse() throws Exception {
*/
@Test
public void userAttributeUnknownAttribute() throws Exception {
UserAttribute testInstance = new UserAttribute("unknown_dim", "custom_dimension", "unknown");
UserAttribute testInstance = new UserAttribute("unknown_dim", "custom_attribute", "unknown");
assertFalse(testInstance.evaluate(testUserAttributes));
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,7 @@
{
"id": "100",
"name": "not_firefox_users",
"conditions": "[\"and\", [\"or\", [\"not\", [\"or\", {\"name\": \"browser_type\", \"type\": \"custom_dimension\", \"value\":\"firefox\"}]]]]"
"conditions": "[\"and\", [\"or\", [\"not\", [\"or\", {\"name\": \"browser_type\", \"type\": \"custom_attribute\", \"value\":\"firefox\"}]]]]"
}
],
"attributes": [
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -201,7 +201,7 @@
{
"id": "100",
"name": "not_firefox_users",
"conditions": "[\"and\", [\"or\", [\"not\", [\"or\", {\"name\": \"browser_type\", \"type\": \"custom_dimension\", \"value\":\"firefox\"}]]]]"
"conditions": "[\"and\", [\"or\", [\"not\", [\"or\", {\"name\": \"browser_type\", \"type\": \"custom_attribute\", \"value\":\"firefox\"}]]]]"
}
],
"attributes": [
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,22 +9,22 @@
{
"id": "3468206642",
"name": "Gryffindors",
"conditions": "[\"and\", [\"or\", [\"or\", {\"name\": \"house\", \"type\": \"custom_dimension\", \"value\":\"Gryffindor\"}]]]"
"conditions": "[\"and\", [\"or\", [\"or\", {\"name\": \"house\", \"type\": \"custom_attribute\", \"value\":\"Gryffindor\"}]]]"
},
{
"id": "3988293898",
"name": "Slytherins",
"conditions": "[\"and\", [\"or\", [\"or\", {\"name\": \"house\", \"type\": \"custom_dimension\", \"value\":\"Slytherin\"}]]]"
"conditions": "[\"and\", [\"or\", [\"or\", {\"name\": \"house\", \"type\": \"custom_attribute\", \"value\":\"Slytherin\"}]]]"
},
{
"id": "4194404272",
"name": "english_citizens",
"conditions": "[\"and\", [\"or\", [\"or\", {\"name\": \"nationality\", \"type\": \"custom_dimension\", \"value\":\"English\"}]]]"
"conditions": "[\"and\", [\"or\", [\"or\", {\"name\": \"nationality\", \"type\": \"custom_attribute\", \"value\":\"English\"}]]]"
},
{
"id": "2196265320",
"name": "audience_with_missing_value",
"conditions": "[\"and\", [\"or\", [\"or\", {\"name\": \"nationality\", \"type\": \"custom_dimension\", \"value\": \"English\"}, {\"name\": \"nationality\", \"type\": \"custom_dimension\"}]]]"
"conditions": "[\"and\", [\"or\", [\"or\", {\"name\": \"nationality\", \"type\": \"custom_attribute\", \"value\": \"English\"}, {\"name\": \"nationality\", \"type\": \"custom_attribute\"}]]]"
}
],
"attributes": [
Expand Down