Class Identifiers


  • public class Identifiers
    extends java.lang.Object
    Convenience wrapper for Map, used to select an identifier suitable to resolve test groups for the given experiment.
    • 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 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:
        equals in class java.lang.Object
      • hashCode

        public int hashCode()
        Overrides:
        hashCode in class java.lang.Object