Package hudson.plugins.parameterizedtrigger

Examples of hudson.plugins.parameterizedtrigger.TriggerBuilder


   */
  public void testBuildStepTriggerBuildNoParameters() throws Exception {
    Project<?,?> projectA = createFreeStyleProject("projectA");
    List<AbstractBuildParameters> buildParameters = new ArrayList<AbstractBuildParameters>();
    buildParameters.add(new CurrentBuildParameters());
    projectA.getBuildersList().add(new TriggerBuilder(new BlockableBuildTriggerConfig("projectB", null, buildParameters)));
    CaptureEnvironmentBuilder builder = new CaptureEnvironmentBuilder();

    Project<?,?> projectB = createFreeStyleProject("projectB");
    projectB.getBuildersList().add(builder);
    projectB.setQuietPeriod(1);
View Full Code Here


        BlockingBehaviour neverFail = new BlockingBehaviour("never", "never", "never");
        return new BlockableBuildTriggerConfig(projectToTrigger, neverFail, buildParameters);
    }

    private void addParameterizedTrigger(Project<?, ?> projectA, BlockableBuildTriggerConfig config) throws Exception {
        projectA.getBuildersList().add(new TriggerBuilder(config));
        CaptureEnvironmentBuilder builder = new CaptureEnvironmentBuilder();
        projectA.getBuildersList().add(builder);
    }
View Full Code Here

   
    //confirm projectA's build step trigger is updated automatically
    assertEquals("build step trigger project should be renamed", "projectB-renamed,projectC", projectA.getBuildersList().get(TriggerBuilder.class).getConfigs().get(0).getProjects());
   
      final List<ConditionalBuilder> all = projectA.getBuildersList().getAll(ConditionalBuilder.class);
      final TriggerBuilder wrappedBuilder0 = (TriggerBuilder)all.get(0).getConditionalbuilders().get(0);
      assertEquals("build step trigger project within first conditionalbuildstep should be renamed", "projectB-renamed,projectC", wrappedBuilder0.getConfigs().get(0).getProjects());

      final List<SingleConditionalBuilder> allSingleConditions = projectA.getBuildersList().getAll(SingleConditionalBuilder.class);
      final TriggerBuilder singleCondTrigger0 = (TriggerBuilder)allSingleConditions.get(0).getBuildStep();
        assertEquals("build step trigger project within first singleconditionalbuildstep should be renamed", "projectB-renamed,projectC", singleCondTrigger0.getConfigs().get(0).getProjects());

    //confirm projectA's post build trigger is updated automatically
    assertEquals("post build trigger project should be renamed", "projectB-renamed,projectC", projectA.getPublishersList().get(BuildTrigger.class).getConfigs().get(0).getProjects());
   
    projectB.delete();

    //confirm projectA's build step trigger is updated automatically:
    assertEquals("build step trigger project should be removed", "projectC", projectA.getBuildersList().get(TriggerBuilder.class).getConfigs().get(0).getProjects());

    //confirm projectA's post build trigger is updated automatically:
    assertEquals("post build trigger project should be removed", "projectC", projectA.getPublishersList().get(BuildTrigger.class).getConfigs().get(0).getProjects());
   
      //confirm deletes are reflected within conditional buildsteps too
        final List<ConditionalBuilder> allAfterDelete = projectA.getBuildersList().getAll(ConditionalBuilder.class);
        final TriggerBuilder wrappedBuilderAfterDel0 = (TriggerBuilder)allAfterDelete.get(0).getConditionalbuilders().get(0);
        assertEquals("build step trigger project within first conditionalbuildstep should be removed", "projectC", wrappedBuilderAfterDel0.getConfigs().get(0).getProjects());
       

        final List<SingleConditionalBuilder> allSingleAfterDelete = projectA.getBuildersList().getAll(SingleConditionalBuilder.class);
        final TriggerBuilder singleCondTriggerAfterDel0 = (TriggerBuilder)allSingleAfterDelete.get(0).getBuildStep();
        assertEquals("build step trigger project within first singleconditionalbuildstep should be removed", "projectC", singleCondTriggerAfterDel0.getConfigs().get(0).getProjects());

  }
View Full Code Here

      childJobNamesString.append(childJobName);
      childJobNamesString.append(",");
    }
   
    //setup build step trigger
    project.getBuildersList().add(new TriggerBuilder(new BlockableBuildTriggerConfig(childJobNamesString.toString(), null, buildParameters)));
   
    // setup triggers for conditional buildsteps
    // test conditional builder (multi)
    List<BuildStep> blist = new ArrayList<BuildStep>();
    TriggerBuilder tb = new TriggerBuilder(new BlockableBuildTriggerConfig(childJobNamesString.toString(), null, buildParameters));
      blist.add(tb);
      project.getBuildersList().add(new ConditionalBuilder(new AlwaysRun(), new BuildStepRunner.Run(), blist));
     
      // test conditional builder (single)
      TriggerBuilder tb2 = new TriggerBuilder(new BlockableBuildTriggerConfig(childJobNamesString.toString(), null, buildParameters));       
      project.getBuildersList().add(new SingleConditionalBuilder(tb2, new AlwaysRun(), new BuildStepRunner.Run()));

    //setup post build trigger
    project.getPublishersList().add(new BuildTrigger(new BuildTriggerConfig(childJobNamesString.toString(), ResultCondition.SUCCESS, new CurrentBuildParameters())));
    return project;
View Full Code Here

        return createTriggerBuilder(project, action, null);
    }
   
    private TriggerBuilder createTriggerBuilder(AbstractProject project, NoFilesFoundEnum action, String encoding){

        TriggerBuilder tBuilder = new TriggerBuilder(
                                new BlockableBuildTriggerConfig(project.getName(),
                                new BlockingBehaviour(Result.FAILURE, Result.UNSTABLE, Result.FAILURE),
                                ImmutableList.<AbstractBuildParameterFactory>of(
                                    new FileBuildParameterFactory("*.txt", encoding, action)),
                                Collections.<AbstractBuildParameters>emptyList()));
View Full Code Here

    public void testWithOneParameter() throws Exception {
        Project<?,?> projectA = createFreeStyleProject();
        Project projectB = createFreeStyleProject();
        projectA.getBuildersList().add(
                new TriggerBuilder(
                        new BlockableBuildTriggerConfig(projectB.getName(),
                                new BlockingBehaviour(Result.FAILURE, Result.UNSTABLE, Result.FAILURE),
                                ImmutableList.<AbstractBuildParameterFactory>of(new CounterBuildParameterFactory("0","1","1", "TEST=COUNT$COUNT")),
                                Collections.<AbstractBuildParameters>emptyList())));
View Full Code Here

    public void testWithTwoParameters() throws Exception {
        Project<?,?> projectA = createFreeStyleProject();
        Project projectB = createFreeStyleProject();
        projectA.getBuildersList().add(
                new TriggerBuilder(
                        new BlockableBuildTriggerConfig(projectB.getName(),
                                new BlockingBehaviour(Result.FAILURE, Result.UNSTABLE, Result.FAILURE),
                                ImmutableList.<AbstractBuildParameterFactory>of(
                                        new CounterBuildParameterFactory("0","1","1", "TEST=COUNT$COUNT"),
                                        new CounterBuildParameterFactory("0","2","1", "NEWTEST=COUNT$COUNT")
View Full Code Here

    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);

    Project projectB = createFreeStyleProject("projectB");
View Full Code Here

    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);

    Project projectB = createFreeStyleProject(testName);
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())));
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.