Class RepositoryControl
- java.lang.Object
-
- com.atlassian.bamboo.testutils.backdoor.BackdoorControl<RepositoryControl>
-
- com.atlassian.bamboo.testutils.backdoor.RepositoryControl
-
public class RepositoryControl extends BackdoorControl<RepositoryControl>
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class com.atlassian.bamboo.testutils.backdoor.BackdoorControl
BackdoorControl.AddXsrfNoCheckTokenFilter, BackdoorControl.JsonMediaTypeFilter
-
-
Field Summary
-
Fields inherited from class com.atlassian.bamboo.testutils.backdoor.BackdoorControl
ADMIN_REST_PATH, API_REST_PATH, DEFAULT_REST_PATH, rootPath
-
-
Constructor Summary
Constructors Constructor Description RepositoryControl(@NotNull BambooEnvironmentData environmentData)
-
Method Summary
All Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description 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 RSSvoid
changeRSSAccessToAllProjects(String repositoryId, boolean canAccessAllProjects)
Changes repository 'all projects access' rss permission.void
changeRSSAccessToAllRepositories(String repositoryId, boolean canAccessAllRepositories)
Changes repository 'all repositories access' rss permission.void
changeRSSPermissionToCreateProjects(String repositoryId, boolean canCreateProjects)
Changes repository 'project creation allowed' rss permission.long
clearSpecsStates()
Remove orphaned Spec states@NotNull RestRepositoryDefinition
createLinkedRepository(@NotNull RestRepositoryConfig restRepositoryConfig)
Deprecated.Prefer usingcreateRepository(VcsRepository)
@NotNull RestRepositoryDefinition
createLinkedRepository(@NotNull Repository repository, @NotNull String displayName)
Deprecated.Prefer usingcreateRepository(VcsRepository)
<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.Prefer ussingcreateRepository(VcsRepository)
<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.void
deleteAllLinkedRepositories()
Deletes all linked repositories.void
deleteBuildWarnings(@NotNull PlanResultKey resultKey, long repositoryId)
Delete all build warnings from a repository for a build result.boolean
deleteLinkedRepository(long repositoryId)
Deletes a linked repository asTestUser.ADMIN
.boolean
deleteLinkedRepository(String repositoryName)
void
enableRss(String sharedRepositoryName)
Enables RSS for given repository and grants 'all projects access' permission.void
enableRss(String repositoryName, String projectKey)
Enables RSS for given project repositoryList<RestRepository>
getLinkedRepositories()
List<RestRepository>
getProjectRepositories(String projectKey)
List<Long>
getRssRepositoriesAllowedToAccessRepository(String targetRepositoryId)
RestVcsLocationSpecsStatus
getSpecsDetectionStatus(long repositoryId, @NotNull String branch)
Get specs status for repository and branchboolean
isPullRequestClosed(String repositoryName, String pullRequestKey)
Check if pull request is marked as closed in Bamboo DBboolean
isRssEnabled(String sharedRepositoryName)
boolean
sendBuildWarnings(@NotNull PlanResultKey resultKey, long repositoryId, @NotNull RestBuildWarnings warnings)
Manually send build warnings to a repository for a build result.void
tearDown()
Cleanup resourcesvoid
triggerBranchDetection(long repositoryId)
Triggers (polling) branch detection for given repository.void
triggerRssDetection(long repositoryId, @NotNull String branch)
Trigger RSS detection for repository and branchvoid
triggerRssDetection(@NotNull String repositoryName)
Trigger RSS detection-
Methods inherited from class com.atlassian.bamboo.testutils.backdoor.BackdoorControl
client, createResource, createResourceForPath, get, getEnvironmentData, getRestModulePath, percentEncode, ping, post, resourceRoot
-
-
-
-
Constructor Detail
-
RepositoryControl
public RepositoryControl(@NotNull @NotNull BambooEnvironmentData environmentData)
-
-
Method Detail
-
tearDown
public void tearDown()
Description copied from class:BackdoorControl
Cleanup resources- Overrides:
tearDown
in classBackdoorControl<RepositoryControl>
-
createLinkedRepository
@NotNull @Deprecated public @NotNull RestRepositoryDefinition createLinkedRepository(@NotNull @NotNull RestRepositoryConfig restRepositoryConfig)
Deprecated.Prefer usingcreateRepository(VcsRepository)
Creates a linked repository as the default auth user. The repository will be automatically deleted ontearDown()
.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.Prefer ussingcreateRepository(VcsRepository)
- 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 ontearDown()
.- Parameters:
vcsRepository
- repository configuration
-
createLinkedRepository
@NotNull @Deprecated public @NotNull RestRepositoryDefinition createLinkedRepository(@NotNull @NotNull Repository repository, @NotNull @NotNull String displayName)
Deprecated.Prefer usingcreateRepository(VcsRepository)
Creates a linked repository as the default auth user. The repository will be automatically deleted ontearDown()
.This method has a lot of limitations - see the relevant backdoor resource for more details.
- Parameters:
repository
- repository configurationdisplayName
- 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 asTestUser.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
- nameprojectKey
-
-
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 idcanAccessAllProjects
- 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 idcanAccessAllRepositories
- 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 idcanCreateProjects
- 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 grantedtargetRepositoryId
- 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
andrepositoryId
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 warningsrepositoryId
- repository for which to send build warnings, must have been checked out by the buildwarnings
- 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 generatedrepositoryId
- 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()
-
-