Package org.apache.continuum.taskqueue

Examples of org.apache.continuum.taskqueue.BuildProjectTask


        throws Exception
    {
        setupMockOverallBuildQueues();

        final List<Task> tasks = new ArrayList<Task>();
        tasks.add( new BuildProjectTask( 2, 1, new BuildTrigger( 1, "test-user" ), "continuum-project-test-2", "BUILD_DEF", null, ) );

        context.checking( new Expectations()
        {
            {
                exactly( 5 ).of( overallBuildQueue ).getName();
View Full Code Here


        Map<String, BuildProjectTask> currentBuilds = buildsManager.getCurrentBuilds();
        Set<String> keySet = currentBuilds.keySet();
        for ( String key : keySet )
        {
            BuildProjectTask buildProjectTask = currentBuilds.get( key );
            if ( buildProjectTask != null && buildResult != null )
            {
                return !( buildResult.getState() == ContinuumProjectState.BUILDING &&
                    ( buildProjectTask.getBuildDefinitionId() == buildResult.getBuildDefinition().getId() &&
                        buildProjectTask.getProjectId() == this.getProjectId() ) );
            }
        }
        return true;
    }
View Full Code Here

            // current builds
            Map<String, BuildProjectTask> currentBuildMap = getContinuum().getDistributedBuildManager().getProjectsCurrentlyBuilding();

            for ( String url : currentBuildMap.keySet() )
            {
                BuildProjectTask task = currentBuildMap.get( url );

                Project project = getContinuum().getProject( task.getProjectId() );

                DistributedBuildSummary summary = new DistributedBuildSummary();
                summary.setProjectId( project.getId() );
                summary.setProjectName( project.getName() );
                summary.setProjectGroupName( project.getProjectGroup().getName() );
                summary.setBuildDefinitionId( task.getBuildDefinitionId() );
                summary.setBuildDefinitionLabel( task.getBuildDefinitionLabel() );
                summary.setHashCode( task.getHashCode() );
                summary.setBuildAgentUrl( url );

                currentDistributedBuilds.add( summary );
            }
           
            // prepare build queues
            Map<String, List<PrepareBuildProjectsTask>> prepareBuildMap = getContinuum().getDistributedBuildManager().getProjectsInPrepareBuildQueue();

            for ( String url : prepareBuildMap.keySet() )
            {
                for ( PrepareBuildProjectsTask task : prepareBuildMap.get( url ) )
                {
                    ProjectGroup projectGroup = getContinuum().getProjectGroup( task.getProjectGroupId() );

                    PrepareBuildSummary summary = new PrepareBuildSummary();
                    summary.setBuildAgentUrl( url );
                    summary.setProjectGroupId( task.getProjectGroupId() );
                    summary.setProjectGroupName( projectGroup.getName() );
                    summary.setScmRootAddress( task.getScmRootAddress() );
                    summary.setScmRootId( task.getProjectScmRootId() );
                    summary.setHashCode( task.getHashCode() );

                    distributedPrepareBuildQueues.add( summary );
                }
            }

            // build queues
            Map<String, List<BuildProjectTask>> buildMap = getContinuum().getDistributedBuildManager().getProjectsInBuildQueue();

            for ( String url : buildMap.keySet() )
            {
                for ( BuildProjectTask task : buildMap.get( url ) )
                {
                    DistributedBuildSummary summary = new DistributedBuildSummary();

                    Project project = getContinuum().getProject( task.getProjectId() );

                    summary.setProjectId( project.getId() );
                    summary.setProjectName( project.getName() );
                    summary.setProjectGroupName( project.getProjectGroup().getName() );
                    summary.setBuildDefinitionId( task.getBuildDefinitionId() );
                    summary.setBuildDefinitionLabel( task.getBuildDefinitionLabel() );
                    summary.setHashCode( task.getHashCode() );
                    summary.setBuildAgentUrl( url );

                    distributedBuildQueues.add( summary );
                }
            }

            return DISTRIBUTED_BUILD_SUCCESS;
        }
        else
        {
            try
            {
                // current prepare builds
                PrepareBuildProjectsTask currentPrepareBuildTask = getContinuum().getBuildsManager().getCurrentProjectInPrepareBuild();

                if ( currentPrepareBuildTask != null )
                {
                    PrepareBuildSummary s = new PrepareBuildSummary();
                   
                    s.setProjectGroupId( currentPrepareBuildTask.getProjectGroupId() );
                    s.setProjectGroupName( currentPrepareBuildTask.getProjectGroupName() );
                    s.setScmRootId( currentPrepareBuildTask.getProjectScmRootId() );
                    s.setScmRootAddress( currentPrepareBuildTask.getScmRootAddress() );
                    currentPrepareBuilds.add( s );
                }
            }
            catch ( BuildManagerException e )
            {
                addActionError( e.getMessage() );
                return ERROR;
            }

            try
            {
                // current builds
                Map<String, BuildProjectTask> currentBuilds = getContinuum().getBuildsManager().getCurrentBuilds();
                Set<String> keySet = currentBuilds.keySet();
                for ( String key : keySet )
                {
                    BuildProjectTask buildTask = currentBuilds.get( key );
                    BuildProjectQueue queue = new BuildProjectQueue();
                    queue.setName( key );
                    queue.setTask( buildTask );
                    currentBuildProjectTasks.add( queue );
                }
View Full Code Here

    // ----------------------------------------------------------------------

    public void executeTask( Task task )
        throws TaskExecutionException
    {
        BuildProjectTask buildProjectTask = (BuildProjectTask) task;

        controller.build( buildProjectTask.getProjectId(), buildProjectTask.getBuildDefinitionId(), buildProjectTask
            .getBuildTrigger(), buildProjectTask.getScmResult() );
    }
View Full Code Here

    private void buildProject( int projectId, int trigger )
        throws Exception
    {
        ProjectGroup group = getDefaultProjectGroup();
        buildQueue.put( new BuildProjectTask( projectId, 0, new BuildTrigger( trigger, "" ), null, null, null, group.getId() ) );
    }
View Full Code Here

    {
        Task task = buildQueue.take();

        assertEquals( BuildProjectTask.class.getName(), task.getClass().getName() );

        BuildProjectTask buildProjectTask = (BuildProjectTask) task;

        assertEquals( "Didn't get the expected project id.", expectedProjectId, buildProjectTask.getProjectId() );
    }
View Full Code Here

    }

    public void testManualCancellation()
        throws Exception
    {
        BuildProjectTask task = runTimeoutProject( 0 );

        assertFalse( "Build completed", getTestFile( "src/test-projects/timeout/target/TEST-COMPLETED" ).exists() );

        long taskStartTime = System.currentTimeMillis();
View Full Code Here

     * @throws Exception
     */
    private BuildProjectTask runTimeoutProject( int maxRunTime )
        throws Exception
    {
        BuildProjectTask task = createTask( maxRunTime );

        FileUtils.forceDelete( getTestFile( "src/test-projects/timeout/target/TEST-STARTED" ) );
        FileUtils.forceDelete( getTestFile( "src/test-projects/timeout/target/TEST-COMPLETED" ) );

        System.err.println( "Queueing build" );
View Full Code Here

        buildDefinition = (BuildDefinition) projectGroup.getBuildDefinitions().get( 0 );

        // projectGroup = continuumStore.addProjectGroup( projectGroup );

        BuildProjectTask task = new BuildProjectTask( project.getId(), buildDefinition.getId(), new BuildTrigger( 0, "" ),
                                             project.getName(), buildDefinition.getDescription(), null, projectGroupId );

        task.setMaxExecutionTime( maxRunTime );

        return task;
    }
View Full Code Here

            if ( StringUtils.isEmpty( buildDefinitionLabel ) )
            {
                buildDefinitionLabel = buildDefinition.getGoals();
            }

            BuildProjectTask buildTask = new BuildProjectTask( projectId, buildDefinition.getId(), buildTrigger,
                                                               projectName, buildDefinitionLabel, scmResult,
                                                               projectGroupId );
            try
            {
                log.info( "Project '" + projectName + "' added to overall build queue '" + overallBuildQueue.getName() +
View Full Code Here

TOP

Related Classes of org.apache.continuum.taskqueue.BuildProjectTask

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.