Package hudson.plugins.parameterizedtrigger

Examples of hudson.plugins.parameterizedtrigger.TriggerBuilder


        ));

        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();
        assertBuildStatusSuccess(upstreamBuild);
View Full Code Here


        // Without useMatrixBuild, builder
        // 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)
                    ))
            ));
           
View Full Code Here

        // Without useMatrixBuild, builder
        // 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();
           
            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)
                    ))
            ));
           
View Full Code Here

TOP

Related Classes of hudson.plugins.parameterizedtrigger.TriggerBuilder

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.