maven-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jvan...@apache.org
Subject svn commit: r746150 [1/2] - in /maven/components/branches/MNG-3932-1: ./ maven-compat/src/main/java/org/apache/maven/artifact/deployer/ maven-compat/src/main/java/org/apache/maven/artifact/manager/ maven-compat/src/main/java/org/apache/maven/artifact/r...
Date Fri, 20 Feb 2009 05:38:24 GMT
Author: jvanzyl
Date: Fri Feb 20 05:38:03 2009
New Revision: 746150

URL: http://svn.apache.org/viewvc?rev=746150&view=rev
Log:
o clean slate for merge

Modified:
    maven/components/branches/MNG-3932-1/bs
    maven/components/branches/MNG-3932-1/build.xml
    maven/components/branches/MNG-3932-1/maven-compat/src/main/java/org/apache/maven/artifact/deployer/DefaultArtifactDeployer.java
    maven/components/branches/MNG-3932-1/maven-compat/src/main/java/org/apache/maven/artifact/manager/DefaultWagonManager.java
    maven/components/branches/MNG-3932-1/maven-compat/src/main/java/org/apache/maven/artifact/manager/WagonManager.java
    maven/components/branches/MNG-3932-1/maven-compat/src/main/java/org/apache/maven/artifact/repository/metadata/DefaultRepositoryMetadataManager.java
    maven/components/branches/MNG-3932-1/maven-compat/src/main/java/org/apache/maven/artifact/resolver/DefaultArtifactResolver.java
    maven/components/branches/MNG-3932-1/maven-compat/src/main/java/org/apache/maven/artifact/transform/SnapshotTransformation.java
    maven/components/branches/MNG-3932-1/maven-compat/src/test/java/org/apache/maven/artifact/manager/DefaultWagonManagerTest.java
    maven/components/branches/MNG-3932-1/maven-compat/src/test/java/org/apache/maven/artifact/resolver/ArtifactUpdatePolicyTest.java
    maven/components/branches/MNG-3932-1/maven-embedder/src/main/java/org/apache/maven/embedder/MavenEmbedder.java
    maven/components/branches/MNG-3932-1/maven-embedder/src/main/java/org/apache/maven/embedder/execution/DefaultMavenExecutionRequestPopulator.java
    maven/components/branches/MNG-3932-1/maven-embedder/src/test/java/org/apache/maven/embedder/execution/DefaultMavenExecutionRequestPopulatorTest.java
    maven/components/branches/MNG-3932-1/maven-mercury/src/main/java/org/apache/maven/mercury/MavenDomainModel.java
    maven/components/branches/MNG-3932-1/maven-project/src/main/java/org/apache/maven/DefaultMavenTools.java
    maven/components/branches/MNG-3932-1/maven-project/src/main/java/org/apache/maven/MavenTools.java
    maven/components/branches/MNG-3932-1/maven-project/src/test/java/org/apache/maven/project/builder/PomConstructionTest.java
    maven/components/branches/MNG-3932-1/pom.xml

Modified: maven/components/branches/MNG-3932-1/bs
URL: http://svn.apache.org/viewvc/maven/components/branches/MNG-3932-1/bs?rev=746150&r1=746149&r2=746150&view=diff
==============================================================================
--- maven/components/branches/MNG-3932-1/bs (original)
+++ maven/components/branches/MNG-3932-1/bs Fri Feb 20 05:38:03 2009
@@ -5,9 +5,6 @@
 #       and maven-3 requires a specific default implementation
 #
 export CLASSPATH=./mercury-ant-tasks-1.0-alpha-6-SNAPSHOT.jar
-export ANT_OPTS='-Dmercury.log.threshold=debug -Djavax.xml.stream.XMLInputFactory=com.ctc.wstx.stax.WstxInputFactory -Dmercury.repo.central=http://repository.sonatype.org/content/groups/public '
+export ANT_OPTS='-Dmercury.log.threshold=warn -Djavax.xml.stream.XMLInputFactory=com.ctc.wstx.stax.WstxInputFactory -Dmaven.repo.central=http://repository.sonatype.org/content/groups/public '
 #export ANT_OPTS=$ANT_OPTS' -Xdebug -Xnoagent -Djava.compiler=NONE -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=8000'
-
-echo ANT_OPTS=$ANT_OPTS
-
-ant -f build-mercury.xml $*
+ant -f build-mercury.xml

Modified: maven/components/branches/MNG-3932-1/build.xml
URL: http://svn.apache.org/viewvc/maven/components/branches/MNG-3932-1/build.xml?rev=746150&r1=746149&r2=746150&view=diff
==============================================================================
--- maven/components/branches/MNG-3932-1/build.xml (original)
+++ maven/components/branches/MNG-3932-1/build.xml Fri Feb 20 05:38:03 2009
@@ -146,6 +146,7 @@
           <arg value="false"/> <!-- package with version -->
           <arg value="true"/> <!-- use Java 5 -->
           <arg value="UTF-8"/> <!-- encoding -->
+          <arg value="false"/>
         </java>
       </sequential>
     </macrodef>

Modified: maven/components/branches/MNG-3932-1/maven-compat/src/main/java/org/apache/maven/artifact/deployer/DefaultArtifactDeployer.java
URL: http://svn.apache.org/viewvc/maven/components/branches/MNG-3932-1/maven-compat/src/main/java/org/apache/maven/artifact/deployer/DefaultArtifactDeployer.java?rev=746150&r1=746149&r2=746150&view=diff
==============================================================================
--- maven/components/branches/MNG-3932-1/maven-compat/src/main/java/org/apache/maven/artifact/deployer/DefaultArtifactDeployer.java (original)
+++ maven/components/branches/MNG-3932-1/maven-compat/src/main/java/org/apache/maven/artifact/deployer/DefaultArtifactDeployer.java Fri Feb 20 05:38:03 2009
@@ -69,12 +69,6 @@
     public void deploy( File source, Artifact artifact, ArtifactRepository deploymentRepository, ArtifactRepository localRepository )
         throws ArtifactDeploymentException
     {
-        if ( !wagonManager.isOnline() )
-        {
-            // deployment shouldn't silently fail when offline
-            throw new ArtifactDeploymentException( "System is offline. Cannot deploy artifact: " + artifact + "." );
-        }
-
         try
         {
             transformationManager.transformForDeployment( artifact, deploymentRepository, localRepository );

Modified: maven/components/branches/MNG-3932-1/maven-compat/src/main/java/org/apache/maven/artifact/manager/DefaultWagonManager.java
URL: http://svn.apache.org/viewvc/maven/components/branches/MNG-3932-1/maven-compat/src/main/java/org/apache/maven/artifact/manager/DefaultWagonManager.java?rev=746150&r1=746149&r2=746150&view=diff
==============================================================================
--- maven/components/branches/MNG-3932-1/maven-compat/src/main/java/org/apache/maven/artifact/manager/DefaultWagonManager.java (original)
+++ maven/components/branches/MNG-3932-1/maven-compat/src/main/java/org/apache/maven/artifact/manager/DefaultWagonManager.java Fri Feb 20 05:38:03 2009
@@ -72,21 +72,14 @@
 @Component(role=WagonManager.class)
 public class DefaultWagonManager
     extends AbstractLogEnabled
-    implements WagonManager, Contextualizable
+    implements WagonManager
 {
-    private static final String WILDCARD = "*";
-
-    private static final String EXTERNAL_WILDCARD = "external:*";
-
     private static final String[] CHECKSUM_IDS = {"md5", "sha1"};
 
     /** have to match the CHECKSUM_IDS */
     private static final String[] CHECKSUM_ALGORITHMS = {"MD5", "SHA-1"};
-
-    private static final String MAVEN_ARTIFACT_PROPERTIES = "META-INF/maven/org.apache.maven.artifact/maven-artifact/pom.properties";
-
-    private static int anonymousMirrorIdSeed = 0;
         
+    @Requirement
     private PlexusContainer container;
 
     // TODO: proxies, authentication and mirrors are via settings, and should come in via an alternate method - perhaps
@@ -119,7 +112,7 @@
     @Requirement(role=Wagon.class)
     private Map wagons;
 
-    /** encapsulates access to Server credentials */
+    //@Requirement
     private CredentialsDataSource credentialsDataSource;
 
     @Requirement
@@ -138,6 +131,7 @@
             throw new UnsupportedProtocolException( "The repository " + repository + " does not specify a protocol" );
         }
 
+        
         Wagon wagon = getWagon( protocol );
 
         configureWagon( wagon, repository.getId(), protocol );
@@ -152,6 +146,7 @@
         {
             throw new UnsupportedProtocolException( "Unspecified protocol" );
         }
+        
 
         String hint = protocol.toLowerCase( java.util.Locale.ENGLISH );
         Wagon wagon = (Wagon) wagons.get( hint );
@@ -162,8 +157,6 @@
                 "Cannot find wagon which supports the requested protocol: " + protocol );
         }
 
-        wagon.setInteractive( interactive );
-
         return wagon;
     }
 
@@ -190,8 +183,6 @@
                                 TransferListener downloadMonitor )
         throws TransferFailedException
     {
-        failIfNotOnline();
-
         String protocol = repository.getProtocol();
 
         Wagon wagon;
@@ -227,20 +218,6 @@
             {
                 Repository artifactRepository = new Repository( repository.getId(), repository.getUrl() );
 
-                if ( serverPermissionsMap.containsKey( repository.getId() ) )
-                {
-                    RepositoryPermissions perms = serverPermissionsMap.get( repository.getId() );
-
-                    getLogger().debug(
-                        "adding permissions to wagon connection: " + perms.getFileMode() + " " + perms.getDirectoryMode() );
-
-                    artifactRepository.setPermissions( perms );
-                }
-                else
-                {
-                    getLogger().debug( "not adding permissions to wagon connection" );
-                }
-
                 AuthenticationInfo authenticationInfo = getAuthenticationInfo( repository.getId() ); 
                                 
                 wagon.connect( artifactRepository, authenticationInfo, new ProxyInfoProvider()
@@ -416,8 +393,7 @@
 
             try
             {
-                getRemoteFile( getMirrorRepository( repository ), artifact.getFile(), remotePath, downloadMonitor,
-                               policy.getChecksumPolicy(), false );
+                getRemoteFile( repository, artifact.getFile(), remotePath, downloadMonitor, policy.getChecksumPolicy(), false );
             }
             finally
             {
@@ -442,8 +418,7 @@
 
                 try
                 {
-                    getRemoteFile( getMirrorRepository( repository ), artifact.getFile(), remotePath, downloadMonitor,
-                                   policy.getChecksumPolicy(), false );
+                    getRemoteFile( repository, artifact.getFile(), remotePath, downloadMonitor, policy.getChecksumPolicy(), false );
                 }
                 catch ( ResourceDoesNotExistException e )
                 {
@@ -475,7 +450,7 @@
         {
             getLogger().debug( "Trying repository " + repository.getId() );
 
-            getRemoteFile( getMirrorRepository( repository ), artifact.getFile(), remotePath, downloadMonitor, policy.getChecksumPolicy(), false );
+            getRemoteFile( repository, artifact.getFile(), remotePath, downloadMonitor, policy.getChecksumPolicy(), false );
 
             getLogger().debug( "  Artifact resolved" );
 
@@ -491,7 +466,7 @@
     {
         String remotePath = repository.pathOfRemoteRepositoryMetadata( metadata );
 
-        getRemoteFile( getMirrorRepository( repository ), destination, remotePath, null, checksumPolicy, true );
+        getRemoteFile( repository, destination, remotePath, null, checksumPolicy, true );
     }
 
     public void getArtifactMetadataFromDeploymentRepository( ArtifactMetadata metadata, ArtifactRepository repository,
@@ -511,10 +486,6 @@
                                 boolean force )
         throws TransferFailedException, ResourceDoesNotExistException
     {
-        // TODO: better excetpions - transfer failed is not enough?
-
-        failIfNotOnline();
-
         String protocol = repository.getProtocol();
 
         Wagon wagon;
@@ -736,35 +707,6 @@
         }
     }
 
-    public ArtifactRepository getMirrorRepository( ArtifactRepository repository )
-    {
-        ArtifactRepository mirror = getMirror( repository );
-        if ( mirror != null )
-        {
-            String id = mirror.getId();
-            if ( id == null )
-            {
-                // TODO: this should be illegal in settings.xml
-                id = repository.getId();
-            }
-
-            getLogger().debug( "Using mirror: " + mirror.getId() + " for repository: " + repository.getId() + "\n(mirror url: " + mirror.getUrl() + ")" );
-            repository = repositoryFactory.createArtifactRepository( id, mirror.getUrl(),
-                                                                     repository.getLayout(), repository.getSnapshots(),
-                                                                     repository.getReleases() );
-        }
-        return repository;
-    }
-
-    private void failIfNotOnline()
-        throws TransferFailedException
-    {
-        if ( !isOnline() )
-        {
-            throw new TransferFailedException( "System is offline." );
-        }
-    }
-
     private void handleChecksumFailure( String checksumPolicy,
                                         String message,
                                         Throwable cause )
@@ -869,7 +811,7 @@
             getLogger().debug( "", e );
         }
     }
-
+    
     public ProxyInfo getProxy( String protocol )
     {
         return proxies.get( protocol );
@@ -878,92 +820,7 @@
     public AuthenticationInfo getAuthenticationInfo( String id )
         throws CredentialsDataSourceException
     {
-        return credentialsDataSource == null
-            ? authenticationInfoMap.get( id )
-            : credentialsDataSource.get( id );
-    }
-
-    /**
-     * This method finds a matching mirror for the selected repository. If there is an exact match, this will be used.
-     * If there is no exact match, then the list of mirrors is examined to see if a pattern applies.
-     *
-     * @param originalRepository See if there is a mirror for this repository.
-     * @return the selected mirror or null if none are found.
-     */
-    public ArtifactRepository getMirror( ArtifactRepository originalRepository )
-    {
-        ArtifactRepository selectedMirror = mirrors.get( originalRepository.getId() );
-        if ( null == selectedMirror )
-        {
-            // Process the patterns in order. First one that matches wins.
-            Set<String> keySet = mirrors.keySet();
-            if ( keySet != null )
-            {
-                for (String pattern : keySet) 
-                {
-                    if (matchPattern(originalRepository, pattern)) 
-                    {
-                        selectedMirror = mirrors.get(pattern);
-                        break;
-                    }
-                }
-            }
-
-        }
-        return selectedMirror;
-    }
-
-    /**
-     * This method checks if the pattern matches the originalRepository.
-     * Valid patterns:
-     * * = everything
-     * external:* = everything not on the localhost and not file based.
-     * repo,repo1 = repo or repo1
-     * *,!repo1 = everything except repo1
-     *
-     * @param originalRepository to compare for a match.
-     * @param pattern used for match. Currently only '*' is supported.
-     * @return true if the repository is a match to this pattern.
-     */
-    public boolean matchPattern( ArtifactRepository originalRepository, String pattern )
-    {
-        boolean result = false;
-        String originalId = originalRepository.getId();
-
-        // simple checks first to short circuit processing below.
-        if ( WILDCARD.equals( pattern ) || pattern.equals( originalId ) )
-        {
-            result = true;
-        }
-        else
-        {
-            // process the list
-            String[] repos = pattern.split( "," );
-            for (String repo : repos) {
-                // see if this is a negative match
-                if (repo.length() > 1 && repo.startsWith("!")) {
-                    if (originalId.equals(repo.substring(1))) {
-                        // explicitly exclude. Set result and stop processing.
-                        result = false;
-                        break;
-                    }
-                }
-                // check for exact match
-                else if (originalId.equals(repo)) {
-                    result = true;
-                    break;
-                }
-                // check for external:*
-                else if (EXTERNAL_WILDCARD.equals(repo) && isExternalRepo(originalRepository)) {
-                    result = true;
-                    // don't stop processing in case a future segment explicitly excludes this repo
-                } else if (WILDCARD.equals(repo)) {
-                    result = true;
-                    // don't stop processing in case a future segment explicitly excludes this repo
-                }
-            }
-        }
-        return result;
+        return authenticationInfoMap.get( id );
     }
 
     /**
@@ -1016,18 +873,6 @@
         proxies.put( protocol, proxyInfo );
     }
 
-    public void contextualize( Context context )
-        throws ContextException
-    {
-        container = (PlexusContainer) context.get( PlexusConstants.PLEXUS_KEY );
-    }
-
-    /** @todo I'd rather not be setting this explicitly. */
-    public void setDownloadMonitor( TransferListener downloadMonitor )
-    {
-        this.downloadMonitor = downloadMonitor;
-    }
-
     // We are leaving this method here so that we can attempt to use the new maven-artifact
     // library from the 2.0.x code so that we aren't maintaining two lines of code
     // for the artifact management.
@@ -1047,32 +892,6 @@
         authenticationInfoMap.put( repositoryId, authInfo );
     }
 
-    // This is the new way of handling authentication that will allow us to help users setup
-    // authentication requirements.
-    public void addAuthenticationCredentials( String repositoryId,
-                                              String username,
-                                              String password,
-                                              String privateKey,
-                                              String passphrase
-    )
-        throws CredentialsDataSourceException
-    {
-        AuthenticationInfo authInfo = new AuthenticationInfo();
-        authInfo.setUserName( username );
-        authInfo.setPassword( password );
-        authInfo.setPrivateKey( privateKey );
-        authInfo.setPassphrase( passphrase );
-
-        if ( credentialsDataSource == null )
-        {
-            authenticationInfoMap.put( repositoryId, authInfo );
-        }
-        else
-        {
-            credentialsDataSource.set( new CredentialsChangeRequest( repositoryId, authInfo, null ) );
-        }
-    }
-
     public void addPermissionInfo( String repositoryId,
                                    String filePermissions,
                                    String directoryPermissions )
@@ -1099,35 +918,6 @@
         }
     }
 
-    public void addMirror( String id,
-                           String mirrorOf,
-                           String url )
-    {
-        if ( id == null )
-        {
-            id = "mirror-" + anonymousMirrorIdSeed++;
-            getLogger().warn( "You are using a mirror that doesn't declare an <id/> element. Using \'" + id + "\' instead:\nId: " + id + "\nmirrorOf: " + mirrorOf + "\nurl: " + url + "\n" );
-        }
-        
-        ArtifactRepository mirror = new DefaultArtifactRepository( id, url, null );
-
-        //to preserve first wins, don't add repeated mirrors.
-        if (!mirrors.containsKey( mirrorOf ))
-        {
-            mirrors.put( mirrorOf, mirror );
-        }
-    }
-
-    public void setOnline( boolean online )
-    {
-        this.online = online;
-    }
-
-    public boolean isOnline()
-    {
-        return online;
-    }
-
     public void setInteractive( boolean interactive )
     {
         this.interactive = interactive;
@@ -1161,23 +951,16 @@
      * @param repository the repository that has the configuration
      * @throws WagonConfigurationException wraps any error given during configuration of the wagon instance
      */
-    private void configureWagon( Wagon wagon,
-                                 ArtifactRepository repository )
+    private void configureWagon( Wagon wagon, ArtifactRepository repository )
         throws WagonConfigurationException
     {
         configureWagon( wagon, repository.getId(), repository.getProtocol() );
     }
 
-    private void configureWagon( Wagon wagon,
-                                 String repositoryId,
-                                 String protocol )
+    private void configureWagon( Wagon wagon, String repositoryId, String protocol )
         throws WagonConfigurationException
     {
         PlexusConfiguration config = (PlexusConfiguration) serverConfigurationMap.get( repositoryId ); 
-        if ( protocol.startsWith( "http" ) || protocol.startsWith( "dav" ) )
-        {
-            config = updateUserAgentForHttp( wagon, config );
-        }
         
         if ( config != null )
         {
@@ -1210,56 +993,6 @@
             }
         }
     }
-
-    private PlexusConfiguration updateUserAgentForHttp( Wagon wagon, PlexusConfiguration config )
-    {
-        if ( config == null )
-        {
-            config = new XmlPlexusConfiguration( "configuration" );
-        }
-
-        XmlPlexusConfiguration propertyConfig = new XmlPlexusConfiguration( "property" );
-        PlexusConfiguration headerConfig = config.getChild( "httpHeaders", true );
-        headerConfig.addChild( propertyConfig );
-        
-        XmlPlexusConfiguration nameConfig = new XmlPlexusConfiguration( "name" );
-        nameConfig.setValue( "User-Agent" );
-        propertyConfig.addChild( nameConfig );
-        
-        XmlPlexusConfiguration versionConfig = new XmlPlexusConfiguration( "value" );
-        versionConfig.setValue( httpUserAgent );
-        propertyConfig.addChild( versionConfig );
-                
-        return config;
-    }
-
-    public void addConfiguration( String repositoryId,
-                                  Xpp3Dom configuration )
-    {
-        if ( ( repositoryId == null ) || ( configuration == null ) )
-        {
-            throw new IllegalArgumentException( "arguments can't be null" );
-        }
-
-        final XmlPlexusConfiguration xmlConf = new XmlPlexusConfiguration( configuration );
-
-        serverConfigurationMap.put( repositoryId, xmlConf );
-    }
-
-    public void setDefaultRepositoryPermissions( RepositoryPermissions defaultRepositoryPermissions )
-    {
-        this.defaultRepositoryPermissions = defaultRepositoryPermissions;
-    }
-
-    public void registerCredentialsDataSource( CredentialsDataSource cds )
-    {
-        credentialsDataSource = cds;
-    }
-
-    public void setUpdateCheckManager( UpdateCheckManager updateCheckManager )
-    {
-        this.updateCheckManager = updateCheckManager;        
-    }
     
     /**
      * {@inheritDoc}
@@ -1276,4 +1009,11 @@
     {
         return httpUserAgent;
     }
+    
+    // Things to remove
+    
+    public void setDownloadMonitor( TransferListener listener )
+    {
+        this.downloadMonitor = listener;
+    }
 }

Modified: maven/components/branches/MNG-3932-1/maven-compat/src/main/java/org/apache/maven/artifact/manager/WagonManager.java
URL: http://svn.apache.org/viewvc/maven/components/branches/MNG-3932-1/maven-compat/src/main/java/org/apache/maven/artifact/manager/WagonManager.java?rev=746150&r1=746149&r2=746150&view=diff
==============================================================================
--- maven/components/branches/MNG-3932-1/maven-compat/src/main/java/org/apache/maven/artifact/manager/WagonManager.java (original)
+++ maven/components/branches/MNG-3932-1/maven-compat/src/main/java/org/apache/maven/artifact/manager/WagonManager.java Fri Feb 20 05:38:03 2009
@@ -112,65 +112,6 @@
                                                       File file, String checksumPolicyWarn )
         throws TransferFailedException, ResourceDoesNotExistException;
 
-    void setOnline( boolean online );
-
-    boolean isOnline();
-
-    void addProxy( String protocol,
-                   String host,
-                   int port,
-                   String username,
-                   String password,
-                   String nonProxyHosts );
-
-    void registerCredentialsDataSource( CredentialsDataSource cds );
-
-    public void addAuthenticationCredentials( String repositoryId,
-                                              String username,
-                                              String password,
-                                              String privateKey,
-                                              String passphrase )
-        throws CredentialsDataSourceException;
-
-    void addAuthenticationInfo( String repositoryId,
-                                String username,
-                                String password,
-                                String privateKey,
-                                String passphrase );
-
-    void addMirror( String id,
-                    String mirrorOf,
-                    String url );
-
-    void setDownloadMonitor( TransferListener downloadMonitor );
-
-    void addPermissionInfo( String repositoryId,
-                            String filePermissions,
-                            String directoryPermissions );
-
-    ProxyInfo getProxy( String protocol );
-
-    AuthenticationInfo getAuthenticationInfo( String id )
-        throws CredentialsDataSourceException;
-
-    /**
-     * Set the configuration for a repository
-     *
-     * @param repositoryId  id of the repository to set the configuration to
-     * @param configuration dom tree of the xml with the configuration for the {@link Wagon}
-     */
-    void addConfiguration( String repositoryId,
-                           Xpp3Dom configuration );
-
-    void setInteractive( boolean interactive );
-
-    @Deprecated
-    void registerWagons( Collection wagons,
-                         PlexusContainer extensionContainer );
-
-    void findAndRegisterWagons( PlexusContainer container );
-
-    void setDefaultRepositoryPermissions( RepositoryPermissions permissions );
-
-    ArtifactRepository getMirrorRepository( ArtifactRepository repository );
+    // All the tests fail that are specifically look for the contents of the listener fail without this.
+    void setDownloadMonitor( TransferListener listener );    
 }

Modified: maven/components/branches/MNG-3932-1/maven-compat/src/main/java/org/apache/maven/artifact/repository/metadata/DefaultRepositoryMetadataManager.java
URL: http://svn.apache.org/viewvc/maven/components/branches/MNG-3932-1/maven-compat/src/main/java/org/apache/maven/artifact/repository/metadata/DefaultRepositoryMetadataManager.java?rev=746150&r1=746149&r2=746150&view=diff
==============================================================================
--- maven/components/branches/MNG-3932-1/maven-compat/src/main/java/org/apache/maven/artifact/repository/metadata/DefaultRepositoryMetadataManager.java (original)
+++ maven/components/branches/MNG-3932-1/maven-compat/src/main/java/org/apache/maven/artifact/repository/metadata/DefaultRepositoryMetadataManager.java Fri Feb 20 05:38:03 2009
@@ -1,22 +1,18 @@
 package org.apache.maven.artifact.repository.metadata;
 
 /*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *  http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
+ * Licensed to the Apache Software Foundation (ASF) under one or more contributor license
+ * agreements. See the NOTICE file distributed with this work for additional information regarding
+ * copyright ownership. The ASF licenses this file to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance with the License. You may obtain a
+ * copy of the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software distributed under the License
+ * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
+ * or implied. See the License for the specific language governing permissions and limitations under
+ * the License.
  */
 
 import java.io.File;
@@ -68,77 +64,76 @@
     {
     }
 
-    public void resolve( RepositoryMetadata metadata,
-                         List<ArtifactRepository> remoteRepositories,
-                         ArtifactRepository localRepository )
+    public void resolve( RepositoryMetadata metadata, List<ArtifactRepository> remoteRepositories, ArtifactRepository localRepository )
         throws RepositoryMetadataResolutionException
     {
-        for (ArtifactRepository repository : remoteRepositories) {
-            ArtifactRepositoryPolicy policy =
-                    metadata.isSnapshot() ? repository.getSnapshots() : repository.getReleases();
-
-            File file = new File(localRepository.getBasedir(),
-                    localRepository.pathOfLocalRepositoryMetadata(metadata, repository));
-
-            if (wagonManager.isOnline()) {
-                if (updateCheckManager.isUpdateRequired(metadata, repository, file)) {
-                    getLogger().info(metadata.getKey() + ": checking for updates from " + repository.getId());
-                    try {
-                        wagonManager.getArtifactMetadata(metadata, repository, file, policy.getChecksumPolicy());
+        for ( ArtifactRepository repository : remoteRepositories )
+        {
+            ArtifactRepositoryPolicy policy = metadata.isSnapshot() ? repository.getSnapshots() : repository.getReleases();
+
+            File file = new File( localRepository.getBasedir(), localRepository.pathOfLocalRepositoryMetadata( metadata, repository ) );
+
+            if ( updateCheckManager.isUpdateRequired( metadata, repository, file ) )
+                {
+                    getLogger().info( metadata.getKey() + ": checking for updates from " + repository.getId() );
+                    try
+                    {
+                        wagonManager.getArtifactMetadata( metadata, repository, file, policy.getChecksumPolicy() );
                     }
-                    catch (ResourceDoesNotExistException e) {
-                        getLogger().debug(metadata + " could not be found on repository: " + repository.getId());
+                    catch ( ResourceDoesNotExistException e )
+                    {
+                        getLogger().debug( metadata + " could not be found on repository: " + repository.getId() );
 
                         // delete the local copy so the old details aren't used.
-                        if (file.exists()) {
+                        if ( file.exists() )
+                        {
                             file.delete();
                         }
                     }
-                    catch (TransferFailedException e) {
-                        getLogger().warn(metadata + " could not be retrieved from repository: " + repository.getId() +
-                                " due to an error: " + e.getMessage());
-                        getLogger().debug("Exception", e);
+                    catch ( TransferFailedException e )
+                    {
+                        getLogger().warn( metadata + " could not be retrieved from repository: " + repository.getId() + " due to an error: " + e.getMessage() );
+                        getLogger().debug( "Exception", e );
 
-                        getLogger().info("Repository '" + repository.getId() + "' will be blacklisted");
-                        repository.setBlacklisted(true);
+                        getLogger().info( "Repository '" + repository.getId() + "' will be blacklisted" );
+                        repository.setBlacklisted( true );
 
                         // TODO: [jc; 08-Nov-2005] revisit this for 2.1
                         // suppressing logging to avoid logging this error twice.
                     }
-                    finally {
-                        updateCheckManager.touch(metadata, repository, file);
+                    finally
+                    {
+                        updateCheckManager.touch( metadata, repository, file );
                     }
                 }
-            } else {
-                getLogger().debug(
-                        "System is offline. Cannot resolve metadata:\n" + metadata.extendedToString() + "\n\n");
+            else
+            {
+                getLogger().debug( "System is offline. Cannot resolve metadata:\n" + metadata.extendedToString() + "\n\n" );
             }
 
             // TODO: should this be inside the above check?
             // touch file so that this is not checked again until interval has passed
-            if (file.exists()) {
-                file.setLastModified(System.currentTimeMillis());
+            if ( file.exists() )
+            {
+                file.setLastModified( System.currentTimeMillis() );
             }
         }
+            
         try
         {
             mergeMetadata( metadata, remoteRepositories, localRepository );
         }
         catch ( RepositoryMetadataStoreException e )
         {
-            throw new RepositoryMetadataResolutionException(
-                "Unable to store local copy of metadata: " + e.getMessage(), e );
+            throw new RepositoryMetadataResolutionException( "Unable to store local copy of metadata: " + e.getMessage(), e );
         }
         catch ( RepositoryMetadataReadException e )
         {
-            throw new RepositoryMetadataResolutionException( "Unable to read local copy of metadata: " + e.getMessage(),
-                e );
+            throw new RepositoryMetadataResolutionException( "Unable to read local copy of metadata: " + e.getMessage(), e );
         }
     }
 
-    private void mergeMetadata( RepositoryMetadata metadata,
-                                List<ArtifactRepository> remoteRepositories,
-                                ArtifactRepository localRepository )
+    private void mergeMetadata( RepositoryMetadata metadata, List<ArtifactRepository> remoteRepositories, ArtifactRepository localRepository )
         throws RepositoryMetadataStoreException, RepositoryMetadataReadException
     {
         // TODO: currently this is first wins, but really we should take the latest by comparing either the
@@ -146,15 +141,15 @@
         // TODO: this needs to be repeated here so the merging doesn't interfere with the written metadata
         //  - we'd be much better having a pristine input, and an ongoing metadata for merging instead
 
-        Map<ArtifactRepository,Metadata> previousMetadata = new HashMap<ArtifactRepository,Metadata>();
+        Map<ArtifactRepository, Metadata> previousMetadata = new HashMap<ArtifactRepository, Metadata>();
         ArtifactRepository selected = null;
-        for (ArtifactRepository repository : remoteRepositories) {
-            ArtifactRepositoryPolicy policy =
-                    metadata.isSnapshot() ? repository.getSnapshots() : repository.getReleases();
-
-            if ((policy.isEnabled() && !repository.isBlacklisted())
-                    && (loadMetadata(metadata, repository, localRepository, previousMetadata))) {
-                metadata.setRepository(repository);
+        for ( ArtifactRepository repository : remoteRepositories )
+        {
+            ArtifactRepositoryPolicy policy = metadata.isSnapshot() ? repository.getSnapshots() : repository.getReleases();
+
+            if ( ( policy.isEnabled() && !repository.isBlacklisted() ) && ( loadMetadata( metadata, repository, localRepository, previousMetadata ) ) )
+            {
+                metadata.setRepository( repository );
                 selected = repository;
             }
         }
@@ -167,10 +162,7 @@
         updateSnapshotMetadata( metadata, previousMetadata, selected, localRepository );
     }
 
-    private void updateSnapshotMetadata( RepositoryMetadata metadata,
-                                         Map<ArtifactRepository,Metadata> previousMetadata,
-                                         ArtifactRepository selected,
-                                         ArtifactRepository localRepository )
+    private void updateSnapshotMetadata( RepositoryMetadata metadata, Map<ArtifactRepository, Metadata> previousMetadata, ArtifactRepository selected, ArtifactRepository localRepository )
         throws RepositoryMetadataStoreException
     {
         // TODO: this could be a lot nicer... should really be in the snapshot transformation?
@@ -178,22 +170,28 @@
         {
             Metadata prevMetadata = metadata.getMetadata();
 
-            for (ArtifactRepository repository : previousMetadata.keySet()) {
-                Metadata m = previousMetadata.get(repository);
-                if (repository.equals(selected)) {
-                    if (m.getVersioning() == null) {
-                        m.setVersioning(new Versioning());
+            for ( ArtifactRepository repository : previousMetadata.keySet() )
+            {
+                Metadata m = previousMetadata.get( repository );
+                if ( repository.equals( selected ) )
+                {
+                    if ( m.getVersioning() == null )
+                    {
+                        m.setVersioning( new Versioning() );
                     }
 
-                    if (m.getVersioning().getSnapshot() == null) {
-                        m.getVersioning().setSnapshot(new Snapshot());
+                    if ( m.getVersioning().getSnapshot() == null )
+                    {
+                        m.getVersioning().setSnapshot( new Snapshot() );
                     }
-                } else {
-                    if ((m.getVersioning() != null) && (m.getVersioning().getSnapshot() != null) &&
-                            m.getVersioning().getSnapshot().isLocalCopy()) {
-                        m.getVersioning().getSnapshot().setLocalCopy(false);
-                        metadata.setMetadata(m);
-                        metadata.storeInLocalRepository(localRepository, repository);
+                }
+                else
+                {
+                    if ( ( m.getVersioning() != null ) && ( m.getVersioning().getSnapshot() != null ) && m.getVersioning().getSnapshot().isLocalCopy() )
+                    {
+                        m.getVersioning().getSnapshot().setLocalCopy( false );
+                        metadata.setMetadata( m );
+                        metadata.storeInLocalRepository( localRepository, repository );
                     }
                 }
             }
@@ -202,16 +200,12 @@
         }
     }
 
-    private boolean loadMetadata( RepositoryMetadata repoMetadata,
-                                  ArtifactRepository remoteRepository,
-                                  ArtifactRepository localRepository,
-                                  Map<ArtifactRepository,Metadata> previousMetadata )
+    private boolean loadMetadata( RepositoryMetadata repoMetadata, ArtifactRepository remoteRepository, ArtifactRepository localRepository, Map<ArtifactRepository, Metadata> previousMetadata )
         throws RepositoryMetadataReadException
     {
         boolean setRepository = false;
 
-        File metadataFile = new File( localRepository.getBasedir(),
-            localRepository.pathOfLocalRepositoryMetadata( repoMetadata, remoteRepository ) );
+        File metadataFile = new File( localRepository.getBasedir(), localRepository.pathOfLocalRepositoryMetadata( repoMetadata, remoteRepository ) );
 
         if ( metadataFile.exists() )
         {
@@ -256,13 +250,11 @@
         }
         catch ( IOException e )
         {
-            throw new RepositoryMetadataReadException(
-                "Cannot read metadata from '" + mappingFile + "': " + e.getMessage(), e );
+            throw new RepositoryMetadataReadException( "Cannot read metadata from '" + mappingFile + "': " + e.getMessage(), e );
         }
         catch ( XmlPullParserException e )
         {
-            throw new RepositoryMetadataReadException(
-                "Cannot read metadata from '" + mappingFile + "': " + e.getMessage(), e );
+            throw new RepositoryMetadataReadException( "Cannot read metadata from '" + mappingFile + "': " + e.getMessage(), e );
         }
         finally
         {
@@ -271,18 +263,9 @@
         return result;
     }
 
-    public void resolveAlways( RepositoryMetadata metadata,
-                               ArtifactRepository localRepository,
-                               ArtifactRepository remoteRepository )
+    public void resolveAlways( RepositoryMetadata metadata, ArtifactRepository localRepository, ArtifactRepository remoteRepository )
         throws RepositoryMetadataResolutionException
     {
-        if ( !wagonManager.isOnline() )
-        {
-            // metadata is required for deployment, can't be offline
-            throw new RepositoryMetadataResolutionException(
-                "System is offline. Cannot resolve required metadata:\n" + metadata.extendedToString() );
-        }
-
         File file;
         try
         {
@@ -290,8 +273,7 @@
         }
         catch ( TransferFailedException e )
         {
-            throw new RepositoryMetadataResolutionException( metadata + " could not be retrieved from repository: " +
-                remoteRepository.getId() + " due to an error: " + e.getMessage(), e );
+            throw new RepositoryMetadataResolutionException( metadata + " could not be retrieved from repository: " + remoteRepository.getId() + " due to an error: " + e.getMessage(), e );
         }
 
         try
@@ -308,23 +290,18 @@
         }
     }
 
-    private File getArtifactMetadataFromDeploymentRepository( ArtifactMetadata metadata,
-                                                              ArtifactRepository localRepository,
-                                                              ArtifactRepository remoteRepository )
+    private File getArtifactMetadataFromDeploymentRepository( ArtifactMetadata metadata, ArtifactRepository localRepository, ArtifactRepository remoteRepository )
         throws TransferFailedException
     {
-        File file = new File( localRepository.getBasedir(),
-                              localRepository.pathOfLocalRepositoryMetadata( metadata, remoteRepository ) );
+        File file = new File( localRepository.getBasedir(), localRepository.pathOfLocalRepositoryMetadata( metadata, remoteRepository ) );
 
         try
         {
-            wagonManager.getArtifactMetadataFromDeploymentRepository( metadata, remoteRepository, file,
-                                                                      ArtifactRepositoryPolicy.CHECKSUM_POLICY_WARN );
+            wagonManager.getArtifactMetadataFromDeploymentRepository( metadata, remoteRepository, file, ArtifactRepositoryPolicy.CHECKSUM_POLICY_WARN );
         }
         catch ( ResourceDoesNotExistException e )
         {
-            getLogger().info(
-                metadata + " could not be found on repository: " + remoteRepository.getId() + ", so will be created" );
+            getLogger().info( metadata + " could not be found on repository: " + remoteRepository.getId() + ", so will be created" );
 
             // delete the local copy so the old details aren't used.
             if ( file.exists() )
@@ -342,18 +319,9 @@
         return file;
     }
 
-    public void deploy( ArtifactMetadata metadata,
-                        ArtifactRepository localRepository,
-                        ArtifactRepository deploymentRepository )
+    public void deploy( ArtifactMetadata metadata, ArtifactRepository localRepository, ArtifactRepository deploymentRepository )
         throws RepositoryMetadataDeploymentException
     {
-        if ( !wagonManager.isOnline() )
-        {
-            // deployment shouldn't silently fail when offline
-            throw new RepositoryMetadataDeploymentException(
-                "System is offline. Cannot deploy metadata:\n" + metadata.extendedToString() );
-        }
-
         File file;
         if ( metadata instanceof RepositoryMetadata )
         {
@@ -364,16 +332,13 @@
             }
             catch ( TransferFailedException e )
             {
-                throw new RepositoryMetadataDeploymentException( metadata +
-                    " could not be retrieved from repository: " + deploymentRepository.getId() + " due to an error: " +
-                    e.getMessage(), e );
+                throw new RepositoryMetadataDeploymentException( metadata + " could not be retrieved from repository: " + deploymentRepository.getId() + " due to an error: " + e.getMessage(), e );
             }
         }
         else
         {
             // It's a POM - we don't need to retrieve it first
-            file = new File( localRepository.getBasedir(),
-                             localRepository.pathOfLocalRepositoryMetadata( metadata, deploymentRepository ) );
+            file = new File( localRepository.getBasedir(), localRepository.pathOfLocalRepositoryMetadata( metadata, deploymentRepository ) );
         }
 
         try
@@ -395,8 +360,7 @@
         }
     }
 
-    public void install( ArtifactMetadata metadata,
-                         ArtifactRepository localRepository )
+    public void install( ArtifactMetadata metadata, ArtifactRepository localRepository )
         throws RepositoryMetadataInstallationException
     {
         try

Modified: maven/components/branches/MNG-3932-1/maven-compat/src/main/java/org/apache/maven/artifact/resolver/DefaultArtifactResolver.java
URL: http://svn.apache.org/viewvc/maven/components/branches/MNG-3932-1/maven-compat/src/main/java/org/apache/maven/artifact/resolver/DefaultArtifactResolver.java?rev=746150&r1=746149&r2=746150&view=diff
==============================================================================
--- maven/components/branches/MNG-3932-1/maven-compat/src/main/java/org/apache/maven/artifact/resolver/DefaultArtifactResolver.java (original)
+++ maven/components/branches/MNG-3932-1/maven-compat/src/main/java/org/apache/maven/artifact/resolver/DefaultArtifactResolver.java Fri Feb 20 05:38:03 2009
@@ -1,24 +1,28 @@
 package org.apache.maven.artifact.resolver;
 
 /*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *  http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
+ * Licensed to the Apache Software Foundation (ASF) under one or more contributor license
+ * agreements. See the NOTICE file distributed with this work for additional information regarding
+ * copyright ownership. The ASF licenses this file to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance with the License. You may obtain a
+ * copy of the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software distributed under the License
+ * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
+ * or implied. See the License for the specific language governing permissions and limitations under
+ * the License.
  */
 
+import java.io.File;
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+
 import org.apache.maven.artifact.Artifact;
 import org.apache.maven.artifact.factory.ArtifactFactory;
 import org.apache.maven.artifact.manager.WagonManager;
@@ -29,8 +33,8 @@
 import org.apache.maven.artifact.repository.metadata.Snapshot;
 import org.apache.maven.artifact.repository.metadata.SnapshotArtifactRepositoryMetadata;
 import org.apache.maven.artifact.repository.metadata.Versioning;
-import org.apache.maven.artifact.resolver.filter.ArtifactFilter;
 import org.apache.maven.artifact.resolver.conflict.ConflictResolver;
+import org.apache.maven.artifact.resolver.filter.ArtifactFilter;
 import org.apache.maven.artifact.transform.ArtifactTransformationManager;
 import org.apache.maven.wagon.ResourceDoesNotExistException;
 import org.apache.maven.wagon.TransferFailedException;
@@ -39,16 +43,6 @@
 import org.codehaus.plexus.logging.AbstractLogEnabled;
 import org.codehaus.plexus.util.FileUtils;
 
-import java.io.File;
-import java.io.IOException;
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.HashMap;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
-
 /**
  * @author Jason van Zyl
  */
@@ -77,15 +71,13 @@
     // Implementation
     // ----------------------------------------------------------------------
 
-    public void resolve( Artifact artifact, List<ArtifactRepository> remoteRepositories,
-                         ArtifactRepository localRepository )
+    public void resolve( Artifact artifact, List<ArtifactRepository> remoteRepositories, ArtifactRepository localRepository )
         throws ArtifactResolutionException, ArtifactNotFoundException
     {
         resolve( artifact, remoteRepositories, localRepository, false );
     }
 
-    public void resolveAlways( Artifact artifact, List<ArtifactRepository> remoteRepositories,
-                               ArtifactRepository localRepository )
+    public void resolveAlways( Artifact artifact, List<ArtifactRepository> remoteRepositories, ArtifactRepository localRepository )
         throws ArtifactResolutionException, ArtifactNotFoundException
     {
         resolve( artifact, remoteRepositories, localRepository, true );
@@ -100,6 +92,7 @@
             return;
         }
 
+        File destination;
         if ( Artifact.SCOPE_SYSTEM.equals( artifact.getScope() ) )
         {
             File systemFile = artifact.getFile();
@@ -139,23 +132,17 @@
 
             boolean localCopy = isLocalCopy( artifact );
 
-            File destination = artifact.getFile();
-
+            destination = artifact.getFile();
+                             
             boolean resolved = false;
-            if ( !wagonManager.isOnline() )
-            {
-                if ( !destination.exists() )
-                {
-                    throw new ArtifactNotFoundException( "System is offline.", artifact );
-                }
-            }
+
             // There are three conditions in which we'll go after the artifact here:
             // 1. the force flag is set.
             // 2. the artifact's file doesn't exist (this would be true for release or snapshot artifacts)
             // 3. the artifact is a snapshot and is not a locally installed snapshot
 
             // TODO: Should it matter whether it's a locally installed snapshot??
-            else if ( force || !destination.exists() || ( artifact.isSnapshot() && !localCopy ) )
+            if ( force || !destination.exists() || ( artifact.isSnapshot() && !localCopy ) )
             {
                 try
                 {
@@ -173,18 +160,16 @@
                     {
                         throw new ArtifactResolutionException(
                                                                "Failed to resolve artifact, possibly due to a repository list that is not appropriately equipped for this artifact's metadata.",
-                                                               artifact, getMirroredRepositories( remoteRepositories ) );
+                                                               artifact, remoteRepositories );
                     }
                 }
                 catch ( ResourceDoesNotExistException e )
                 {
-                    throw new ArtifactNotFoundException( e.getMessage(), artifact,
-                                                         getMirroredRepositories( remoteRepositories ), e );
+                    throw new ArtifactNotFoundException( e.getMessage(), artifact, remoteRepositories, e );
                 }
                 catch ( TransferFailedException e )
                 {
-                    throw new ArtifactResolutionException( e.getMessage(), artifact,
-                                                           getMirroredRepositories( remoteRepositories ), e );
+                    throw new ArtifactResolutionException( e.getMessage(), artifact, remoteRepositories, e );
                 }
 
                 resolved = true;
@@ -216,7 +201,7 @@
                     catch ( IOException e )
                     {
                         throw new ArtifactResolutionException( "Unable to copy resolved artifact for local use: "
-                            + e.getMessage(), artifact, getMirroredRepositories( remoteRepositories ), e );
+                            + e.getMessage(), artifact, remoteRepositories, e );
                     }
                 }
 
@@ -229,7 +214,6 @@
 
     private boolean isLocalCopy( Artifact artifact )
     {
-
         boolean localCopy = false;
 
         for ( ArtifactMetadata m : artifact.getMetadataList() )
@@ -261,51 +245,37 @@
         return localCopy;
     }
 
-    public ArtifactResolutionResult resolveTransitively( Set<Artifact> artifacts, Artifact originatingArtifact,
-                                                         ArtifactRepository localRepository,
-                                                         List<ArtifactRepository> remoteRepositories,
+    public ArtifactResolutionResult resolveTransitively( Set<Artifact> artifacts, Artifact originatingArtifact, ArtifactRepository localRepository, List<ArtifactRepository> remoteRepositories,
                                                          ArtifactMetadataSource source, ArtifactFilter filter )
         throws ArtifactResolutionException, ArtifactNotFoundException
     {
-        return resolveTransitively( artifacts, originatingArtifact, Collections.EMPTY_MAP, localRepository,
-                                    remoteRepositories, source, filter );
+        return resolveTransitively( artifacts, originatingArtifact, Collections.EMPTY_MAP, localRepository, remoteRepositories, source, filter );
 
     }
 
-    public ArtifactResolutionResult resolveTransitively( Set<Artifact> artifacts, Artifact originatingArtifact,
-                                                         Map managedVersions, ArtifactRepository localRepository,
-                                                         List<ArtifactRepository> remoteRepositories,
-                                                         ArtifactMetadataSource source )
+    public ArtifactResolutionResult resolveTransitively( Set<Artifact> artifacts, Artifact originatingArtifact, Map managedVersions, ArtifactRepository localRepository,
+                                                         List<ArtifactRepository> remoteRepositories, ArtifactMetadataSource source )
         throws ArtifactResolutionException, ArtifactNotFoundException
     {
-        return resolveTransitively( artifacts, originatingArtifact, managedVersions, localRepository,
-                                    remoteRepositories, source, null );
+        return resolveTransitively( artifacts, originatingArtifact, managedVersions, localRepository, remoteRepositories, source, null );
     }
 
-    public ArtifactResolutionResult resolveTransitively( Set<Artifact> artifacts, Artifact originatingArtifact,
-                                                         Map managedVersions, ArtifactRepository localRepository,
-                                                         List<ArtifactRepository> remoteRepositories,
-                                                         ArtifactMetadataSource source, ArtifactFilter filter )
+    public ArtifactResolutionResult resolveTransitively( Set<Artifact> artifacts, Artifact originatingArtifact, Map managedVersions, ArtifactRepository localRepository,
+                                                         List<ArtifactRepository> remoteRepositories, ArtifactMetadataSource source, ArtifactFilter filter )
         throws ArtifactResolutionException, ArtifactNotFoundException
     {
-        return resolveTransitively( artifacts, originatingArtifact, managedVersions, localRepository,
-                                    remoteRepositories, source, filter, null );
+        return resolveTransitively( artifacts, originatingArtifact, managedVersions, localRepository, remoteRepositories, source, filter, null );
     }
 
-    public ArtifactResolutionResult resolveTransitively( Set<Artifact> artifacts, Artifact originatingArtifact,
-                                                         List<ArtifactRepository> remoteRepositories,
-                                                         ArtifactRepository localRepository,
+    public ArtifactResolutionResult resolveTransitively( Set<Artifact> artifacts, Artifact originatingArtifact, List<ArtifactRepository> remoteRepositories, ArtifactRepository localRepository,
                                                          ArtifactMetadataSource source )
         throws ArtifactResolutionException, ArtifactNotFoundException
     {
         return resolveTransitively( artifacts, originatingArtifact, localRepository, remoteRepositories, source, null );
     }
 
-    public ArtifactResolutionResult resolveTransitively( Set<Artifact> artifacts, Artifact originatingArtifact,
-                                                         List<ArtifactRepository> remoteRepositories,
-                                                         ArtifactRepository localRepository,
-                                                         ArtifactMetadataSource source,
-                                                         List<ResolutionListener> listeners )
+    public ArtifactResolutionResult resolveTransitively( Set<Artifact> artifacts, Artifact originatingArtifact, List<ArtifactRepository> remoteRepositories, ArtifactRepository localRepository,
+                                                         ArtifactMetadataSource source, List<ResolutionListener> listeners )
         throws ArtifactResolutionException, ArtifactNotFoundException
     {
         return resolveTransitively( artifacts, originatingArtifact,
@@ -313,22 +283,15 @@
         Collections.EMPTY_MAP, localRepository, remoteRepositories, source, null, listeners );
     }
 
-    public ArtifactResolutionResult resolveTransitively( Set<Artifact> artifacts, Artifact originatingArtifact,
-                                                         Map managedVersions, ArtifactRepository localRepository,
-                                                         List<ArtifactRepository> remoteRepositories,
-                                                         ArtifactMetadataSource source, ArtifactFilter filter,
-                                                         List<ResolutionListener> listeners )
+    public ArtifactResolutionResult resolveTransitively( Set<Artifact> artifacts, Artifact originatingArtifact, Map managedVersions, ArtifactRepository localRepository,
+                                                         List<ArtifactRepository> remoteRepositories, ArtifactMetadataSource source, ArtifactFilter filter, List<ResolutionListener> listeners )
         throws ArtifactResolutionException, ArtifactNotFoundException
     {
-        return resolveTransitively( artifacts, originatingArtifact, managedVersions, localRepository,
-                                    remoteRepositories, source, filter, listeners, null );
+        return resolveTransitively( artifacts, originatingArtifact, managedVersions, localRepository, remoteRepositories, source, filter, listeners, null );
     }
 
-    public ArtifactResolutionResult resolveTransitively( Set<Artifact> artifacts, Artifact originatingArtifact,
-                                                         Map managedVersions, ArtifactRepository localRepository,
-                                                         List<ArtifactRepository> remoteRepositories,
-                                                         ArtifactMetadataSource source, ArtifactFilter filter,
-                                                         List<ResolutionListener> listeners,
+    public ArtifactResolutionResult resolveTransitively( Set<Artifact> artifacts, Artifact originatingArtifact, Map managedVersions, ArtifactRepository localRepository,
+                                                         List<ArtifactRepository> remoteRepositories, ArtifactMetadataSource source, ArtifactFilter filter, List<ResolutionListener> listeners,
                                                          List<ConflictResolver> conflictResolvers )
         throws ArtifactResolutionException, ArtifactNotFoundException
     {
@@ -346,9 +309,7 @@
 
         ArtifactResolutionResult result;
 
-        result =
-            artifactCollector.collect( artifacts, originatingArtifact, managedVersions, localRepository,
-                                       remoteRepositories, source, filter, listeners, conflictResolvers );
+        result = artifactCollector.collect( artifacts, originatingArtifact, managedVersions, localRepository, remoteRepositories, source, filter, listeners, conflictResolvers );
 
         // We have collected all the problems so let's mimic the way the old code worked and just blow up right here.
         // That's right lets just let it rip right here and send a big incomprehensible blob of text at unsuspecting
@@ -399,26 +360,12 @@
 
         if ( missingArtifacts.size() > 0 )
         {
-            throw new MultipleArtifactsNotFoundException( originatingArtifact, resolvedArtifacts, missingArtifacts,
-                                                          getMirroredRepositories( remoteRepositories ) );
+            throw new MultipleArtifactsNotFoundException( originatingArtifact, resolvedArtifacts, missingArtifacts, remoteRepositories );
         }
 
         return result;
     }
 
-    private List<ArtifactRepository> getMirroredRepositories( List<ArtifactRepository> remoteRepositories )
-    {
-        Map<String, ArtifactRepository> repos = new HashMap<String, ArtifactRepository>();
-
-        for ( ArtifactRepository repository : remoteRepositories )
-        {
-            ArtifactRepository repo = wagonManager.getMirrorRepository( repository );
-            repos.put( repo.getId(), repo );
-        }
-
-        return new ArrayList<ArtifactRepository>( repos.values() );
-    }
-
     // ------------------------------------------------------------------------
     //
     // ------------------------------------------------------------------------
@@ -444,9 +391,9 @@
         // This is an attempt to get the metadata for the artifacts we are ultimately trying to resolve.
         // We still
 
-        ArtifactResolutionResult result =
-            artifactCollector.collect( artifacts, originatingArtifact, managedVersions, localRepository,
-                                       remoteRepositories, source, filter, listeners );
+        ArtifactResolutionResult result = artifactCollector.collect( artifacts, originatingArtifact, 
+                                                                     managedVersions, localRepository, 
+                                                                     remoteRepositories, source, filter, listeners );
 
         // Let's grab all the repositories that were gleaned. This we should know up front. I'm not sure
         // what the metadata source is doing. Repositories in POMs are deadly.

Modified: maven/components/branches/MNG-3932-1/maven-compat/src/main/java/org/apache/maven/artifact/transform/SnapshotTransformation.java
URL: http://svn.apache.org/viewvc/maven/components/branches/MNG-3932-1/maven-compat/src/main/java/org/apache/maven/artifact/transform/SnapshotTransformation.java?rev=746150&r1=746149&r2=746150&view=diff
==============================================================================
--- maven/components/branches/MNG-3932-1/maven-compat/src/main/java/org/apache/maven/artifact/transform/SnapshotTransformation.java (original)
+++ maven/components/branches/MNG-3932-1/maven-compat/src/main/java/org/apache/maven/artifact/transform/SnapshotTransformation.java Fri Feb 20 05:38:03 2009
@@ -158,13 +158,6 @@
     {
         RepositoryMetadata metadata = new SnapshotArtifactRepositoryMetadata( artifact );
 
-        if ( !wagonManager.isOnline() )
-        {
-            // build number is a required feature for metadata consistency
-            throw new RepositoryMetadataResolutionException(
-                "System is offline. Cannot resolve metadata:\n" + metadata.extendedToString() + "\n\n" );
-        }
-
         getLogger().info( "Retrieving previous build number from " + remoteRepository.getId() );
         repositoryMetadataManager.resolveAlways( metadata, localRepository, remoteRepository );
 

Modified: maven/components/branches/MNG-3932-1/maven-compat/src/test/java/org/apache/maven/artifact/manager/DefaultWagonManagerTest.java
URL: http://svn.apache.org/viewvc/maven/components/branches/MNG-3932-1/maven-compat/src/test/java/org/apache/maven/artifact/manager/DefaultWagonManagerTest.java?rev=746150&r1=746149&r2=746150&view=diff
==============================================================================
--- maven/components/branches/MNG-3932-1/maven-compat/src/test/java/org/apache/maven/artifact/manager/DefaultWagonManagerTest.java (original)
+++ maven/components/branches/MNG-3932-1/maven-compat/src/test/java/org/apache/maven/artifact/manager/DefaultWagonManagerTest.java Fri Feb 20 05:38:03 2009
@@ -91,130 +91,11 @@
         	}
         };
         TransferListener listener = new TransferListener();
-
-        wagonManager.setDownloadMonitor(listener);
+        wagonManager.setDownloadMonitor(listener);                                                                                     
         wagonManager.getArtifact( artifact, repos, false );
-
         assertEquals(1, listener.events.size());
     }
-
-    public void testGetMissingPomUncached() throws TransferFailedException, UnsupportedProtocolException, IOException
-    {
-        Artifact artifact = createTestPomArtifact( "target/test-data/get-missing-pom" );
-        
-        ArtifactRepository repo = createStringRepo();
-        
-        MockControl control = MockControl.createControl( UpdateCheckManager.class );
-        UpdateCheckManager updateCheckManager = (UpdateCheckManager) control.getMock();
-        wagonManager.setUpdateCheckManager( updateCheckManager );
-        
-        updateCheckManager.isPomUpdateRequired( artifact, repo );
-        control.setReturnValue( true );
-        updateCheckManager.touch( artifact, repo );        
-        control.replay();        
-        
-        try
-        {
-            wagonManager.getArtifact( artifact, repo, false );
-            
-            fail();
-        }
-        catch ( ResourceDoesNotExistException e )
-        {
-            assertTrue( true );
-        }
-        
-        assertFalse( artifact.getFile().exists() );
-        
-        control.verify();
-    }
-
-    public void testGetMissingPomCached() throws TransferFailedException, UnsupportedProtocolException, IOException
-    {
-        Artifact artifact = createTestPomArtifact( "target/test-data/get-missing-pom" );
-        
-        ArtifactRepository repo = createStringRepo();
-        
-        MockControl control = MockControl.createControl( UpdateCheckManager.class );
-        UpdateCheckManager updateCheckManager = (UpdateCheckManager) control.getMock();
-        wagonManager.setUpdateCheckManager( updateCheckManager );
-        
-        updateCheckManager.isPomUpdateRequired( artifact, repo );
-        control.setReturnValue( false );
-        control.replay();        
-        
-        try
-        {
-            wagonManager.getArtifact( artifact, repo, false );
-            
-            fail();
-        }
-        catch ( ResourceDoesNotExistException e )
-        {
-            assertTrue( true );
-        }
-        
-        assertFalse( artifact.getFile().exists() );
-        
-        control.verify();
-    }
     
-    public void testGetMissingPomCachedForced() throws TransferFailedException, UnsupportedProtocolException, IOException
-    {
-        Artifact artifact = createTestPomArtifact( "target/test-data/get-missing-pom" );
-        
-        ArtifactRepository repo = createStringRepo();
-        
-        MockControl control = MockControl.createControl( UpdateCheckManager.class );
-        UpdateCheckManager updateCheckManager = (UpdateCheckManager) control.getMock();
-        wagonManager.setUpdateCheckManager( updateCheckManager );
-        
-        updateCheckManager.touch( artifact, repo );        
-        control.replay();        
-        
-        try
-        {
-            wagonManager.getArtifact( artifact, repo, true );
-            
-            fail();
-        }
-        catch ( ResourceDoesNotExistException e )
-        {
-            assertTrue( true );
-        }
-        
-        assertFalse( artifact.getFile().exists() );
-        
-        control.verify();
-    }
-    
-    public void testGetRemotePom()
-        throws TransferFailedException, ResourceDoesNotExistException, UnsupportedProtocolException, IOException,
-        AuthorizationException
-    {
-        Artifact artifact = createTestPomArtifact( "target/test-data/get-remote-pom" );
-
-        ArtifactRepository repo = createStringRepo();
-
-        StringWagon wagon = (StringWagon) wagonManager.getWagon( "string" );
-        wagon.addExpectedContent( repo.getLayout().pathOf( artifact ), "expected" );
-
-        MockControl control = MockControl.createControl( UpdateCheckManager.class );
-        UpdateCheckManager updateCheckManager = (UpdateCheckManager) control.getMock();
-        wagonManager.setUpdateCheckManager( updateCheckManager );
-
-        updateCheckManager.isPomUpdateRequired( artifact, repo );
-        control.setReturnValue( true );
-        control.replay();
-
-        wagonManager.getArtifact( artifact, repo, false );
-
-        assertTrue( artifact.getFile().exists() );
-        assertEquals( "expected", FileUtils.fileRead( artifact.getFile(), "UTF-8" ) );
-
-        control.verify();
-    }
-
     public void testGetPomExistsLocallyForced()
         throws IOException, TransferFailedException, ResourceDoesNotExistException, UnsupportedProtocolException
     {
@@ -229,7 +110,6 @@
 
         MockControl control = MockControl.createControl( UpdateCheckManager.class );
         UpdateCheckManager updateCheckManager = (UpdateCheckManager) control.getMock();
-        wagonManager.setUpdateCheckManager( updateCheckManager );
 
         control.replay();
 
@@ -294,7 +174,6 @@
 
         MockControl control = MockControl.createControl( UpdateCheckManager.class );
         UpdateCheckManager updateCheckManager = (UpdateCheckManager) control.getMock();
-        wagonManager.setUpdateCheckManager( updateCheckManager );
 
         control.replay();
 
@@ -320,7 +199,6 @@
 
         MockControl control = MockControl.createControl( UpdateCheckManager.class );
         UpdateCheckManager updateCheckManager = (UpdateCheckManager) control.getMock();
-        wagonManager.setUpdateCheckManager( updateCheckManager );
 
         control.replay();
 
@@ -332,124 +210,6 @@
         control.verify();
     }
 
-    public void testGetRemoteSnapshotJar()
-        throws TransferFailedException, ResourceDoesNotExistException, UnsupportedProtocolException, IOException,
-        AuthorizationException
-    {
-        Artifact artifact = createTestArtifact( "target/test-data/get-remote-jar", "1.0-SNAPSHOT", "jar" );
-
-        ArtifactRepository repo = createStringRepo();
-
-        StringWagon wagon = (StringWagon) wagonManager.getWagon( "string" );
-        wagon.addExpectedContent( repo.getLayout().pathOf( artifact ), "expected" );
-
-        MockControl control = MockControl.createControl( UpdateCheckManager.class );
-        UpdateCheckManager updateCheckManager = (UpdateCheckManager) control.getMock();
-        wagonManager.setUpdateCheckManager( updateCheckManager );
-
-        updateCheckManager.isUpdateRequired( artifact, repo );
-        control.setReturnValue( true );
-        
-        updateCheckManager.touch( artifact, repo );
-
-        control.replay();
-
-        wagonManager.getArtifact( artifact, repo, false );
-
-        assertTrue( artifact.getFile().exists() );
-        assertEquals( "expected", FileUtils.fileRead( artifact.getFile(), "UTF-8" ) );
-
-        control.verify();
-    }
-
-    public void testGetSnapshotJarExistsLocally()
-        throws IOException, TransferFailedException, ResourceDoesNotExistException, UnsupportedProtocolException
-    {
-        Artifact artifact = createTestArtifact( "target/test-data/get-remote-jar", "1.0-SNAPSHOT", "jar" );
-        artifact.getFile().createNewFile();
-        artifact.getFile().setLastModified( System.currentTimeMillis() - 60 * 1000 );
-
-        ArtifactRepository repo = createStringRepo();
-
-        StringWagon wagon = (StringWagon) wagonManager.getWagon( "string" );
-        wagon.addExpectedContent( repo.getLayout().pathOf( artifact ), "expected" );
-
-        MockControl control = MockControl.createControl( UpdateCheckManager.class );
-        UpdateCheckManager updateCheckManager = (UpdateCheckManager) control.getMock();
-        wagonManager.setUpdateCheckManager( updateCheckManager );
-
-        updateCheckManager.isUpdateRequired( artifact, repo );
-        control.setReturnValue( false );
-
-        control.replay();
-
-        wagonManager.getArtifact( artifact, repo, false );
-
-        assertTrue( artifact.getFile().exists() );
-        assertEquals( "", FileUtils.fileRead( artifact.getFile(), "UTF-8" ) );
-
-        control.verify();
-    }
-
-    public void testGetSnapshotJarExistsLocallyExpired()
-        throws IOException, TransferFailedException, ResourceDoesNotExistException, UnsupportedProtocolException
-    {
-        Artifact artifact = createTestArtifact( "target/test-data/get-remote-jar", "1.0-SNAPSHOT", "jar" );
-        artifact.getFile().createNewFile();
-        artifact.getFile().setLastModified( System.currentTimeMillis() - 60 * 1000 );
-
-        ArtifactRepository repo = createStringRepo();
-
-        StringWagon wagon = (StringWagon) wagonManager.getWagon( "string" );
-        wagon.addExpectedContent( repo.getLayout().pathOf( artifact ), "expected" );
-
-        MockControl control = MockControl.createControl( UpdateCheckManager.class );
-        UpdateCheckManager updateCheckManager = (UpdateCheckManager) control.getMock();
-        wagonManager.setUpdateCheckManager( updateCheckManager );
-
-        updateCheckManager.isUpdateRequired( artifact, repo );
-        control.setReturnValue( true );
-
-        updateCheckManager.touch( artifact, repo );
-
-        control.replay();
-
-        wagonManager.getArtifact( artifact, repo, false );
-
-        assertTrue( artifact.getFile().exists() );
-        assertEquals( "expected", FileUtils.fileRead( artifact.getFile(), "UTF-8" ) );
-
-        control.verify();
-    }
-
-    public void testGetSnapshotJarExistsLocallyForced()
-        throws IOException, TransferFailedException, ResourceDoesNotExistException, UnsupportedProtocolException
-    {
-        Artifact artifact = createTestArtifact( "target/test-data/get-remote-jar", "1.0-SNAPSHOT", "jar" );
-        artifact.getFile().createNewFile();
-        artifact.getFile().setLastModified( System.currentTimeMillis() - 60 * 1000 );
-
-        ArtifactRepository repo = createStringRepo();
-
-        StringWagon wagon = (StringWagon) wagonManager.getWagon( "string" );
-        wagon.addExpectedContent( repo.getLayout().pathOf( artifact ), "expected" );
-
-        MockControl control = MockControl.createControl( UpdateCheckManager.class );
-        UpdateCheckManager updateCheckManager = (UpdateCheckManager) control.getMock();
-        wagonManager.setUpdateCheckManager( updateCheckManager );
-
-        updateCheckManager.touch( artifact, repo );
-        
-        control.replay();
-
-        wagonManager.getArtifact( artifact, repo, true );
-
-        assertTrue( artifact.getFile().exists() );
-        assertEquals( "expected", FileUtils.fileRead( artifact.getFile(), "UTF-8" ) );
-
-        control.verify();
-    }
-
     private Artifact createTestPomArtifact( String directory )
         throws IOException
     {
@@ -482,27 +242,6 @@
         return artifact;
     }
 
-    public void testAddMirrorWithNullRepositoryId()
-    {
-        wagonManager.addMirror( null, "test", "http://www.nowhere.com/" );
-    }
-    
-    public void testGetArtifactSha1MissingMd5Present()
-        throws IOException, UnsupportedProtocolException, TransferFailedException, ResourceDoesNotExistException
-    {
-        Artifact artifact = createTestPomArtifact( "target/test-data/get-remote-artifact" );
-
-        ArtifactRepository repo = createStringRepo();
-
-        StringWagon wagon = (StringWagon) wagonManager.getWagon( "string" );
-        wagon.addExpectedContent( repo.getLayout().pathOf( artifact ), "expected" );
-        wagon.addExpectedContent( repo.getLayout().pathOf( artifact ) + ".md5", "bad_checksum" );
-        
-        wagonManager.getArtifact( artifact, repo, true );
-
-        assertTrue( artifact.getFile().exists() );
-    }
-
     private ArtifactRepository createStringRepo()
     {
         ArtifactRepository repo =
@@ -510,174 +249,6 @@
         return repo;
     }
     
-    /**
-     * checks the handling of urls
-     */
-    public void testExternalURL()
-    {
-        DefaultWagonManager mgr = new DefaultWagonManager();
-        assertTrue( mgr.isExternalRepo( getRepo( "foo", "http://somehost" ) ) );
-        assertTrue( mgr.isExternalRepo( getRepo( "foo", "http://somehost:9090/somepath" ) ) );
-        assertTrue( mgr.isExternalRepo( getRepo( "foo", "ftp://somehost" ) ) );
-        assertTrue( mgr.isExternalRepo( getRepo( "foo", "http://192.168.101.1" ) ) );
-        assertTrue( mgr.isExternalRepo( getRepo( "foo", "http://" ) ) );
-        // these are local
-        assertFalse( mgr.isExternalRepo( getRepo( "foo", "http://localhost:8080" ) ) );
-        assertFalse( mgr.isExternalRepo( getRepo( "foo", "http://127.0.0.1:9090" ) ) );
-        assertFalse( mgr.isExternalRepo( getRepo( "foo", "file://localhost/somepath" ) ) );
-        assertFalse( mgr.isExternalRepo( getRepo( "foo", "file://localhost/D:/somepath" ) ) );
-        assertFalse( mgr.isExternalRepo( getRepo( "foo", "http://localhost" ) ) );
-        assertFalse( mgr.isExternalRepo( getRepo( "foo", "http://127.0.0.1" ) ) );
-        assertFalse( mgr.isExternalRepo( getRepo( "foo", "file:///somepath" ) ) );
-        assertFalse( mgr.isExternalRepo( getRepo( "foo", "file://D:/somepath" ) ) );
-
-        // not a proper url so returns false;
-        assertFalse( mgr.isExternalRepo( getRepo( "foo", "192.168.101.1" ) ) );
-        assertFalse( mgr.isExternalRepo( getRepo( "foo", "" ) ) );
-    }
-
-    /**
-     * Check that lookups with exact matches work and that no matches don't corrupt the repo.
-     */
-    public void testMirrorLookup()
-    {
-        wagonManager.addMirror( "a", "a", "http://a" );
-        wagonManager.addMirror( "b", "b", "http://b" );
-
-        ArtifactRepository repo = null;
-        repo = wagonManager.getMirrorRepository( getRepo( "a", "http://a.a" ) );
-        assertEquals( "http://a", repo.getUrl() );
-
-        repo = wagonManager.getMirrorRepository( getRepo( "b", "http://a.a" ) );
-        assertEquals( "http://b", repo.getUrl() );
-
-        repo = wagonManager.getMirrorRepository( getRepo( "c", "http://c.c" ) );
-        assertEquals( "http://c.c", repo.getUrl() );
-
-    }
-
-    /**
-     * Check that wildcards don't override exact id matches.
-     */
-    public void testMirrorWildcardLookup()
-    {
-        wagonManager.addMirror( "a", "a", "http://a" );
-        wagonManager.addMirror( "b", "b", "http://b" );
-        wagonManager.addMirror( "c", "*", "http://wildcard" );
-
-        ArtifactRepository repo = null;
-        repo = wagonManager.getMirrorRepository( getRepo( "a", "http://a.a" ) );
-        assertEquals( "http://a", repo.getUrl() );
-
-        repo = wagonManager.getMirrorRepository( getRepo( "b", "http://a.a" ) );
-        assertEquals( "http://b", repo.getUrl() );
-
-        repo = wagonManager.getMirrorRepository( getRepo( "c", "http://c.c" ) );
-        assertEquals( "http://wildcard", repo.getUrl() );
-
-    }
-
-    /**
-     * Check that first match wins
-     */
-    public void testMirrorStopOnFirstMatch()
-    {
-        //exact matches win first
-        wagonManager.addMirror( "a2", "a,b", "http://a2" );
-        wagonManager.addMirror( "a", "a", "http://a" );
-        //make sure repeated entries are skipped
-        wagonManager.addMirror( "a", "a", "http://a3" );
-        
-        wagonManager.addMirror( "b", "b", "http://b" );
-        wagonManager.addMirror( "c", "d,e", "http://de" );
-        wagonManager.addMirror( "c", "*", "http://wildcard" );
-        wagonManager.addMirror( "c", "e,f", "http://ef" );
-        
-    
-
-        ArtifactRepository repo = null;
-        repo = wagonManager.getMirrorRepository( getRepo( "a", "http://a.a" ) );
-        assertEquals( "http://a", repo.getUrl() );
-
-        repo = wagonManager.getMirrorRepository( getRepo( "b", "http://a.a" ) );
-        assertEquals( "http://b", repo.getUrl() );
-
-        repo = wagonManager.getMirrorRepository( getRepo( "c", "http://c.c" ) );
-        assertEquals( "http://wildcard", repo.getUrl() );
-        
-        repo = wagonManager.getMirrorRepository( getRepo( "d", "http://d" ) );
-        assertEquals( "http://de", repo.getUrl() );
-        
-        repo = wagonManager.getMirrorRepository( getRepo( "e", "http://e" ) );
-        assertEquals( "http://de", repo.getUrl() );
-        
-        repo = wagonManager.getMirrorRepository( getRepo( "f", "http://f" ) );
-        assertEquals( "http://wildcard", repo.getUrl() );
-
-    }
-
-    
-    /**
-     * Check that patterns are processed correctly Valid patterns: * = everything external:* = everything not on the
-     * localhost and not file based. repo,repo1 = repo or repo1 *,!repo1 = everything except repo1
-     */
-    public void testPatterns()
-    {
-        DefaultWagonManager mgr = new DefaultWagonManager();
-
-        assertTrue( mgr.matchPattern( getRepo( "a" ), "*" ) );
-        assertTrue( mgr.matchPattern( getRepo( "a" ), "*," ) );
-        assertTrue( mgr.matchPattern( getRepo( "a" ), ",*," ) );
-        assertTrue( mgr.matchPattern( getRepo( "a" ), "*," ) );
-
-        assertTrue( mgr.matchPattern( getRepo( "a" ), "a" ) );
-        assertTrue( mgr.matchPattern( getRepo( "a" ), "a," ) );
-        assertTrue( mgr.matchPattern( getRepo( "a" ), ",a," ) );
-        assertTrue( mgr.matchPattern( getRepo( "a" ), "a," ) );
-
-        assertFalse( mgr.matchPattern( getRepo( "b" ), "a" ) );
-        assertFalse( mgr.matchPattern( getRepo( "b" ), "a," ) );
-        assertFalse( mgr.matchPattern( getRepo( "b" ), ",a" ) );
-        assertFalse( mgr.matchPattern( getRepo( "b" ), ",a," ) );
-
-        assertTrue( mgr.matchPattern( getRepo( "a" ), "a,b" ) );
-        assertTrue( mgr.matchPattern( getRepo( "b" ), "a,b" ) );
-
-        assertFalse( mgr.matchPattern( getRepo( "c" ), "a,b" ) );
-
-        assertTrue( mgr.matchPattern( getRepo( "a" ), "*" ) );
-        assertTrue( mgr.matchPattern( getRepo( "a" ), "*,b" ) );
-        assertTrue( mgr.matchPattern( getRepo( "a" ), "*,!b" ) );
-
-        assertFalse( mgr.matchPattern( getRepo( "a" ), "*,!a" ) );
-        assertFalse( mgr.matchPattern( getRepo( "a" ), "!a,*" ) );
-
-        assertTrue( mgr.matchPattern( getRepo( "c" ), "*,!a" ) );
-        assertTrue( mgr.matchPattern( getRepo( "c" ), "!a,*" ) );
-
-        assertFalse( mgr.matchPattern( getRepo( "c" ), "!a,!c" ) );
-        assertFalse( mgr.matchPattern( getRepo( "d" ), "!a,!c*" ) );
-    }
-
-    /**
-     * make sure the external if is fully exercised. We can assume file and ips are also handled because they have a
-     * separate test above.
-     */
-    public void testPatternsWithExternal()
-    {
-        DefaultWagonManager mgr = new DefaultWagonManager();
-
-        assertTrue( mgr.matchPattern( getRepo( "a", "http://localhost" ), "*" ) );
-        assertFalse( mgr.matchPattern( getRepo( "a", "http://localhost" ), "external:*" ) );
-
-        assertTrue( mgr.matchPattern( getRepo( "a", "http://localhost" ), "external:*,a" ) );
-        assertFalse( mgr.matchPattern( getRepo( "a", "http://localhost" ), "external:*,!a" ) );
-        assertTrue( mgr.matchPattern( getRepo( "a", "http://localhost" ), "a,external:*" ) );
-        assertFalse( mgr.matchPattern( getRepo( "a", "http://localhost" ), "!a,external:*" ) );
-
-        assertFalse( mgr.matchPattern( getRepo( "c", "http://localhost" ), "!a,external:*" ) );
-        assertTrue( mgr.matchPattern( getRepo( "c", "http://somehost" ), "!a,external:*" ) );
-    }
 
     /**
      * Build an ArtifactRepository object.
@@ -728,30 +299,6 @@
         }
     }
 
-    public void testGetWagonRepository()
-        throws Exception
-    {
-        assertWagonRepository( "a" );
-
-        assertWagonRepository( "b1" );
-
-        assertWagonRepository( "b2" );
-
-        assertWagonRepository( "c" );
-
-        try
-        {
-            assertWagonRepository( "d" );
-
-            fail( "Expected :" + UnsupportedProtocolException.class.getName() );
-        }
-        catch ( UnsupportedProtocolException e )
-        {
-            // ok
-            assertTrue( true );
-        }
-    }
-
     public void testGetWagonRepositoryNullProtocol()
         throws Exception
     {
@@ -773,21 +320,6 @@
     }
 
     /**
-     * Checks that lookup by protocol/scheme is case-insensitive as suggested by RFC 2396, "3.1. Scheme Component".
-     */
-    public void testGetWagonCaseInsensitive()
-        throws Exception
-    {
-        assertWagon( "a" );
-
-        assertWagon( "A" );
-
-        assertWagonRepository( "a" );
-
-        assertWagonRepository( "A" );
-    }
-
-    /**
      * Check that transfer listeners are properly removed after getArtifact and putArtifact
      */
     public void testWagonTransferListenerRemovedAfterGetArtifactAndPutArtifact()
@@ -801,7 +333,7 @@
         /* getArtifact */
         assertFalse( "Transfer listener is registered before test",
                      wagon.getTransferEventSupport().hasTransferListener( transferListener ) );
-        wagonManager.setDownloadMonitor( transferListener );
+        wagonManager.setDownloadMonitor( transferListener );                                                                                   
         wagonManager.getArtifact( artifact, repo );
         assertFalse( "Transfer listener still registered after getArtifact",
                      wagon.getTransferEventSupport().hasTransferListener( transferListener ) );
@@ -812,7 +344,7 @@
 
         assertFalse( "Transfer listener is registered before test",
                      wagon.getTransferEventSupport().hasTransferListener( transferListener ) );
-        wagonManager.setDownloadMonitor( transferListener );
+        wagonManager.setDownloadMonitor( transferListener );                                                                                   
         wagonManager.putArtifact( sampleFile, artifact, repo );
         assertFalse( "Transfer listener still registered after putArtifact",
                      wagon.getTransferEventSupport().hasTransferListener( transferListener ) );
@@ -945,8 +477,6 @@
 
         conf.addChild( configurableField );
 
-        wagonManager.addConfiguration( repository.getId(), conf );
-
         WagonMock wagon = (WagonMock) wagonManager.getWagon( repository );
 
         assertNotNull( "Check wagon, protocol=" + protocol, wagon );



Mime
View raw message