Class PlansControl
- java.lang.Object
-
- com.atlassian.bamboo.testutils.backdoor.BackdoorControl<PlansControl>
-
- com.atlassian.bamboo.testutils.backdoor.PlansControl
-
public class PlansControl extends BackdoorControl<PlansControl>
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class com.atlassian.bamboo.testutils.backdoor.BackdoorControl
BackdoorControl.AddXsrfNoCheckTokenFilter, BackdoorControl.JsonMediaTypeFilter
-
-
Field Summary
Fields Modifier and Type Field Description static com.atlassian.pageobjects.elements.query.Poller.WaitTimeout
DEFAULT_BUILD_WAIT_TIMEOUT
-
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 PlansControl(@NotNull BambooEnvironmentData environmentData)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description PlansControl
addCreatedPlan(PlanKey planKey)
Register plan created outside backdoor, so it would be removed on cleanupPlansControl
addCustomRequirement(@NotNull PlanKey jobKey, @NotNull String requirementKey)
RestRequirement
addGetCustomRequirement(@NotNull PlanKey jobKey, @NotNull String requirementKey)
PlansControl
addPlanVariable(PlanKey planKey, String variableName, String variableValue)
RestPlan
clonePlan(PlanKey planKeyToClone, PlanKey newPlanKey)
Clone planPlansControl
createArtifact(PlanKey producerJobKey, Consumer<TestArtifactDetails.Builder> consumer)
RestPlanBranch
createBranch(PlanKey planKey, String vcsBranch, String branchName)
com.atlassian.bamboo.specs.api.model.plan.PlanProperties
createOrUpdatePlan(TestUser user, com.atlassian.bamboo.specs.api.builders.plan.Plan plan)
com.atlassian.bamboo.specs.api.model.plan.PlanProperties
createPlan(com.atlassian.bamboo.specs.api.builders.plan.Plan plan)
PlanKey
createPlan(TestBuildDetails buildDetails)
PlansControl
deleteAllPlans()
Marks all top level plans as deleted.PlansControl
deleteAllPlansInProject(String projectKey)
Marks all top level plans within a project as deleted.void
deleteBuildResult(@NotNull PlanResultKey planResultKey)
PlansControl
deletePlan(@NotNull PlanKey planKey)
Delete planPlansControl
deletePlanQuietly(@NotNull PlanKey planKey)
Delete plan quietlyPlansControl
deletePlanVariable(PlanKey planKey, String variableName)
PlansControl
disablePlan(@NotNull PlanKey planKey)
Disable planboolean
doesPlanExistAsRecord(@NotNull PlanKey planKey)
PlansControl
enablePlan(@NotNull PlanKey planKey)
Enable planRestBranches
getAllBranches(PlanKey key)
Get all branches for chainRestPlanBranch
getBranchByName(PlanKey key, String branchName)
Get branches with given name for chaincom.atlassian.pageobjects.elements.query.TimedQuery<RestPlanBranch>
getBranchByNameTimed(PlanKey key, String branchName)
Get branches with given name for chain as a timed queryResult
getBuildResult(PlanKey planKey, int buildNumber)
Get build resultResult
getBuildResult(PlanResultKey planResultKey)
Get build resultResult
getBuildResultWithArtifacts(PlanResultKey planResultKey)
Get build resultRestDockerPipelineConfiguration
getDockerPipelineConfiguration(String jobKey)
List<RestJob>
getJobs(PlanKey planKey)
long
getPlanId(PlanKey key)
List<String>
getPlanLabels(@NotNull PlanKey planKey)
List<RestRepository>
getPlanRepositories(@NotNull PlanKey planKey)
String
getPlanRootArtifactDirectory(PlanKey planKey)
Get the plan directory information for the plan@NotNull List<RestVariableDefinition>
getPlanVariables(@NotNull PlanKey planKey)
List<RestRequirement>
getRequirementsForJob(@NotNull PlanKey jobKey)
RestStageList
getStages(PlanKey planKey)
@NotNull List<String>
getTriggerNames(@NotNull PlanKey planKey)
@NotNull List<RestTrigger>
getTriggers(@NotNull PlanKey planKey)
boolean
isPlanEnabled(@NotNull PlanKey planKey)
void
rerun(@NotNull PlanResultKey planResultKey)
Rebuild completed build.void
rerunFailedJobs(@NotNull PlanResultKey planResultKey)
void
setPlanLabels(@NotNull PlanKey planKey, @NotNull List<String> labels)
void
tearDown()
Cleanup resourcesvoid
triggerBackgroundDeletionAndWait()
Trigger background plan deletion and wait up to 30s for its completion.TriggerPlanBuilder
triggerBuild()
PlansControl
triggerBuild(PlanKey planKey)
Trigger buildPlansControl
triggerBuild(PlanKey planKey, Map<String,String> params)
Trigger buildPlansControl
triggerBuildAndAwaitCompletion(PlanKey planKey)
Trigger build and wait for the completionPlansControl
triggerBuildAndAwaitCompletion(PlanKey planKey, com.atlassian.pageobjects.elements.query.Poller.WaitTimeout timeout)
Trigger build and wait for the completionPlansControl
triggerBuildAndAwaitFailure(PlanKey planKey, int expectStatusCode)
PlansControl
triggerBuildAndAwaitSuccess(@NotNull PlanKey planKey)
RestQueuedBuild
triggerBuildWithResponse(PlanKey planKey, Map<String,String> parameters)
io.restassured.path.json.JsonPath
waitForBuildWithResponse(PlanResultKey key, org.hamcrest.Matcher<io.restassured.path.json.JsonPath> matcher, com.atlassian.pageobjects.elements.query.Poller.WaitTimeout timeout)
PlansControl
waitForCompletedBuild(PlanKey planKey, int buildNumber)
Waits for a build that is completed (builds stopped are not included)PlansControl
waitForCompletedBuild(PlanKey planKey, int buildNumber, com.atlassian.pageobjects.elements.query.Poller.WaitTimeout waitTimeout)
PlansControl
waitForCompletedBuild(PlanResultKey key)
Wait for a build to completePlansControl
waitForCompletedBuild(PlanResultKey key, com.atlassian.pageobjects.elements.query.Poller.WaitTimeout timeout)
PlansControl
waitForFailedBuild(@NotNull PlanKey planKey, int buildNumber)
PlansControl
waitForFailedBuild(@NotNull PlanResultKey planResultKey)
PlansControl
waitForFailedBuild(@NotNull PlanResultKey planResultKey, com.atlassian.pageobjects.elements.query.Poller.WaitTimeout timeout)
PlansControl
waitForFinishedBuild(PlanKey planKey, int buildNumber)
Wait until build is finished (either completed or stopped)@NotNull PlansControl
waitForQueuedBuild(PlanResultKey key)
@NotNull PlansControl
waitForQueuedBuild(PlanResultKey key, com.atlassian.pageobjects.elements.query.Poller.WaitTimeout timeout)
@NotNull PlansControl
waitForQueuedOrStartedBuild(PlanResultKey key, com.atlassian.pageobjects.elements.query.Poller.WaitTimeout timeout)
PlansControl
waitForStartedBuild(PlanKey planKey, int buildNumber)
@NotNull PlansControl
waitForStartedBuild(PlanResultKey key)
@NotNull PlansControl
waitForStartedBuild(PlanResultKey key, com.atlassian.pageobjects.elements.query.Poller.WaitTimeout timeout)
PlansControl
waitForSuccessfulBuild(@NotNull PlanKey planKey, int buildNumber)
PlansControl
waitForSuccessfulBuild(@NotNull PlanResultKey planResultKey)
PlansControl
waitForSuccessfulBuild(@NotNull PlanResultKey planResultKey, com.atlassian.pageobjects.elements.query.Poller.WaitTimeout timeout)
RestPlanBranch
waitUntilBranchIsCreated(PlanKey key, String branchName)
Wait unit plan branch with given name is created for chainRestPlanBranch
waitUntilBranchIsCreatedAndEnabled(PlanKey key, String branchName)
Wait unit plan branch with given name is created and enabled for chainString
waitUntilPlanIsAffectedInFailedSpecsRun(PlanKey planKey, int buildNumber)
void
waitUntilPlanIsAffectedInSuccessfulSpecsRun(PlanKey planKey, int buildNumber)
void
waitUntilPlanIsUpdated(PlanKey planKey, int buildNumber)
-
Methods inherited from class com.atlassian.bamboo.testutils.backdoor.BackdoorControl
client, createResource, createResourceForPath, get, getEnvironmentData, getRestModulePath, percentEncode, ping, post, resourceRoot
-
-
-
-
Constructor Detail
-
PlansControl
public PlansControl(@NotNull @NotNull BambooEnvironmentData environmentData)
-
-
Method Detail
-
doesPlanExistAsRecord
public boolean doesPlanExistAsRecord(@NotNull @NotNull PlanKey planKey)
-
isPlanEnabled
public boolean isPlanEnabled(@NotNull @NotNull PlanKey planKey)
-
addCreatedPlan
public PlansControl addCreatedPlan(PlanKey planKey)
Register plan created outside backdoor, so it would be removed on cleanup
-
deletePlan
public PlansControl deletePlan(@NotNull @NotNull PlanKey planKey)
Delete plan- Parameters:
planKey
- key of a Plan
-
deletePlanQuietly
public PlansControl deletePlanQuietly(@NotNull @NotNull PlanKey planKey)
Delete plan quietly- Parameters:
planKey
- key of a Plan
-
enablePlan
public PlansControl enablePlan(@NotNull @NotNull PlanKey planKey)
Enable plan- Parameters:
planKey
- key of a Plan
-
disablePlan
public PlansControl disablePlan(@NotNull @NotNull PlanKey planKey)
Disable plan- Parameters:
planKey
- key of a Plan
-
deleteAllPlans
public PlansControl deleteAllPlans()
Marks all top level plans as deleted. To await the actual data deletion, usetriggerBackgroundDeletionAndWait()
afterwards.
-
deleteAllPlansInProject
public PlansControl deleteAllPlansInProject(String projectKey)
Marks all top level plans within a project as deleted. To await the actual data deletion, usetriggerBackgroundDeletionAndWait()
afterwards.
-
triggerBackgroundDeletionAndWait
public void triggerBackgroundDeletionAndWait()
Trigger background plan deletion and wait up to 30s for its completion.
-
getBranchByName
public RestPlanBranch getBranchByName(PlanKey key, String branchName) throws Exception
Get branches with given name for chain- Throws:
Exception
-
getBranchByNameTimed
public com.atlassian.pageobjects.elements.query.TimedQuery<RestPlanBranch> getBranchByNameTimed(PlanKey key, String branchName) throws Exception
Get branches with given name for chain as a timed query- Throws:
Exception
-
waitUntilBranchIsCreated
public RestPlanBranch waitUntilBranchIsCreated(PlanKey key, String branchName) throws Exception
Wait unit plan branch with given name is created for chain- Throws:
Exception
-
waitUntilBranchIsCreatedAndEnabled
public RestPlanBranch waitUntilBranchIsCreatedAndEnabled(PlanKey key, String branchName) throws Exception
Wait unit plan branch with given name is created and enabled for chain- Throws:
Exception
-
getAllBranches
public RestBranches getAllBranches(PlanKey key) throws Exception
Get all branches for chain- Throws:
Exception
-
createBranch
public RestPlanBranch createBranch(PlanKey planKey, String vcsBranch, String branchName)
-
clonePlan
public RestPlan clonePlan(PlanKey planKeyToClone, PlanKey newPlanKey) throws Exception
Clone plan- Throws:
Exception
-
triggerBuild
public TriggerPlanBuilder triggerBuild()
-
triggerBuild
public PlansControl triggerBuild(PlanKey planKey)
Trigger build- Parameters:
planKey
- which will be triggered
-
triggerBuildAndAwaitFailure
public PlansControl triggerBuildAndAwaitFailure(PlanKey planKey, int expectStatusCode)
-
triggerBuild
public PlansControl triggerBuild(PlanKey planKey, Map<String,String> params)
Trigger build- Parameters:
planKey
- which will be triggeredparams
- additional params to be passed to the build
-
rerun
public void rerun(@NotNull @NotNull PlanResultKey planResultKey)
Rebuild completed build.- Parameters:
planResultKey
- build result to be rerun
-
rerunFailedJobs
public void rerunFailedJobs(@NotNull @NotNull PlanResultKey planResultKey)
-
triggerBuildWithResponse
public RestQueuedBuild triggerBuildWithResponse(PlanKey planKey, Map<String,String> parameters)
-
triggerBuildAndAwaitCompletion
public PlansControl triggerBuildAndAwaitCompletion(PlanKey planKey)
Trigger build and wait for the completion- Parameters:
planKey
- key of the plan to trigger
-
triggerBuildAndAwaitCompletion
public PlansControl triggerBuildAndAwaitCompletion(PlanKey planKey, com.atlassian.pageobjects.elements.query.Poller.WaitTimeout timeout)
Trigger build and wait for the completion- Parameters:
planKey
- key of the plan to trigger
-
getBuildResult
public Result getBuildResult(PlanResultKey planResultKey)
Get build result
-
getBuildResultWithArtifacts
public Result getBuildResultWithArtifacts(PlanResultKey planResultKey)
Get build result
-
getBuildResult
public Result getBuildResult(PlanKey planKey, int buildNumber) throws Exception
Get build result- Throws:
Exception
-
triggerBuildAndAwaitSuccess
public PlansControl triggerBuildAndAwaitSuccess(@NotNull @NotNull PlanKey planKey)
-
waitForSuccessfulBuild
public PlansControl waitForSuccessfulBuild(@NotNull @NotNull PlanResultKey planResultKey)
-
waitForSuccessfulBuild
public PlansControl waitForSuccessfulBuild(@NotNull @NotNull PlanKey planKey, int buildNumber)
-
waitForSuccessfulBuild
public PlansControl waitForSuccessfulBuild(@NotNull @NotNull PlanResultKey planResultKey, com.atlassian.pageobjects.elements.query.Poller.WaitTimeout timeout)
-
waitForFailedBuild
public PlansControl waitForFailedBuild(@NotNull @NotNull PlanResultKey planResultKey)
-
waitForFailedBuild
public PlansControl waitForFailedBuild(@NotNull @NotNull PlanKey planKey, int buildNumber)
-
waitForFailedBuild
public PlansControl waitForFailedBuild(@NotNull @NotNull PlanResultKey planResultKey, com.atlassian.pageobjects.elements.query.Poller.WaitTimeout timeout)
-
waitForCompletedBuild
public PlansControl waitForCompletedBuild(PlanResultKey key)
Wait for a build to complete- Parameters:
key
- plan result key
-
waitForCompletedBuild
public PlansControl waitForCompletedBuild(PlanResultKey key, com.atlassian.pageobjects.elements.query.Poller.WaitTimeout timeout)
- Throws:
AssertionError
- if build is not completed
-
waitForCompletedBuild
public PlansControl waitForCompletedBuild(PlanKey planKey, int buildNumber)
Waits for a build that is completed (builds stopped are not included)
-
waitUntilPlanIsUpdated
public void waitUntilPlanIsUpdated(PlanKey planKey, int buildNumber)
-
waitUntilPlanIsAffectedInSuccessfulSpecsRun
public void waitUntilPlanIsAffectedInSuccessfulSpecsRun(PlanKey planKey, int buildNumber)
-
waitUntilPlanIsAffectedInFailedSpecsRun
public String waitUntilPlanIsAffectedInFailedSpecsRun(PlanKey planKey, int buildNumber)
-
waitForCompletedBuild
public PlansControl waitForCompletedBuild(PlanKey planKey, int buildNumber, com.atlassian.pageobjects.elements.query.Poller.WaitTimeout waitTimeout)
-
waitForStartedBuild
public PlansControl waitForStartedBuild(PlanKey planKey, int buildNumber)
-
waitForStartedBuild
@NotNull public @NotNull PlansControl waitForStartedBuild(PlanResultKey key)
-
waitForStartedBuild
@NotNull public @NotNull PlansControl waitForStartedBuild(PlanResultKey key, com.atlassian.pageobjects.elements.query.Poller.WaitTimeout timeout)
-
waitForQueuedBuild
@NotNull public @NotNull PlansControl waitForQueuedBuild(PlanResultKey key)
-
waitForQueuedBuild
@NotNull public @NotNull PlansControl waitForQueuedBuild(PlanResultKey key, com.atlassian.pageobjects.elements.query.Poller.WaitTimeout timeout)
-
waitForQueuedOrStartedBuild
@NotNull public @NotNull PlansControl waitForQueuedOrStartedBuild(PlanResultKey key, com.atlassian.pageobjects.elements.query.Poller.WaitTimeout timeout)
-
waitForFinishedBuild
public PlansControl waitForFinishedBuild(PlanKey planKey, int buildNumber)
Wait until build is finished (either completed or stopped)
-
waitForBuildWithResponse
public io.restassured.path.json.JsonPath waitForBuildWithResponse(PlanResultKey key, org.hamcrest.Matcher<io.restassured.path.json.JsonPath> matcher, com.atlassian.pageobjects.elements.query.Poller.WaitTimeout timeout)
-
getStages
public RestStageList getStages(PlanKey planKey) throws Exception
- Throws:
Exception
-
createPlan
public com.atlassian.bamboo.specs.api.model.plan.PlanProperties createPlan(com.atlassian.bamboo.specs.api.builders.plan.Plan plan) throws Exception
- Throws:
Exception
-
createOrUpdatePlan
public com.atlassian.bamboo.specs.api.model.plan.PlanProperties createOrUpdatePlan(TestUser user, com.atlassian.bamboo.specs.api.builders.plan.Plan plan) throws Exception
- Throws:
Exception
-
createPlan
public PlanKey createPlan(TestBuildDetails buildDetails) throws Exception
- Throws:
Exception
-
tearDown
public void tearDown()
Description copied from class:BackdoorControl
Cleanup resources- Overrides:
tearDown
in classBackdoorControl<PlansControl>
-
deleteBuildResult
public void deleteBuildResult(@NotNull @NotNull PlanResultKey planResultKey) throws Exception
- Throws:
Exception
-
getPlanVariables
@NotNull public @NotNull List<RestVariableDefinition> getPlanVariables(@NotNull @NotNull PlanKey planKey)
-
getTriggerNames
@NotNull public @NotNull List<String> getTriggerNames(@NotNull @NotNull PlanKey planKey)
-
getTriggers
@NotNull public @NotNull List<RestTrigger> getTriggers(@NotNull @NotNull PlanKey planKey)
-
addPlanVariable
public PlansControl addPlanVariable(PlanKey planKey, String variableName, String variableValue)
-
deletePlanVariable
public PlansControl deletePlanVariable(PlanKey planKey, String variableName)
-
createArtifact
public PlansControl createArtifact(PlanKey producerJobKey, Consumer<TestArtifactDetails.Builder> consumer)
-
getPlanRootArtifactDirectory
public String getPlanRootArtifactDirectory(PlanKey planKey)
Get the plan directory information for the plan- Parameters:
planKey
-- Returns:
-
addCustomRequirement
public PlansControl addCustomRequirement(@NotNull @NotNull PlanKey jobKey, @NotNull @NotNull String requirementKey)
-
addGetCustomRequirement
public RestRequirement addGetCustomRequirement(@NotNull @NotNull PlanKey jobKey, @NotNull @NotNull String requirementKey)
-
getRequirementsForJob
public List<RestRequirement> getRequirementsForJob(@NotNull @NotNull PlanKey jobKey)
-
getPlanId
public long getPlanId(PlanKey key)
-
getDockerPipelineConfiguration
public RestDockerPipelineConfiguration getDockerPipelineConfiguration(String jobKey)
-
getPlanRepositories
public List<RestRepository> getPlanRepositories(@NotNull @NotNull PlanKey planKey)
-
-