Package org.apache.maven.archiva.model

Examples of org.apache.maven.archiva.model.ArchivaArtifact


        artifactDao = dao.getArtifactDAO();
    }

    public ArchivaArtifact createArtifact( String artifactId, String version )
    {
        ArchivaArtifact artifact =
            artifactDao.createArtifact( "org.apache.maven.archiva.test", artifactId, version, "", "jar" );
        artifact.getModel().setLastModified( new Date() );
        artifact.getModel().setRepositoryId( "testable_repo" );
        return artifact;
    }
View Full Code Here


    }

    public void testConstraintSHA1()
        throws Exception
    {
        ArchivaArtifact artifact;

        // Setup artifacts in fresh DB.
        artifact = createArtifact( "test-sha1-one", "1.0" );
        artifact.getModel().setChecksumSHA1( SHA1_HASH1 );
        artifactDao.saveArtifact( artifact );

        artifact = createArtifact( "test-sha1-one", "1.1" );
        artifact.getModel().setChecksumSHA1( SHA1_HASH1 );
        artifactDao.saveArtifact( artifact );

        artifact = createArtifact( "test-sha1-one", "1.2" );
        artifact.getModel().setChecksumSHA1( SHA1_HASH1 );
        artifactDao.saveArtifact( artifact );

        artifact = createArtifact( "test-sha1-two", "1.0" );
        artifact.getModel().setChecksumSHA1( SHA1_HASH1 );
        artifactDao.saveArtifact( artifact );

        artifact = createArtifact( "test-sha1-two", "2.0" );
        artifact.getModel().setChecksumSHA1( SHA1_HASH3 );
        artifactDao.saveArtifact( artifact );

        artifact = createArtifact( "test-sha1-two", "2.1" );
        artifact.getModel().setChecksumSHA1( SHA1_HASH2 );
        artifactDao.saveArtifact( artifact );

        artifact = createArtifact( "test-sha1-two", "3.0" );
        artifact.getModel().setChecksumSHA1( SHA1_HASH2 );
        artifactDao.saveArtifact( artifact );

        assertConstraint( "Artifacts by SHA1 Checksum", 4,
                          new ArtifactsByChecksumConstraint( SHA1_HASH1, ArtifactsByChecksumConstraint.SHA1 ) );
        assertConstraint( "Artifacts by SHA1 Checksum", 2,
View Full Code Here

    }

    public void testConstraintMD5()
        throws Exception
    {
        ArchivaArtifact artifact;

        artifact = createArtifact( "test-md5-one", "1.0" );
        artifact.getModel().setChecksumMD5( MD5_HASH1 );
        artifactDao.saveArtifact( artifact );

        artifact = createArtifact( "test-md5-one", "1.1" );
        artifact.getModel().setChecksumMD5( MD5_HASH1 );
        artifactDao.saveArtifact( artifact );

        artifact = createArtifact( "test-md5-one", "1.2" );
        artifact.getModel().setChecksumMD5( MD5_HASH1 );
        artifactDao.saveArtifact( artifact );

        artifact = createArtifact( "test-md5-two", "1.0" );
        artifact.getModel().setChecksumMD5( MD5_HASH1 );
        artifactDao.saveArtifact( artifact );

        artifact = createArtifact( "test-md5-two", "2.0" );
        artifact.getModel().setChecksumMD5( MD5_HASH3 );
        artifactDao.saveArtifact( artifact );

        artifact = createArtifact( "test-md5-two", "2.1" );
        artifact.getModel().setChecksumMD5( MD5_HASH2 );
        artifactDao.saveArtifact( artifact );

        artifact = createArtifact( "test-md5-two", "3.0" );
        artifact.getModel().setChecksumMD5( MD5_HASH2 );
        artifactDao.saveArtifact( artifact );

        assertConstraint( "Artifacts by MD5 Checksum", 4,
                          new ArtifactsByChecksumConstraint( MD5_HASH1, ArtifactsByChecksumConstraint.MD5 ) );
        assertConstraint( "Artifacts by MD5 Checksum", 2,
View Full Code Here

    }

    public void testConstraintOR()
        throws Exception
    {
        ArchivaArtifact artifact;

        artifact = createArtifact( "test-one", "1.0" );
        artifact.getModel().setChecksumMD5( MD5_HASH1 );
        artifactDao.saveArtifact( artifact );

        artifact = createArtifact( "test-one", "1.1" );
        artifact.getModel().setChecksumMD5( MD5_HASH1 );
        artifactDao.saveArtifact( artifact );

        artifact = createArtifact( "test-one", "1.2" );
        artifact.getModel().setChecksumMD5( MD5_HASH1 );
        artifactDao.saveArtifact( artifact );

        artifact = createArtifact( "test-two", "1.0" );
        artifact.getModel().setChecksumMD5( MD5_HASH1 );
        artifactDao.saveArtifact( artifact );

        artifact = createArtifact( "test-two", "2.0" );
        artifact.getModel().setChecksumMD5( MD5_HASH3 );
        artifactDao.saveArtifact( artifact );

        artifact = createArtifact( "test-two", "2.1" );
        artifact.getModel().setChecksumMD5( MD5_HASH2 );
        artifactDao.saveArtifact( artifact );

        artifact = createArtifact( "test-two", "3.0" );
        artifact.getModel().setChecksumMD5( MD5_HASH2 );
        artifactDao.saveArtifact( artifact );

        assertConstraint( "Artifacts by MD5 Checksum", 4, new ArtifactsByChecksumConstraint( MD5_HASH1 ) );
        assertConstraint( "Artifacts by MD5 Checksum", 2, new ArtifactsByChecksumConstraint( MD5_HASH2 ) );
        assertConstraint( "Artifacts by MD5 Checksum", 1, new ArtifactsByChecksumConstraint( MD5_HASH3 ) );
View Full Code Here

        artifactDao = dao.getArtifactDAO();
    }

    private ArchivaArtifact createArtifact( String groupId, String artifactId, String version )
    {
        ArchivaArtifact artifact = artifactDao.createArtifact( groupId, artifactId, version, null, "jar" );
        artifact.getModel().setLastModified( new Date() );
        artifact.getModel().setRepositoryId( "test-repo" );

        return artifact;
    }
View Full Code Here

        throws Exception
    {
        Date whenGathered = Calendar.getInstance().getTime();
        whenGathered.setTime( 123456789 );

        ArchivaArtifact artifact = createArtifact( "org.apache.archiva", "artifact-one", "1.0" );
        artifact.getModel().setWhenGathered( whenGathered );
        artifactDao.saveArtifact( artifact );

        artifact = createArtifact( "org.apache.archiva", "artifact-one", "1.0.1" );
        artifact.getModel().setWhenGathered( whenGathered );
        artifactDao.saveArtifact( artifact );

        artifact = createArtifact( "org.apache.archiva", "artifact-two", "1.0.2" );
        artifact.getModel().setWhenGathered( whenGathered );
        artifactDao.saveArtifact( artifact );

        artifact = createArtifact( "org.apache.archiva", "artifact-one", "2.0" );
        artifact.getModel().setRepositoryId( "different-repo" );
        artifact.getModel().setWhenGathered( whenGathered );
        artifactDao.saveArtifact( artifact );

        assertConstraint( "Artifacts By Repository", 3, new ArtifactsByRepositoryConstraint( "test-repo" ) );
    }
View Full Code Here

    public void testQueryArtifactsInRepoWithWhenGathered()
        throws Exception
    {
        Date whenGathered = Calendar.getInstance().getTime();

        ArchivaArtifact artifact = createArtifact( "org.apache.archiva", "artifact-one", "1.0" );
        artifact.getModel().setWhenGathered( whenGathered );
        artifactDao.saveArtifact( artifact );

        artifact = createArtifact( "org.apache.archiva", "artifact-one", "1.0.1" );
        artifact.getModel().setWhenGathered( whenGathered );
        artifactDao.saveArtifact( artifact );

        artifact = createArtifact( "org.apache.archiva", "artifact-one", "1.0.2" );
        artifact.getModel().setWhenGathered( whenGathered );
        artifactDao.saveArtifact( artifact );

        artifact = createArtifact( "org.apache.archiva", "artifact-one", "2.0" );
        artifact.getModel().setRepositoryId( "different-repo" );
        artifact.getModel().setWhenGathered( whenGathered );
        artifactDao.saveArtifact( artifact );

        Date olderWhenGathered = Calendar.getInstance().getTime();
        olderWhenGathered.setTime( 123456789 );
       
        artifact = createArtifact( "org.apache.archiva", "artifact-two", "1.1-SNAPSHOT" );
        artifact.getModel().setWhenGathered( olderWhenGathered );
        artifactDao.saveArtifact( artifact );

        artifact = createArtifact( "org.apache.archiva", "artifact-three", "2.0-beta-1" );
        artifact.getModel().setWhenGathered( whenGathered );
        artifactDao.saveArtifact( artifact );

        assertConstraint( "Artifacts By Repository and When Gathered", 4,
                          new ArtifactsByRepositoryConstraint( "test-repo", whenGathered, "repositoryId" ) );
    }
View Full Code Here

        artifactDao = dao.getArtifactDAO();
    }

    public ArchivaArtifact createArtifact( String groupId, String artifactId, String version )
    {
        ArchivaArtifact artifact = artifactDao.createArtifact( groupId, artifactId, version, "", "jar" );
        artifact.getModel().setLastModified( new Date() ); // mandatory field.
        artifact.getModel().setRepositoryId( "testable_repo" );
        return artifact;
    }
View Full Code Here

    }

    public void testConstraint()
        throws Exception
    {
        ArchivaArtifact artifact;

        // Setup artifacts in fresh DB.
        artifact = createArtifact( "commons-lang", "commons-lang", "2.0" );
        artifactDao.saveArtifact( artifact );
View Full Code Here

    public ArchivaArtifact toArtifact( String id )
    {
        ArtifactReference ref = toArtifactReference( id );

        ArchivaArtifact artifact = new ArchivaArtifact( ref.getGroupId(), ref.getArtifactId(), ref.getVersion(), ref
            .getClassifier(), ref.getType() );
        artifact.getModel().setLastModified( new Date() );
        artifact.getModel().setRepositoryId( "testable_repo" );
        return artifact;
    }
View Full Code Here

TOP

Related Classes of org.apache.maven.archiva.model.ArchivaArtifact

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.