Package org.apache.maven.continuum.model.project

Examples of org.apache.maven.continuum.model.project.BuildResult


    }
   
    public String getFileContent( int projectId, String directory, String filename )
        throws ContinuumException
    {
        BuildResult buildResult = buildResultDao.getLatestBuildResultForProject( projectId );

        if ( buildResult != null )
        {
            String buildAgentUrl = buildResult.getBuildUrl();

            if ( buildAgentUrl == null )
            {
                return "";
            }
View Full Code Here


        project = getProjectDao().getProjectByName( "test-project" );

        assertNotNull ( project );

        BuildResult buildResult = new BuildResult();

        getBuildResultDao().addBuildResult( project, buildResult );

        Collection<BuildResult> brs = continuum.getBuildResultsForProject( project.getId() );
View Full Code Here

    public void testGetDefaultBuildagent()
        throws Exception
    {
        String defaultBuildagentUrl = "http://localhost:8181/continuum-buildagent/xmlrpc";
       
        buildResult = new BuildResult();
        buildResult.setBuildUrl( defaultBuildagentUrl );
       
        contextBuildResultDaoExpectations();
       
        String returnedBuildagent = distributedReleaseManager.getDefaultBuildagent( 0 );
View Full Code Here

        projectDao.updateProject( project );

        try
        {
            BuildResult buildResult = buildResultDao.getLatestBuildResultForProject( project.getId() );

            latestUpdateDate = new Date( buildResult.getStartTime() );
        }
        catch ( Exception e )
        {
        }
View Full Code Here

        ProjectGroup group = createStubProjectGroup( "foo.bar", "" );

        BuildResultDao brDao = (BuildResultDao) lookup( BuildResultDao.class );
        Project project = addProject( "Test Project", group );
        BuildResult br = makeBuild( ContinuumProjectState.FAILED );
        brDao.addBuildResult( project, br );

        br = makeBuild( ContinuumProjectState.OK );
        brDao.addBuildResult( project, br );

        br = makeBuild( ContinuumProjectState.FAILED );
        brDao.addBuildResult( project, br );

        BuildResult build = makeBuild( ContinuumProjectState.OK );
        assertEquals( ContinuumProjectState.OK, build.getState() );

        project.setState( build.getState() );
        getProjectDao().updateProject( project );

        BuildDefinition buildDef = new BuildDefinition();
        buildDef.setType( "maven2" );
        buildDef.setBuildFile( "pom.xml" );
        buildDef.setGoals( "clean install" );
        buildDef.setArguments( "" );
        BuildDefinitionDao buildDefDao = (BuildDefinitionDao) lookup( BuildDefinitionDao.class );
        buildDef = buildDefDao.addBuildDefinition( buildDef );
        build.setBuildDefinition( buildDef );
        assertEquals( ContinuumProjectState.OK, build.getState() );

        brDao.addBuildResult( project, build );
        build = brDao.getLatestBuildResultForProjectWithDetails( project.getId() );
        assertEquals( ContinuumProjectState.OK, build.getState() );

        MimeMessage mailMessage =
            sendNotificationAndGetMessage( project, build, buildDef, "lots out build output", toOverride );

        assertEquals( "[continuum] BUILD SUCCESSFUL: foo.bar Test Project", mailMessage.getSubject() );
View Full Code Here

    {
        ProjectGroup group = createStubProjectGroup( "foo.bar", "" );

        Project project = addProject( "Test Project", group );

        BuildResult build = makeBuild( ContinuumProjectState.FAILED );

        MimeMessage mailMessage = sendNotificationAndGetMessage( project, build, null, "output", null );

        assertEquals( "[continuum] BUILD FAILURE: foo.bar Test Project", mailMessage.getSubject() );
View Full Code Here

    {
        ProjectGroup group = createStubProjectGroup( "foo.bar", "" );

        Project project = addProject( "Test Project", group );

        BuildResult build = makeBuild( ContinuumProjectState.ERROR );

        build.setError( "Big long error message" );

        MimeMessage mailMessage = sendNotificationAndGetMessage( project, build, null, "lots of stack traces", null );

        assertEquals( "[continuum] BUILD ERROR: foo.bar Test Project", mailMessage.getSubject() );
View Full Code Here

        return mailMessage;
    }

    private BuildResult makeBuild( int state )
    {
        BuildResult build = new BuildResult();

        build.setStartTime( System.currentTimeMillis() );

        build.setEndTime( System.currentTimeMillis() + 1234567 );

        build.setState( state );

        build.setTrigger( ContinuumProjectState.TRIGGER_FORCED );

        build.setExitCode( 10 );

        return build;
    }
View Full Code Here

        // ----------------------------------------------------------------------
        // Make the buildResult
        // ----------------------------------------------------------------------

        BuildResult buildResult = new BuildResult();

        buildResult.setStartTime( new Date().getTime() );

        buildResult.setState( ContinuumProjectState.BUILDING );

        buildResult.setTrigger( buildTrigger.getTrigger() );
       
        buildResult.setUsername( buildTrigger.getUsername() );

        buildResult.setScmResult( scmResult );

        buildResult.setModifiedDependencies( updatedDependencies );

        buildResult.setBuildDefinition( getBuildDefinition( context ) );

        buildResultDao.addBuildResult( project, buildResult );

        AbstractContinuumAction.setBuildId( context, Integer.toString( buildResult.getId() ) );

        setCancelled( context, false );

        buildResult = buildResultDao.getBuildResult( buildResult.getId() );

        try
        {
            notifier.runningGoals( project, buildDefinition, buildResult );

            File buildOutputFile = configurationService.getBuildOutputFile( buildResult.getId(), project.getId() );

            ContinuumBuildExecutionResult result = buildExecutor.build( project, buildDefinition, buildOutputFile );

            buildResult.setState( result.getExitCode() == 0 ? ContinuumProjectState.OK : ContinuumProjectState.FAILED );

            buildResult.setExitCode( result.getExitCode() );
        }
        catch ( ContinuumBuildCancelledException e )
        {
            getLogger().info( "Cancelled build" );

            buildResult.setState( ContinuumProjectState.CANCELLED );

            setCancelled( context, true );
        }
        catch ( Throwable e )
        {
            getLogger().error( "Error running buildResult", e );

            buildResult.setState( ContinuumProjectState.ERROR );

            buildResult.setError( ContinuumUtils.throwableToString( e ) );
        }
        finally
        {
            project = projectDao.getProject( project.getId() );

            if ( buildResult.getState() == ContinuumProjectState.CANCELLED )
            {
                project.setState( project.getOldState() );

                project.setOldState( 0 );

                int buildResultId = getOldBuildId( context );

                project.setLatestBuildId( buildResultId );

                buildResultDao.removeBuildResult( buildResult );
            }
            else
            {
                buildResult.setEndTime( new Date().getTime() );

                if ( buildResult.getState() == ContinuumProjectState.OK )
                {
                    project.setBuildNumber( project.getBuildNumber() + 1 );
                }

                project.setLatestBuildId( buildResult.getId() );

                buildResult.setBuildNumber( project.getBuildNumber() );

                if ( buildResult.getState() != ContinuumProjectState.OK &&
                    buildResult.getState() != ContinuumProjectState.FAILED &&
                    buildResult.getState() != ContinuumProjectState.ERROR )
                {
                    buildResult.setState( ContinuumProjectState.ERROR );
                }

                project.setState( buildResult.getState() );

                // ----------------------------------------------------------------------
                // Copy over the buildResult result
                // ----------------------------------------------------------------------

                buildResultDao.updateBuildResult( buildResult );

                buildResult = buildResultDao.getBuildResult( buildResult.getId() );

                notifier.goalsCompleted( project, buildDefinition, buildResult );
            }

            AbstractContinuumAction.setProject( context, project );

            projectDao.updateProject( project );

            // ----------------------------------------------------------------------
            // Backup test result files
            // ----------------------------------------------------------------------
            //TODO: Move as a plugin
            buildExecutor.backupTestFiles( project, buildResult.getId() );
        }
    }
View Full Code Here

    }

    public List<Map<String, String>> processProject( int projectId, String pomFilename, boolean autoVersionSubmodules )
        throws ContinuumReleaseException, BuildAgentConfigurationException
    {
        BuildResult buildResult = buildResultDao.getLatestBuildResultForProject( projectId );

        String buildAgentUrl = buildResult.getBuildUrl();

        if ( !checkBuildAgent( buildAgentUrl ) )
        {
            throw new BuildAgentConfigurationException( buildAgentUrl );
        }
View Full Code Here

TOP

Related Classes of org.apache.maven.continuum.model.project.BuildResult

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.