Search in sources :

Example 6 with Bug

use of org.jvnet.hudson.test.Bug in project hudson-2.x by hudson.

the class CronTabTest method testFloor4.

@Bug(8401)
public void testFloor4() throws Exception {
    // conflict between DoM and DoW. In this we need to find a day that's the first day of a month and Sunday in 2010
    CronTab x = new CronTab("0 0 1 * 0");
    Calendar c = new GregorianCalendar(2011, 0, 1, 15, 55);
    c.setFirstDayOfWeek(MONDAY);
    // the last such day in 2010 is Aug 1st
    GregorianCalendar answer = new GregorianCalendar(2010, 7, 1, 0, 0);
    answer.setFirstDayOfWeek(MONDAY);
    compare(answer, x.floor(c));
}
Also used : Calendar(java.util.Calendar) GregorianCalendar(java.util.GregorianCalendar) GregorianCalendar(java.util.GregorianCalendar) Bug(org.jvnet.hudson.test.Bug)

Example 7 with Bug

use of org.jvnet.hudson.test.Bug in project promoted-builds-plugin by jenkinsci.

the class SelfPromotionTest method testPromotionEnvironmentShouldIncludeTargetParameters.

@Bug(22679)
public // @Bug(34826) // Can be reproduced in Jenkins 2.3 +
void testPromotionEnvironmentShouldIncludeTargetParameters() throws Exception {
    String paramName = "param";
    FreeStyleProject p = createFreeStyleProject();
    p.addProperty(new ParametersDefinitionProperty(new StringParameterDefinition(paramName, "")));
    // promote if the downstream passes
    JobPropertyImpl promotion = new JobPropertyImpl(p);
    p.addProperty(promotion);
    PromotionProcess promo1 = promotion.addProcess("promo1");
    promo1.conditions.add(new SelfPromotionCondition(false));
    // ensure that the data survives the roundtrip
    configRoundtrip(p);
    // rebind
    promotion = p.getProperty(JobPropertyImpl.class);
    promo1 = promotion.getItem("promo1");
    String paramValue = "someString";
    FreeStyleBuild b = assertBuildStatusSuccess(p.scheduleBuild2(0, new Cause.UserCause(), new ParametersAction(new StringParameterValue(paramName, paramValue))));
    // internally, the promotion is still an asynchronous process. It just happens
    // right away after the build is complete.
    Thread.sleep(1000);
    // verify that the promotion's environment contains the parameter from the target build.
    Promotion pb = promo1.getBuildByNumber(1);
    assertEquals(paramValue, pb.getEnvironment(TaskListener.NULL).get(paramName, null));
}
Also used : StringParameterDefinition(hudson.model.StringParameterDefinition) ParametersDefinitionProperty(hudson.model.ParametersDefinitionProperty) PromotionProcess(hudson.plugins.promoted_builds.PromotionProcess) StringParameterValue(hudson.model.StringParameterValue) FreeStyleBuild(hudson.model.FreeStyleBuild) FreeStyleProject(hudson.model.FreeStyleProject) JobPropertyImpl(hudson.plugins.promoted_builds.JobPropertyImpl) Promotion(hudson.plugins.promoted_builds.Promotion) ParametersAction(hudson.model.ParametersAction) Bug(org.jvnet.hudson.test.Bug)

Example 8 with Bug

use of org.jvnet.hudson.test.Bug 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)

Aggregations

Bug (org.jvnet.hudson.test.Bug)8 FreeStyleProject (hudson.model.FreeStyleProject)5 JobPropertyImpl (hudson.plugins.promoted_builds.JobPropertyImpl)4 PromotionProcess (hudson.plugins.promoted_builds.PromotionProcess)4 DownstreamPassCondition (hudson.plugins.promoted_builds.conditions.DownstreamPassCondition)3 Test (org.junit.Test)3 HtmlPage (com.gargoylesoftware.htmlunit.html.HtmlPage)2 FreeStyleBuild (hudson.model.FreeStyleBuild)2 ParametersAction (hudson.model.ParametersAction)2 ParametersDefinitionProperty (hudson.model.ParametersDefinitionProperty)2 StringParameterDefinition (hudson.model.StringParameterDefinition)2 StringParameterValue (hudson.model.StringParameterValue)2 PromotedBuildAction (hudson.plugins.promoted_builds.PromotedBuildAction)2 Promotion (hudson.plugins.promoted_builds.Promotion)2 Status (hudson.plugins.promoted_builds.Status)2 InheritanceProjectsPair (hudson.plugins.promoted_builds.inheritance.helpers.InheritanceProjectsPair)2 BuildTrigger (hudson.tasks.BuildTrigger)2 JavadocArchiver (hudson.tasks.JavadocArchiver)2 InheritanceBuild (hudson.plugins.project_inheritance.projects.InheritanceBuild)1 SelfPromotionCondition (hudson.plugins.promoted_builds.conditions.SelfPromotionCondition)1