Class TestCaseResultHibernateDao
java.lang.Object
org.springframework.dao.support.DaoSupport
org.springframework.orm.hibernate5.support.HibernateDaoSupport
com.atlassian.bamboo.persistence3.StatelessSessionHibernateDaoSupport
com.atlassian.bamboo.persistence3.BambooHibernateObjectDao<TestCaseResult>
com.atlassian.bamboo.resultsummary.tests.TestCaseResultHibernateDao
- All Implemented Interfaces:
BambooObjectDao<TestCaseResult>
,TestCaseResultDao
,org.springframework.beans.factory.InitializingBean
public class TestCaseResultHibernateDao
extends BambooHibernateObjectDao<TestCaseResult>
implements TestCaseResultDao
-
Field Summary
Fields inherited from class org.springframework.dao.support.DaoSupport
logger
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionlong
Count all TestCaseResultErrorslong
Count all TestCaseResultsfindById
(long id) Find a specific testCaseResult by id@NotNull List<Pair<TestCaseResult,
Integer>> getLastNFailingResultsForTestCase
(@NotNull TestCase testCase, int number) Retrieve the last n failing testResults for this given test case, latest first.@NotNull List<Pair<TestCaseResult,
Integer>> getLastNFailingResultsForTestCaseAndBuildResults
(@NotNull TestCase testCase, @NotNull List<BuildResultsSummary> buildResults, int number) Retrieve the last n failing testResults for this given test case, but only those that occurred within the provided build results.@NotNull List<TestCaseResult>
getQuarantinedTestCasesForBuildResult
(@NotNull BuildResultsSummary buildResultsSummary) Provide a list of the quarantined tests for a build result@NotNull List<TestCaseResult>
getQuarantinedTestCasesForChainResult
(@NotNull ChainResultsSummary chainResultsSummary) Provide a list of the quarantined tests for a chain result@NotNull List<TestCaseResultStatisticsProvider>
getResultStatisticsForTestCase
(@NotNull TestCase testCase) Returns a list of wrapped TestCaseResult and BuildResultSummary for a particular test case, for use by e.g.@NotNull List<TestCaseResultStatisticsProvider>
getResultStatisticsForTestCaseAndBuilds
(@NotNull TestCase testCase, @NotNull List<BuildResultsSummary> buildResults) Returns a list of wrapped TestCaseResult and BuildResultSummary for a particular test case and contained within a specific span of build result summaries.getSucceedingSinceBuildResultSummary
(TestCase testCase) Find the build in which the given test has been successful since.@NotNull List<TestCaseResult>
getTestCaseResults
(TestCase testCase, long buildNumber) Find a specific run of a testCase@NotNull List<TestCaseResult>
getTestCaseResultsForTestCase
(@NotNull TestCase testCase) Return a list of TestCaseResults for a given TestCase@NotNull List<TestCaseResult>
getTestCaseResultsForTestCaseAndBuilds
(@NotNull TestCase testCase, @NotNull List<BuildResultsSummary> buildResults) Return a list of TestCaseResults for a given TestCase constrained to a specific set of Build Result Summaries@NotNull List<TestCaseResult>
getTestsForBuildResultByDeltaState
(ResultsSummary summary, TestDeltaState deltaState, int firstResult, int maxResults) Retrieves a list of testCaseResults for a BuildResultSummary based on their delta state (e.g BROKEN, FIXED)@NotNull List<TestCaseResult>
getTestsForBuildResultByState
(ResultsSummary summary, TestState state, int firstResult, int maxResults) Retrieves a list of testCaseResults for a BuildResultSummary based on their state (e.f FAILED or SUCCESS).@NotNull List<TestCaseResult>
Retrieves a list of all testCaseResults for a BuildResultSummary@NotNull List<TestCaseResult>
getTestsForChainResultByDeltaStates
(ChainResultsSummary summary, TestDeltaState[] deltaStates, int firstResult, int maxResults) Retrieves a list of testCaseResults for a ChainResultSummary based on their delta state (e.g BROKEN, FIXED)@NotNull List<TestCaseResult>
getTestsForChainResultByState
(@NotNull ChainResultsSummary summary, @NotNull TestState testState, int firstResult, int maxResults) Retrieves a list of testCaseResults for a ChainResultSummary based on theirTestState
long
scrollTestCaseResultErrorsForExport
(@NotNull Consumer<TestCaseResultError> consumer) Scroll through and execute function for each of TestCaseResultErrors Objects passed to function are not fully initialized.long
scrollTestCaseResultsForExport
(@NotNull Consumer<TestCaseResult> consumer) Scroll through and execute function for each of TestCaseResults Objects passed to function are not fully initialized.Methods inherited from class com.atlassian.bamboo.persistence3.BambooHibernateObjectDao
convertSearchTermToLikeExpression, countAll, countWithRestriction, delete, deleteAll, executeCountQuery, findAll, findById, merge, save, saveAll
Methods inherited from class com.atlassian.bamboo.persistence3.StatelessSessionHibernateDaoSupport
getCacheAwareHibernateTemplate
Methods inherited from class org.springframework.orm.hibernate5.support.HibernateDaoSupport
checkDaoConfig, createHibernateTemplate, currentSession, getHibernateTemplate, getSessionFactory, setHibernateTemplate, setSessionFactory
Methods inherited from class org.springframework.dao.support.DaoSupport
afterPropertiesSet, initDao
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface com.atlassian.bamboo.persistence3.BambooObjectDao
countAll, countWithRestriction, delete, deleteAll, findAll, findById, merge, save, saveAll
-
Constructor Details
-
TestCaseResultHibernateDao
public TestCaseResultHibernateDao()
-
-
Method Details
-
findById
Description copied from interface:TestCaseResultDao
Find a specific testCaseResult by id- Specified by:
findById
in interfaceTestCaseResultDao
- 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 interfaceTestCaseResultDao
- Parameters:
summary
- the BuildResultsSummary to get the tests forstate
- 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 interfaceTestCaseResultDao
- Parameters:
summary
- the BuildResultsSummary to get the tests fordeltaState
- 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 interfaceTestCaseResultDao
firstResult
- - index of the first resultmaxResults
- - 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 theirTestState
- Specified by:
getTestsForChainResultByState
in interfaceTestCaseResultDao
- 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 interfaceTestCaseResultDao
- 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 interfaceTestCaseResultDao
- 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 interfaceTestCaseResultDao
- 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 interfaceTestCaseResultDao
- Parameters:
testCase
- to find the results for- Returns:
- list of $
TestCaseResultStatisticsProvider
for 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 interfaceTestCaseResultDao
- Parameters:
testCase
- to find the results forbuildResults
- 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 interfaceTestCaseResultDao
- 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 interfaceTestCaseResultDao
- Parameters:
testCase
- to look forbuildResults
- 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 interfaceTestCaseResultDao
- 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 interfaceTestCaseResultDao
- 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 interfaceTestCaseResultDao
- Parameters:
testCase
- to look forbuildNumber
- 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
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 interfaceTestCaseResultDao
- 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 interfaceTestCaseResultDao
- Returns:
- number of TestCaseResults
-
countTestCaseResultErrors
public long countTestCaseResultErrors()Description copied from interface:TestCaseResultDao
Count all TestCaseResultErrors- Specified by:
countTestCaseResultErrors
in interfaceTestCaseResultDao
- Returns:
- number of TestCaseResultErrors
-
scrollTestCaseResultsForExport
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 interfaceTestCaseResultDao
- 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 interfaceTestCaseResultDao
- Parameters:
consumer
- consumer to accept each of the TestCaseResultErrors- Returns:
- number of traversed rows
-