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

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


    {
        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


    extends AbstractValidationContinuumAction
{
    public void execute( Map context )
        throws Exception
    {
        ProjectGroup projectGroup = getUnvalidatedProjectGroup( context );

        // TODO: assert that the name is unique

        assertStringNotEmpty( projectGroup.getName(), "name" );

        assertStringNotEmpty( projectGroup.getGroupId(), "group id" );
    }
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

    public void execute( Map context )
        throws ContinuumException, ContinuumStoreException
    {
        int projectGroupId = getProjectGroupId( context );

        ProjectGroup projectGroup = projectGroupDao.getProjectGroup( projectGroupId );

        // TODO: make the resource the name of the project group and hide the id from the user

        try
        {
            if ( !roleManager.templatedRoleExists( "project-administrator", projectGroup.getName() ) )
            {
                roleManager.createTemplatedRole( "project-administrator", projectGroup.getName() );
            }
            if ( !roleManager.templatedRoleExists( "project-developer", projectGroup.getName() ) )
            {
                roleManager.createTemplatedRole( "project-developer", projectGroup.getName() );
            }

            if ( !roleManager.templatedRoleExists( "project-user", projectGroup.getName() ) )
            {
                roleManager.createTemplatedRole( "project-user", projectGroup.getName() );
            }
        }
        catch ( RoleManagerException e )
        {
            e.printStackTrace();
            throw new ContinuumException( "error generating templated role for project " + projectGroup.getName(), e );
        }
    }
View Full Code Here

    public ProjectGroup addBuildDefinitionTemplateToProjectGroup( int projectGroupId, BuildDefinitionTemplate template )
        throws BuildDefinitionServiceException, ContinuumObjectNotFoundException
    {
        try
        {
            ProjectGroup projectGroup =
                projectGroupDao.getProjectGroupWithBuildDetailsByProjectGroupId( projectGroupId );
            if ( template.getBuildDefinitions().isEmpty() )
            {
                return null;
            }

            for ( BuildDefinition bd : (List<BuildDefinition>) template.getBuildDefinitions() )
            {
                bd.setTemplate( false );
                bd = buildDefinitionDao.addBuildDefinition( cloneBuildDefinition( bd ) );
                projectGroup.addBuildDefinition( bd );
            }
            projectGroupDao.updateProjectGroup( projectGroup );
            return projectGroup;

        }
View Full Code Here

        throws Exception
    {
        BuildDefinition buildDefinition = getBuildDefinition( context );
        int projectGroupId = getProjectGroupId( context );

        ProjectGroup projectGroup = projectGroupDao.getProjectGroupWithBuildDetailsByProjectGroupId( projectGroupId );

        resolveDefaultBuildDefinitionsForProjectGroup( buildDefinition, projectGroup );

        updateBuildDefinitionInList( projectGroup.getBuildDefinitions(), buildDefinition );

        AbstractContinuumAction.setBuildDefinition( context, buildDefinition );
    }
View Full Code Here

   
    public void testAddProjectToExistingGroupWithBuildDefTemplate()
        throws Exception
    {

        ProjectGroup pg = new ProjectGroup();
        pg.setName( "foo" );
        pg.setDescription( "foo pg" );
        getContinuum().addProjectGroup( pg );
        pg = getContinuum().getAllProjectGroups().get( 1 );
        assertEquals( 2, getContinuum().getAllProjectGroups().size() );
        pg = getContinuum().getProjectGroupWithBuildDetails( pg.getId() );
        // group created with the m2 default build def
        assertEquals( 1, pg.getBuildDefinitions().size() );
       

        File rootPom = getTestFile( "src/test/resources/projects/continuum/continuum-core/pom.xml" );

        assertTrue( rootPom.exists() );
        //String url = getTestFile( "src/test-projects/project1/pom.xml" ).toURL().toExternalForm();
        ContinuumProjectBuildingResult result = getContinuum().addMavenTwoProject(
                                                                                   rootPom.toURI().toURL()
                                                                                       .toExternalForm(), pg.getId(),
                                                                                   true, false, false, bdt.getId() );
        assertNotNull( result );

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

        Project project = result.getProjects().get( 0 );
        project = getContinuum().getProjectWithBuildDetails( project.getId() );
        assertNotNull( project );
        pg = getContinuum().getProjectGroupWithBuildDetails( pg.getId() );
        log.info( "project buildDef list size : " + project.getBuildDefinitions().size() );
        // project with the build def coming from template
        assertEquals( 1, project.getBuildDefinitions().size() );
        assertEquals( "clean deploy", ( (BuildDefinition) project.getBuildDefinitions().get( 0 ) ).getGoals() );
    }
View Full Code Here

        log.info( "project buildDef list size : " + project.getBuildDefinitions().size() );
        // build def only at the group level du to group creation
        assertEquals( 0, project.getBuildDefinitions().size() );
       
        log.info( "all pg size " + getContinuum().getAllProjectGroups().size() );
        ProjectGroup pg = result.getProjectGroups().get( 0 );

        pg = getContinuum().getProjectGroupWithBuildDetails( pg.getId() );

        log.info( " pg groupId " + pg.getGroupId() );
        //@ group level the db from template must be used
        log.info( " pg builddefs size " + pg.getBuildDefinitions().size() );
        log.info( "pg bd goals " + ( (BuildDefinition) pg.getBuildDefinitions().get( 0 ) ).getGoals() );
        assertEquals( "clean deploy", ( (BuildDefinition) pg.getBuildDefinitions().get( 0 ) ).getGoals() );
       
    }   
View Full Code Here

        assertEquals( "mail", notifier.getType() );

        assertEquals( "foo@bar", notifier.getConfiguration().get( "address" ) );

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

        assertNotNull( pg );

        assertNotNull( pg.getNotifiers() );

        assertEquals( 0, pg.getNotifiers().size() );
    }
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.