use of org.jenkinsci.plugins.workflow.multibranch.WorkflowMultiBranchProject in project blueocean-plugin by jenkinsci.
the class PipelineScmTest method unauthenticatedUserContentUpdateShouldFail.
@Test
public void unauthenticatedUserContentUpdateShouldFail() throws IOException, ExecutionException, InterruptedException {
WorkflowMultiBranchProject mp = j.createProject(WorkflowMultiBranchProject.class, "mbp");
mp.setDisplayName("My MBP");
new RequestBuilder(baseUrl).status(401).data(ImmutableMap.of("content", ImmutableMap.of("data", "Hello World Again!"))).put("/organizations/jenkins/pipelines/mbp/scm/content").build(Map.class);
}
use of org.jenkinsci.plugins.workflow.multibranch.WorkflowMultiBranchProject in project blueocean-plugin by jenkinsci.
the class PipelineScmTest method unauthenticatedUserContentAccessShouldFail.
@Test
public void unauthenticatedUserContentAccessShouldFail() throws IOException, ExecutionException, InterruptedException {
WorkflowMultiBranchProject mp = j.createProject(WorkflowMultiBranchProject.class, "mbp");
mp.setDisplayName("My MBP");
new RequestBuilder(baseUrl).status(401).get("/organizations/jenkins/pipelines/mbp/scm/content").build(Map.class);
}
use of org.jenkinsci.plugins.workflow.multibranch.WorkflowMultiBranchProject in project blueocean-plugin by jenkinsci.
the class JobAnalyticsTest method createMultiBranch.
private void createMultiBranch(GitSampleRepoRule rule) throws Exception {
WorkflowMultiBranchProject mp = j.createProject(WorkflowMultiBranchProject.class, UUID.randomUUID().toString());
mp.getSourcesList().add(new BranchSource(new GitSCMSource(null, rule.toString(), "", "*", "", false), new DefaultBranchPropertyStrategy(new BranchProperty[0])));
mp.save();
mp.scheduleBuild2(0).getFuture().get();
mp.getIndexing().getLogText().writeLogTo(0, System.out);
j.waitUntilNoActivity();
WorkflowJob master = mp.getItemByBranchName("master");
assertNotNull(master);
WorkflowRun lastBuild = master.getLastBuild();
assertNotNull(lastBuild);
assertEquals(Result.SUCCESS, lastBuild.getResult());
}
use of org.jenkinsci.plugins.workflow.multibranch.WorkflowMultiBranchProject in project blueocean-plugin by jenkinsci.
the class MultiBranchTest method getMultiBranchPipelineRunStages.
@Test
public void getMultiBranchPipelineRunStages() 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, "master");
j.waitUntilNoActivity();
WorkflowRun b1 = p.getLastBuild();
assertEquals(1, b1.getNumber());
assertEquals(3, mp.getItems().size());
j.waitForCompletion(b1);
List<Map> nodes = get("/organizations/jenkins/pipelines/p/branches/master/runs/1/nodes", List.class);
Assert.assertEquals(3, nodes.size());
}
use of org.jenkinsci.plugins.workflow.multibranch.WorkflowMultiBranchProject in project blueocean-plugin by jenkinsci.
the class MultiBranchTest method getMultiBranchPipeline.
@Test
public void getMultiBranchPipeline() throws IOException, ExecutionException, InterruptedException {
Assume.assumeTrue(runAllTests());
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());
}
mp.scheduleBuild2(0).getFuture().get();
Map resp = get("/organizations/jenkins/pipelines/p/");
validateMultiBranchPipeline(mp, resp, 3);
List<String> names = (List<String>) resp.get("branchNames");
IsArrayContainingInAnyOrder.arrayContainingInAnyOrder(names, branches);
List<Map> br = get("/organizations/jenkins/pipelines/p/branches", List.class);
List<String> branchNames = new ArrayList<>();
List<Integer> weather = new ArrayList<>();
for (Map b : br) {
branchNames.add((String) b.get("name"));
weather.add((int) b.get("weatherScore"));
}
for (String n : branches) {
assertTrue(branchNames.contains(n));
}
for (int s : weather) {
assertEquals(100, s);
}
}
Aggregations