Package hudson.plugins.parameterizedtrigger

Examples of hudson.plugins.parameterizedtrigger.BlockableBuildTriggerConfig


  public void test() throws Exception {
    Project<?, ?> projectA = createFreeStyleProject("projectA");
    List<AbstractBuildParameters> buildParameters = new ArrayList<AbstractBuildParameters>();
    buildParameters.add(new CurrentBuildParameters());
    BlockingBehaviour neverFail = new BlockingBehaviour("never", "never", "never");
    BlockableBuildTriggerConfig config = new BlockableBuildTriggerConfig("projectB", neverFail, buildParameters);
    projectA.getBuildersList().add(new TriggerBuilder(config));

    CaptureEnvironmentBuilder builder = new CaptureEnvironmentBuilder();
    projectA.getBuildersList().add(builder);
View Full Code Here


    buildParameters.add(new CurrentBuildParameters());
    BlockingBehaviour neverFail = new BlockingBehaviour("never", "never", "never");

    String testName = "odd£()+}{-=~chars-10";
    String testNameResult = "odd_chars_10";
    BlockableBuildTriggerConfig config = new BlockableBuildTriggerConfig(testName, neverFail, buildParameters);
    projectA.getBuildersList().add(new TriggerBuilder(config));

    CaptureEnvironmentBuilder builder = new CaptureEnvironmentBuilder();
    projectA.getBuildersList().add(builder);
View Full Code Here

    Project<?, ?> projectA = createFreeStyleProject();
    Project projectB = createFreeStyleProject(testNameResult);
    Project projectC = createFreeStyleProject(testNameResult2);
    projectA.getBuildersList().add(
            new TriggerBuilder(
            new BlockableBuildTriggerConfig(testNameResult + "," + testNameResult2,
            new BlockingBehaviour(Result.FAILURE, Result.UNSTABLE, Result.FAILURE),
            ImmutableList.<AbstractBuildParameterFactory>of(new CounterBuildParameterFactory("0", Integer.toString(buildsToTest - 1), "1", "TEST=COUNT$COUNT")),
            Collections.<AbstractBuildParameters>emptyList())));

    CaptureEnvironmentBuilder builder = new CaptureEnvironmentBuilder();
View Full Code Here

  public void testNonBlocking() throws Exception {
    Project<?, ?> projectA = createFreeStyleProject("projectA");
    List<AbstractBuildParameters> buildParameters = new ArrayList<AbstractBuildParameters>();
    buildParameters.add(new CurrentBuildParameters());
    BlockingBehaviour neverFail = new BlockingBehaviour("never", "never", "never");
    BlockableBuildTriggerConfig config = new BlockableBuildTriggerConfig("projectB", neverFail, buildParameters);

    BlockableBuildTriggerConfig nonBlockingConfig = new BlockableBuildTriggerConfig("projectC", null, buildParameters);
    projectA.getBuildersList().add(new TriggerBuilder(config, nonBlockingConfig));

    CaptureEnvironmentBuilder builder = new CaptureEnvironmentBuilder();
    projectA.getBuildersList().add(builder);
View Full Code Here

  public void testProjectDeleted() throws Exception {
      FreeStyleProject p1 = createFreeStyleProject();
      FreeStyleProject p2 = createFreeStyleProject();
     
      // Blocked build
      p1.getBuildersList().add(new TriggerBuilder(new BlockableBuildTriggerConfig(
              p2.getName(),
              new BlockingBehaviour(
                      Result.FAILURE,
                      Result.UNSTABLE,
                      Result.FAILURE
              ),
              Arrays.<AbstractBuildParameters>asList(
                      new PredefinedBuildParameters("test=test")
              )
      )));
     
      FreeStyleBuild blockedBuild = p1.scheduleBuild2(0).get();
      assertBuildStatusSuccess(blockedBuild);
     
      // Unblocked build
      p1.getBuildersList().clear();
      p1.getBuildersList().add(new TriggerBuilder(new BlockableBuildTriggerConfig(
              p2.getName(),
              null,
              Arrays.<AbstractBuildParameters>asList(
                      new PredefinedBuildParameters("test=test")
              )
View Full Code Here

import jenkins.model.Jenkins;

public class TriggerBuilderTest extends HudsonTestCase {

    private BlockableBuildTriggerConfig createTriggerConfig(String projects) {
        return new BlockableBuildTriggerConfig(projects, new BlockingBehaviour("never", "never", "never"), null);
    }
View Full Code Here

        createFreeStyleProject("project2");
        createFreeStyleProject("project3");

        Project<?, ?> triggerProject = createFreeStyleProject("projectA");

        BlockableBuildTriggerConfig config = new BlockableBuildTriggerConfig("project1, project2, project3", null, null);
        TriggerBuilder triggerBuilder = new TriggerBuilder(config);

        triggerProject.getBuildersList().add(triggerBuilder);

        triggerProject.scheduleBuild2(0).get();
View Full Code Here

        BlockingBehaviour blockingBehaviour = new BlockingBehaviour(Result.FAILURE, Result.UNSTABLE, Result.FAILURE);
        ImmutableList<AbstractBuildParameterFactory> buildParameter = ImmutableList.<AbstractBuildParameterFactory>of(new CounterBuildParameterFactory("0","2","1", "TEST=COUNT$COUNT"));
        List<AbstractBuildParameters> emptyList = Collections.<AbstractBuildParameters>emptyList();

        BlockableBuildTriggerConfig bBTConfig = new BlockableBuildTriggerConfig("project1, project2, project3", blockingBehaviour, buildParameter, emptyList);

        triggerProject.getBuildersList().add(new TriggerBuilder(bBTConfig));

        triggerProject.scheduleBuild2(0).get();
View Full Code Here

                new StringParameterDefinition("PARAM", "downstream1,downstream2")
        ));

        FreeStyleProject downstream1 = createFreeStyleProject("downstream1");
        FreeStyleProject downstream2 = createFreeStyleProject("downstream2");
        BlockableBuildTriggerConfig config = new BlockableBuildTriggerConfig("${PARAM}", null, null);
        TriggerBuilder triggerBuilder = new TriggerBuilder(config);

        upstream.getBuildersList().add(triggerBuilder);

        FreeStyleBuild upstreamBuild = upstream.scheduleBuild2(0, new Cause.UserCause(), new ParametersAction(new StringParameterValue("PARAM", "downstream1,downstream2"))).get();
View Full Code Here

        // Downstream project is triggered with parameters of each child.
        {
            upstream.getBuildersList().clear();
            upstream.getBuildersList().add(wfb);
            upstream.getBuildersList().add(new TriggerBuilder(
                    new BlockableBuildTriggerConfig(downstream.getFullName(), null, Arrays.<AbstractBuildParameters>asList(
                            new FileBuildParameters("properties.txt", null, false, false, null, false)
                    ))
            ));
           
            upstream.getPublishersList().clear();
           
            jenkins.rebuildDependencyGraph();
           
            assertEquals(0, downstream.getBuilds().size());
           
            upstream.scheduleBuild2(0).get();
            waitUntilNoActivity();
           
            // Build is triggered in each builds with parameters.
            assertEquals(2, downstream.getBuilds().size());
            FreeStyleBuild build1 = downstream.getLastBuild();
            FreeStyleBuild build2 = build1.getPreviousBuild();
           
            if (build1.getCause(Cause.UpstreamCause.class).getUpstreamProject().contains("child1")) {
                assertEquals("true", getStringParameterValue(build1, "triggered_child1"));
                assertNull(getStringParameterValue(build1, "triggered_child2"));
               
                assertNull(getStringParameterValue(build2, "triggered_child1"));
                assertEquals("true", getStringParameterValue(build2, "triggered_child2"));
            } else {
                assertEquals("true", getStringParameterValue(build2, "triggered_child1"));
                assertNull(getStringParameterValue(build2, "triggered_child2"));
               
                assertNull(getStringParameterValue(build1, "triggered_child1"));
                assertEquals("true", getStringParameterValue(build1, "triggered_child2"));
            }
           
            build2.delete();
            build1.delete();
        }
       
        // With useMatrixBuild, publisher
        // Downstream project is triggered with parameters of each child.
        // (useMatrixBuild is ignored)
        {
            upstream.getBuildersList().clear();
            upstream.getBuildersList().add(wfb);
            upstream.getBuildersList().add(new TriggerBuilder(
                    new BlockableBuildTriggerConfig(downstream.getFullName(), null, Arrays.<AbstractBuildParameters>asList(
                            new FileBuildParameters("properties.txt", null, false, true, null, false)
                    ))
            ));
           
            upstream.getPublishersList().clear();
View Full Code Here

TOP

Related Classes of hudson.plugins.parameterizedtrigger.BlockableBuildTriggerConfig

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.