Class FakeBuildHistory

    • Constructor Detail

      • FakeBuildHistory

        public FakeBuildHistory()
    • Method Detail

      • getHistoryByAgentType

        @NotNull
        public List<SFinishedBuild> getHistoryByAgentType​(@NotNull
                                                          AgentType agent,
                                                          @Nullable
                                                          User user,
                                                          boolean includeCanceled)
        Description copied from interface: BuildHistoryEx
        Returns the build history filtered by the agent type.
        Specified by:
        getHistoryByAgentType in interface BuildHistoryEx
        Parameters:
        agent - the build agent type
        user - if set the result will contain only builds by user
        includeCanceled - if set the result will include calceled builds as well
        Returns:
        build history
      • getLastChangesBuild

        public SFinishedBuild getLastChangesBuild​(String buildTypeId)
        Description copied from interface: BuildHistoryEx
        Returns last finished build with last changes in the specified configuration, excluding personal and canceled builds.
        Specified by:
        getLastChangesBuild in interface BuildHistoryEx
        Parameters:
        buildTypeId - specified configuration id.
        Returns:
        last finished build in the specified configuration or null if there are no finished builds.
      • getLastSuccessfulChangesBuild

        public SFinishedBuild getLastSuccessfulChangesBuild​(String buildTypeId)
        Description copied from interface: BuildHistoryEx
        Returns last successfully finished build with last changes in the specified configuration, personal and canceled builds are not considered
        Specified by:
        getLastSuccessfulChangesBuild in interface BuildHistoryEx
        Parameters:
        buildTypeId - specified configuration id.
        Returns:
        last successfully finished build in the specified configuration (excluding personal) or null if there are no successfully finished builds.
      • removeCachedEntry

        public void removeCachedEntry​(long buildId)
        Description copied from interface: BuildHistoryEx
        Removes a single cached build from builds history cache
        Specified by:
        removeCachedEntry in interface BuildHistoryEx
        Parameters:
        buildId - build id
      • buildsRemoved

        public void buildsRemoved​(@NotNull
                                  String buildTypeId,
                                  @NotNull
                                  BuildTypeRemovedBuilds predicate)
        Description copied from interface: BuildHistoryEx
        Accepts a build configuration id and a collection of removed finished builds ids. Cleans internal caches for builds in this collection.
        Specified by:
        buildsRemoved in interface BuildHistoryEx
      • getTestHistory

        @NotNull
        public List<STestRun> getTestHistory​(long testNameId,
                                             @NotNull
                                             String buildTypeId,
                                             long userId,
                                             String branchName)
        Description copied from interface: BuildHistoryEx
        Order of the returned TestRuns is recent runs first, according to the starting order of the builds. Multiple test runs in the build are NOT wrapped into MultiRun class, i.e. each test run is returned independently
        Specified by:
        getTestHistory in interface BuildHistoryEx
        buildTypeId - required to set the build configuration for the test history
        userId - if > 0, includes personal builds of the given user
        branchName - if not null, returns only builds which match given branchName
        Returns:
        Test run objects for given test, recent builds go first
        See Also:
        TestHistory
      • getTestHistory

        @NotNull
        public List<STestRun> getTestHistory​(long testNameId,
                                             @NotNull
                                             SProject project,
                                             long userId,
                                             String branchName)
        Description copied from interface: BuildHistoryEx
        Order of the returned TestRuns is recent runs first, according to the starting order of the builds. Multiple test runs in the build are NOT wrapped into MultiRun class, i.e. each test run is returned independently
        Specified by:
        getTestHistory in interface BuildHistoryEx
        project - required to set the parent project, all returned test runs will belong to build configurations under this project and its subprojects
        userId - if > 0, includes personal builds of the given user
        branchName - if not null, returns only builds which match given branchName
        Returns:
        Test run objects for given test, recent builds go first
        See Also:
        TestHistory
      • getTestHistory

        @NotNull
        public List<STestRun> getTestHistory​(long testNameId,
                                             @NotNull
                                             SProject project,
                                             Filter<STestRun> filter)
        Description copied from interface: BuildHistoryEx
        Order of the returned TestRuns is recent runs first, according to the starting order of the builds. Multiple test runs in the build are NOT wrapped into MultiRun class, i.e. each test run is returned independently
        Specified by:
        getTestHistory in interface BuildHistoryEx
        project - required to set the parent project, all returned test runs will belong to build configurations under this project and its subprojects
        filter - additional filter for the returned test runs
        Returns:
        Test run objects for given test, recent builds go first
        See Also:
        TestHistory
      • getTestHistory

        @NotNull
        public List<STestRun> getTestHistory​(long testNameId,
                                             @NotNull
                                             String buildTypeId,
                                             Filter<STestRun> filter)
        Description copied from interface: BuildHistoryEx
        Order of the returned TestRuns is recent runs first, according to the starting order of the builds. Multiple test runs in the build are NOT wrapped into MultiRun class, i.e. each test run is returned independently
        Specified by:
        getTestHistory in interface BuildHistoryEx
        buildTypeId - required to set the build configuration for the test history
        filter - additional filter for the returned test runs
        Returns:
        Test run objects for given test, recent builds go first
        See Also:
        TestHistory
      • removeEntry

        public boolean removeEntry​(long buildId,
                                   @Nullable
                                   String comment)
        Description copied from interface: BuildHistoryEx
        Removes finished build from the history with specified reason.
        Specified by:
        removeEntry in interface BuildHistoryEx
        Parameters:
        buildId - build identifier of the finished build.
        comment - reason for audit why build is removed
        Returns:
        true if the build was successfully removed
      • getEntries

        @NotNull
        public List<SFinishedBuild> getEntries​(boolean includeCanceled)
        Description copied from interface: BuildHistory
        Return whole build history for all build configurations of all projects. Personal builds are not included. Build ordering is by start time.
        Specified by:
        getEntries in interface BuildHistory
        Parameters:
        includeCanceled - true if cancelled builds should be included into result
        Returns:
        list of builds, most recent first
      • processEntries

        public void processEntries​(String buildTypeId,
                                   @Nullable
                                   User user,
                                   boolean includePersonalBuildsIfUserNotSpecified,
                                   boolean includeCanceled,
                                   boolean orderByChanges,
                                   @NotNull
                                   ItemProcessor<SFinishedBuild> processor)
        Description copied from interface: BuildHistory
        Process build history for the specified build configuration. Personal builds are included if user is specified. Builds are processed using given processor.
        Specified by:
        processEntries in interface BuildHistory
        Parameters:
        buildTypeId - internal id of build configuration
        user - if not null, personal builds of this user will be included into result
        includePersonalBuildsIfUserNotSpecified - if true and user==null, all personal builds will be included into results
        includeCanceled - true if cancelled builds should be included into result
        orderByChanges - if true, builds are ordered by changes, i.e. most recent build with recent changes goes first; if false, most recent builds go first, regardless change order
        processor - processor for builds
      • getEntriesSince

        @NotNull
        public List<SFinishedBuild> getEntriesSince​(@Nullable
                                                    SBuild sinceBuildInclusive,
                                                    @NotNull
                                                    BuildType buildType)
        Description copied from interface: BuildHistory
        Returns builds of the specified configuration started after the specified build (including the specified build), ordered by changes. History builds which contain changes older than in sinceBuildInclusive are not included.
        Specified by:
        getEntriesSince in interface BuildHistory
        Parameters:
        sinceBuildInclusive - boundary for returning builds (inclusive), may be null - in this case all builds are returned
        buildType - specified configuration.
        Returns:
        see above
      • getEntriesBefore

        @NotNull
        public List<SFinishedBuild> getEntriesBefore​(@NotNull
                                                     SBuild beforeThisBuild,
                                                     boolean successfulOnly)
        Description copied from interface: BuildHistory
        Returns builds of the specified configuration started before the specified build (excluding the specified build). Personal builds are included, canceled builds are excluded. Returned builds are sorted by containing changes and than by build start time (if contain same changes). Recent builds go first.
        Specified by:
        getEntriesBefore in interface BuildHistory
        Parameters:
        beforeThisBuild - returns build before this one
        successfulOnly - if only successful builds should be included.
        Returns:
        see above
      • findEntries

        @NotNull
        public Collection<SFinishedBuild> findEntries​(@NotNull
                                                      Collection<Long> buildIds)
        Description copied from interface: BuildHistory
        Returns collection of finished builds corresponding to the specified build ids. The collection will contain existing builds only. NOTE: RETURNED COLLECTION WILL NOT MAINTAIN REQUESTED ORDER!
        Specified by:
        findEntries in interface BuildHistory
        Parameters:
        buildIds - id list to find builds with these ids.
        Returns:
        collection of finished builds corresponding to the specified build ids.
      • findEntries

        @NotNull
        public Collection<SFinishedBuild> findEntries​(@NotNull
                                                      Collection<Long> buildIds,
                                                      boolean addToCache)
        Description copied from interface: BuildHistory
        Same as BuildHistory.findEntries(Collection) but with additional parameter which controls whether the found builds should be cached or not.
        Specified by:
        findEntries in interface BuildHistory
        Parameters:
        buildIds - id list to find builds with these ids.
        addToCache - whether to put found builds in cache or not
        Returns:
        collection of finished builds corresponding to the specified build ids.
      • findEntry

        public SFinishedBuild findEntry​(long buildId)
        Description copied from interface: BuildHistory
        Finds entry with the specified id and cache the data internally. Same as findEntry(buildId, true).
        Specified by:
        findEntry in interface BuildHistory
        Parameters:
        buildId - specified build id.
        Returns:
        entry with the specified id, null if it does not exist or invisible for the current user.
      • findEntry

        @Nullable
        public SFinishedBuild findEntry​(long buildId,
                                        boolean addToCache)
        Description copied from interface: BuildHistory
        Finds entry with the specified id and optionally cache it.
        Specified by:
        findEntry in interface BuildHistory
        Parameters:
        buildId - specified build id.
        addToCache - if true, the build will be added to internal caches
        Returns:
        entry with the specified id, null if it does not exist or invisible for the current user.
      • findEntry

        public SFinishedBuild findEntry​(@NotNull
                                        String buildTypeId,
                                        @NotNull
                                        String buildNumber)
        Description copied from interface: BuildHistory
        Finds the most recent by changes entry inside specified configuration with specified build number.
        Specified by:
        findEntry in interface BuildHistory
        Parameters:
        buildTypeId - specified build configuration id.
        buildNumber - specified build number.
        Returns:
        entry with the specified number in the specified configuration, null if it does not exist or invisible for the current user.
      • findEntries

        @NotNull
        public List<SFinishedBuild> findEntries​(@NotNull
                                                String buildTypeId,
                                                @NotNull
                                                String buildNumber)
        Description copied from interface: BuildHistory
        Returns list of finished builds with specified build number belonging to specified build configuration ordered by changes (the most recent first).
        Specified by:
        findEntries in interface BuildHistory
        Parameters:
        buildTypeId - build configuration id
        buildNumber - build number
        Returns:
        collection of found builds
      • removeEntry

        public void removeEntry​(@NotNull
                                SFinishedBuild finishedBuild,
                                @Nullable
                                String comment,
                                @NotNull
                                CleanupLevel cleanupLevel)
        Description copied from interface: BuildHistory
        Removes finished build from build history. If action is performed by authenticated user, provided comment will be written in audit. CleanupLevel could be used to specify action strictness. See CleanupLevel for more details.
        Specified by:
        removeEntry in interface BuildHistory
      • removeEntry

        public void removeEntry​(@NotNull
                                SFinishedBuild finishedBuild,
                                @Nullable
                                String comment)
        Description copied from interface: BuildHistory
        Removes finished build from build history. If action is performed by authenticated user, provided comment will be written in audit.
        Specified by:
        removeEntry in interface BuildHistory
      • removeEntry

        public boolean removeEntry​(long buildId)
        Description copied from interface: BuildHistory
        Removes finished build from the history.

        The removing build must be an instance of SFinishedBuild.

        Specified by:
        removeEntry in interface BuildHistory
        Parameters:
        buildId - build identifier of the finished build.
        Returns:
        true if the build was successfully removed
      • processEntries

        public void processEntries​(@NotNull
                                   ItemProcessor<SFinishedBuild> itemProcessor)
        Description copied from interface: BuildHistory
        Invokes the given ItemProcessor for all history records existing in the system. Entries are pushed into the processor in the most-recent-first order.
        Specified by:
        processEntries in interface BuildHistory
        Parameters:
        itemProcessor - processor for history entries
      • getHistoryByAgent

        @NotNull
        public List<SFinishedBuild> getHistoryByAgent​(@NotNull
                                                      SBuildAgent agent,
                                                      @Nullable
                                                      User user,
                                                      boolean includeCanceled)
        Description copied from interface: BuildHistory
        Returns the build history filtered by the agent.
        Specified by:
        getHistoryByAgent in interface BuildHistory
        Parameters:
        agent - the build agent
        user - if set the result will contain only builds by user
        includeCanceled - if set the result will include canceled builds as well
        Returns:
        build history
      • getLastFinishedBuildDateOnAgent

        public Date getLastFinishedBuildDateOnAgent​(@NotNull
                                                    SBuildAgent agent,
                                                    @NotNull
                                                    Date finishTimeAfter)
        Description copied from interface: BuildHistory
        Return last finished build that was started on the agent.
        Specified by:
        getLastFinishedBuildDateOnAgent in interface BuildHistory
        Parameters:
        agent - agent
        finishTimeAfter - finish time lower bound
        Returns:
        found build or null
      • getActiveBuildTypes

        @NotNull
        public Collection<SBuildType> getActiveBuildTypes​(@NotNull
                                                          Date sinceDate)
        Description copied from interface: BuildHistory
        Return a list of build configurations that have been active (i.e. have any kind of finished/canceled/personal/etc. builds) since the specified date.
        Specified by:
        getActiveBuildTypes in interface BuildHistory
        Returns:
        see above
      • getNumberOfBuildsInBuildType

        public int getNumberOfBuildsInBuildType​(@NotNull
                                                SBuildType buildType)
        Description copied from interface: BuildHistoryEx
        Return the number of all builds for this build configuration, including personal and canceled ones
        Specified by:
        getNumberOfBuildsInBuildType in interface BuildHistoryEx