Class RepositoryControl

java.lang.Object
com.atlassian.bamboo.testutils.backdoor.BackdoorControl<RepositoryControl>
com.atlassian.bamboo.testutils.backdoor.RepositoryControl

public class RepositoryControl extends BackdoorControl<RepositoryControl>
  • Constructor Details

  • Method Details

    • tearDown

      public void tearDown()
      Description copied from class: BackdoorControl
      Cleanup resources
      Overrides:
      tearDown in class BackdoorControl<RepositoryControl>
    • createLinkedRepository

      @NotNull @Deprecated public @NotNull RestRepositoryDefinition createLinkedRepository(@NotNull @NotNull RestRepositoryConfig restRepositoryConfig)
      Deprecated.
      Creates a linked repository as the default auth user. The repository will be automatically deleted on tearDown().

      This method has a lot of limitations - see the relevant backdoor resource for more details.

      Parameters:
      restRepositoryConfig - repository configuration
      Returns:
      repository definition with ID of the newly created repository
    • createLinkedRepository

      @Deprecated public <T extends com.atlassian.bamboo.specs.api.builders.repository.VcsRepository<T, E>, E extends com.atlassian.bamboo.specs.api.model.repository.VcsRepositoryProperties> io.atlassian.fugue.Pair<Long,E> createLinkedRepository(T vcsRepository)
      Deprecated.
      Parameters:
      vcsRepository - repository configuration
    • createRepository

      public <T extends com.atlassian.bamboo.specs.api.builders.repository.VcsRepository<T, E>, E extends com.atlassian.bamboo.specs.api.model.repository.VcsRepositoryProperties> io.atlassian.fugue.Pair<Long,E> createRepository(T vcsRepository)
      Creates a linked/project repository as the default auth user. The repository will be automatically deleted on tearDown().
      Parameters:
      vcsRepository - repository configuration
    • createLinkedRepository

      @NotNull @Deprecated public @NotNull RestRepositoryDefinition createLinkedRepository(@NotNull @NotNull Repository repository, @NotNull @NotNull String displayName)
      Deprecated.
      Creates a linked repository as the default auth user. The repository will be automatically deleted on tearDown().

      This method has a lot of limitations - see the relevant backdoor resource for more details.

      Parameters:
      repository - repository configuration
      displayName - display name of the linked repository to create
      Returns:
      repository definition with ID of the newly created repository
    • deleteLinkedRepository

      public boolean deleteLinkedRepository(long repositoryId)
      Deletes a linked repository as TestUser.ADMIN. Returns true if repository with the given ID existed and was deleted successfully, false otherwise.
      Parameters:
      repositoryId - id of the linked repository
      Returns:
      true if repository with the given ID existed and was deleted, false otherwise
    • deleteLinkedRepository

      public boolean deleteLinkedRepository(String repositoryName)
    • deleteAllLinkedRepositories

      public void deleteAllLinkedRepositories()
      Deletes all linked repositories.
    • enableRss

      public void enableRss(String sharedRepositoryName)
      Enables RSS for given repository and grants 'all projects access' permission.
      Parameters:
      sharedRepositoryName - name
    • enableRss

      public void enableRss(String repositoryName, String projectKey)
      Enables RSS for given project repository
      Parameters:
      repositoryName - name
      projectKey -
    • isRssEnabled

      public boolean isRssEnabled(String sharedRepositoryName)
    • changeRSSAccessToAllProjects

      public void changeRSSAccessToAllProjects(String repositoryId, boolean canAccessAllProjects) throws com.opensymphony.webwork.dispatcher.json.JSONException
      Changes repository 'all projects access' rss permission.
      Parameters:
      repositoryId - linked repository id
      canAccessAllProjects - true if repository should have all projects access, false otherwise
      Throws:
      com.opensymphony.webwork.dispatcher.json.JSONException
    • changeRSSAccessToAllRepositories

      public void changeRSSAccessToAllRepositories(String repositoryId, boolean canAccessAllRepositories) throws com.opensymphony.webwork.dispatcher.json.JSONException
      Changes repository 'all repositories access' rss permission.
      Parameters:
      repositoryId - linked repository id
      canAccessAllRepositories - true if repository should have all repositories access, false otherwise
      Throws:
      com.opensymphony.webwork.dispatcher.json.JSONException
    • changeRSSPermissionToCreateProjects

      public void changeRSSPermissionToCreateProjects(String repositoryId, boolean canCreateProjects) throws com.opensymphony.webwork.dispatcher.json.JSONException
      Changes repository 'project creation allowed' rss permission.
      Parameters:
      repositoryId - linked repository id
      canCreateProjects - true if repository should be allowed to create new projects, false otherwise
      Throws:
      com.opensymphony.webwork.dispatcher.json.JSONException
    • isPullRequestClosed

      public boolean isPullRequestClosed(String repositoryName, String pullRequestKey)
      Check if pull request is marked as closed in Bamboo DB
      Returns:
      true if pull request is closed
    • allowRssRepoAccess

      public void allowRssRepoAccess(String repositoryId, String targetRepositoryId)
      Grant permission of repository defined by repositoryId to use repository defined by targetRepositoryId in build plans and deployments when import RSS
      Parameters:
      repositoryId - which will have USE permission granted
      targetRepositoryId - which can be used by RSS code in repositoryId repository
    • getRssRepositoriesAllowedToAccessRepository

      public List<Long> getRssRepositoriesAllowedToAccessRepository(String targetRepositoryId)
      Parameters:
      targetRepositoryId - repository id
      Returns:
      ids of repositories which can USE given repository in build plans and deployments stored in RSS code
    • triggerRssDetection

      public void triggerRssDetection(@NotNull @NotNull String repositoryName)
      Trigger RSS detection
      Parameters:
      repositoryName - name
    • triggerRssDetection

      public void triggerRssDetection(long repositoryId, @NotNull @NotNull String branch)
      Trigger RSS detection for repository and branch
    • getSpecsDetectionStatus

      public RestVcsLocationSpecsStatus getSpecsDetectionStatus(long repositoryId, @NotNull @NotNull String branch)
      Get specs status for repository and branch
    • clearSpecsStates

      public long clearSpecsStates()
      Remove orphaned Spec states
      Returns:
      count of removed Specs states
    • sendBuildWarnings

      public boolean sendBuildWarnings(@NotNull @NotNull PlanResultKey resultKey, long repositoryId, @NotNull @NotNull RestBuildWarnings warnings)
      Manually send build warnings to a repository for a build result.

      Subsequent calls for the same resultKey and repositoryId will append new build warnings to the list of existing ones.

      Parameters:
      resultKey - build result to use, it does not need to have generated any warnings
      repositoryId - repository for which to send build warnings, must have been checked out by the build
      warnings - definition of all warnings to send
      Returns:
      true if warnings were successfully sent, false if the repository has rejected the warnings and no subsequent requests should be performed (e.g. a limit has been exceeded)
    • deleteBuildWarnings

      public void deleteBuildWarnings(@NotNull @NotNull PlanResultKey resultKey, long repositoryId)
      Delete all build warnings from a repository for a build result.
      Parameters:
      resultKey - build result for which the warnings have been previously generated
      repositoryId - repository from which to delete build warnings, must have been checked out by the build
    • triggerBranchDetection

      public void triggerBranchDetection(long repositoryId)
      Triggers (polling) branch detection for given repository. Creates plan branches for all chains using this repo.
    • getProjectRepositories

      public List<RestRepository> getProjectRepositories(String projectKey)
    • getLinkedRepositories

      public List<RestRepository> getLinkedRepositories()