use of hudson.model.FreeStyleProject in project blueocean-plugin by jenkinsci.
the class ArtifactContainerImplTest method testArtifactsListing.
@Test
public void testArtifactsListing() throws Exception {
FreeStyleProject p = j.createFreeStyleProject(JOB_NAME);
p.getBuildersList().add(new Shell("#!/bin/bash\nmkdir -p test/me/out; cd test/me/out; touch {0..105}.txt"));
p.getPublishersList().add(new ArtifactArchiver("**/*"));
Run r = p.scheduleBuild2(0).waitForStart();
r = j.waitForCompletion(r);
List artifacts = request().get("/organizations/jenkins/pipelines/" + JOB_NAME + "/runs/" + r.getId() + "/artifacts").build(List.class);
Assert.assertEquals(100, artifacts.size());
Assert.assertEquals(0, ((Map) artifacts.get(0)).get("size"));
Assert.assertEquals("test/me/out/0.txt", ((Map) artifacts.get(0)).get("path"));
Assert.assertEquals("/job/artifactTest/1/artifact/test/me/out/0.txt", ((Map) artifacts.get(0)).get("url"));
}
use of hudson.model.FreeStyleProject in project blueocean-plugin by jenkinsci.
the class BlueOceanWebURLBuilderTest method test_freestyle.
@Test
public void test_freestyle() throws IOException, ExecutionException, InterruptedException {
MockFolder folder1 = jenkinsRule.createFolder("folder1");
MockFolder folder2 = folder1.createProject(MockFolder.class, "folder two with spaces");
FreeStyleProject freestyleProject = folder2.createProject(FreeStyleProject.class, "freestyle with spaces");
String blueOceanURL;
blueOceanURL = BlueOceanWebURLBuilder.toBlueOceanURL(freestyleProject);
assertURL("blue/organizations/jenkins/folder1%2Ffolder%20two%20with%20spaces%2Ffreestyle%20with%20spaces", blueOceanURL);
FreeStyleBuild run = freestyleProject.scheduleBuild2(0).get();
blueOceanURL = BlueOceanWebURLBuilder.toBlueOceanURL(run);
assertURL("blue/organizations/jenkins/folder1%2Ffolder%20two%20with%20spaces%2Ffreestyle%20with%20spaces/detail/freestyle%20with%20spaces/1", blueOceanURL);
}
use of hudson.model.FreeStyleProject in project blueocean-plugin by jenkinsci.
the class StatePreloaderTest method test.
@Test
public void test() throws IOException, ExecutionException, InterruptedException, SAXException {
// Create a project and run a build on it.
FreeStyleProject freestyleProject = j.createProject(FreeStyleProject.class, "freestyle");
FreeStyleBuild run = freestyleProject.scheduleBuild2(0).get();
j.waitForCompletion(run);
// Lets request the activity page for that project. The page should
// contain some prefetched javascript for the pipeline
// details + the runs on the page
String projectBlueUrl = j.jenkins.getRootUrl() + BlueOceanWebURLBuilder.toBlueOceanURL(freestyleProject);
Document doc = Jsoup.connect(projectBlueUrl + "/activity/").get();
String script = doc.select("head script").toString();
Assert.assertTrue(script.contains(String.format("setState('prefetchdata.%s',", PipelineStatePreloader.class.getSimpleName())));
Assert.assertTrue(script.contains(String.format("setState('prefetchdata.%s',", PipelineActivityStatePreloader.class.getSimpleName())));
Assert.assertTrue(script.contains("\"restUrl\":\"/blue/rest/organizations/jenkins/pipelines/freestyle/activities/?start=0&limit=26\""));
}
use of hudson.model.FreeStyleProject in project promoted-builds-plugin by jenkinsci.
the class PromotionsDslContextExtensionTest method testShouldGenerateTheDefindedComplexJob.
@Test
public void testShouldGenerateTheDefindedComplexJob() throws Exception {
// Given
String dsl = FileUtils.readFileToString(new File("src/test/resources/complex-example-dsl.groovy"));
FreeStyleProject seedJob = createFreeStyleProject();
seedJob.getBuildersList().add(new ExecuteDslScripts(new ExecuteDslScripts.ScriptLocation(Boolean.TRUE.toString(), null, dsl), false, RemovedJobAction.DELETE));
// When
QueueTaskFuture<FreeStyleBuild> scheduleBuild2 = seedJob.scheduleBuild2(0);
// Then
assertBuildStatusSuccess(scheduleBuild2);
}
use of hudson.model.FreeStyleProject in project promoted-builds-plugin by jenkinsci.
the class PromotionsDslContextExtensionTest method testShouldGenerateTheDefindedJob.
@Test
public void testShouldGenerateTheDefindedJob() throws Exception {
// Given
String dsl = FileUtils.readFileToString(new File("src/test/resources/example-dsl.groovy"));
FreeStyleProject seedJob = createFreeStyleProject();
seedJob.getBuildersList().add(new ExecuteDslScripts(new ExecuteDslScripts.ScriptLocation(Boolean.TRUE.toString(), null, dsl), false, RemovedJobAction.DELETE));
// When
QueueTaskFuture<FreeStyleBuild> scheduleBuild2 = seedJob.scheduleBuild2(0);
// Then
assertBuildStatusSuccess(scheduleBuild2);
}
Aggregations