use of org.kohsuke.stapler.AcceptHeader in project blueocean-plugin by jenkinsci.
the class PipelineApiTest method getPipelineJobRunsLogTest.
@Test
public void getPipelineJobRunsLogTest() throws Exception {
WorkflowJob job1 = j.jenkins.createProject(WorkflowJob.class, "pipeline1");
job1.setDefinition(new CpsFlowDefinition("" + "node {" + " stage ('Build1'); " + " echo ('Building'); " + " stage ('Test1'); " + " echo ('Testing'); " + "}"));
WorkflowRun b1 = job1.scheduleBuild2(0).get();
j.assertBuildStatusSuccess(b1);
HttpResponse<String> response = get("/organizations/jenkins/pipelines/pipeline1/runs/" + b1.getId() + "/log?start=0", 200, "text/html", HttpResponse.class);
AcceptHeader acceptHeader = new AcceptHeader(response.getHeaders().getFirst("Content-Type"));
Assert.assertNotNull(acceptHeader.select("text/plain"));
int size = Integer.parseInt(response.getHeaders().getFirst("X-Text-Size"));
System.out.println(response.getBody());
Assert.assertTrue(size > 0);
}
Aggregations