Class CurrentProblemsManagerImpl
- java.lang.Object
-
- jetbrains.buildServer.serverSide.ProjectsModelListenerAdapter
-
- jetbrains.buildServer.serverSide.BuildServerAdapter
-
- jetbrains.buildServer.serverSide.impl.CurrentProblemsManagerImpl
-
- All Implemented Interfaces:
EventListener,BuildServerListener,CurrentProblemsManager,CurrentProblemsManagerEx,ProjectsModelListener,ServerListener
public class CurrentProblemsManagerImpl extends BuildServerAdapter implements CurrentProblemsManagerEx
Few implementation details:the instance of
CurrentProblemsManagerImplholds the reference for all build types (per project) and for all build types - a reference to last normally finished build (can be null). The current problems of a build type include failed tests from the last normally finished build plus failed tests from running builds. All normally finished builds except running ones form the cache.The instance also listens for build events - start and finish - to update the cache. Thus there is no "stop-the-world" phase collecting the cache. But if the cache isn't full enough, the first rendering of the "Current Problems" page can take some time.
Thread-safe.
Ideas for further performance improvement:
- persist the cache
Currently the manager ignores all the problems from non-default branches.
- Author:
- Maxim Podkolzine (maxim.podkolzine@jetbrains.com)
-
-
Constructor Summary
Constructors Constructor Description CurrentProblemsManagerImpl(BuildsManager buildsManager, ProblemMutingService problemMutingService, ResponsibilityManager responsibilityManager, BuildProblemManager buildProblemManager, ProjectManager projectManager, SQLRunnerEx sqlRunner, EventDispatcher<BuildServerListener> eventDispatcher)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description voidbuildFinished(SRunningBuild build)Called after build finishing, only if build was not interruptedvoidbuildStarted(SRunningBuild build)Build server events.voidbuildTypeRegistered(SBuildType buildType)Called when build configuration is created or build configuration is reloaded from the diskvoidbuildTypeUnregistered(SBuildType buildType)Called when build configuration is deletedMap<TestName,List<STestRun>>getCurrentProblems(SBuildType bt, long lastNormalBuildId)Map<TestName,List<STestRun>>getFailingTests(SProject project)Calculates and returns currently failing tests (including muted) with corresponding test runs in the specified projectMap<TestName,List<STestRun>>getMutedOnlyProblems(SBuildType bt, long lastNormalBuildId)CurrentProblemsgetProblemsForProject(SProject project)Calculates and returns current project problems.List<STestRun>getProblemsInRunningBuilds(SProject project, Collection<Long> testNameIds, boolean includingMutedProblems, boolean inAllBranches)Returns the list of test runs in which thetestsis currently failing, from running builds only.ProblemsSummarygetProblemsSummary(Map<SProject,List<SBuildType>> buildTypes)Returns the problems summary for the projects and build types specified.static booleanisFinishedNormally(SBuild build)Returns whether a build is finished normally, i.e.static booleanisFromDefaultBranch(SBuild build)Returns whether a build is from the default branch.-
Methods inherited from class jetbrains.buildServer.serverSide.BuildServerAdapter
agentDescriptionUpdated, agentRegistered, agentRemoved, agentRemoved, agentsDescriptionUpdated, agentStatusChanged, agentUnregistered, agentUnregistered, beforeAgentUnregistered, beforeBuildFinish, beforeEntryDelete, beforeServerConfigurationLoaded, buildArtifactsChanged, buildChangedStatus, buildCommented, buildDetachedFromAgent, buildInterrupted, buildPinned, buildProblemsChanged, buildProblemsMuted, buildProblemsUnmuted, buildPromotionTagsChanged, buildQueueOrderChanged, buildRemovedFromQueue, buildTagsChanged, buildTagsChanged, buildTypeAddedToQueue, buildTypeAddedToQueue, buildUnpinned, changeAdded, changesLoaded, changesLoaded, cleanupFinished, cleanupStarted, entriesDeleted, entryCreated, entryDeleted, labelingFailed, labelingSucceed, messageReceived, pluginsLoaded, responsibleChanged, responsibleChanged, responsibleChanged, responsibleChanged, responsibleRemoved, responsibleRemoved, serverConfigurationReloaded, serverShutdown, serverShutdownComplete, serverStartup, sourcesVersionReleased, sourcesVersionReleased, sourcesVersionReleased, statisticValuePublished, testsMuted, testsUnmuted
-
Methods inherited from class jetbrains.buildServer.serverSide.ProjectsModelListenerAdapter
beforeBuildTypeDeleted, beforeBuildTypesDeleted, buildTypeActiveStatusChanged, buildTypeDeleted, buildTypeDescriptionUpdated, buildTypeExternalIdChanged, buildTypeMoved, buildTypePersisted, buildTypeRenamed, buildTypeTemplateDeleted, buildTypeTemplateDeleted, buildTypeTemplateExternalIdChanged, buildTypeTemplateMoved, buildTypeTemplatePersisted, buildTypeTemplateRestored, projectArchived, projectCreated, projectDearchived, projectDescriptionUpdated, projectExternalIdChanged, projectFeatureAdded, projectFeatureChanged, projectFeatureRemoved, projectMoved, projectPersisted, projectPluginDataFileRemoved, projectPluginDataFileSaved, projectRemoved, projectRemoved, projectRenamed, projectRestored, vcsRootExternalIdChanged, vcsRootMoved, vcsRootPersisted, vcsRootRemoved, vcsRootsPersisted, vcsRootUpdated
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface jetbrains.buildServer.serverSide.ProjectsModelListener
beforeBuildTypeDeleted, beforeBuildTypesDeleted, buildTypeActiveStatusChanged, buildTypeDeleted, buildTypeDescriptionUpdated, buildTypeExternalIdChanged, buildTypeMoved, buildTypePersisted, buildTypeRenamed, buildTypeTemplateDeleted, buildTypeTemplateDeleted, buildTypeTemplateExternalIdChanged, buildTypeTemplateMoved, buildTypeTemplatePersisted, buildTypeTemplateRestored, projectArchived, projectCreated, projectDearchived, projectDescriptionUpdated, projectExternalIdChanged, projectFeatureAdded, projectFeatureChanged, projectFeatureRemoved, projectMoved, projectPersisted, projectPluginDataFileRemoved, projectPluginDataFileSaved, projectRemoved, projectRemoved, projectRenamed, projectRestored, vcsRootExternalIdChanged, vcsRootMoved, vcsRootPersisted, vcsRootRemoved, vcsRootsPersisted, vcsRootUpdated
-
-
-
-
Constructor Detail
-
CurrentProblemsManagerImpl
public CurrentProblemsManagerImpl(@NotNull BuildsManager buildsManager, @NotNull ProblemMutingService problemMutingService, @NotNull ResponsibilityManager responsibilityManager, @NotNull BuildProblemManager buildProblemManager, @NotNull ProjectManager projectManager, @NotNull SQLRunnerEx sqlRunner, @NotNull EventDispatcher<BuildServerListener> eventDispatcher)
-
-
Method Detail
-
getProblemsForProject
@NotNull public CurrentProblems getProblemsForProject(@NotNull SProject project)
Description copied from interface:CurrentProblemsManagerCalculates and returns current project problems. All running builds are taken into account.- Specified by:
getProblemsForProjectin interfaceCurrentProblemsManager- Parameters:
project- the project- Returns:
- current project problems
-
getFailingTests
@NotNull public Map<TestName,List<STestRun>> getFailingTests(@NotNull SProject project)
Description copied from interface:CurrentProblemsManagerCalculates and returns currently failing tests (including muted) with corresponding test runs in the specified project- Specified by:
getFailingTestsin interfaceCurrentProblemsManager- Returns:
- see above
-
getProblemsInRunningBuilds
@NotNull public List<STestRun> getProblemsInRunningBuilds(@NotNull SProject project, @NotNull Collection<Long> testNameIds, boolean includingMutedProblems, boolean inAllBranches)
Description copied from interface:CurrentProblemsManagerExReturns the list of test runs in which thetestsis currently failing, from running builds only.- Specified by:
getProblemsInRunningBuildsin interfaceCurrentProblemsManagerEx- Parameters:
project- the projecttestNameIds- the test namesincludingMutedProblems- if true, muted tests are considered a problem- Returns:
- the list of test runs
-
getProblemsSummary
@NotNull public ProblemsSummary getProblemsSummary(@NotNull Map<SProject,List<SBuildType>> buildTypes)
Description copied from interface:CurrentProblemsManagerReturns the problems summary for the projects and build types specified. All current problems (including ones from the running builds) and investigations are taken into account.- Specified by:
getProblemsSummaryin interfaceCurrentProblemsManager- Parameters:
buildTypes- the map of build types to get summary for- Returns:
- problems summary
-
buildStarted
public void buildStarted(@NotNull SRunningBuild build)Build server events.- Specified by:
buildStartedin interfaceBuildServerListener- Overrides:
buildStartedin classBuildServerAdapter- Parameters:
build- build configuration whose status has changed
-
buildFinished
public void buildFinished(@NotNull SRunningBuild build)Description copied from interface:BuildServerListenerCalled after build finishing, only if build was not interrupted- Specified by:
buildFinishedin interfaceBuildServerListener- Overrides:
buildFinishedin classBuildServerAdapter- Parameters:
build- running build // TODO: shall pass SFinishedBuild as parameter
-
buildTypeUnregistered
public void buildTypeUnregistered(@NotNull SBuildType buildType)Description copied from interface:ProjectsModelListenerCalled when build configuration is deleted- Specified by:
buildTypeUnregisteredin interfaceProjectsModelListener- Overrides:
buildTypeUnregisteredin classProjectsModelListenerAdapter- Parameters:
buildType- unregistered build configuration
-
buildTypeRegistered
public void buildTypeRegistered(@NotNull SBuildType buildType)Description copied from interface:ProjectsModelListenerCalled when build configuration is created or build configuration is reloaded from the disk- Specified by:
buildTypeRegisteredin interfaceProjectsModelListener- Overrides:
buildTypeRegisteredin classProjectsModelListenerAdapter- Parameters:
buildType- registered build configuration
-
isFinishedNormally
public static boolean isFinishedNormally(@NotNull SBuild build)Returns whether a build is finished normally, i.e. because of failed tests. Compilation errors, checkout errors, OOM, etc are not considered normal.- Parameters:
build- the build- Returns:
- true iff build is finished normally
-
isFromDefaultBranch
public static boolean isFromDefaultBranch(@NotNull SBuild build)Returns whether a build is from the default branch.- Parameters:
build- the build to check- Returns:
- true iff build is from the default branch.
-
getCurrentProblems
@Nullable public Map<TestName,List<STestRun>> getCurrentProblems(@NotNull SBuildType bt, long lastNormalBuildId)
-
getMutedOnlyProblems
@NotNull public Map<TestName,List<STestRun>> getMutedOnlyProblems(@NotNull SBuildType bt, long lastNormalBuildId)
-
-