Search in sources :

Example 11 with ManualCondition

use of hudson.plugins.promoted_builds.conditions.ManualCondition in project promoted-builds-plugin by jenkinsci.

the class PromotionTargetActionTest method test1.

/**
     * When a project is created, built, and renamed, then the old build is created,
     * that results in NPE.
     */
public void test1() throws Exception {
    FreeStyleProject up = createFreeStyleProject("up");
    up.setCustomWorkspace(createTmpDir().getPath());
    // promote if the downstream passes
    JobPropertyImpl promotion = new JobPropertyImpl(up);
    up.addProperty(promotion);
    PromotionProcess proc = promotion.addProcess("promo");
    proc.conditions.add(new ManualCondition());
    FreeStyleBuild b = assertBuildStatusSuccess(up.scheduleBuild2(0));
    b.addAction(new ManualApproval(proc.getName(), Collections.<ParameterValue>emptyList()));
    b.save();
    // check for promotion
    Promotion p = assertBuildStatusSuccess(proc.considerPromotion2(b));
    up.renameTo("up2");
    assertSame(b, p.getTarget());
}
Also used : ManualCondition(hudson.plugins.promoted_builds.conditions.ManualCondition) ManualApproval(hudson.plugins.promoted_builds.conditions.ManualCondition.ManualApproval) ParameterValue(hudson.model.ParameterValue) FreeStyleBuild(hudson.model.FreeStyleBuild) FreeStyleProject(hudson.model.FreeStyleProject)

Example 12 with ManualCondition

use of hudson.plugins.promoted_builds.conditions.ManualCondition in project promoted-builds-plugin by jenkinsci.

the class Status method isManuallyApproved.

public boolean isManuallyApproved() {
    final PromotionProcess process = getProcess();
    if (process == null) {
        // Should not be processed
        return false;
    }
    ManualCondition manualCondition = (ManualCondition) process.getPromotionCondition(ManualCondition.class.getName());
    return manualCondition != null;
}
Also used : ManualCondition(hudson.plugins.promoted_builds.conditions.ManualCondition)

Aggregations

ManualCondition (hudson.plugins.promoted_builds.conditions.ManualCondition)12 ParameterValue (hudson.model.ParameterValue)9 FreeStyleBuild (hudson.model.FreeStyleBuild)6 FreeStyleProject (hudson.model.FreeStyleProject)6 StringParameterDefinition (hudson.model.StringParameterDefinition)6 JobPropertyImpl (hudson.plugins.promoted_builds.JobPropertyImpl)6 PromotionProcess (hudson.plugins.promoted_builds.PromotionProcess)6 ManualApproval (hudson.plugins.promoted_builds.conditions.ManualCondition.ManualApproval)6 Descriptor (hudson.model.Descriptor)5 PromotedBuildAction (hudson.plugins.promoted_builds.PromotedBuildAction)5 ParameterDefinition (hudson.model.ParameterDefinition)4 Promotion (hudson.plugins.promoted_builds.Promotion)4 ArrayList (java.util.ArrayList)4 Test (org.junit.Test)4 StringParameterValue (hudson.model.StringParameterValue)3 DescriptorImpl (hudson.plugins.promoted_builds.JobPropertyImpl.DescriptorImpl)3 HtmlElement (com.gargoylesoftware.htmlunit.html.HtmlElement)2 HtmlForm (com.gargoylesoftware.htmlunit.html.HtmlForm)2 HtmlPage (com.gargoylesoftware.htmlunit.html.HtmlPage)2 EnvVars (hudson.EnvVars)2