Package org.apache.archiva.model

Examples of org.apache.archiva.model.ProjectReference


        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() );

        try
        {
            metadataTools.updateMetadata( repository, versionRef );
        }
View Full Code Here


        processFile( path );
    }

    private void updateProjectMetadata( ArtifactReference artifact, String path )
    {
        ProjectReference projectRef = new ProjectReference();
        projectRef.setGroupId( artifact.getGroupId() );
        projectRef.setArtifactId( artifact.getArtifactId() );

        try
        {
            String metadataPath = this.metadataTools.toPath( projectRef );
View Full Code Here

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

        ProjectReference reference = new ProjectReference();

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

        // Assume last part of the path is the version.

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

        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

    }

    @Test
    public void testToMetadataPathFromProjectReference()
    {
        ProjectReference reference = new ProjectReference();
        reference.setGroupId( "com.foo" );
        reference.setArtifactId( "foo-tool" );

        assertEquals( "com/foo/foo-tool/maven-metadata.xml", repoContent.toMetadataPath( reference ) );
    }
View Full Code Here

    }

    private void assertGetVersions( String artifactId, List<String> expectedVersions )
        throws Exception
    {
        ProjectReference reference = new ProjectReference();
        reference.setGroupId( "org.apache.archiva.metadata.tests" );
        reference.setArtifactId( artifactId );

        // 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

    }

    private void assertVersions( String groupId, String artifactId, String[] expectedVersions )
        throws Exception
    {
        ProjectReference reference = new ProjectReference();
        reference.setGroupId( groupId );
        reference.setArtifactId( artifactId );

        // Request the versions.
        Set<String> testedVersionSet = repoContent.getVersions( reference );

        // Sort the list (for asserts later)
View Full Code Here

    @Test
    public void testUpdateProjectNonExistingVersion()
        throws Exception
    {
        ManagedRepositoryContent testRepo = createTestRepoContent();
        ProjectReference reference = new ProjectReference();
        reference.setGroupId( "org.apache.archiva.metadata.tests" );
        reference.setArtifactId( "missing_artifact" );

        prepTestRepo( testRepo, reference );

        // check metadata prior to update -- should contain the non-existing artifact version
        assertProjectMetadata( testRepo, reference, "missing_artifact",
View Full Code Here

    }

    @Test
    public void testToPathFromProjectReference()
    {
        ProjectReference reference = new ProjectReference();
        reference.setGroupId( "com.foo" );
        reference.setArtifactId( "foo-tool" );

        assertEquals( "com/foo/foo-tool/maven-metadata.xml", tools.toPath( reference ) );
    }
View Full Code Here

    }

    private void assertProjectReference( String groupId, String artifactId, String path )
        throws RepositoryMetadataException
    {
        ProjectReference reference = tools.toProjectReference( path );

        assertNotNull( "Reference should not be null.", reference );
        assertEquals( "ProjectReference.groupId", groupId, reference.getGroupId() );
        assertEquals( "ProjectReference.artifactId", artifactId, reference.getArtifactId() );
    }
View Full Code Here

    private void assertUpdatedProjectMetadata( String artifactId, String[] expectedVersions, String latestVersion,
                                               String releaseVersion )
        throws Exception
    {
        ManagedRepositoryContent testRepo = createTestRepoContent();
        ProjectReference reference = new ProjectReference();
        reference.setGroupId( "org.apache.archiva.metadata.tests" );
        reference.setArtifactId( artifactId );

        prepTestRepo( testRepo, reference );

        tools.updateMetadata( testRepo, reference );

        StringBuilder buf = new StringBuilder();
        buf.append( "<metadata>\n" );
        buf.append( "  <groupId>" ).append( reference.getGroupId() ).append( "</groupId>\n" );
        buf.append( "  <artifactId>" ).append( reference.getArtifactId() ).append( "</artifactId>\n" );
        // buf.append( "  <version>1.0</version>\n" );

        if ( expectedVersions != null )
        {
            buf.append( "  <versioning>\n" );
View Full Code Here

TOP

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

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.