Class TestDependencies


  • public class TestDependencies
    extends java.lang.Object
    A collection of utility functions for test dependencies
    • Method Detail

      • validateDependenciesAndReturnReasons

        public static java.util.Map<java.lang.String,​java.lang.String> validateDependenciesAndReturnReasons​(java.util.Map<java.lang.String,​ConsumableTestDefinition> testDefinitions)
        Returns test names and reasons of all tests with invalid dependency relationship. It's invalid when a test directly or indirectly depends on
        • an unknown test, or
        • a test with circular dependency (depending on itself), or
        • a test with a different test type, or
        • a test with the same salt, or
        • a bucket undefined in the test
        It's expected to be used in test matrix loading time to filter out invalid test definitions.
      • validateDependencyAndReturnReason

        public static java.util.Optional<java.lang.String> validateDependencyAndReturnReason​(java.lang.String testName,
                                                                                             ConsumableTestDefinition definition,
                                                                                             java.util.Map<java.lang.String,​ConsumableTestDefinition> testDefinitions)
        Validate a direct dependency relationship of the given test and returns reason if the dependency is invalid.

        It's expected to be used by Proctor Webapp to validate a test modification or deletion.

      • determineEvaluationOrder

        public static java.util.List<java.lang.String> determineEvaluationOrder​(java.util.Map<java.lang.String,​ConsumableTestDefinition> testDefinitions)
        Returns a list of all test names in arbitrary order satisfying the following condition - If test X depends on test Y, test Y comes earlier than X in the list.

        It's expected to be used in test matrix loading time to precompute evaluation order.

        Throws:
        java.lang.IllegalArgumentException - when it detects circular dependency or dependency to unknown test
      • computeMaximumDependencyChains

        public static int computeMaximumDependencyChains​(java.util.Map<java.lang.String,​ConsumableTestDefinition> testDefinitions,
                                                         java.lang.String testName)
        Returns maximum length (number of edges) of dependency chains through the given test.

        It's expected to be used by Proctor Webapp to limit the allowed depth in edit.

      • computeTransitiveDependencies

        public static java.util.Set<java.lang.String> computeTransitiveDependencies​(java.util.Map<java.lang.String,​ConsumableTestDefinition> testDefinitions,
                                                                                    java.util.Set<java.lang.String> testNames)
        Returns all test names required to evaluate all the given tests. It runs in linear time to the size of response instead of all tests.
        Throws:
        java.lang.IllegalArgumentException - when it detects dependency on an unknown name