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

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


*/
   
    private PrepareBuildProjectsTask createTask( String pomResource, boolean singleCheckout, boolean buildFresh )
        throws Exception
    {
        ProjectGroup projectGroup = getProjectGroup( pomResource, singleCheckout );

        BuildDefinition buildDefinition = new BuildDefinition();
        buildDefinition.setId( 0 );
        buildDefinition.setGoals( "clean" );
        buildDefinition.setBuildFresh( buildFresh );
       
        projectGroup.addBuildDefinition( buildDefinition );

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

        AbstractContinuumAction.setWorkingDirectory( pgContext, configurationService.getWorkingDirectory().getAbsolutePath() );

        AbstractContinuumAction.setUnvalidatedProjectGroup( pgContext, projectGroup );

        actionManager.lookup( "validate-project-group" ).execute( pgContext );

        actionManager.lookup( "store-project-group" ).execute( pgContext );

        int projectGroupId = AbstractContinuumAction.getProjectGroupId( pgContext );

        projectGroup = getProjectGroupDao().getProjectGroupWithBuildDetailsByProjectGroupId( projectGroupId );

        String scmRootUrl = getScmRootUrl( projectGroup );

        assertNotNull( scmRootUrl );

        ProjectScmRoot scmRoot = getProjectScmRoot( projectGroup, scmRootUrl );

        assertNotNull( scmRoot );

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

        Map<Integer, Integer> map = new HashMap<Integer, Integer>();

        Project rootProject = null;

        List<Project> projects = (List<Project>) projectGroup.getProjects();

        for ( Project project : projects )
        {
            assertFalse( project.getId() == 0 );
           
            map.put( project.getId(), buildDefinition.getId() );

            if ( rootProject == null || rootProject.getId() > project.getId() )
            {
                rootProject = project;
            }
        }

        assertEquals( 3, map.size() );
        PrepareBuildProjectsTask task = new PrepareBuildProjectsTask( map, 1,
                                                                      projectGroupId, projectGroup.getName(),
                                                                      scmRoot.getScmRootAddress(), scmRoot.getId() );

        return task;
    }
View Full Code Here


   
        assertNotNull( "Project list not null", result.getProjects() );
   
        assertEquals( "#Projectgroups", 1, result.getProjectGroups().size() );
   
        ProjectGroup pg = result.getProjectGroups().get( 0 );
   
        if ( !result.getProjects().isEmpty() )
        {
            for ( Project p : result.getProjects() )
            {
                pg.addProject( p );
            }
        }

        return pg;
    }
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

    {
        Continuum continuum = getContinuum();

        Project project = new Project();
        project.setScmUrl( "scmUrl" );
        ProjectGroup defaultProjectGroup =
            continuum.getProjectGroupByGroupId( ContinuumInitializer.DEFAULT_PROJECT_GROUP_GROUP_ID );
        int projectId = continuum.addProject( project, ContinuumBuildExecutorConstants.ANT_BUILD_EXECUTOR,
                                              defaultProjectGroup.getId() );
        assertEquals( 1, continuum.getProjectGroupWithProjects( defaultProjectGroup.getId() ).getProjects().size() );
        project = continuum.getProjectWithAllDetails( projectId );
        assertNotNull( project );

        BuildDefinitionService service = (BuildDefinitionService) lookup( BuildDefinitionService.class );
        assertEquals( 4, service.getAllBuildDefinitionTemplate().size() );
View Full Code Here

        LocalRepository repository = new LocalRepository();
        repository.setName( "defaultRepo" );
        repository.setLocation( getTestFile( "target/default-repository" ).getAbsolutePath() );
        repository = service.addLocalRepository( repository );

        ProjectGroup group = new ProjectGroup();
        group.setGroupId( "testGroup" );
        group.setName( "testGroup" );
        group.setLocalRepository( repository );
        continuum.addProjectGroup( group );

        ProjectGroup retrievedDefaultProjectGroup = continuum.getProjectGroupByGroupId( "testGroup" );
        assertNotNull( retrievedDefaultProjectGroup.getLocalRepository() );

        continuum.removeProjectGroup( retrievedDefaultProjectGroup.getId() );

        try
        {
            continuum.getProjectGroupByGroupId( "testGroup" );
            fail( "project group was not deleted" );
View Full Code Here

    public void testContinuumReleaseResult()
        throws Exception
    {
        Continuum continuum = getContinuum();

        ProjectGroup defaultProjectGroup =
            continuum.getProjectGroupByGroupId( ContinuumInitializer.DEFAULT_PROJECT_GROUP_GROUP_ID );

        assertEquals( 0, continuum.getAllContinuumReleaseResults().size() );

        ContinuumReleaseResult releaseResult = new ContinuumReleaseResult();
        releaseResult.setStartTime( System.currentTimeMillis() );

        File logFile = continuum.getConfiguration().getReleaseOutputFile( defaultProjectGroup.getId(),
                                                                          "releases-" + releaseResult.getStartTime() );
        logFile.mkdirs();

        assertTrue( logFile.exists() );

        releaseResult.setResultCode( 0 );
        releaseResult.setEndTime( System.currentTimeMillis() );
        releaseResult.setProjectGroup( defaultProjectGroup );

        releaseResult = continuum.addContinuumReleaseResult( releaseResult );

        List<ContinuumReleaseResult> releaseResults =
            continuum.getContinuumReleaseResultsByProjectGroup( defaultProjectGroup.getId() );
        assertEquals( 1, releaseResults.size() );
        assertEquals( releaseResult, releaseResults.get( 0 ) );

        continuum.removeContinuumReleaseResult( releaseResult.getId() );
        assertEquals( 0, continuum.getAllContinuumReleaseResults().size() );
View Full Code Here

    }
*/
    private PrepareBuildProjectsTask createTask( String pomResource, boolean singleCheckout, boolean buildFresh )
        throws Exception
    {
        ProjectGroup projectGroup = getProjectGroup( pomResource, singleCheckout );

        BuildDefinition buildDefinition = new BuildDefinition();
        buildDefinition.setId( 0 );
        buildDefinition.setGoals( "clean" );
        buildDefinition.setBuildFresh( buildFresh );
       
        projectGroup.addBuildDefinition( buildDefinition );

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

        AbstractContinuumAction.setWorkingDirectory( pgContext, configurationService.getWorkingDirectory().getAbsolutePath() );

        AbstractContinuumAction.setUnvalidatedProjectGroup( pgContext, projectGroup );

        actionManager.lookup( "validate-project-group" ).execute( pgContext );

        actionManager.lookup( "store-project-group" ).execute( pgContext );

        int projectGroupId = AbstractContinuumAction.getProjectGroupId( pgContext );

        projectGroup = getProjectGroupDao().getProjectGroupWithBuildDetailsByProjectGroupId( projectGroupId );

        String scmRootUrl = getScmRootUrl( projectGroup );

        assertNotNull( scmRootUrl );

        ProjectScmRoot scmRoot = getProjectScmRoot( projectGroup, scmRootUrl );

        assertNotNull( scmRoot );

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

        Map<Integer, Integer> map = new HashMap<Integer, Integer>();

        Project rootProject = null;

        List<Project> projects = (List<Project>) projectGroup.getProjects();

        for ( Project project : projects )
        {
            assertFalse( project.getId() == 0 );
           
            map.put( project.getId(), buildDefinition.getId() );

            if ( rootProject == null || rootProject.getId() > project.getId() )
            {
                rootProject = project;
            }
        }

        assertEquals( 3, map.size() );
        PrepareBuildProjectsTask task = new PrepareBuildProjectsTask( map, 1,
                                                                      projectGroupId, projectGroup.getName(),
                                                                      scmRoot.getScmRootAddress(), scmRoot.getId() );

        return task;
    }
View Full Code Here

   
        assertNotNull( "Project list not null", result.getProjects() );
   
        assertEquals( "#Projectgroups", 1, result.getProjectGroups().size() );
   
        ProjectGroup pg = result.getProjectGroups().get( 0 );
   
        if ( !result.getProjects().isEmpty() )
        {
            for ( Project p : result.getProjects() )
            {
                pg.addProject( p );
            }
        }

        return pg;
    }
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.