UX-64# Renamed branches to branchNames in Pipeline model

This commit is contained in:
Vivek Pandey 2016-02-29 19:34:11 -08:00
parent 946a8772e0
commit 3439eedfd1
2 changed files with 11 additions and 5 deletions

View File

@ -1,6 +1,7 @@
package io.jenkins.blueocean.service.embedded;
import com.jayway.restassured.response.Response;
import com.jayway.restassured.response.ValidatableResponse;
import hudson.model.FreeStyleProject;
import io.jenkins.blueocean.commons.JsonConverter;
import io.jenkins.blueocean.service.embedded.scm.GitSampleRepoRule;
@ -10,6 +11,7 @@ import jenkins.branch.DefaultBranchPropertyStrategy;
import jenkins.plugins.git.GitSCMSource;
import jenkins.scm.api.SCMSource;
import org.hamcrest.Matchers;
import org.hamcrest.collection.IsArrayContainingInAnyOrder;
import org.jenkinsci.plugins.scriptsecurity.scripts.ScriptApproval;
import org.jenkinsci.plugins.workflow.job.WorkflowJob;
import org.jenkinsci.plugins.workflow.job.WorkflowRun;
@ -90,14 +92,18 @@ public class MultiBranchTest {
mp.scheduleBuild2(0).getFuture().get();
given().log().all().get("/organizations/jenkins/pipelines/p/").then().log().all().statusCode(200)
.body("organization", Matchers.equalTo("jenkins"))
Response response = given().log().all().get("/organizations/jenkins/pipelines/p/");
ValidatableResponse validatableResponse = response.then().log().all().statusCode(200);
validatableResponse.body("organization", Matchers.equalTo("jenkins"))
.body("name", Matchers.equalTo(mp.getName()))
.body("displayName", Matchers.equalTo(mp.getDisplayName()))
.body("numberOfFailingBranches", Matchers.equalTo(0))
.body("numberOfSuccessfulBranches", Matchers.equalTo(0))
.body("totalNumberOfBranches", Matchers.equalTo(3));
List<String> names = with(response.asString()).get("branchNames");
IsArrayContainingInAnyOrder.arrayContainingInAnyOrder(names, branches);
Response r = given().log().all().get("/organizations/jenkins/pipelines/p/branches");
r.then().log().all().statusCode(200);

View File

@ -18,7 +18,7 @@ public abstract class BlueMultiBranchPipeline extends BluePipeline{
public static final String NUMBER_OF_FAILING_BRANCHES="numberOfFailingBranches";
public static final String NUMBER_OF_SUCCESSFULT_BRANCHES="numberOfSuccessfulBranches";
public static final String PRIMARY_BRANCH_WEATHER="primaryBranchWeather";
public static final String BRANCHES="branches";
public static final String BRANCH_NAMES ="branchNames";
/**
* @return total number of branches
@ -56,8 +56,8 @@ public abstract class BlueMultiBranchPipeline extends BluePipeline{
/**
* @return Gives array of branch names
*/
@Exported(name = BRANCHES)
@JsonProperty(BRANCHES)
@Exported(name = BRANCH_NAMES)
@JsonProperty(BRANCH_NAMES)
public abstract Collection<String> getBranchNames();
/**