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

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


    private void prepareBuildProjects( Map<Integer, Integer> projectsBuildDefinitionsMap, BuildTrigger buildTrigger,
                                       String scmRootAddress, int projectGroupId, int scmRootId, List<ProjectScmRoot> scmRoots )
        throws ContinuumException, NoBuildAgentException, NoBuildAgentInGroupException
    {
        ProjectGroup group = getProjectGroup( projectGroupId );

        try
        {
            if ( configurationService.isDistributedBuildEnabled() )
            {
              distributedBuildManager.prepareBuildProjects( projectsBuildDefinitionsMap, buildTrigger, projectGroupId,
                                                              group.getName(), scmRootAddress, scmRootId, scmRoots );
            }
            else
            {
              parallelBuildsManager.prepareBuildProjects( projectsBuildDefinitionsMap, buildTrigger, projectGroupId,
                                                            group.getName(), scmRootAddress, scmRootId );
            }
        }
        catch ( BuildManagerException e )
        {
            throw logAndCreateException( "Error while creating enqueuing object.", e );
View Full Code Here



    private void createDefaultProjectGroup()
        throws ContinuumStoreException, BuildDefinitionServiceException
    {
        ProjectGroup group;
        try
        {
            group = projectGroupDao.getProjectGroupByGroupId( DEFAULT_PROJECT_GROUP_GROUP_ID );
            log.info( "Default Project Group exists" );
        }
        catch ( ContinuumObjectNotFoundException e )
        {
            Collection<ProjectGroup> pgs = projectGroupDao.getAllProjectGroups();
            if ( pgs != null && pgs.isEmpty() )
            {
                log.info( "create Default Project Group" );

                group = new ProjectGroup();

                group.setName( "Default Project Group" );

                group.setGroupId( DEFAULT_PROJECT_GROUP_GROUP_ID );

                group.setDescription( "Contains all projects that do not have a group of their own" );

                LocalRepository localRepository = localRepositoryDao.getLocalRepositoryByName( "DEFAULT" );

                group.setLocalRepository( localRepository );

                group = projectGroupDao.addProjectGroup( group );

                BuildDefinitionTemplate bdt = buildDefinitionService.getDefaultMavenTwoBuildDefinitionTemplate();

                buildDefinitionService.addBuildDefinitionTemplateToProjectGroup( group.getId(), bdt );
            }
        }
    }
View Full Code Here

        Map<String, Object> context = new HashMap<String, Object>();

        try
        {
            Project project = projectDao.getProject( projectId );
            ProjectGroup projectGroup = project.getProjectGroup();

            List<ProjectScmRoot> scmRoots = projectScmRootDao.getProjectScmRootByProjectGroup( projectGroup.getId() );
            String projectScmUrl = project.getScmUrl();

            for ( ProjectScmRoot projectScmRoot : scmRoots )
            {
                if ( projectScmUrl.startsWith( projectScmRoot.getScmRootAddress() ) )
                {
                    AbstractContinuumAction.setProjectScmRoot( context, projectScmRoot );
                    break;
                }
            }

            AbstractContinuumAction.setProjectGroupId( context, projectGroup.getId() );
            AbstractContinuumAction.setProjectId( context, projectId );
            AbstractContinuumAction.setProject( context, project );
            AbstractContinuumAction.setBuildTrigger( context, buildTrigger );

            AbstractContinuumAction.setBuildDefinitionId( context, buildDefinitionId );
View Full Code Here

            //  - builds are used to detect if the state has changed (TODO: maybe previousState field is better)
            //  - notifiers are used to send the notification
            //  - scm results are used to detect if scm failed
            project = projectDao.getProjectWithAllDetails( project.getId() );

            ProjectGroup projectGroup =
                projectGroupDao.getProjectGroupWithBuildDetailsByProjectGroupId( project.getProjectGroup().getId() );

            Map<String, List<ProjectNotifier>> notifiersMap = new HashMap<String, List<ProjectNotifier>>();

            getProjectNotifiers( project, notifiersMap );
View Full Code Here

    private void sendNotification( String messageId, ProjectScmRoot projectScmRoot )
    {
        try
        {
            ProjectGroup group = projectGroupDao.getProjectGroupWithBuildDetailsByProjectGroupId(
                projectScmRoot.getProjectGroup().getId() );

            Map<String, List<ProjectNotifier>> notifiersMap = new HashMap<String, List<ProjectNotifier>>();
            getProjectGroupNotifiers( group, notifiersMap );
View Full Code Here

    {
        Continuum continuum = (Continuum) lookup( Continuum.ROLE );

        Project project = makeStubProject( "test-project" );

        ProjectGroup defaultGroup = getDefaultProjectGroup();

        defaultGroup.addProject( project );

        getProjectGroupDao().updateProjectGroup( defaultGroup );

        project = getProjectDao().getProjectByName( "test-project" );
View Full Code Here

        Project project = projects.get( 0 );

        // reattach
        project = continuum.getProject( project.getId() );

        ProjectGroup projectGroup = getProjectGroupDao().getProjectGroupByProjectId( project.getId() );

        projectGroup = getProjectGroupDao().getProjectGroupWithBuildDetailsByProjectGroupId( projectGroup.getId() );

        List<BuildDefinition> buildDefs = projectGroup.getBuildDefinitions();

        assertTrue( "missing project group build definition", !buildDefs.isEmpty() );

        assertTrue( "more then one project group build definition on add project", buildDefs.size() == 1 );

        BuildDefinition pgbd = buildDefs.get( 0 );

        pgbd.setGoals( "foo" );

        continuum.updateBuildDefinitionForProjectGroup( projectGroup.getId(), pgbd );

        pgbd = continuum.getBuildDefinition( pgbd.getId() );

        assertTrue( "update failed for project group build definition", "foo".equals( pgbd.getGoals() ) );

        assertTrue( "project group build definition is not default", pgbd.isDefaultForProject() );

        assertTrue( "project group build definition not default for project",
                    continuum.getDefaultBuildDefinition( project.getId() ).getId() == pgbd.getId() );

        BuildDefinition nbd = new BuildDefinition();
        nbd.setGoals( "clean" );
        nbd.setArguments( "" );
        nbd.setDefaultForProject( true );
        nbd.setSchedule( getScheduleDao().getScheduleByName( ConfigurationService.DEFAULT_SCHEDULE_NAME ) );

        continuum.addBuildDefinitionToProject( project.getId(), nbd );

        assertTrue( "project lvl build definition not default for project",
                    continuum.getDefaultBuildDefinition( project.getId() ).getId() == nbd.getId() );

        continuum.removeBuildDefinitionFromProject( project.getId(), nbd.getId() );

        assertTrue( "default build definition didn't toggle back to project group level",
                    continuum.getDefaultBuildDefinition( project.getId() ).getId() == pgbd.getId() );

        try
        {
            continuum.removeBuildDefinitionFromProjectGroup( projectGroup.getId(), pgbd.getId() );
            fail( "we were able to remove the default build definition, and that is bad" );
        }
        catch ( ContinuumException expected )
        {
View Full Code Here

        assertNotNull( result );

        assertEquals( 1, result.getProjectGroups().size() );

        ProjectGroup projectGroup = result.getProjectGroups().get( 0 );

        assertEquals( "plexus", projectGroup.getGroupId() );

        projectGroupList = continuum.getAllProjectGroups();

        assertEquals( "Project group missing, should have " + ( projectGroupsBefore + 1 ) + " project groups",
                      projectGroupsBefore + 1, projectGroupList.size() );

        projectGroup = (ProjectGroup) projectGroupList.iterator().next();

        assertNotNull( projectGroup );

        BuildsManager buildsManager = continuum.getBuildsManager();

        List<Project> projects = continuum.getProjectGroupWithProjects( projectGroup.getId() ).getProjects();
        int[] projectIds = new int[projects.size()];

        int idx = 0;
        for ( Project project : projects )
        {
            projectIds[idx] = project.getId();
            idx++;
        }

        while ( buildsManager.isAnyProjectCurrentlyBeingCheckedOut( projectIds ) )
        {
        }

        continuum.removeProjectGroup( projectGroup.getId() );

        projectGroupList = continuum.getAllProjectGroups();

        assertEquals( "Remove project group failed", projectGroupsBefore, projectGroupList.size() );
    }
View Full Code Here

        assertNotNull( result );

        assertEquals( 1, result.getProjectGroups().size() );

        ProjectGroup projectGroup = result.getProjectGroups().get( 0 );

        continuum.addGroupNotifier( projectGroup.getId(), new ProjectNotifier() );

        for ( Project p : (List<Project>) projectGroup.getProjects() )
        {
            continuum.addNotifier( p.getId(), new ProjectNotifier() );
        }

        projectGroup = continuum.getProjectGroupWithBuildDetails( projectGroup.getId() );

        assertEquals( 1, projectGroup.getNotifiers().size() );

        for ( Project p : (List<Project>) projectGroup.getProjects() )
        {
            assertEquals( 2, p.getNotifiers().size() );
        }
    }
View Full Code Here

    public void execute( Map context )
        throws ContinuumException, ContinuumStoreException
    {
        Project project = getUnvalidatedProject( context );

        ProjectGroup projectGroup = getUnvalidatedProjectGroup( context );

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

        boolean useCredentialsCache = isUseScmCredentialsCache( context, false );
        // CONTINUUM-1605 don't store username/password
        if ( useCredentialsCache )
        {
            project.setScmUsername( null );
            project.setScmPassword( null );
            project.setScmUseCache( true );
        }

        projectGroup.addProject( project );

        projectGroupDao.updateProjectGroup( projectGroup );

        setProjectId( context, project.getId() );
View Full Code Here

TOP

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

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.