Package org.apache.archiva.maven2.model

Examples of org.apache.archiva.maven2.model.TreeEntry


            Assertions.assertThat( artifactFile ).exists();
            Assertions.assertThat( artifactFilemd5 ).exists();
            Assertions.assertThat( artifactFilepom ).exists();

            // we delete only one snapshot
            Artifact artifact =
                new Artifact( "org.apache.archiva.redback.components", "spring-quartz", "2.0-20120618.214127-1" );
            artifact.setPackaging( "jar" );
            artifact.setRepositoryId( SNAPSHOT_REPO_ID );
            artifact.setContext( SNAPSHOT_REPO_ID );

            repositoriesService.deleteArtifact( artifact );

            artifacts =
                browseService.getArtifactDownloadInfos( "org.apache.archiva.redback.components", "spring-quartz",
View Full Code Here


        List<Artifact> artifacts = new ArrayList<Artifact>( references.size() );

        for ( ProjectVersionReference projectVersionReference : references )
        {
            artifacts.add( new Artifact( projectVersionReference.getNamespace(), projectVersionReference.getProjectId(),
                                         projectVersionReference.getProjectVersion() ) );
        }
        return artifacts;
    }
View Full Code Here

        ref.setType( type );
        File file = managedRepositoryContent.toFile( ref );

        String extension = FilenameUtils.getExtension( file.getName() );

        Artifact artifact = new Artifact( ref.getGroupId(), ref.getArtifactId(), ref.getVersion() );
        artifact.setRepositoryId( artifactMetadata.getRepositoryId() );
        artifact.setClassifier( classifier );
        artifact.setPackaging( type );
        artifact.setType( type );
        artifact.setFileExtension( extension );
        artifact.setPath( managedRepositoryContent.toPath( ref ) );
        // TODO: find a reusable formatter for this
        double s = this.artifactMetadata.getSize();
        String symbol = "b";
        if ( s > 1024 )
        {
            symbol = "K";
            s /= 1024;

            if ( s > 1024 )
            {
                symbol = "M";
                s /= 1024;

                if ( s > 1024 )
                {
                    symbol = "G";
                    s /= 1024;
                }
            }
        }
        artifact.setContext( managedRepositoryContent.getId() );
        DecimalFormat df = new DecimalFormat( "#,###.##", new DecimalFormatSymbols( Locale.US ) );
        artifact.setSize( df.format( s ) + " " + symbol );

        artifact.setId( ref.getArtifactId() + "-" + ref.getVersion() + "." + ref.getType() );

        return artifact;

    }
View Full Code Here

            if ( hit.getVersions().size() > 0 )
            {
                for ( String version : hit.getVersions() )
                {

                    Artifact versionned = new BeanReplicator().replicateBean( hit, Artifact.class );

                    if ( StringUtils.isNotBlank( version ) )
                    {
                        versionned.setVersion( version );
                        versionned.setUrl( getArtifactUrl( versionned ) );

                        artifacts.add( versionned );

                    }
                }
View Full Code Here

    public void deleteArtifactKarmaFailed()
        throws Exception
    {
        try
        {
            Artifact artifact = new Artifact();
            artifact.setGroupId( "commons-logging" );
            artifact.setArtifactId( "commons-logging" );
            artifact.setVersion( "1.0.1" );
            artifact.setPackaging( "jar" );
            artifact.setContext( SOURCE_REPO_ID );

            RepositoriesService repositoriesService = getRepositoriesService( null );

            repositoriesService.deleteArtifact( artifact );
        }
View Full Code Here

                {

                    ArtifactBuilder builder =
                        new ArtifactBuilder().forArtifactMetadata( artifact ).withManagedRepositoryContent(
                            repositoryContentFactory.getManagedRepositoryContent( repositoryId ) );
                    Artifact art = builder.build();
                    art.setUrl( getArtifactUrl( art ) );
                    artifacts.add( art );
                }
                return artifacts;
            }
            return Collections.emptyList();
View Full Code Here

        List<TreeEntry> treeEntries =
            builder.buildDependencyTree( Collections.singletonList( TEST_REPO_ID ), TEST_GROUP_ID, TEST_ARTIFACT_ID,
                                         TEST_VERSION );

        assertThat( treeEntries ).isNotNull().isNotEmpty().contains(
            new TreeEntry( new Artifact( TEST_GROUP_ID, TEST_ARTIFACT_ID, TEST_VERSION, "", "" ) ) );

        assertThat( treeEntries.get( 0 ).getChilds() ).isNotNull().isNotEmpty().contains(
            new TreeEntry( new Artifact( "commons-lang", "commons-lang", "2.2", "compile", "" ) ) );
    }
View Full Code Here


    @Override
    public boolean visitEnter( DependencyNode dependencyNode )
    {
        TreeEntry entry =
            new TreeEntry( getModelMapper().map( dependencyNode.getDependency().getArtifact(), Artifact.class ) );
        entry.getArtifact().setFileExtension( dependencyNode.getDependency().getArtifact().getExtension() );
        entry.getArtifact().setScope( dependencyNode.getDependency().getScope() );
        entry.setParent( currentEntry );
        currentEntry = entry;

        if ( firstDependencyNode == null )
        {
            firstDependencyNode = dependencyNode;
View Full Code Here

    }


    public boolean visitEnter( DependencyNode dependencyNode )
    {
        TreeEntry entry =
            new TreeEntry( getModelMapper().map( dependencyNode.getDependency().getArtifact(), Artifact.class ) );
        entry.getArtifact().setScope( dependencyNode.getDependency().getScope() );
        entry.setParent( currentEntry );
        currentEntry = entry;

        if ( firstDependencyNode == null )
        {
            firstDependencyNode = dependencyNode;
View Full Code Here

        List<TreeEntry> treeEntries =
            builder.buildDependencyTree( Collections.singletonList( TEST_REPO_ID ), TEST_GROUP_ID, TEST_ARTIFACT_ID,
                                         TEST_VERSION );

        Assertions.assertThat( treeEntries ).isNotNull().isNotEmpty().contains(
            new TreeEntry( new Artifact( TEST_GROUP_ID, TEST_ARTIFACT_ID, TEST_VERSION, "", "" ) ) );

        Assertions.assertThat( treeEntries.get( 0 ).getChilds() ).isNotNull().isNotEmpty().contains(
            new TreeEntry( new Artifact( "commons-lang", "commons-lang", "2.2", "compile", "" ) ) );
    }
View Full Code Here

TOP

Related Classes of org.apache.archiva.maven2.model.TreeEntry

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.