Package org.apache.archiva.model

Examples of org.apache.archiva.model.VersionedReference


    }

    private void assertVersions( String artifactId, String version, String[] expectedVersions )
        throws Exception
    {
        VersionedReference reference = new VersionedReference();
        reference.setGroupId( "org.apache.archiva.metadata.tests" );
        reference.setArtifactId( artifactId );
        reference.setVersion( version );

        // Use the test metadata-repository, which is already setup for
        // These kind of version tests.
        File repoDir = new File( "src/test/repositories/metadata-repository" );
        repoContent.getRepository().setLocation( repoDir.getAbsolutePath() );
View Full Code Here


        try
        {
            ManagedRepositoryContent repository = repositoryFactory.getManagedRepositoryContent( repositoryId );

            VersionedReference ref = new VersionedReference();
            ref.setArtifactId( projectId );
            ref.setGroupId( namespace );
            ref.setVersion( version );

            repository.deleteVersion( ref );

            /*
            ProjectReference projectReference = new ProjectReference();
View Full Code Here

            TimeZone timezone = TimeZone.getTimeZone( "UTC" );
            DateFormat fmt = new SimpleDateFormat( "yyyyMMdd.HHmmss" );
            fmt.setTimeZone( timezone );
            ManagedRepository repoConfig = managedRepositoryAdmin.getManagedRepository( repositoryId );

            VersionedReference ref = new VersionedReference();
            ref.setArtifactId( artifact.getArtifactId() );
            ref.setGroupId( artifact.getGroupId() );
            ref.setVersion( artifact.getVersion() );

            ManagedRepositoryContent repository = repositoryFactory.getManagedRepositoryContent( repositoryId );

            ArtifactReference artifactReference = new ArtifactReference();
            artifactReference.setArtifactId( artifact.getArtifactId() );
View Full Code Here

    private void assertFetchVersioned( String requestedResource )
        throws Exception
    {
        File expectedFile = new File( managedDefaultDir, requestedResource );

        VersionedReference metadata = createVersionedReference( requestedResource );

        File downloadedFile = proxyHandler.fetchMetatadaFromProxies( managedDefaultRepository,
                                                                     managedDefaultRepository.toMetadataPath(
                                                                         metadata ) );
View Full Code Here

     */
    private void assertFetchVersionedFailed( String requestedResource )
        throws Exception
    {
        File expectedFile = new File( managedDefaultDir, requestedResource );
        VersionedReference metadata = createVersionedReference( requestedResource );

        File downloadedFile = proxyHandler.fetchMetatadaFromProxies( managedDefaultRepository,
                                                                     managedDefaultRepository.toMetadataPath(
                                                                         metadata ) );

View Full Code Here

        throws Exception
    {
        File actualFile = new File( managedDefaultDir, requestedResource );
        assertTrue( "Release Metadata should exist: " + requestedResource, 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

        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

        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

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.