Package org.apache.maven.settings

Examples of org.apache.maven.settings.Mirror


    {
        if ( repositories != null && mirrors != null )
        {
            for ( ArtifactRepository repository : repositories )
            {
                Mirror mirror = getMirror( repository, mirrors );

                if ( mirror != null )
                {
                    repository.setId( mirror.getId() );
                    repository.setUrl( mirror.getUrl() );

                    ArtifactRepositoryLayout layout = layouts.get( mirror.getLayout() );
                    if ( layout != null )
                    {
                        repository.setLayout( layout );
                    }
                }
View Full Code Here


            wagonManager.setDefaultRepositoryPermissions( defaultPermissions );

            for ( Iterator i = settings.getMirrors().iterator(); i.hasNext(); )
            {
                Mirror mirror = (Mirror) i.next();

                wagonManager.addMirror( mirror.getId(), mirror.getMirrorOf(), mirror.getUrl() );
            }
        }
        finally
        {
            container.release( wagonManager );
View Full Code Here

    }

    public void testValidateMirror()
        throws Exception
    {
        Mirror mirror = new Mirror();
        mirror.setId( "local" );
        Settings settings = new Settings();
        settings.addMirror( mirror );

        SimpleProblemCollector problems = new SimpleProblemCollector();
        validator.validate( settings, problems );
View Full Code Here

    {
        if ( repositories != null && mirrors != null )
        {
            for ( ArtifactRepository repository : repositories )
            {
                Mirror mirror = getMirror( repository, mirrors );

                if ( mirror != null )
                {
                    repository.setId( mirror.getId() );
                    repository.setUrl( mirror.getUrl() );

                    ArtifactRepositoryLayout layout = layouts.get( mirror.getLayout() );
                    if ( layout != null )
                    {
                        repository.setLayout( layout );
                    }
                }
View Full Code Here

        assertFalse( DefaultMirrorSelector.isExternalRepo( getRepo( "foo", "" ) ) );
    }

    public void testMirrorLookup()
    {
        Mirror mirrorA = newMirror( "a", "a", "http://a" );
        Mirror mirrorB = newMirror( "b", "b", "http://b" );

        List<Mirror> mirrors = Arrays.asList( mirrorA, mirrorB );

        assertSame( mirrorA, mirrorSelector.getMirror( getRepo( "a", "http://a.a" ), mirrors ) );
View Full Code Here

        assertNull( mirrorSelector.getMirror( getRepo( "c", "http://c.c" ), mirrors ) );
    }

    public void testMirrorWildcardLookup()
    {
        Mirror mirrorA = newMirror( "a", "a", "http://a" );
        Mirror mirrorB = newMirror( "b", "b", "http://b" );
        Mirror mirrorC = newMirror( "c", "*", "http://wildcard" );

        List<Mirror> mirrors = Arrays.asList( mirrorA, mirrorB, mirrorC );

        assertSame( mirrorA, mirrorSelector.getMirror( getRepo( "a", "http://a.a" ), mirrors ) );

View Full Code Here

    }

    public void testMirrorStopOnFirstMatch()
    {
        // exact matches win first
        Mirror mirrorA2 = newMirror( "a2", "a,b", "http://a2" );
        Mirror mirrorA = newMirror( "a", "a", "http://a" );
        // make sure repeated entries are skipped
        Mirror mirrorA3 = newMirror( "a", "a", "http://a3" );

        Mirror mirrorB = newMirror( "b", "b", "http://b" );
        Mirror mirrorC = newMirror( "c", "d,e", "http://de" );
        Mirror mirrorC2 = newMirror( "c", "*", "http://wildcard" );
        Mirror mirrorC3 = newMirror( "c", "e,f", "http://ef" );

        List<Mirror> mirrors = Arrays.asList( mirrorA2, mirrorA, mirrorA3, mirrorB, mirrorC, mirrorC2, mirrorC3 );

        assertSame( mirrorA, mirrorSelector.getMirror( getRepo( "a", "http://a.a" ), mirrors ) );

View Full Code Here

    public void testMirrorLayoutConsideredForMatching()
    {
        ArtifactRepository repo = getRepo( "a" );

        Mirror mirrorA = newMirror( "a", "a", null, "http://a" );
        Mirror mirrorB = newMirror( "b", "a", "p2", "http://b" );

        Mirror mirrorC = newMirror( "c", "*", null, "http://c" );
        Mirror mirrorD = newMirror( "d", "*", "p2", "http://d" );

        assertSame( mirrorA, mirrorSelector.getMirror( repo, Arrays.asList( mirrorA ) ) );
        assertNull( mirrorSelector.getMirror( repo, Arrays.asList( mirrorB ) ) );

        assertSame( mirrorC, mirrorSelector.getMirror( repo, Arrays.asList( mirrorC ) ) );
View Full Code Here

        return newMirror( id, mirrorOf, null, url );
    }

    private Mirror newMirror( String id, String mirrorOf, String layouts, String url )
    {
        Mirror mirror = new Mirror();

        mirror.setId( id );
        mirror.setMirrorOf( mirrorOf );
        mirror.setMirrorOfLayouts( layouts );
        mirror.setUrl( url );

        return mirror;
    }
View Full Code Here

    {
        if ( repositories != null && mirrors != null )
        {
            for ( ArtifactRepository repository : repositories )
            {
                Mirror mirror = getMirror( repository, mirrors );

                if ( mirror != null )
                {
                    repository.setId( mirror.getId() );
                    repository.setUrl( mirror.getUrl() );

                    ArtifactRepositoryLayout layout = layouts.get( mirror.getLayout() );
                    if ( layout != null )
                    {
                        repository.setLayout( layout );
                    }
                }
View Full Code Here

TOP

Related Classes of org.apache.maven.settings.Mirror

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.