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

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


            List<ProjectDependency> deps = new ArrayList<ProjectDependency>();

            for ( Xpp3Dom dependency : dependenciesList )
            {
                ProjectDependency cd = new ProjectDependency();

                if ( getValue( dependency, "groupId", null ) != null )
                {
                    cd.setGroupId( getValue( dependency, "groupId", null ) );

                    cd.setArtifactId( getValue( dependency, "artifactId", null ) );
                }
                else
                {
                    cd.setGroupId( getValue( dependency, "id", null ) );

                    cd.setArtifactId( getValue( dependency, "id", null ) );
                }

                cd.setVersion( getValue( dependency, "version", null ) );

                deps.add( cd );
            }

            project.setDependencies( deps );
View Full Code Here


    public void testAddDependencyToProject()
        throws ContinuumStoreException
    {
        Project project = projectDao.getProjectWithAllDetails( testProject1.getId() );

        ProjectDependency dependency = createTestDependency( "TADTP groupId", "TADTP artifactId", "TADTP version" );
        ProjectDependency copy = createTestDependency( dependency );
        project.addDependency( dependency );
        projectDao.updateProject( project );

        project = projectDao.getProjectWithAllDetails( testProject1.getId() );
        assertEquals( "check # deps", 3, project.getDependencies().size() );
View Full Code Here

    public void testEditDependency()
        throws ContinuumStoreException
    {
        Project project = projectDao.getProjectWithAllDetails( testProject1.getId() );

        ProjectDependency newDependency = project.getDependencies().get( 0 );
        newDependency.setGroupId( "groupId1.1" );
        newDependency.setArtifactId( "artifactId1.1" );

        ProjectDependency copy = createTestDependency( newDependency );
        projectDao.updateProject( project );

        project = projectDao.getProjectWithAllDetails( testProject1.getId() );
        assertEquals( "check # deps", 2, project.getDependencies().size() );
        assertDependencyEquals( copy, project.getDependencies().get( 0 ) );
View Full Code Here

    public void testDeleteDependency()
        throws ContinuumStoreException
    {
        Project project = projectDao.getProjectWithAllDetails( testProject1.getId() );
        ProjectDependency dependency = project.getDependencies().get( 1 );
        project.getDependencies().remove( 0 );
        projectDao.updateProject( project );

        project = projectDao.getProjectWithAllDetails( testProject1.getId() );
        assertEquals( "check size is now 1", 1, project.getDependencies().size() );
View Full Code Here

        return project;
    }

    private ProjectDependency generateProjectDependency( Project project )
    {
        ProjectDependency dep = new ProjectDependency();
        dep.setArtifactId( project.getArtifactId() );
        dep.setGroupId( project.getGroupId() );
        dep.setVersion( project.getVersion() );

        return dep;
    }
View Full Code Here

            String projectGroupId = "[" + project.getProjectGroup().getId() + "]";

            // Dependencies
            for ( Object o : project.getDependencies() )
            {
                ProjectDependency dependency = (ProjectDependency) o;

                String dependencyId = projectGroupId + ":" + getDependencyId( dependency );

                if ( dag.getVertex( dependencyId ) != null )
                {
                    try
                    {
                        dag.addEdge( id, dependencyId );
                    }
                    catch ( CycleDetectedException e )
                    {
                        logger.warn( "Ignore cycle detected in project dependencies: " + e.getMessage() );
                    }
                }
            }

            // Parent
            ProjectDependency parent = project.getParent();

            if ( parent != null )
            {
                String parentId = projectGroupId + ":" + getDependencyId( parent );
View Full Code Here

            List<ProjectDependency> deps = new ArrayList<ProjectDependency>();

            for ( Xpp3Dom dependency : dependenciesList )
            {
                ProjectDependency cd = new ProjectDependency();

                if ( getValue( dependency, "groupId", null ) != null )
                {
                    cd.setGroupId( getValue( dependency, "groupId", null ) );

                    cd.setArtifactId( getValue( dependency, "artifactId", null ) );
                }
                else
                {
                    cd.setGroupId( getValue( dependency, "id", null ) );

                    cd.setArtifactId( getValue( dependency, "id", null ) );
                }

                cd.setVersion( getValue( dependency, "version", null ) );

                deps.add( cd );
            }

            project.setDependencies( deps );
View Full Code Here

        ProjectDeveloper testDeveloper1 = createTestDeveloper( 1, "email1", "name1", "scmId1" );
        ProjectDeveloper testDeveloper2 = createTestDeveloper( 2, "email2", "name2", "scmId2" );
        ProjectDeveloper testDeveloper3 = createTestDeveloper( 3, "email3", "name3", "scmId3" );

        ProjectDependency testDependency1 = createTestDependency( "groupId1", "artifactId1", "version1" );
        ProjectDependency testDependency2 = createTestDependency( "groupId2", "artifactId2", "version2" );
        ProjectDependency testDependency3 = createTestDependency( "groupId3", "artifactId3", "version3" );

        // TODO: simplify by deep copying the relationships in createTest... ?
        baseTime = System.currentTimeMillis();

        Calendar cal = Calendar.getInstance();
        cal.setTime( new Date( baseTime ) );
        cal.add( Calendar.DAY_OF_MONTH, 1 );

        long newTime = cal.getTimeInMillis();

        // successful forced build
        testBuildResult1 = createTestBuildResult( 1, true, 2, 1, "error1", 1, baseTime, baseTime + 1000, "user" );
        BuildResult buildResult1 = createTestBuildResult( testBuildResult1 );
        ScmResult scmResult = createTestScmResult( "commandOutput1", "providerMessage1", true, "1" );
        buildResult1.setScmResult( scmResult );
        ScmResult testBuildResult1ScmResult = createTestScmResult( scmResult, "1" );
        testBuildResult1.setScmResult( testBuildResult1ScmResult );
        testCheckoutResult1 = createTestScmResult( "commandOutputCO1", "providerMessageCO1", false, "CO1" );
        ScmResult checkoutResult1 = createTestScmResult( testCheckoutResult1, "CO1" );
        testProject1.setCheckoutResult( checkoutResult1 );
        testProject1.addBuildResult( buildResult1 );

        // failed scheduled build
        testBuildResult2 = createTestBuildResult( 2, false, 3, 2, "error2", 2, newTime, newTime + 3000, "schedule" );
        BuildResult buildResult2 = createTestBuildResult( testBuildResult2 );
        testProject1.addBuildResult( buildResult2 );

        cal.add( Calendar.DAY_OF_MONTH, 2 );
        newTime = cal.getTimeInMillis();

        // successful scheduled build
        testBuildResult3 = createTestBuildResult( 2, true, 2, 3, "error3", 3, newTime, newTime + 5000, "schedule" );
        BuildResult buildResult3 = createTestBuildResult( testBuildResult3 );
        scmResult = createTestScmResult( "commandOutput3", "providerMessage3", true, "3" );
        buildResult3.setScmResult( scmResult );
        testBuildResult3.setScmResult( createTestScmResult( scmResult, "3" ) );
        testProject2.addBuildResult( buildResult3 );

        // TODO: better way? this assumes that some untested methods already work!
        Schedule schedule2 = createTestSchedule( testSchedule2 );
        if ( addToStore )
        {
            schedule2 = scheduleDao.addSchedule( schedule2 );
            testSchedule2.setId( schedule2.getId() );
        }
        else
        {
            // from expected.xml, continuum-data-management
            testSchedule2.setId( 1 );
        }

        Schedule schedule1 = createTestSchedule( testSchedule1 );
        if ( addToStore )
        {
            schedule1 = scheduleDao.addSchedule( schedule1 );
            testSchedule1.setId( schedule1.getId() );
        }
        else
        {
            // from expected.xml, continuum-data-management
            testSchedule1.setId( 2 );
        }

        Schedule schedule3 = createTestSchedule( testSchedule3 );
        if ( addToStore )
        {
            schedule3 = scheduleDao.addSchedule( schedule3 );
            testSchedule3.setId( schedule3.getId() );
        }
        else
        {
            // from expected.xml, continuum-data-management
            testSchedule3.setId( 3 );
        }

        Installation installationJava14 = createTestInstallation( testInstallationJava14 );
        if ( addToStore )
        {
            installationJava14 = installationDao.addInstallation( installationJava14 );
        }
        else
        {
            installationJava14.setInstallationId( 1 );
        }

        Installation installationMaven20a3 = createTestInstallation( testInstallationMaven20a3 );
        if ( addToStore )
        {
            installationMaven20a3 = installationDao.addInstallation( installationMaven20a3 );
        }
        else
        {
            installationMaven20a3.setInstallationId( 2 );
        }

        Installation installationJava13 = createTestInstallation( testInstallationJava13 );
        if ( addToStore )
        {
            installationJava13 = installationDao.addInstallation( installationJava13 );
        }
        else
        {
            installationJava13.setInstallationId( 3 );
        }

        Installation installationEnvVar = createTestInstallation( testInstallationEnvVar );
        if ( addToStore )
        {
            installationEnvVar = installationDao.addInstallation( installationEnvVar );
        }
        else
        {
            installationEnvVar.setInstallationId( 4 );
        }

        testProfile1 = createTestProfile( "name1", "description1", 1, true, true, installationJava13,
                                          installationMaven20a3 );
        testProfile2 = createTestProfile( "name2", "description2", 2, false, true, installationJava14,
                                          installationMaven20a3 );
        testProfile3 = createTestProfile( "name3", "description3", 3, true, false, installationJava14,
                                          installationMaven20a3 );
        testProfile4 = createTestProfile( "name4", "description4", 4, false, false, installationJava14,
                                          installationMaven20a3 );
        testProfile4.addEnvironmentVariable( installationEnvVar );

        Profile profile1 = createTestProfile( testProfile1 );
        if ( addToStore )
        {
            profile1 = profileDao.addProfile( profile1 );
            testProfile1.setId( profile1.getId() );
        }
        else
        {
            testProfile1.setId( 1 );
        }

        Profile profile2 = createTestProfile( testProfile2 );
        if ( addToStore )
        {
            profile2 = profileDao.addProfile( profile2 );
            testProfile2.setId( profile2.getId() );
        }
        else
        {
            testProfile2.setId( 2 );
        }

        Profile profile3 = createTestProfile( testProfile3 );
        if ( addToStore )
        {
            profile3 = profileDao.addProfile( profile3 );
            testProfile3.setId( profile3.getId() );
        }
        else
        {
            profile3.setId( 3 );
        }

        Profile profile4 = createTestProfile( testProfile4 );
        if ( addToStore )
        {
            profile4 = profileDao.addProfile( profile4 );
            testProfile4.setId( profile4.getId() );
        }
        else
        {
            profile4.setId( 4 );
        }

        testRepoPurgeConfiguration1 = createTestRepositoryPurgeConfiguration( true, 5, 50, false, schedule2, true,
                                                                              localRepository1 );
        if ( addToStore )
        {
            testRepoPurgeConfiguration1 = repositoryPurgeConfigurationDao.addRepositoryPurgeConfiguration(
                testRepoPurgeConfiguration1 );
        }
        else
        {
            testRepoPurgeConfiguration1.setId( 1 );
        }

        testRepoPurgeConfiguration2 = createTestRepositoryPurgeConfiguration( false, 10, 200, true, schedule1, true,
                                                                              localRepository2 );
        if ( addToStore )
        {
            testRepoPurgeConfiguration2 = repositoryPurgeConfigurationDao.addRepositoryPurgeConfiguration(
                testRepoPurgeConfiguration2 );
        }
        else
        {
            testRepoPurgeConfiguration2.setId( 2 );
        }

        testRepoPurgeConfiguration3 = createTestRepositoryPurgeConfiguration( false, 10, 200, true, schedule2, true,
                                                                              localRepository1 );
        if ( addToStore )
        {
            testRepoPurgeConfiguration3 = repositoryPurgeConfigurationDao.addRepositoryPurgeConfiguration(
                testRepoPurgeConfiguration3 );
        }
        else
        {
            testRepoPurgeConfiguration3.setId( 3 );
        }

        testDirectoryPurgeConfig = createTestDirectoryPurgeConfiguration( "location1", "directoryType1", true, 10, 50,
                                                                          schedule2, true );
        if ( addToStore )
        {
            testDirectoryPurgeConfig = directoryPurgeConfigurationDao.addDirectoryPurgeConfiguration(
                testDirectoryPurgeConfig );
        }
        else
        {
            testDirectoryPurgeConfig.setId( 1 );
        }

        BuildDefinition testGroupBuildDefinition1 = createTestBuildDefinition( "arguments1", "buildFile1", "goals1",
                                                                               profile1, schedule2, false, false );
        BuildDefinition testGroupBuildDefinition2 = createTestBuildDefinition( "arguments2", "buildFile2", "goals2",
                                                                               profile1, schedule1, false, false );
        BuildDefinition testGroupBuildDefinition3 = createTestBuildDefinition( "arguments3", "buildFile3", "goals3",
                                                                               profile2, schedule1, false, false );
        BuildDefinition testGroupBuildDefinition4 = createTestBuildDefinition( null, null, "deploy", null, null, false,
                                                                               false );

        BuildDefinition testBuildDefinition1 = createTestBuildDefinition( "arguments11", "buildFile11", "goals11",
                                                                          profile2, schedule1, false, false );
        BuildDefinition testBuildDefinition2 = createTestBuildDefinition( "arguments12", "buildFile12", "goals12",
                                                                          profile2, schedule2, false, false );
        BuildDefinition testBuildDefinition3 = createTestBuildDefinition( "arguments13", "buildFile13", "goals13",
                                                                          profile1, schedule2, false, false );
        BuildDefinition testBuildDefinition4 = createTestBuildDefinition( null, null, "deploy", null, null, false,
                                                                          false );
        BuildDefinition testBuildDefinition5 = createTestBuildDefinition( "arguments14", "buildFile14", "goals14",
                                                                          profile1, schedule1, false, false );
        testBuildDefinition5.setTemplate( true );

        BuildDefinitionTemplate testBuildDefinitionTemplate1 = createTestBuildDefinitionTemplate( "template2", "type2",
                                                                                                  false );
        testBuildDefinitionTemplate1.addBuildDefinition( testBuildDefinition5 );

        if ( addToStore )
        {
            buildDefinitionTemplateDao.addBuildDefinitionTemplate( testBuildDefinitionTemplate1 );
        }

        ProjectGroup group = createTestProjectGroup( defaultProjectGroup );

        Project project1 = createTestProject( testProject1 );
        project1.addBuildResult( buildResult1 );
        project1.addBuildResult( buildResult2 );
        project1.setCheckoutResult( checkoutResult1 );
        ProjectNotifier notifier1 = createTestNotifier( testNotifier1 );
        project1.addNotifier( notifier1 );
        testProject1.addNotifier( testNotifier1 );

        BuildDefinition buildDefinition1 = createTestBuildDefinition( testBuildDefinition1 );
        project1.addBuildDefinition( buildDefinition1 );
        testProject1.addBuildDefinition( testBuildDefinition1 );
        BuildDefinition buildDefinition2 = createTestBuildDefinition( testBuildDefinition2 );
        project1.addBuildDefinition( buildDefinition2 );
        testProject1.addBuildDefinition( testBuildDefinition2 );

        ProjectDeveloper projectDeveloper1 = createTestDeveloper( testDeveloper1 );
        project1.addDeveloper( projectDeveloper1 );
        testProject1.addDeveloper( testDeveloper1 );

        ProjectDependency projectDependency1 = createTestDependency( testDependency1 );
        project1.addDependency( projectDependency1 );
        testProject1.addDependency( testDependency1 );

        ProjectDependency projectDependency2 = createTestDependency( testDependency2 );
        project1.addDependency( projectDependency2 );
        testProject1.addDependency( testDependency2 );

        group.addProject( project1 );
        defaultProjectGroup.addProject( project1 );
        Project project2 = createTestProject( testProject2 );
        project2.addBuildResult( buildResult3 );
        ProjectNotifier notifier2 = createTestNotifier( testNotifier2 );
        project2.addNotifier( notifier2 );
        testProject2.addNotifier( testNotifier2 );
        ProjectNotifier notifier3 = createTestNotifier( testNotifier3 );
        project2.addNotifier( notifier3 );
        testProject2.addNotifier( testNotifier3 );

        BuildDefinition buildDefinition3 = createTestBuildDefinition( testBuildDefinition3 );
        project2.addBuildDefinition( buildDefinition3 );
        testProject2.addBuildDefinition( testBuildDefinition3 );

        BuildDefinition buildDefinition4 = createTestBuildDefinition( testBuildDefinition4 );
        project2.addBuildDefinition( buildDefinition4 );
        testProject2.addBuildDefinition( testBuildDefinition4 );

        ProjectDeveloper projectDeveloper2 = createTestDeveloper( testDeveloper2 );
        project2.addDeveloper( projectDeveloper2 );
        testProject2.addDeveloper( testDeveloper2 );

        ProjectDeveloper projectDeveloper3 = createTestDeveloper( testDeveloper3 );
        project2.addDeveloper( projectDeveloper3 );
        testProject2.addDeveloper( testDeveloper3 );

        ProjectDependency projectDependency3 = createTestDependency( testDependency3 );
        project2.addDependency( projectDependency3 );
        testProject2.addDependency( testDependency3 );

        group.addProject( project2 );
        defaultProjectGroup.addProject( project2 );
View Full Code Here

                                    developer.getScmId() );
    }

    protected static ProjectDependency createTestDependency( String groupId, String artifactId, String version )
    {
        ProjectDependency dependency = new ProjectDependency();
        dependency.setArtifactId( artifactId );
        dependency.setGroupId( groupId );
        dependency.setVersion( version );
        return dependency;
    }
View Full Code Here

    public void testAddDependencyToProject()
        throws ContinuumStoreException
    {
        Project project = projectDao.getProjectWithAllDetails( testProject1.getId() );

        ProjectDependency dependency = createTestDependency( "TADTP groupId", "TADTP artifactId", "TADTP version" );
        ProjectDependency copy = createTestDependency( dependency );
        project.addDependency( dependency );
        projectDao.updateProject( project );

        project = projectDao.getProjectWithAllDetails( testProject1.getId() );
        assertEquals( "check # deps", 3, project.getDependencies().size() );
View Full Code Here

TOP

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

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.