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

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


    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

        if ( mavenProject.getParent() != null )
        {
            MavenProject parentProject = mavenProject.getParent();

            ProjectDependency parent = new ProjectDependency();

            parent.setGroupId( parentProject.getGroupId() );

            parent.setArtifactId( parentProject.getArtifactId() );

            parent.setVersion( parentProject.getVersion() );

            continuumProject.setParent( parent );
        }

        // ----------------------------------------------------------------------
        // Dependencies
        // ----------------------------------------------------------------------

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

        for ( Dependency dependency : (List<Dependency>) mavenProject.getDependencies() )
        {
            ProjectDependency cd = new ProjectDependency();

            cd.setGroupId( dependency.getGroupId() );

            cd.setArtifactId( dependency.getArtifactId() );

            cd.setVersion( dependency.getVersion() );

            dependencies.add( cd );
        }

        for ( Plugin dependency : (List<Plugin>) mavenProject.getBuildPlugins() )
        {
            ProjectDependency cd = new ProjectDependency();

            cd.setGroupId( dependency.getGroupId() );

            cd.setArtifactId( dependency.getArtifactId() );

            cd.setVersion( dependency.getVersion() );

            dependencies.add( cd );
        }

        for ( ReportPlugin dependency : (List<ReportPlugin>) mavenProject.getReportPlugins() )
        {
            ProjectDependency cd = new ProjectDependency();

            cd.setGroupId( dependency.getGroupId() );

            cd.setArtifactId( dependency.getArtifactId() );

            cd.setVersion( dependency.getVersion() );

            dependencies.add( cd );
        }

        for ( Extension dependency : (List<Extension>) mavenProject.getBuildExtensions() )
        {
            ProjectDependency cd = new ProjectDependency();

            cd.setGroupId( dependency.getGroupId() );

            cd.setArtifactId( dependency.getArtifactId() );

            cd.setVersion( dependency.getVersion() );

            dependencies.add( cd );
        }

        continuumProject.setDependencies( dependencies );
View Full Code Here

    {
        Map map = ContinuumBuildConstant.getProjectParent( context );

        if ( map != null && map.size() > 0 )
        {
            ProjectDependency parent = new ProjectDependency();
            parent.setGroupId( ContinuumBuildConstant.getGroupId( map ) );
            parent.setArtifactId( ContinuumBuildConstant.getArtifactId( map ) );
            parent.setVersion( ContinuumBuildConstant.getVersion( map ) );

            return parent;
        }

        return null;
View Full Code Here

        if ( dependencies != null )
        {
            for ( Map map : dependencies )
            {
                ProjectDependency dependency = new ProjectDependency();
                dependency.setGroupId( ContinuumBuildConstant.getGroupId( map ) );
                dependency.setArtifactId( ContinuumBuildConstant.getArtifactId( map ) );
                dependency.setVersion( ContinuumBuildConstant.getVersion( map ) );

                projectDependencies.add( dependency );
            }
        }
        return projectDependencies;
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... ?
        long baseTime = System.currentTimeMillis();
        testBuildResult1 = createTestBuildResult( 1, true, 1, 1, "error1", 1, baseTime, baseTime + 1000 );
        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 );

        testBuildResult2 = createTestBuildResult( 2, false, 2, 2, "error2", 2, baseTime + 2000, baseTime + 3000 );
        BuildResult buildResult2 = createTestBuildResult( testBuildResult2 );
        testProject1.addBuildResult( buildResult2 );

        testBuildResult3 = createTestBuildResult( 3, true, 3, 3, "error3", 3, baseTime + 4000, baseTime + 5000 );
        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 );
        }

        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 );

        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 );
        }

        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 );

        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

            .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

        if ( mavenProject.getParent() != null )
        {
            MavenProject parentProject = mavenProject.getParent();

            ProjectDependency parent = new ProjectDependency();

            parent.setGroupId( parentProject.getGroupId() );

            parent.setArtifactId( parentProject.getArtifactId() );

            parent.setVersion( parentProject.getVersion() );

            continuumProject.setParent( parent );
        }

        // ----------------------------------------------------------------------
        // Dependencies
        // ----------------------------------------------------------------------

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

        for ( Dependency dependency : (List<Dependency>)mavenProject.getDependencies() )
        {
            ProjectDependency cd = new ProjectDependency();

            cd.setGroupId( dependency.getGroupId() );

            cd.setArtifactId( dependency.getArtifactId() );

            cd.setVersion( dependency.getVersion() );

            dependencies.add( cd );
        }

        for ( Plugin dependency : (List<Plugin>)mavenProject.getBuildPlugins() )
        {
            ProjectDependency cd = new ProjectDependency();

            cd.setGroupId( dependency.getGroupId() );

            cd.setArtifactId( dependency.getArtifactId() );

            cd.setVersion( dependency.getVersion() );

            dependencies.add( cd );
        }

        for ( ReportPlugin dependency : (List<ReportPlugin>)mavenProject.getReportPlugins() )
        {
            ProjectDependency cd = new ProjectDependency();

            cd.setGroupId( dependency.getGroupId() );

            cd.setArtifactId( dependency.getArtifactId() );

            cd.setVersion( dependency.getVersion() );

            dependencies.add( cd );
        }

        for ( Extension dependency : (List<Extension>)mavenProject.getBuildExtensions() )
        {
            ProjectDependency cd = new ProjectDependency();

            cd.setGroupId( dependency.getGroupId() );

            cd.setArtifactId( dependency.getArtifactId() );

            cd.setVersion( dependency.getVersion() );

            dependencies.add( cd );
        }

        continuumProject.setDependencies( dependencies );
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

    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.