Package org.apache.archiva.model

Examples of org.apache.archiva.model.VersionedReference


        throws Exception
    {
        File actualFile = new File( managedDefaultDir, requestedResource );
        assertTrue( "Snapshot Metadata should exist: " + requestedResource, actualFile.exists() );

        VersionedReference actualMetadata = createVersionedReference( requestedResource );

        assertSnapshotMetadata( actualFile, actualMetadata, expectedDate, expectedTime, expectedBuildnumber );
    }
View Full Code Here


        String proxiedFile = metadataTools.getRepositorySpecificName( proxiedRepoId, requestedResource );

        File actualFile = new File( managedDefaultDir, proxiedFile );
        assertTrue( "Repo Specific Snapshot Metadata should exist: " + requestedResource, actualFile.exists() );

        VersionedReference actualMetadata = createVersionedReference( requestedResource );

        assertSnapshotMetadata( actualFile, actualMetadata, expectedDate, expectedTime, expectedBuildnumber );
    }
View Full Code Here

        String proxiedFile = metadataTools.getRepositorySpecificName( proxiedRepoId, requestedResource );

        File actualFile = new File( managedDefaultDir, proxiedFile );
        assertTrue( "Release metadata for repo should exist: " + actualFile, actualFile.exists() );

        VersionedReference metadata = createVersionedReference( requestedResource );

        // Build expected metadata XML
        StringWriter expectedMetadataXml = new StringWriter();
        ArchivaRepositoryMetadata m = new ArchivaRepositoryMetadata();
        m.setGroupId( metadata.getGroupId() );
        m.setArtifactId( metadata.getArtifactId() );
        m.setVersion( metadata.getVersion() );
        RepositoryMetadataWriter.write( m, expectedMetadataXml );

        // Compare the file to the actual contents.
        assertMetadataEquals( expectedMetadataXml.toString(), actualFile );
    }
View Full Code Here

            Calendar olderThanThisDate = Calendar.getInstance( DateUtils.UTC_TIME_ZONE );
            olderThanThisDate.add( Calendar.DATE, -daysOlder );

            // respect retention count
            VersionedReference reference = new VersionedReference();
            reference.setGroupId( artifact.getGroupId() );
            reference.setArtifactId( artifact.getArtifactId() );
            reference.setVersion( artifact.getVersion() );

            List<String> versions = new ArrayList<String>( repository.getVersions( reference ) );

            Collections.sort( versions, VersionComparator.getInstance() );
View Full Code Here

            Collections.sort( releasedVersions, VersionComparator.getInstance() );

            // Now clean out any version that is earlier than the highest released version.
            boolean needsMetadataUpdate = false;

            VersionedReference versionRef = new VersionedReference();
            versionRef.setGroupId( artifactRef.getGroupId() );
            versionRef.setArtifactId( artifactRef.getArtifactId() );

            MetadataRepository metadataRepository = repositorySession.getRepository();

            if ( releasedVersions.contains( VersionUtil.getReleaseVersion( artifactRef.getVersion() ) ) )
            {
                versionRef.setVersion( artifactRef.getVersion() );
                repository.deleteVersion( versionRef );

                // FIXME: looks incomplete, might not delete related metadata?
                for ( RepositoryListener listener : listeners )
                {
View Full Code Here

        }
    }

    private void updateMetadata( ArtifactReference artifact )
    {
        VersionedReference versionRef = new VersionedReference();
        versionRef.setGroupId( artifact.getGroupId() );
        versionRef.setArtifactId( artifact.getArtifactId() );
        versionRef.setVersion( artifact.getVersion() );

        ProjectReference projectRef = new ProjectReference();
        projectRef.setGroupId( artifact.getGroupId() );
        projectRef.setArtifactId( artifact.getArtifactId() );
View Full Code Here

        if ( !path.endsWith( "/" + MAVEN_METADATA ) )
        {
            throw new RepositoryMetadataException( "Cannot convert to versioned reference, not a metadata file. " );
        }

        VersionedReference reference = new VersionedReference();

        String normalizedPath = StringUtils.replace( path, "\\", "/" );
        String pathParts[] = StringUtils.split( normalizedPath, '/' );

        int versionOffset = pathParts.length - 2;
        int artifactIdOffset = versionOffset - 1;
        int groupIdEnd = artifactIdOffset - 1;

        reference.setVersion( pathParts[versionOffset] );

        if ( !hasNumberAnywhere( reference.getVersion() ) )
        {
            // Scary check, but without it, all paths are version references;
            throw new RepositoryMetadataException(
                "Not a versioned reference, as version id on path has no number in it." );
        }

        reference.setArtifactId( pathParts[artifactIdOffset] );

        StringBuilder gid = new StringBuilder();
        for ( int i = 0; i <= groupIdEnd; i++ )
        {
            if ( i > 0 )
            {
                gid.append( "." );
            }
            gid.append( pathParts[i] );
        }

        reference.setGroupId( gid.toString() );

        return reference;
    }
View Full Code Here

            Calendar olderThanThisDate = Calendar.getInstance( DateUtils.UTC_TIME_ZONE );
            olderThanThisDate.add( Calendar.DATE, -daysOlder );

            // respect retention count
            VersionedReference reference = new VersionedReference();
            reference.setGroupId( artifact.getGroupId() );
            reference.setArtifactId( artifact.getArtifactId() );
            reference.setVersion( artifact.getVersion() );

            List<String> versions = new ArrayList<>( repository.getVersions( reference ) );

            Collections.sort( versions, VersionComparator.getInstance() );
View Full Code Here

            Collections.sort( releasedVersions, VersionComparator.getInstance() );

            // Now clean out any version that is earlier than the highest released version.
            boolean needsMetadataUpdate = false;

            VersionedReference versionRef = new VersionedReference();
            versionRef.setGroupId( artifactRef.getGroupId() );
            versionRef.setArtifactId( artifactRef.getArtifactId() );

            MetadataRepository metadataRepository = repositorySession.getRepository();

            if ( releasedVersions.contains( VersionUtil.getReleaseVersion( artifactRef.getVersion() ) ) )
            {
                versionRef.setVersion( artifactRef.getVersion() );
                repository.deleteVersion( versionRef );

                // FIXME: looks incomplete, might not delete related metadata?
                for ( RepositoryListener listener : listeners )
                {
View Full Code Here

        }
    }

    private void updateMetadata( ArtifactReference artifact )
    {
        VersionedReference versionRef = new VersionedReference();
        versionRef.setGroupId( artifact.getGroupId() );
        versionRef.setArtifactId( artifact.getArtifactId() );
        versionRef.setVersion( artifact.getVersion() );

        ProjectReference projectRef = new ProjectReference();
        projectRef.setGroupId( artifact.getGroupId() );
        projectRef.setArtifactId( artifact.getArtifactId() );
View Full Code Here

TOP

Related Classes of org.apache.archiva.model.VersionedReference

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.