Class RepositoryControl
java.lang.Object
com.atlassian.bamboo.testutils.backdoor.BackdoorControl<RepositoryControl>
com.atlassian.bamboo.testutils.backdoor.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, XSRF_NO_CHECK, XSRF_TOKEN_HEADER
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
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
Remove orphaned Spec states@NotNull RestRepositoryDefinition
createLinkedRepository
(@NotNull RestRepositoryConfig restRepositoryConfig) Deprecated.@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
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
Enables RSS for given repository and grants 'all projects access' permission.void
Enables RSS for given project repositorygetProjectRepositories
(String projectKey) getRssRepositoriesAllowedToAccessRepository
(String targetRepositoryId) 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 detectionMethods inherited from class com.atlassian.bamboo.testutils.backdoor.BackdoorControl
anonymousResourceRoot, client, createResource, createResourceForPath, createResourceForPath, get, getEnvironmentData, getRestModulePath, getRootPath, percentEncode, ping, post, resourceRoot
-
Constructor Details
-
RepositoryControl
-
-
Method Details
-
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>, io.atlassian.fugue.Pair<Long,E extends com.atlassian.bamboo.specs.api.model.repository.VcsRepositoryProperties> 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>, io.atlassian.fugue.Pair<Long,E extends com.atlassian.bamboo.specs.api.model.repository.VcsRepositoryProperties> 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
-
deleteAllLinkedRepositories
public void deleteAllLinkedRepositories()Deletes all linked repositories. -
enableRss
Enables RSS for given repository and grants 'all projects access' permission.- Parameters:
sharedRepositoryName
- name
-
enableRss
Enables RSS for given project repository- Parameters:
repositoryName
- nameprojectKey
-
-
isRssEnabled
-
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
Check if pull request is marked as closed in Bamboo DB- Returns:
- true if pull request is closed
-
allowRssRepoAccess
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
- Parameters:
targetRepositoryId
- repository id- Returns:
- ids of repositories which can USE given repository in build plans and deployments stored in RSS code
-
triggerRssDetection
Trigger RSS detection- Parameters:
repositoryName
- name
-
triggerRssDetection
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
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
-
getLinkedRepositories
-
createRepository(VcsRepository)