com.atlassian.bamboo.resultsummary.tests
Class TestsHibernateDao

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.TestsHibernateDao
All Implemented Interfaces:
bucket.core.persistence.ObjectDao, BambooObjectDao, TestsDao, org.springframework.beans.factory.InitializingBean

public class TestsHibernateDao
extends BambooHibernateObjectDao
implements TestsDao


Field Summary
 
Fields inherited from class org.springframework.dao.support.DaoSupport
logger
 
Constructor Summary
TestsHibernateDao()
           
 
Method Summary
 long countTestCases()
          Count all TestCase records
 long countTestClasses()
          Count all TestClass records
 java.util.List<Pair<TestCaseResult,java.lang.Integer>> getLastNFailingResultsForTestCase(TestCase testCase, int number)
          Retrieve the last n failing testResults for this given test case, latest first.
 java.util.List<Pair<TestCaseResult,java.lang.Integer>> getLastNFailingResultsForTestCaseAndBuildResults(TestCase testCase, java.util.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.
 java.util.List<TestCase> getLongestRunningTestCasesForPlan(Plan plan)
          Provide a list of the top ten longest running tests for a plan, based on the duration of the TestCase's TestCaseResults Finds top 10 results in order (longest first)
 java.util.List<Pair<java.lang.Long,java.lang.Float>> getLongestToFixTestCasesForBuildResults(java.util.List<BuildResultsSummary> buildResults)
          Retrieve a list of the test cases that have taken the longest amount of time to fix.
 java.util.List<Pair<java.lang.Long,java.lang.Float>> getLongestToFixTestCasesForPlan(Plan plan)
          Retrieve a list of the test cases that have taken the longest amount of time to fix.
 java.util.List<Pair<java.lang.Long,java.lang.Integer>> getMostFailingTestCasesForBuildResults(java.util.List<BuildResultsSummary> buildResults)
          Provide a list of the top 10 most failing test cases for a plan.
 java.util.List<Pair<java.lang.Long,java.lang.Integer>> getMostFailingTestCasesForPlan(Plan plan)
          Provide a list of the top 10 most failing test cases for a plan.
 java.lang.Class getPersistentClass()
           
 TestCase getTestCaseById(long testCaseId)
          Find a specific testCase by id
 TestClass getTestClassById(long testClassId)
          Find a specific testClass by id
 java.util.List<TestClass> getTestClassesForPlan(Plan plan)
          Retrieve all test classes attached to a specific plab
 long scrollTestCasesForExport(com.google.common.base.Function<TestCase,java.lang.Void> function)
          Scroll through and execute function for each of TestCase records Objects passed to function are not fully initialized.
 long scrollTestClassesForExport(com.google.common.base.Function<TestClass,java.lang.Void> function)
          Scroll through and execute function for each of TestClass records 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

TestsHibernateDao

public TestsHibernateDao()
Method Detail

getPersistentClass

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

getTestCaseById

@Nullable
public TestCase getTestCaseById(long testCaseId)
Description copied from interface: TestsDao
Find a specific testCase by id

Specified by:
getTestCaseById in interface TestsDao
Parameters:
testCaseId - of the test case you want to find
Returns:
the testCase corresponding to the id provided.

getTestClassById

@Nullable
public TestClass getTestClassById(long testClassId)
Description copied from interface: TestsDao
Find a specific testClass by id

Specified by:
getTestClassById in interface TestsDao
Parameters:
testClassId - of the test class you want to find
Returns:
the testClass corresponding to the id provided.

getTestClassesForPlan

@NotNull
public java.util.List<TestClass> getTestClassesForPlan(Plan plan)
Retrieve all test classes attached to a specific plab

Specified by:
getTestClassesForPlan in interface TestsDao
Parameters:
plan - the tests are attached to
Returns:
a list of TestClass attached to a plan.

getLongestRunningTestCasesForPlan

@NotNull
public java.util.List<TestCase> getLongestRunningTestCasesForPlan(@NotNull
                                                                          Plan plan)
Description copied from interface: TestsDao
Provide a list of the top ten longest running tests for a plan, based on the duration of the TestCase's TestCaseResults Finds top 10 results in order (longest first)

Specified by:
getLongestRunningTestCasesForPlan in interface TestsDao
Parameters:
plan - to search in for the tests.
Returns:
List of Pairs containing the testCase id (long) and the average duration (float)

getMostFailingTestCasesForPlan

@NotNull
public java.util.List<Pair<java.lang.Long,java.lang.Integer>> getMostFailingTestCasesForPlan(@NotNull
                                                                                                     Plan plan)
Description copied from interface: TestsDao
Provide a list of the top 10 most failing test cases for a plan. It is calculated based on failure count, not percentage. Results are ordered from most failing to least failing.

Specified by:
getMostFailingTestCasesForPlan in interface TestsDao
Parameters:
plan - to search for the tests
Returns:
List of Pairs containing the testCase id (long) and the number of failures found (int)

getMostFailingTestCasesForBuildResults

@NotNull
public java.util.List<Pair<java.lang.Long,java.lang.Integer>> getMostFailingTestCasesForBuildResults(@NotNull
                                                                                                             java.util.List<BuildResultsSummary> buildResults)
Description copied from interface: TestsDao
Provide a list of the top 10 most failing test cases for a plan. It is calculated based on failure count, not percentage Results are ordered from most failing to least failing.

Specified by:
getMostFailingTestCasesForBuildResults in interface TestsDao
Parameters:
buildResults - to search in for the tests.
Returns:
List of Pairs containing the testCase id (long) and the number of failures found (int)

getLongestToFixTestCasesForPlan

@NotNull
public java.util.List<Pair<java.lang.Long,java.lang.Float>> getLongestToFixTestCasesForPlan(@NotNull
                                                                                                    Plan plan)
Description copied from interface: TestsDao
Retrieve a list of the test cases that have taken the longest amount of time to fix. Returns top 10 with the longest to fix first.

Specified by:
getLongestToFixTestCasesForPlan in interface TestsDao
Parameters:
plan - to search for results in
Returns:
List of Pairs containing the testCase id (long) and the average number of builds between breakages and its corresponding fix (float)

getLongestToFixTestCasesForBuildResults

@NotNull
public java.util.List<Pair<java.lang.Long,java.lang.Float>> getLongestToFixTestCasesForBuildResults(@NotNull
                                                                                                            java.util.List<BuildResultsSummary> buildResults)
Description copied from interface: TestsDao
Retrieve a list of the test cases that have taken the longest amount of time to fix. Returns top 10 with the longest to fix first.

Specified by:
getLongestToFixTestCasesForBuildResults in interface TestsDao
Parameters:
buildResults - to search in for the tests.
Returns:
List of Pairs containing the testCase id (long) and the average number of builds between breakages and its corresponding fix (float)

getLastNFailingResultsForTestCase

@NotNull
public java.util.List<Pair<TestCaseResult,java.lang.Integer>> getLastNFailingResultsForTestCase(@NotNull
                                                                                                        TestCase testCase,
                                                                                                        int number)
Description copied from interface: TestsDao
Retrieve the last n failing testResults for this given test case, latest first.

Specified by:
getLastNFailingResultsForTestCase in interface TestsDao
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 java.util.List<Pair<TestCaseResult,java.lang.Integer>> getLastNFailingResultsForTestCaseAndBuildResults(@NotNull
                                                                                                                       TestCase testCase,
                                                                                                                       @NotNull
                                                                                                                       java.util.List<BuildResultsSummary> buildResults,
                                                                                                                       int number)
Description copied from interface: TestsDao
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 TestsDao
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.

countTestClasses

public long countTestClasses()
Description copied from interface: TestsDao
Count all TestClass records

Specified by:
countTestClasses in interface TestsDao
Returns:
number of TestClass records

scrollTestClassesForExport

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

Specified by:
scrollTestClassesForExport in interface TestsDao
Parameters:
function - function to be executed on each of the TestClass records
Returns:
number of traversed rows

countTestCases

public long countTestCases()
Description copied from interface: TestsDao
Count all TestCase records

Specified by:
countTestCases in interface TestsDao
Returns:
number of TestCase records

scrollTestCasesForExport

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

Specified by:
scrollTestCasesForExport in interface TestsDao
Parameters:
function - function to be executed on each of the TestCase records
Returns:
number of traversed rows


Copyright © 2011 Atlassian. All Rights Reserved.