diff options
Diffstat (limited to 'archiva-modules/archiva-base/archiva-proxy/src')
2 files changed, 16 insertions, 13 deletions
diff --git a/archiva-modules/archiva-base/archiva-proxy/src/main/java/org/apache/archiva/proxy/DefaultRepositoryProxyConnectors.java b/archiva-modules/archiva-base/archiva-proxy/src/main/java/org/apache/archiva/proxy/DefaultRepositoryProxyConnectors.java index 151dd61ea..0daa2d201 100644 --- a/archiva-modules/archiva-base/archiva-proxy/src/main/java/org/apache/archiva/proxy/DefaultRepositoryProxyConnectors.java +++ b/archiva-modules/archiva-base/archiva-proxy/src/main/java/org/apache/archiva/proxy/DefaultRepositoryProxyConnectors.java @@ -48,6 +48,7 @@ import org.apache.archiva.policies.urlcache.UrlFailureCache; import org.apache.archiva.proxy.common.WagonFactory; import org.apache.archiva.proxy.common.WagonFactoryException; import org.apache.archiva.proxy.common.WagonFactoryRequest; +import org.apache.archiva.proxy.model.ProxyFetchResult; import org.apache.archiva.proxy.model.ProxyConnector; import org.apache.archiva.proxy.model.RepositoryProxyConnectors; import org.apache.archiva.redback.components.registry.Registry; @@ -447,7 +448,7 @@ public class DefaultRepositoryProxyConnectors } @Override - public File fetchMetatadaFromProxies( ManagedRepositoryContent repository, String logicalPath ) + public ProxyFetchResult fetchMetadataFromProxies( ManagedRepositoryContent repository, String logicalPath ) { File localFile = new File( repository.getRepoRoot(), logicalPath ); @@ -517,14 +518,15 @@ public class DefaultRepositoryProxyConnectors { log.warn( "Unable to update metadata {}:{}", localFile.getAbsolutePath(), e.getMessage(), e ); } + } if ( fileExists( localFile ) ) { - return localFile; + return new ProxyFetchResult( localFile, metadataNeedsUpdating ); } - return null; + return new ProxyFetchResult( null, false ); } /** diff --git a/archiva-modules/archiva-base/archiva-proxy/src/test/java/org/apache/archiva/proxy/MetadataTransferTest.java b/archiva-modules/archiva-base/archiva-proxy/src/test/java/org/apache/archiva/proxy/MetadataTransferTest.java index ed7f04b48..8ed576788 100644 --- a/archiva-modules/archiva-base/archiva-proxy/src/test/java/org/apache/archiva/proxy/MetadataTransferTest.java +++ b/archiva-modules/archiva-base/archiva-proxy/src/test/java/org/apache/archiva/proxy/MetadataTransferTest.java @@ -31,6 +31,7 @@ import org.apache.archiva.policies.CachedFailuresPolicy; import org.apache.archiva.policies.ChecksumPolicy; import org.apache.archiva.policies.ReleasesPolicy; import org.apache.archiva.policies.SnapshotsPolicy; +import org.apache.archiva.proxy.model.ProxyFetchResult; import org.apache.archiva.repository.metadata.MetadataTools; import org.apache.archiva.repository.metadata.RepositoryMetadataException; import org.apache.archiva.repository.metadata.RepositoryMetadataWriter; @@ -124,9 +125,9 @@ public class MetadataTransferTest ProjectReference metadata = createProjectReference( requestedResource ); - File downloadedFile = proxyHandler.fetchMetatadaFromProxies( managedDefaultRepository, + File downloadedFile = proxyHandler.fetchMetadataFromProxies( managedDefaultRepository, managedDefaultRepository.toMetadataPath( - metadata ) ); + metadata ) ).getFile(); assertNull( "Should not have downloaded a file.", downloadedFile ); assertNoTempFiles( expectedFile ); @@ -987,9 +988,9 @@ public class MetadataTransferTest ProjectReference metadata = createProjectReference( requestedResource ); - File downloadedFile = proxyHandler.fetchMetatadaFromProxies( managedDefaultRepository, + File downloadedFile = proxyHandler.fetchMetadataFromProxies( managedDefaultRepository, managedDefaultRepository.toMetadataPath( - metadata ) ); + metadata ) ).getFile(); assertNotNull( "Should have downloaded a file.", downloadedFile ); assertNoTempFiles( expectedFile ); @@ -1013,9 +1014,9 @@ public class MetadataTransferTest File expectedFile = new File( managedDefaultDir, requestedResource ); ProjectReference metadata = createProjectReference( requestedResource ); - File downloadedFile = proxyHandler.fetchMetatadaFromProxies( managedDefaultRepository, + File downloadedFile = proxyHandler.fetchMetadataFromProxies( managedDefaultRepository, managedDefaultRepository.toMetadataPath( - metadata ) ); + metadata ) ).getFile(); assertNull( downloadedFile ); assertNoTempFiles( expectedFile ); @@ -1034,9 +1035,9 @@ public class MetadataTransferTest VersionedReference metadata = createVersionedReference( requestedResource ); - File downloadedFile = proxyHandler.fetchMetatadaFromProxies( managedDefaultRepository, + File downloadedFile = proxyHandler.fetchMetadataFromProxies( managedDefaultRepository, managedDefaultRepository.toMetadataPath( - metadata ) ); + metadata ) ).getFile(); assertNotNull( "Should have downloaded a file.", downloadedFile ); assertNoTempFiles( expectedFile ); @@ -1060,9 +1061,9 @@ public class MetadataTransferTest File expectedFile = new File( managedDefaultDir, requestedResource ); VersionedReference metadata = createVersionedReference( requestedResource ); - File downloadedFile = proxyHandler.fetchMetatadaFromProxies( managedDefaultRepository, + File downloadedFile = proxyHandler.fetchMetadataFromProxies( managedDefaultRepository, managedDefaultRepository.toMetadataPath( - metadata ) ); + metadata ) ).getFile(); assertNull( downloadedFile ); assertNoTempFiles( expectedFile ); |