Search in sources :

Example 66 with FreeStyleProject

use of hudson.model.FreeStyleProject in project promoted-builds-plugin by jenkinsci.

the class ConfigurationRoundtripTest method testLoad.

@LocalData
@Bug(17341)
public void testLoad() throws Exception {
    FreeStyleProject j = jenkins.getItemByFullName("j", FreeStyleProject.class);
    assertNotNull(j);
    Promotion p = j.getProperty(JobPropertyImpl.class).getItem("OK").getBuildByNumber(1);
    assertNotNull(p);
}
Also used : FreeStyleProject(hudson.model.FreeStyleProject) LocalData(org.jvnet.hudson.test.recipes.LocalData) Bug(org.jvnet.hudson.test.Bug)

Example 67 with FreeStyleProject

use of hudson.model.FreeStyleProject in project promoted-builds-plugin by jenkinsci.

the class KeepBuildForeverActionTest method createProject.

private FreeStyleProject createProject(String name) throws Exception {
    FreeStyleProject project = createFreeStyleProject(name);
    project.getPublishersList().replaceBy(createFingerprinters());
    return project;
}
Also used : FreeStyleProject(hudson.model.FreeStyleProject)

Example 68 with FreeStyleProject

use of hudson.model.FreeStyleProject in project promoted-builds-plugin by jenkinsci.

the class LastBuildPromotionStatusColumnTest method shouldDisplayStars.

@Test
public void shouldDisplayStars() throws Exception {
    // Create project
    FreeStyleProject p = j.createFreeStyleProject();
    JobPropertyImpl base = new JobPropertyImpl(p);
    p.addProperty(base);
    PromotionProcess foo = base.addProcess("foo");
    foo.icon = "star-blue";
    view.add(p);
    // Promote a build
    FreeStyleBuild b1 = j.assertBuildStatusSuccess(p.scheduleBuild2(0));
    foo.promote(b1, new Cause.UserIdCause(), new ManualPromotionBadge());
    // Check column contents
    LastBuildPromotionStatusColumn retrieved = view.getColumns().get(LastBuildPromotionStatusColumn.class);
    assertEquals("Columns should be same", column, retrieved);
    List<String> promotionIcons = retrieved.getPromotionIcons(p);
    assertEquals("Expected only 1 promotion icon", 1, promotionIcons.size());
    assertTrue("Promotion should assign the blue star", promotionIcons.get(0).contains("star-blue"));
}
Also used : Cause(hudson.model.Cause) FreeStyleBuild(hudson.model.FreeStyleBuild) FreeStyleProject(hudson.model.FreeStyleProject) Test(org.junit.Test)

Example 69 with FreeStyleProject

use of hudson.model.FreeStyleProject in project promoted-builds-plugin by jenkinsci.

the class ItemPathResolverTest method shouldRetainTheLegacyBehaviorIfEnabled.

@Test
public void shouldRetainTheLegacyBehaviorIfEnabled() throws Exception {
    assertsPath("prj", null, projectInTop);
    // FOO exists on both top level and within the folder
    final MockFolder folder = rule.createFolder("F");
    final FreeStyleProject prjInRoot = rule.createFreeStyleProject("FOO");
    final FreeStyleProject prjInFolder = folder.createProject(FreeStyleProject.class, "FOO");
    // Raw addressing with different roots, should always point to the root
    assertsPath("FOO", null, prjInRoot);
    assertsPath("FOO", prjInRoot, prjInRoot);
    assertsPath("FOO", folder, prjInRoot);
    assertsPath("FOO", prjInFolder, prjInRoot);
}
Also used : MockFolder(org.jvnet.hudson.test.MockFolder) FreeStyleProject(hudson.model.FreeStyleProject) Test(org.junit.Test)

Example 70 with FreeStyleProject

use of hudson.model.FreeStyleProject in project blueocean-plugin by jenkinsci.

the class PipelineApiTest method findPipelineRunsForAPipelineTest.

@Test
public void findPipelineRunsForAPipelineTest() throws Exception {
    FreeStyleProject p1 = j.createFreeStyleProject("pipeline1");
    FreeStyleProject p2 = j.createFreeStyleProject("pipeline2");
    p1.getBuildersList().add(new Shell("echo hello!\nsleep 1"));
    p2.getBuildersList().add(new Shell("echo hello!\nsleep 1"));
    Stack<FreeStyleBuild> builds = new Stack<FreeStyleBuild>();
    FreeStyleBuild b11 = p1.scheduleBuild2(0).get();
    FreeStyleBuild b12 = p1.scheduleBuild2(0).get();
    builds.push(b11);
    builds.push(b12);
    j.assertBuildStatusSuccess(b11);
    j.assertBuildStatusSuccess(b12);
    List<Map> resp = get("/search?q=type:run;organization:jenkins;pipeline:pipeline1", List.class);
    assertEquals(builds.size(), resp.size());
    for (int i = 0; i < builds.size(); i++) {
        Map p = resp.get(i);
        FreeStyleBuild b = builds.pop();
        validateRun(b, p);
    }
}
Also used : Shell(hudson.tasks.Shell) FreeStyleBuild(hudson.model.FreeStyleBuild) FreeStyleProject(hudson.model.FreeStyleProject) Map(java.util.Map) ImmutableMap(com.google.common.collect.ImmutableMap) Stack(java.util.Stack) Test(org.junit.Test)

Aggregations

FreeStyleProject (hudson.model.FreeStyleProject)88 Test (org.junit.Test)61 FreeStyleBuild (hudson.model.FreeStyleBuild)42 Shell (hudson.tasks.Shell)21 Map (java.util.Map)20 ImmutableMap (com.google.common.collect.ImmutableMap)17 JobPropertyImpl (hudson.plugins.promoted_builds.JobPropertyImpl)14 PromotionProcess (hudson.plugins.promoted_builds.PromotionProcess)13 ArrayList (java.util.ArrayList)12 PrepareForTest (org.powermock.core.classloader.annotations.PrepareForTest)11 StringParameterDefinition (hudson.model.StringParameterDefinition)10 MockFolder (org.jvnet.hudson.test.MockFolder)10 List (java.util.List)9 PromotedBuildAction (hudson.plugins.promoted_builds.PromotedBuildAction)8 ImmutableList (com.google.common.collect.ImmutableList)7 FreeStyleProjectMock (hudson.model.FreeStyleProjectMock)7 Promotion (hudson.plugins.promoted_builds.Promotion)7 ParametersDefinitionProperty (hudson.model.ParametersDefinitionProperty)6 Run (hudson.model.Run)6 ManualCondition (hudson.plugins.promoted_builds.conditions.ManualCondition)6