Examples of BuildTrigger


Examples of hudson.plugins.parameterizedtrigger.BuildTrigger

  public void test() throws Exception {

    Project projectA = createFreeStyleProject("projectA");
    String properties = "KEY=value";
    projectA.getPublishersList().add(
        new BuildTrigger(new BuildTriggerConfig("projectB", ResultCondition.SUCCESS,
            new PredefinedBuildParameters(properties))));

    CaptureEnvironmentBuilder builder = new CaptureEnvironmentBuilder();
    Project projectB = createFreeStyleProject("projectB");
    projectB.getBuildersList().add(builder);
View Full Code Here

Examples of hudson.tasks.BuildTrigger

        setQuietPeriod(3);
        Project p = createFreeStyleProject(),
            down1 = createFreeStyleProject(), down2 = createFreeStyleProject();
        // Add one standard downstream job:
        p.getPublishersList().add(
                new BuildTrigger(Collections.singletonList(down1), Result.SUCCESS));
        // Add one downstream job with custom Dependency impl:
        p.getBuildersList().add(new TestDeclarer(Result.UNSTABLE, down2));
        hudson.rebuildDependencyGraph();
        // First build won't trigger down1 (Unstable doesn't meet threshold)
        // but will trigger down2 (build #1 is odd).
View Full Code Here

Examples of hudson.tasks.BuildTrigger

        HtmlPage page = webClient.getPage(up,"configure");

        HtmlForm form = page.getFormByName("config");

        // configure downstream build
        up.getPublishersList().add(new BuildTrigger("dp",false));
        configRoundtrip(up);

        // verify that the relationship is set up
        BuildTrigger trigger = up.getPublishersList().get(BuildTrigger.class);
        assertEquals(trigger.getChildProjects(up), Collections.singletonList(dp));

        // now go ahead and edit the downstream
        configRoundtrip(dp);

        // verify that the relationship is set up
        trigger = up.getPublishersList().get(BuildTrigger.class);
        assertNotNull(trigger);
        assertEquals(trigger.getChildProjects(up), Collections.singletonList(dp));
    }
View Full Code Here

Examples of hudson.tasks.BuildTrigger

   * the DependencyGraph
   */
  public void testMatrixProjectTriggersDependencies() throws Exception {
    MatrixProject matrixProject = createMatrixProject();
    FreeStyleProject freestyleProject = createFreeStyleProject();
    matrixProject.getPublishersList().add(new BuildTrigger(freestyleProject.getName(), false));
   
    hudson.rebuildDependencyGraph();
   
    buildAndAssertSuccess(matrixProject);
    waitUntilNoActivity();
View Full Code Here

Examples of hudson.tasks.BuildTrigger

            if (!p.isConfigurable()) continue;
            boolean isUpstream = upstream.contains(p);
            synchronized(p) {
                // does 'p' include us in its BuildTrigger?
                DescribableList<Publisher,Descriptor<Publisher>> pl = p.getPublishersList();
                BuildTrigger trigger = pl.get(BuildTrigger.class);
                List<AbstractProject> newChildProjects = trigger == null ? new ArrayList<AbstractProject>():trigger.getChildProjects(p);
                if(isUpstream) {
                    if(!newChildProjects.contains(this))
                        newChildProjects.add(this);
                } else {
                    newChildProjects.remove(this);
                }

                if(newChildProjects.isEmpty()) {
                    pl.remove(BuildTrigger.class);
                } else {
                    // here, we just need to replace the old one with the new one,
                    // but there was a regression (we don't know when it started) that put multiple BuildTriggers
                    // into the list.
                    // for us not to lose the data, we need to merge them all.
                    List<BuildTrigger> existingList = pl.getAll(BuildTrigger.class);
                    BuildTrigger existing;
                    switch (existingList.size()) {
                    case 0:
                        existing = null;
                        break;
                    case 1:
                        existing = existingList.get(0);
                        break;
                    default:
                        pl.removeAll(BuildTrigger.class);
                        Set<AbstractProject> combinedChildren = new HashSet<AbstractProject>();
                        for (BuildTrigger bt : existingList)
                            combinedChildren.addAll(bt.getChildProjects(p));
                        existing = new BuildTrigger(new ArrayList<AbstractProject>(combinedChildren),existingList.get(0).getThreshold());
                        pl.add(existing);
                        break;
                    }

                    if(existing!=null && existing.hasSame(p,newChildProjects))
                        continue;   // no need to touch
                    pl.replace(new BuildTrigger(newChildProjects,
                        existing==null?Result.SUCCESS:existing.getThreshold()));
                }
            }
        }

        // notify the queue as the project might be now tied to different node
View Full Code Here

Examples of org.apache.continuum.utils.build.BuildTrigger

         return getString( context, KEY_USERNAME, "" );
    }
   
    public static BuildTrigger getBuildTrigger( Map<String, Object> context )
    {
         return new BuildTrigger( getTrigger( context ), getUsername( context ) );
    }
View Full Code Here

Examples of org.apache.continuum.utils.build.BuildTrigger

        throws ContinuumBuildAgentException
    {
        if ( buildContexts != null && buildContexts.size() > 0 )
        {
            BuildContext context = buildContexts.get( 0 );
            return new PrepareBuildProjectsTask( buildContexts, new BuildTrigger( context.getTrigger(), context.getUsername() ),
                                             context.getProjectGroupId(), context.getScmRootAddress(), context.getScmRootId() );
        }
        else
        {
            log.info( "Nothing to build" );
View Full Code Here

Examples of org.apache.continuum.utils.build.BuildTrigger

        catch ( AuthorizationRequiredException e )
        {
            return REQUIRES_AUTHORIZATION;
        }
       
        BuildTrigger buildTrigger = new BuildTrigger( ContinuumProjectState.TRIGGER_FORCED, getPrincipal() );

        try
        {
            if ( projectId > 0 )
            {
                if ( buildDefinitionId > 0 )
                {
                  getContinuum().buildProjectWithBuildDefinition( projectId, buildDefinitionId, buildTrigger );
                }
                else
                {
                  getContinuum().buildProject( projectId, buildTrigger.getUsername() );
                }
            }
            else
            {
                if ( buildDefinitionId > 0 )
                {
                  getContinuum().buildProjectGroupWithBuildDefinition( projectGroupId, buildDefinitionId, buildTrigger );
                }
                else
                {
                    //TODO: Check if this code is called, I don't think
                    //If it is, it should used the projectId
                  getContinuum().buildProjects( buildTrigger.getUsername() );
                }
            }
        }
        catch ( NoBuildAgentException e )
        {
View Full Code Here

Examples of org.apache.continuum.utils.build.BuildTrigger

    {
        List<BuildContext> buildContexts = ContinuumBuildAgentUtil.getBuildContexts( context );

        for ( BuildContext buildContext : buildContexts )
        {
          BuildTrigger buildTrigger = new BuildTrigger( buildContext.getTrigger(), buildContext.getUsername() );
         
          BuildProjectTask buildProjectTask =
                new BuildProjectTask( buildContext.getProjectId(), buildContext.getBuildDefinitionId(),
                                  buildTrigger, buildContext.getProjectName(), buildContext.getBuildDefinitionLabel(),
                                      buildContext.getScmResult(), buildContext.getProjectGroupId() );
View Full Code Here

Examples of org.apache.continuum.utils.build.BuildTrigger

    }

    private BuildProjectTask createBuildProjectTask()
    {
        BuildProjectTask task =
            new BuildProjectTask( 1, 1, new BuildTrigger( 1 ), "Test Project", "Default Build Definition",
                                  new ScmResult(), 1 );
        return task;
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.