Search in sources :

Example 31 with DefaultBranchPropertyStrategy

use of jenkins.branch.DefaultBranchPropertyStrategy in project blueocean-plugin by jenkinsci.

the class MultiBranchTest method startMultiBranchPipelineRuns.

@Test
public void startMultiBranchPipelineRuns() throws Exception {
    WorkflowMultiBranchProject mp = j.jenkins.createProject(WorkflowMultiBranchProject.class, "p");
    mp.getSourcesList().add(new BranchSource(new GitSCMSource(null, sampleRepo.toString(), "", "*", "", false), new DefaultBranchPropertyStrategy(new BranchProperty[0])));
    for (SCMSource source : mp.getSCMSources()) {
        assertEquals(mp, source.getOwner());
    }
    WorkflowJob p = scheduleAndFindBranchProject(mp, "feature%2Fux-1");
    j.waitUntilNoActivity();
    Map resp = post("/organizations/jenkins/pipelines/p/branches/" + Util.rawEncode("feature%2Fux-1") + "/runs/", Collections.EMPTY_MAP);
    String id = (String) resp.get("id");
    String link = getHrefFromLinks(resp, "self");
    Assert.assertEquals("/blue/rest/organizations/jenkins/pipelines/p/branches/feature%252Fux-1/runs/" + id + "/", link);
}
Also used : WorkflowMultiBranchProject(org.jenkinsci.plugins.workflow.multibranch.WorkflowMultiBranchProject) GitSCMSource(jenkins.plugins.git.GitSCMSource) SCMSource(jenkins.scm.api.SCMSource) GitSCMSource(jenkins.plugins.git.GitSCMSource) BranchSource(jenkins.branch.BranchSource) WorkflowJob(org.jenkinsci.plugins.workflow.job.WorkflowJob) DefaultBranchPropertyStrategy(jenkins.branch.DefaultBranchPropertyStrategy) Map(java.util.Map) ImmutableMap(com.google.common.collect.ImmutableMap) Test(org.junit.Test)

Aggregations

BranchSource (jenkins.branch.BranchSource)31 DefaultBranchPropertyStrategy (jenkins.branch.DefaultBranchPropertyStrategy)31 GitSCMSource (jenkins.plugins.git.GitSCMSource)31 WorkflowMultiBranchProject (org.jenkinsci.plugins.workflow.multibranch.WorkflowMultiBranchProject)31 Test (org.junit.Test)29 SCMSource (jenkins.scm.api.SCMSource)28 Map (java.util.Map)21 ImmutableMap (com.google.common.collect.ImmutableMap)20 WorkflowJob (org.jenkinsci.plugins.workflow.job.WorkflowJob)20 ArrayList (java.util.ArrayList)12 List (java.util.List)12 ImmutableList (com.google.common.collect.ImmutableList)11 WorkflowRun (org.jenkinsci.plugins.workflow.job.WorkflowRun)8 User (hudson.model.User)5 MockFolder (org.jvnet.hudson.test.MockFolder)5 Queue (hudson.model.Queue)4 FreeStyleProject (hudson.model.FreeStyleProject)3 OneShotEvent (hudson.util.OneShotEvent)2 SSEConnection (io.jenkins.blueocean.events.sse.SSEConnection)2 Date (java.util.Date)2