Package hudson.model.Cause

Examples of hudson.model.Cause.UserCause


        User u = User.get("kutzi");
        u.setFullName("Christoph Kutzinski");
        Mailer.UserProperty prop = new Mailer.UserProperty("kutzi@xxx.com");
        u.addProperty(prop);

        UserCause cause = new MockUserCause("kutzi");

        FreeStyleBuild build = project.scheduleBuild2(0, cause).get();
        j.assertBuildStatusSuccess(build);

        Mailbox mailbox = Mailbox.get("kutzi@xxx.com");
View Full Code Here


        SCMTrigger t = new SCMTrigger("@daily");
        t.start(p,true);
        p.addTrigger(t);

        // Start one build to block others
        assertTrue(p.scheduleBuild(new UserCause()));
        buildStarted.block(); // wait for the build to really start

        // Schedule a new build, and trigger it many ways while it sits in queue
        Future<FreeStyleBuild> fb = p.scheduleBuild2(0, new UserCause());
        assertNotNull(fb);
        assertFalse(p.scheduleBuild(new SCMTriggerCause("First poll")));
        assertFalse(p.scheduleBuild(new SCMTriggerCause("Second poll")));
        assertFalse(p.scheduleBuild(new SCMTriggerCause("Third poll")));
View Full Code Here

    Project projectB = createFreeStyleProject("projectB");
    projectB.getBuildersList().add(builder);
    projectB.setQuietPeriod(1);
    hudson.rebuildDependencyGraph();

    projectA.scheduleBuild2(0, new UserCause(), new ParametersAction(
      new StringParameterValue("KEY", "value"))).get();
    hudson.getQueue().getItem(projectB).getFuture().get();

    assertNotNull("builder should record environment", builder.getEnvVars());
    assertEquals("value", builder.getEnvVars().get("KEY"));
View Full Code Here

    Project<?,?> projectB = createFreeStyleProject("projectB");
    projectB.getBuildersList().add(builder);
    projectB.setQuietPeriod(1);
    hudson.rebuildDependencyGraph();

    projectA.scheduleBuild2(0, new UserCause()).get();
    assertEquals(pWithoutParameters, hudson.getQueue().contains(projectB));
    List<String> log = projectA.getLastBuild().getLog(20);
    for (String string : log) {
      System.out.println(string);
    }
View Full Code Here

    Project<?,?> projectB = createFreeStyleProject("projectB");
    projectB.getBuildersList().add(builder);
    projectB.setQuietPeriod(1);
    hudson.rebuildDependencyGraph();

    projectA.scheduleBuild2(0, new UserCause()).get();
    assertTrue(hudson.getQueue().contains(projectB));
    List<String> log = projectA.getLastBuild().getLog(20);
    for (String string : log) {
      System.out.println(string);
    }
View Full Code Here

    // Just to make sure they differ from projectA's build numbers.
    projectB.updateNextBuildNumber(3);

    int expectedBuildNumber = projectB.getNextBuildNumber();
    projectA.scheduleBuild2(0, new UserCause()).get();

    Run buildB1 = projectB.getBuildByNumber(expectedBuildNumber);
    EnvVars envVars = builder.getEnvVars();
    //System.out.println("envVars: " + envVars);

    assertThat(envVars, notNullValue());
    assertThat(envVars, hasEntry("LAST_TRIGGERED_JOB_NAME", "projectB"));
    assertThat(envVars, hasEntry("TRIGGERED_BUILD_NUMBER_projectB", Integer.toString(expectedBuildNumber)));
    assertThat(envVars, hasEntry("TRIGGERED_BUILD_RESULT_projectB", buildB1.getResult().toString()));
    assertThat(envVars, hasEntry("TRIGGERED_BUILD_RESULT_projectB_RUN_" + Integer.toString(expectedBuildNumber), buildB1.getResult().toString()));
    assertThat(envVars, hasEntry("TRIGGERED_BUILD_RUN_COUNT_projectB", "1"));
    assertThat(envVars, hasEntry("TRIGGERED_JOB_NAMES", "projectB"));

    // The below test for expectedBuildNumber is meaningless if the
    // value doesn't update, though it should always update.
    assertThat(projectB.getNextBuildNumber(), is(not(expectedBuildNumber)));

    expectedBuildNumber = projectB.getNextBuildNumber();
    AbstractBuild<?, ?> buildA2 = projectA.scheduleBuild2(0, new UserCause()).get();
    envVars = builder.getEnvVars();

    assertThat(envVars, notNullValue());
    assertThat(envVars, hasEntry("LAST_TRIGGERED_JOB_NAME", "projectB"));
    assertThat(envVars, hasEntry("TRIGGERED_BUILD_NUMBER_projectB", Integer.toString(expectedBuildNumber)));
View Full Code Here

    hudson.rebuildDependencyGraph();
    // Just to make sure they differ from projectA's build numbers.
    projectB.updateNextBuildNumber(3);

    int expectedBuildNumber = projectB.getNextBuildNumber();
    projectA.scheduleBuild2(0, new UserCause()).get();

    EnvVars envVars = builder.getEnvVars();
    //System.out.println("envVars: " + envVars);

    assertThat(envVars, notNullValue());
    assertThat(envVars, hasEntry("LAST_TRIGGERED_JOB_NAME", testNameResult));
    assertThat(envVars, hasEntry("TRIGGERED_BUILD_NUMBER_" + testNameResult, Integer.toString(expectedBuildNumber)));

    // The below test for expectedBuildNumber is meaningless if the
    // value doesn't update, though it should always update.
    assertThat(projectB.getNextBuildNumber(), is(not(expectedBuildNumber)));

    expectedBuildNumber = projectB.getNextBuildNumber();
    projectA.scheduleBuild2(0, new UserCause()).get();
    envVars = builder.getEnvVars();

    assertThat(envVars, notNullValue());
    assertThat(envVars, hasEntry("LAST_TRIGGERED_JOB_NAME", testNameResult));
    assertThat(envVars, hasEntry("TRIGGERED_BUILD_NUMBER_" + testNameResult, Integer.toString(expectedBuildNumber)));
View Full Code Here

    hudson.rebuildDependencyGraph();

    int firstExpectedBuildNumberB = projectB.getNextBuildNumber();
    int firstExpectedBuildNumberC = projectC.getNextBuildNumber();

    projectA.scheduleBuild2(0, new UserCause()).get();
    waitUntilNoActivity();

    EnvVars envVars = builder.getEnvVars();
    //System.out.println("envVars: " + envVars);
View Full Code Here

    projectB.updateNextBuildNumber(3);
    projectC.updateNextBuildNumber(20);

    int expectedBuildNumber = projectB.getNextBuildNumber();
    int expectedBuildNumberC = projectC.getNextBuildNumber();
    projectA.scheduleBuild2(0, new UserCause()).get();
    waitUntilNoActivity();

    Run buildB1 = projectB.getBuildByNumber(expectedBuildNumber);
    Run buildC1 = projectC.getBuildByNumber(expectedBuildNumberC);
    EnvVars envVars = builder.getEnvVars();
View Full Code Here

        ));
    projectB.getBuildersList().add(builder);
    projectB.setQuietPeriod(1);
    hudson.rebuildDependencyGraph();

    String log = getLog((Run)projectA.scheduleBuild2(0, new UserCause(),
      new ParametersAction(new StringParameterValue("KEY3", "value3"))).get());
    Queue.Item q = hudson.getQueue().getItem(projectB);
    assertNotNull("projectB should be triggered: " + log, q);
    q.getFuture().get();
    assertNotNull("builder should record environment", builder.getEnvVars());
    assertEquals("value1", builder.getEnvVars().get("KEY1"));
    assertEquals("value2", builder.getEnvVars().get("KEY2"));
    assertEquals("value3", builder.getEnvVars().get("KEY3"));

    projectA.scheduleBuild2(0, new UserCause(), new ParametersAction(new StringParameterValue("key1", "value3"))).get();
    hudson.getQueue().getItem(projectB).getFuture().get();
    assertEquals("value3", builder.getEnvVars().get("KEY1"));
    assertEquals("value2", builder.getEnvVars().get("KEY2"));
  }
View Full Code Here

TOP

Related Classes of hudson.model.Cause.UserCause

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.