com.atlassian.bamboo.resultsummary.tests
Class TestResultsHibernateDao

java.lang.Object
  extended by org.springframework.dao.support.DaoSupport
      extended by org.springframework.orm.hibernate.support.HibernateDaoSupport
          extended by com.atlassian.hibernate.HibernateObjectDao
              extended by com.atlassian.bamboo.persistence.BambooHibernateObjectDao
                  extended by com.atlassian.bamboo.resultsummary.tests.TestResultsHibernateDao
All Implemented Interfaces:
bucket.core.persistence.ObjectDao, BambooObjectDao, TestResultsDao, org.springframework.beans.factory.InitializingBean

public class TestResultsHibernateDao
extends BambooHibernateObjectDao
implements TestResultsDao


Field Summary
 
Fields inherited from class org.springframework.dao.support.DaoSupport
logger
 
Constructor Summary
TestResultsHibernateDao()
           
 
Method Summary
 long countTestCaseResultErrors()
          Count all TestCaseResultErrors
 long countTestCaseResults()
          Count all TestCaseResults
 long countTestClassResults()
          Count all TestClassResults
 long countTestClassResults(PlanKey planKey)
          Count TestClassResults for a Plan
 java.lang.Class getPersistentClass()
           
 java.util.List<TestCaseResultStatisticsProvider> getResultStatisticsForTestCase(TestCase testCase)
          Returns a list of wrapped TestCaseResult and BuildResultSummary for a particular test case, for use by e.g.
 java.util.List<TestCaseResultStatisticsProvider> getResultStatisticsForTestCaseAndBuilds(TestCase testCase, java.util.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.
 BuildResultsSummary getSucceedingSinceBuildResultSummary(TestCase testCase)
          Find the build in which the given test has been successful since.
 TestCaseResult getTestCaseResult(TestCase testCase, long buildNumber)
          Find a specific run of a testCase
 TestCaseResult getTestCaseResultById(long testCaseId)
          Find a specific testCaseResult by id
 java.util.List<TestCaseResult> getTestCaseResultsForTestCase(TestCase testCase)
          Return a list of TestCaseResults for a given TestCase
 java.util.List<TestCaseResult> getTestCaseResultsForTestCaseAndBuilds(TestCase testCase, java.util.List<BuildResultsSummary> buildResults)
          Return a list of TestCaseResults for a given TestCase constrained to a specific set of Build Result Summaries
 TestClassResult getTestClassResultById(long testClassId)
          Find a specific testClassResult by id
 java.util.List<TestClassResult> getTestClassResults(PlanResultKey planResultKey)
          Retrieves a list of all testClassResults for a BuildResultSummary
 java.util.List<TestCaseResult> getTestsForBuildResultByDeltaState(ResultsSummary summary, TestDeltaState state, int firstResult, int maxCount)
          Retrieves a list of testCaseResults for a BuildResultSummary based on their delta state (e.g BROKEN, FIXED)
 java.util.List<TestCaseResult> getTestsForBuildResultByState(ResultsSummary summary, TestState state)
          Retrieves a list of testCaseResults for a BuildResultSummary based on their state (e.f FAILED or SUCCESS)
 java.util.List<TestCaseResult> getTestsForBuildResultByState(ResultsSummary summary, TestState state, int firstResult, int maxCount)
          Retrieves a list of testCaseResults for a BuildResultSummary based on their state (e.f FAILED or SUCCESS).
 java.util.List<TestCaseResult> getTestsForBuildResultSummary(BuildResultsSummary summary)
          Retrieves a list of all testCaseResults for a BuildResultSummary
 java.util.List<TestCaseResult> getTestsForChainResultByDeltaStates(ChainResultsSummary summary, TestDeltaState[] deltaStates, int firstResult, int maxCount)
          Retrieves a list of testCaseResults for a ChainResultSummary based on their delta state (e.g BROKEN, FIXED)
 java.util.List<TestCaseResult> getTestsForChainResultByState(ChainResultsSummary summary, TestState state, int firstResult, int maxCount)
          Retrieves a list of testCaseResults for a ChainResultSummary based on their TestState
 int removeTestClassResultsByPlan(PlanKey planKey)
          Remove all TestClassResult objects referenced by ResultsSummary objects identified by planKey
 long scrollTestCaseResultErrorsForExport(com.google.common.base.Function<TestCaseResultError,java.lang.Void> function)
          Scroll through and execute function for each of TestCaseResultErrors Objects passed to function are not fully initialized.
 long scrollTestCaseResultsForExport(com.google.common.base.Function<TestCaseResult,java.lang.Void> function)
          Scroll through and execute function for each of TestCaseResults Objects passed to function are not fully initialized.
 long scrollTestClassResultsForExport(com.google.common.base.Function<TestClassResult,java.lang.Void> function)
          Scroll through and execute function for each of TestClassResults Objects passed to function are not fully initialized.
 
Methods inherited from class com.atlassian.bamboo.persistence.BambooHibernateObjectDao
executeCountQuery, executeReturnLong, findById, findById
 
Methods inherited from class com.atlassian.hibernate.HibernateObjectDao
findAll, findAllSorted, findNamedQuery, findNamedQuery, findNamedQuery, findNamedQueryStringParam, findNamedQueryStringParam, findNamedQueryStringParam, findNamedQueryStringParams, findNamedQueryStringParams, findNamedQueryStringParams, findNamedQueryStringParams, findNamedQueryStringParams, findNamedQueryStringParams, findNamedQueryStringParams, findNamedQueryStringParams, findNamedQueryStringParams, findSingleObject, getByClassId, index, refresh, reIndex, remove, replicate, save, saveRaw, setIndexer, unIndex, updateModificationData
 
Methods inherited from class org.springframework.orm.hibernate.support.HibernateDaoSupport
checkDaoConfig, convertHibernateAccessException, createHibernateTemplate, getHibernateTemplate, getSession, getSession, getSessionFactory, releaseSession, 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.persistence.BambooObjectDao
findById
 
Methods inherited from interface bucket.core.persistence.ObjectDao
findAll, findAllSorted, refresh, remove, replicate, save, saveRaw
 

Constructor Detail

TestResultsHibernateDao

public TestResultsHibernateDao()
Method Detail

getPersistentClass

public java.lang.Class getPersistentClass()
Specified by:
getPersistentClass in interface bucket.core.persistence.ObjectDao

getTestCaseResultById

public TestCaseResult getTestCaseResultById(long testCaseId)
Description copied from interface: TestResultsDao
Find a specific testCaseResult by id

Specified by:
getTestCaseResultById in interface TestResultsDao
Parameters:
testCaseId - of the test you want to find
Returns:
the testCaseResult corresponding to the id provided.

getTestClassResultById

public TestClassResult getTestClassResultById(long testClassId)
Description copied from interface: TestResultsDao
Find a specific testClassResult by id

Specified by:
getTestClassResultById in interface TestResultsDao
Parameters:
testClassId - of the test you want to find
Returns:
the testClassResult corresponding to the id provided.

getTestsForBuildResultByState

@NotNull
public java.util.List<TestCaseResult> getTestsForBuildResultByState(ResultsSummary summary,
                                                                            TestState state)
Description copied from interface: TestResultsDao
Retrieves a list of testCaseResults for a BuildResultSummary based on their state (e.f FAILED or SUCCESS)

Specified by:
getTestsForBuildResultByState in interface TestResultsDao
Parameters:
summary - the BuildResultsSaummary to get the tests for
state - - The TestState to search for.
Returns:
a list of testCaseResults for a BuildResultSummary with the given state

getTestsForBuildResultByState

@NotNull
public java.util.List<TestCaseResult> getTestsForBuildResultByState(ResultsSummary summary,
                                                                            TestState state,
                                                                            int firstResult,
                                                                            int maxCount)
Description copied from interface: TestResultsDao
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 TestResultsDao
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.
maxCount - 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 java.util.List<TestCaseResult> getTestsForBuildResultByDeltaState(ResultsSummary summary,
                                                                                 TestDeltaState state,
                                                                                 int firstResult,
                                                                                 int maxCount)
Description copied from interface: TestResultsDao
Retrieves a list of testCaseResults for a BuildResultSummary based on their delta state (e.g BROKEN, FIXED)

Specified by:
getTestsForBuildResultByDeltaState in interface TestResultsDao
Parameters:
summary - the BuildResultsSummary to get the tests for
state - the TestDeltaState to search for.
firstResult - the first record to be retrieved. Negative values are treated as 0.
maxCount - 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 java.util.List<TestCaseResult> getTestsForChainResultByDeltaStates(ChainResultsSummary summary,
                                                                                  TestDeltaState[] deltaStates,
                                                                                  int firstResult,
                                                                                  int maxCount)
Description copied from interface: TestResultsDao
Retrieves a list of testCaseResults for a ChainResultSummary based on their delta state (e.g BROKEN, FIXED)

Specified by:
getTestsForChainResultByDeltaStates in interface TestResultsDao
firstResult - - index of the first result
maxCount - - maximum amount of records returned
Returns:
testCaseResults

getTestsForChainResultByState

@NotNull
public java.util.List<TestCaseResult> getTestsForChainResultByState(@NotNull
                                                                            ChainResultsSummary summary,
                                                                            @NotNull
                                                                            TestState state,
                                                                            int firstResult,
                                                                            int maxCount)
Description copied from interface: TestResultsDao
Retrieves a list of testCaseResults for a ChainResultSummary based on their TestState

Specified by:
getTestsForChainResultByState in interface TestResultsDao
Returns:
testCaseResults

countTestClassResults

public long countTestClassResults()
Description copied from interface: TestResultsDao
Count all TestClassResults

Specified by:
countTestClassResults in interface TestResultsDao
Returns:
number of TestClassResults

countTestCaseResults

public long countTestCaseResults()
Description copied from interface: TestResultsDao
Count all TestCaseResults

Specified by:
countTestCaseResults in interface TestResultsDao
Returns:
number of TestCaseResults

countTestCaseResultErrors

public long countTestCaseResultErrors()
Description copied from interface: TestResultsDao
Count all TestCaseResultErrors

Specified by:
countTestCaseResultErrors in interface TestResultsDao
Returns:
number of TestCaseResultErrors

countTestClassResults

public long countTestClassResults(@NotNull
                                  PlanKey planKey)
Description copied from interface: TestResultsDao
Count TestClassResults for a Plan

Specified by:
countTestClassResults in interface TestResultsDao
Parameters:
planKey - the Plan to count TestClassResults for
Returns:
number of TestClassResults

scrollTestClassResultsForExport

public long scrollTestClassResultsForExport(@NotNull
                                            com.google.common.base.Function<TestClassResult,java.lang.Void> function)
Description copied from interface: TestResultsDao
Scroll through and execute function for each of TestClassResults Objects passed to function are not fully initialized. Collections are empty and related objects have only id set.

Specified by:
scrollTestClassResultsForExport in interface TestResultsDao
Parameters:
function - function to be executed on each of the TestClassResults
Returns:
number of traversed rows

scrollTestCaseResultsForExport

public long scrollTestCaseResultsForExport(@NotNull
                                           com.google.common.base.Function<TestCaseResult,java.lang.Void> function)
Description copied from interface: TestResultsDao
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 TestResultsDao
Parameters:
function - function to be executed on each of the TestClassResults
Returns:
number of traversed rows

scrollTestCaseResultErrorsForExport

public long scrollTestCaseResultErrorsForExport(@NotNull
                                                com.google.common.base.Function<TestCaseResultError,java.lang.Void> function)
Description copied from interface: TestResultsDao
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 TestResultsDao
Parameters:
function - function to be executed on each of the TestClassResults
Returns:
number of traversed rows

getTestClassResults

@NotNull
public java.util.List<TestClassResult> getTestClassResults(@NotNull
                                                                   PlanResultKey planResultKey)
Description copied from interface: TestResultsDao
Retrieves a list of all testClassResults for a BuildResultSummary

Specified by:
getTestClassResults in interface TestResultsDao
Parameters:
planResultKey - key of the BuildResultsSummary to get the tests class results for
Returns:
a list of all testClassResults for the BuildResultSummary

getTestsForBuildResultSummary

@NotNull
public java.util.List<TestCaseResult> getTestsForBuildResultSummary(BuildResultsSummary summary)
Description copied from interface: TestResultsDao
Retrieves a list of all testCaseResults for a BuildResultSummary

Specified by:
getTestsForBuildResultSummary in interface TestResultsDao
Parameters:
summary - the BuildResultsSummary to get the tests for
Returns:
a list of all testCaseResults for the BuildResultSummary

getResultStatisticsForTestCase

@NotNull
public java.util.List<TestCaseResultStatisticsProvider> getResultStatisticsForTestCase(@NotNull
                                                                                               TestCase testCase)
Description copied from interface: TestResultsDao
Returns a list of wrapped TestCaseResult and BuildResultSummary for a particular test case, for use by e.g. graphs

Specified by:
getResultStatisticsForTestCase in interface TestResultsDao
Parameters:
testCase - to find the results for
Returns:
List for each TestCaseResult found for the TestCase

getResultStatisticsForTestCaseAndBuilds

@NotNull
public java.util.List<TestCaseResultStatisticsProvider> getResultStatisticsForTestCaseAndBuilds(@NotNull
                                                                                                        TestCase testCase,
                                                                                                        @NotNull
                                                                                                        java.util.List<BuildResultsSummary> buildResults)
Description copied from interface: TestResultsDao
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 TestResultsDao
Parameters:
testCase - to find the results for
buildResults - to contain search to (this list must not be empty)
Returns:
List for each TestCaseResult found for the TestCase

getTestCaseResultsForTestCase

@NotNull
public java.util.List<TestCaseResult> getTestCaseResultsForTestCase(@NotNull
                                                                            TestCase testCase)
Description copied from interface: TestResultsDao
Return a list of TestCaseResults for a given TestCase

Specified by:
getTestCaseResultsForTestCase in interface TestResultsDao
Parameters:
testCase - to look for
Returns:
List for the given TestCase

getTestCaseResultsForTestCaseAndBuilds

@NotNull
public java.util.List<TestCaseResult> getTestCaseResultsForTestCaseAndBuilds(@NotNull
                                                                                     TestCase testCase,
                                                                                     @NotNull
                                                                                     java.util.List<BuildResultsSummary> buildResults)
Description copied from interface: TestResultsDao
Return a list of TestCaseResults for a given TestCase constrained to a specific set of Build Result Summaries

Specified by:
getTestCaseResultsForTestCaseAndBuilds in interface TestResultsDao
Parameters:
testCase - to look for
buildResults - to contain search to
Returns:
List for the given TestCase

getTestCaseResult

@Nullable
public TestCaseResult getTestCaseResult(@NotNull
                                                 TestCase testCase,
                                                 long buildNumber)
Description copied from interface: TestResultsDao
Find a specific run of a testCase

Specified by:
getTestCaseResult in interface TestResultsDao
Parameters:
testCase - to look for
buildNumber - of the build the run should have occured 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: TestResultsDao
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 TestResultsDao
Parameters:
testCase - to search history for.
Returns:
the BuildResultSummary that this test has been successful since.

removeTestClassResultsByPlan

public int removeTestClassResultsByPlan(@NotNull
                                        PlanKey planKey)
Description copied from interface: TestResultsDao
Remove all TestClassResult objects referenced by ResultsSummary objects identified by planKey

Specified by:
removeTestClassResultsByPlan in interface TestResultsDao
Parameters:
planKey - plan identifier
Returns:
number of removed objects


Copyright © 2011 Atlassian. All Rights Reserved.