Examples of ArchivaArtifact


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

    }

    public void saveTestData()
        throws Exception
    {
        ArchivaArtifact artifact;

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

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

    }

    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_CONDITION ) );
        assertConstraint( "Artifacts by MD5 Checksum", 2,
View Full Code Here

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

    }

    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

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

    }

    public void processFile( String path )
        throws ConsumerException
    {
        ArchivaArtifact artifact = getLiveArtifact( path );

        if ( artifact == null )
        {
            return;
        }

        try
        {
            artifact.getModel().setRepositoryId( this.repository.getId() );

            // Calculate the hashcodes.
            File artifactFile = new File( this.repositoryDir, path );
            try
            {
                artifact.getModel().setChecksumMD5( digestMd5.calc( artifactFile ) );
            }
            catch ( DigesterException e )
            {
                triggerConsumerWarning( CHECKSUM_CALCULATION, "Unable to calculate the MD5 checksum: " + e.getMessage() );
            }

            try
            {
                artifact.getModel().setChecksumSHA1( digestSha1.calc( artifactFile ) );
            }
            catch ( DigesterException e )
            {
                triggerConsumerWarning( CHECKSUM_CALCULATION, "Unable to calculate the SHA1 checksum: "
                    + e.getMessage() );
            }

            artifact.getModel().setLastModified( new Date( artifactFile.lastModified() ) );
            artifact.getModel().setSize( artifactFile.length() );
            artifact.getModel().setOrigin( "FileSystem" );

            dao.getArtifactDAO().saveArtifact( artifact );
        }
        catch ( ArchivaDatabaseException e )
        {
View Full Code Here

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

     */
    public ArchivaArtifact getLiveArtifact( String path )
    {
        try
        {
            ArchivaArtifact artifact = layout.toArtifact( path );

            ArchivaArtifact liveArtifact = dao.getArtifactDAO().createArtifact( artifact.getGroupId(),
                                                                                artifact.getArtifactId(),
                                                                                artifact.getVersion(),
                                                                                artifact.getClassifier(),
                                                                                artifact.getType() );

View Full Code Here

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

    public ArchivaArtifact toArtifact( String path )
        throws LayoutException
    {
        PathReferences pathrefs = toPathReferences( path, true );

        ArchivaArtifact artifact = new ArchivaArtifact( pathrefs.groupId, pathrefs.artifactId,
                                                        pathrefs.fileParts.version, pathrefs.fileParts.classifier,
                                                        pathrefs.type );

        return artifact;
    }
View Full Code Here

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

            }

            Iterator it = results.iterator();
            while ( it.hasNext() )
            {
                ArchivaArtifact dupArtifact = (ArchivaArtifact) it.next();

                if ( dupArtifact.equals( artifact ) )
                {
                    // Skip reference to itself.
                    continue;
                }

                RepositoryProblem problem = new RepositoryProblem();
                problem.setRepositoryId( dupArtifact.getModel().getRepositoryId() );
                problem.setPath( toPath( dupArtifact ) );
                problem.setGroupId( artifact.getGroupId() );
                problem.setArtifactId( artifact.getArtifactId() );
                problem.setVersion( artifact.getVersion() );
                problem.setType( DuplicateArtifactReport.PROBLEM_TYPE_DUPLICATE_ARTIFACTS );
View Full Code Here

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

    }

    public ArchivaProjectModel resolveProjectModel( VersionedReference reference )
        throws ProjectModelException
    {
        ArchivaArtifact artifact = new ArchivaArtifact( reference.getGroupId(), reference.getArtifactId(), reference
            .getVersion(), "", "pom" );

        String path = layout.toPath( artifact );
        File repoFile = new File( this.repository.getUrl().getPath(), path );
View Full Code Here

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

    }

    public ArchivaProjectModel selectVersion( String groupId, String artifactId, String version )
        throws ObjectNotFoundException, ArchivaDatabaseException
    {
        ArchivaArtifact pomArtifact = null;

        try
        {
            pomArtifact = dao.getArtifactDAO().getArtifact( groupId, artifactId, version, null, "pom" );

            if ( pomArtifact == null )
            {
                throw new ObjectNotFoundException( "Unable to find artifact [" + groupId + ":" + artifactId + ":"
                    + version + "]" );
            }
        }
        catch ( ObjectNotFoundException e )
        {
            throw e;
        }

        ArchivaProjectModel model;

        if ( pomArtifact.getModel().isProcessed() )
        {
            // It's been processed. return it.
            model = dao.getProjectModelDAO().getProjectModel( groupId, artifactId, version );
            return model;
        }
View Full Code Here

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

        dbSearch = (DatabaseSearch) lookup( DatabaseSearch.class.getName() );
    }
   
    public ArchivaArtifact createArtifact( String groupId, String artifactId, String version )
    {
        ArchivaArtifact artifact = artifactDao.createArtifact( groupId, artifactId, version, "", "jar" );
        artifact.getModel().setLastModified( new Date() );
        artifact.getModel().setRepositoryId( "testable_repo" );
        return artifact;
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.