Class TestCaseResultHibernateDao

java.lang.Object
org.springframework.dao.support.DaoSupport
org.springframework.orm.hibernate5.support.HibernateDaoSupport
All Implemented Interfaces:
BambooObjectDao<TestCaseResult>, TestCaseResultDao, org.springframework.beans.factory.InitializingBean

public class TestCaseResultHibernateDao extends BambooHibernateObjectDao<TestCaseResult> implements TestCaseResultDao
  • Constructor Details

    • TestCaseResultHibernateDao

      public TestCaseResultHibernateDao()
  • Method Details

    • findById

      public TestCaseResult findById(long id)
      Description copied from interface: TestCaseResultDao
      Find a specific testCaseResult by id
      Specified by:
      findById in interface TestCaseResultDao
      Parameters:
      id - of the test you want to find
      Returns:
      the testCaseResult corresponding to the id provided.
    • getTestsForBuildResultByState

      @NotNull public @NotNull List<TestCaseResult> getTestsForBuildResultByState(ResultsSummary summary, TestState state, int firstResult, int maxResults)
      Description copied from interface: TestCaseResultDao
      Retrieves a list of testCaseResults for a BuildResultSummary based on their state (e.f FAILED or SUCCESS). To be used whenever pagination is required.
      Specified by:
      getTestsForBuildResultByState in interface TestCaseResultDao
      Parameters:
      summary - the BuildResultsSummary to get the tests for
      state - the TestState to search for.
      firstResult - the first record to be retrieved. Negative values are treated as 0.
      maxResults - maximum amount of records to be retrieved. Values less than or equal to 0 are ignored.
      Returns:
      a list of testCaseResults for a BuildResultSummary with the given state
    • getTestsForBuildResultByDeltaState

      @NotNull public @NotNull List<TestCaseResult> getTestsForBuildResultByDeltaState(ResultsSummary summary, TestDeltaState deltaState, int firstResult, int maxResults)
      Description copied from interface: TestCaseResultDao
      Retrieves a list of testCaseResults for a BuildResultSummary based on their delta state (e.g BROKEN, FIXED)
      Specified by:
      getTestsForBuildResultByDeltaState in interface TestCaseResultDao
      Parameters:
      summary - the BuildResultsSummary to get the tests for
      deltaState - the TestDeltaState to search for.
      firstResult - the first record to be retrieved. Negative values are treated as 0.
      maxResults - maximum amount of records to be retrieved. Values less than or equal to 0 are ignored.
      Returns:
      a list of testCaseResults for a BuildResultSummary with the given delta state
    • getTestsForChainResultByDeltaStates

      @NotNull public @NotNull List<TestCaseResult> getTestsForChainResultByDeltaStates(ChainResultsSummary summary, TestDeltaState[] deltaStates, int firstResult, int maxResults)
      Description copied from interface: TestCaseResultDao
      Retrieves a list of testCaseResults for a ChainResultSummary based on their delta state (e.g BROKEN, FIXED)
      Specified by:
      getTestsForChainResultByDeltaStates in interface TestCaseResultDao
      firstResult - - index of the first result
      maxResults - - maximum amount of records returned
      Returns:
      testCaseResults
    • getTestsForChainResultByState

      @NotNull public @NotNull List<TestCaseResult> getTestsForChainResultByState(@NotNull @NotNull ChainResultsSummary summary, @NotNull @NotNull TestState testState, int firstResult, int maxResults)
      Description copied from interface: TestCaseResultDao
      Retrieves a list of testCaseResults for a ChainResultSummary based on their TestState
      Specified by:
      getTestsForChainResultByState in interface TestCaseResultDao
      Returns:
      testCaseResults
    • getQuarantinedTestCasesForChainResult

      @NotNull public @NotNull List<TestCaseResult> getQuarantinedTestCasesForChainResult(@NotNull @NotNull ChainResultsSummary chainResultsSummary)
      Description copied from interface: TestCaseResultDao
      Provide a list of the quarantined tests for a chain result
      Specified by:
      getQuarantinedTestCasesForChainResult in interface TestCaseResultDao
      Parameters:
      chainResultsSummary - to search for the tests.
      Returns:
      List of TestCases
    • getTestsForBuildResultSummary

      @NotNull public @NotNull List<TestCaseResult> getTestsForBuildResultSummary(BuildResultsSummary summary)
      Description copied from interface: TestCaseResultDao
      Retrieves a list of all testCaseResults for a BuildResultSummary
      Specified by:
      getTestsForBuildResultSummary in interface TestCaseResultDao
      Parameters:
      summary - the BuildResultsSummary to get the tests for
      Returns:
      a list of all testCaseResults for the BuildResultSummary
    • getQuarantinedTestCasesForBuildResult

      @NotNull public @NotNull List<TestCaseResult> getQuarantinedTestCasesForBuildResult(@NotNull @NotNull BuildResultsSummary buildResultsSummary)
      Description copied from interface: TestCaseResultDao
      Provide a list of the quarantined tests for a build result
      Specified by:
      getQuarantinedTestCasesForBuildResult in interface TestCaseResultDao
      Parameters:
      buildResultsSummary - to search for the tests.
      Returns:
      List of TestCases
    • getResultStatisticsForTestCase

      @NotNull public @NotNull List<TestCaseResultStatisticsProvider> getResultStatisticsForTestCase(@NotNull @NotNull TestCase testCase)
      Description copied from interface: TestCaseResultDao
      Returns a list of wrapped TestCaseResult and BuildResultSummary for a particular test case, for use by e.g. graphs
      Specified by:
      getResultStatisticsForTestCase in interface TestCaseResultDao
      Parameters:
      testCase - to find the results for
      Returns:
      list of $TestCaseResultStatisticsProviderfor each TestCaseResult found for the TestCase
    • getResultStatisticsForTestCaseAndBuilds

      @NotNull public @NotNull List<TestCaseResultStatisticsProvider> getResultStatisticsForTestCaseAndBuilds(@NotNull @NotNull TestCase testCase, @NotNull @NotNull List<BuildResultsSummary> buildResults)
      Description copied from interface: TestCaseResultDao
      Returns a list of wrapped TestCaseResult and BuildResultSummary for a particular test case and contained within a specific span of build result summaries. For use by e.g. graphs
      Specified by:
      getResultStatisticsForTestCaseAndBuilds in interface TestCaseResultDao
      Parameters:
      testCase - to find the results for
      buildResults - to contain search to (this list must not be empty)
      Returns:
      list of $TestCaseResultStatisticsProvider for each TestCaseResult found for the TestCase
    • getTestCaseResultsForTestCase

      @NotNull public @NotNull List<TestCaseResult> getTestCaseResultsForTestCase(@NotNull @NotNull TestCase testCase)
      Description copied from interface: TestCaseResultDao
      Return a list of TestCaseResults for a given TestCase
      Specified by:
      getTestCaseResultsForTestCase in interface TestCaseResultDao
      Parameters:
      testCase - to look for
      Returns:
      list of TestCaseResult for the given TestCase
    • getTestCaseResultsForTestCaseAndBuilds

      @NotNull public @NotNull List<TestCaseResult> getTestCaseResultsForTestCaseAndBuilds(@NotNull @NotNull TestCase testCase, @NotNull @NotNull List<BuildResultsSummary> buildResults)
      Description copied from interface: TestCaseResultDao
      Return a list of TestCaseResults for a given TestCase constrained to a specific set of Build Result Summaries
      Specified by:
      getTestCaseResultsForTestCaseAndBuilds in interface TestCaseResultDao
      Parameters:
      testCase - to look for
      buildResults - to contain search to
      Returns:
      list of TestCaseResult for the given TestCase
    • getLastNFailingResultsForTestCase

      @NotNull public @NotNull List<Pair<TestCaseResult,Integer>> getLastNFailingResultsForTestCase(@NotNull @NotNull TestCase testCase, int number)
      Description copied from interface: TestCaseResultDao
      Retrieve the last n failing testResults for this given test case, latest first.
      Specified by:
      getLastNFailingResultsForTestCase in interface TestCaseResultDao
      Parameters:
      testCase - to look for the results for.
      number - of results to retrieve
      Returns:
      List of pairs containing the offending TestCaseResult and the build number it occurred in.
    • getLastNFailingResultsForTestCaseAndBuildResults

      @NotNull public @NotNull List<Pair<TestCaseResult,Integer>> getLastNFailingResultsForTestCaseAndBuildResults(@NotNull @NotNull TestCase testCase, @NotNull @NotNull List<BuildResultsSummary> buildResults, int number)
      Description copied from interface: TestCaseResultDao
      Retrieve the last n failing testResults for this given test case, but only those that occurred within the provided build results. Latest first.
      Specified by:
      getLastNFailingResultsForTestCaseAndBuildResults in interface TestCaseResultDao
      Parameters:
      testCase - to look for the results for.
      buildResults - to search in for the tests.
      number - of results to retrieve
      Returns:
      List of pairs containing the offending TestCaseResult and the build number it occurred in.
    • getTestCaseResults

      @NotNull public @NotNull List<TestCaseResult> getTestCaseResults(TestCase testCase, long buildNumber)
      Description copied from interface: TestCaseResultDao
      Find a specific run of a testCase
      Specified by:
      getTestCaseResults in interface TestCaseResultDao
      Parameters:
      testCase - to look for
      buildNumber - of the build the run should have occurred in
      Returns:
      the TestCaseResult for the given test case, if it ran in the given build.
    • getSucceedingSinceBuildResultSummary

      public BuildResultsSummary getSucceedingSinceBuildResultSummary(TestCase testCase)
      Description copied from interface: TestCaseResultDao
      Find the build in which the given test has been successful since. AKA the last recored "FIXED" test run. Will return null if the test has never failed (ie being successful since the beginning)
      Specified by:
      getSucceedingSinceBuildResultSummary in interface TestCaseResultDao
      Parameters:
      testCase - to search history for.
      Returns:
      the BuildResultSummary that this test has been successful since.
    • countTestCaseResults

      public long countTestCaseResults()
      Description copied from interface: TestCaseResultDao
      Count all TestCaseResults
      Specified by:
      countTestCaseResults in interface TestCaseResultDao
      Returns:
      number of TestCaseResults
    • countTestCaseResultErrors

      public long countTestCaseResultErrors()
      Description copied from interface: TestCaseResultDao
      Count all TestCaseResultErrors
      Specified by:
      countTestCaseResultErrors in interface TestCaseResultDao
      Returns:
      number of TestCaseResultErrors
    • scrollTestCaseResultsForExport

      public long scrollTestCaseResultsForExport(@NotNull @NotNull Consumer<TestCaseResult> consumer)
      Description copied from interface: TestCaseResultDao
      Scroll through and execute function for each of TestCaseResults Objects passed to function are not fully initialized. Collections are empty and related objects have only id set.
      Specified by:
      scrollTestCaseResultsForExport in interface TestCaseResultDao
      Parameters:
      consumer - consumer to accept each of the TestClassResults
      Returns:
      number of traversed rows
    • scrollTestCaseResultErrorsForExport

      public long scrollTestCaseResultErrorsForExport(@NotNull @NotNull Consumer<TestCaseResultError> consumer)
      Description copied from interface: TestCaseResultDao
      Scroll through and execute function for each of TestCaseResultErrors Objects passed to function are not fully initialized. Collections are empty and related objects have only id set.
      Specified by:
      scrollTestCaseResultErrorsForExport in interface TestCaseResultDao
      Parameters:
      consumer - consumer to accept each of the TestCaseResultErrors
      Returns:
      number of traversed rows