Package com.indeed.proctor.common
Class Identifiers
- java.lang.Object
-
- com.indeed.proctor.common.Identifiers
-
public class Identifiers extends java.lang.ObjectConvenience wrapper for Map, used to select an identifier suitable to resolve test groups for the given experiment.
-
-
Constructor Summary
Constructors Constructor Description Identifiers(TestType type, java.lang.String identifier)Identifiers(java.util.Map<TestType,java.lang.String> identifierMap)Identifiers(java.util.Map<TestType,java.lang.String> identifierMap, boolean randomEnabled)This constructor can construct instances with randomEnabled == true, which only affects test with TestType.RANDOM, and enables the random behavior.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description booleanequals(java.lang.Object o)java.lang.StringgetAccountId()java.util.Set<TestType>getAvailableTestTypes()java.lang.StringgetCompanyId()java.lang.StringgetEmail()java.lang.StringgetIdentifier(TestType testType)java.lang.StringgetPageId()java.lang.StringgetUserId()inthashCode()booleanisRandomEnabled()static Identifiersof(TestType type, java.lang.String identifier)static Identifiersof(TestType typeA, java.lang.String identifierA, TestType typeB, java.lang.String identifierB)static Identifiersof(TestType typeA, java.lang.String identifierA, TestType typeB, java.lang.String identifierB, TestType typeC, java.lang.String identifierC)
-
-
-
Constructor Detail
-
Identifiers
public Identifiers(@Nonnull java.util.Map<TestType,java.lang.String> identifierMap)
-
Identifiers
public Identifiers(@Nonnull java.util.Map<TestType,java.lang.String> identifierMap, boolean randomEnabled)This constructor can construct instances with randomEnabled == true, which only affects test with TestType.RANDOM, and enables the random behavior. For A/B testing, randomized behavior is typically harmful, because the same test units get different treatment every time, preventing analysis of effects. TestType.RANDOM can be used for non-experimentation purposes, such as gradual rollouts of migrations with e.g. 20% of traffic to be diverged to a different server.TestType.RANDOM will only work with apps that use this constructor setting randomEnabled == true. Please refers to
Proctor.determineTestGroups(Identifiers, Map, Map, Collection)to know how randomEnabled value is used to enable/disable random behavior for tests with TestType.RANDOM.- Parameters:
identifierMap- : A map from TestType to identifier to use (e.g. ctk, accountId). Note that it must not has an entry for TestType.RANDOM because proctor generates random values for this type.randomEnabled- : A flag whether random behavior for tests with TestType.RANDOM is enabled or not. Default is false.
-
Identifiers
public Identifiers(TestType type, java.lang.String identifier)
-
-
Method Detail
-
of
public static Identifiers of(TestType type, java.lang.String identifier)
-
of
public static Identifiers of(TestType typeA, java.lang.String identifierA, TestType typeB, java.lang.String identifierB)
-
of
public static Identifiers of(TestType typeA, java.lang.String identifierA, TestType typeB, java.lang.String identifierB, TestType typeC, java.lang.String identifierC)
-
isRandomEnabled
public boolean isRandomEnabled()
- Returns:
- true if random test group assignment was enabled in constructor.
-
getAvailableTestTypes
public java.util.Set<TestType> getAvailableTestTypes()
- Returns:
- a set of all the test types whose identifiers are stored in this object.
-
getIdentifier
@CheckForNull public java.lang.String getIdentifier(TestType testType)
-
getUserId
@CheckForNull public java.lang.String getUserId()
-
getPageId
@CheckForNull public java.lang.String getPageId()
-
getCompanyId
@CheckForNull public java.lang.String getCompanyId()
-
getEmail
@CheckForNull public java.lang.String getEmail()
-
getAccountId
@CheckForNull public java.lang.String getAccountId()
-
equals
public boolean equals(java.lang.Object o)
- Overrides:
equalsin classjava.lang.Object
-
hashCode
public int hashCode()
- Overrides:
hashCodein classjava.lang.Object
-
-