diff options
author | Jonathan Sharp <forjsharp@gmail.com> | 2014-10-17 15:23:47 -0700 |
---|---|---|
committer | Jonathan Sharp <forjsharp@gmail.com> | 2014-10-17 15:23:47 -0700 |
commit | 7c9267111a4eb6b8a47b8b4891af98c487dd0c9b (patch) | |
tree | 28731e9883086797a8f854170a86b06b8b91584d /archiva-modules/archiva-base/archiva-proxy | |
parent | d3687d86b46a9638a8bc74c1e24aeb829947cf8c (diff) | |
download | archiva-7c9267111a4eb6b8a47b8b4891af98c487dd0c9b.tar.gz archiva-7c9267111a4eb6b8a47b8b4891af98c487dd0c9b.zip |
MRM-813 tweak APC interface and ADRF AuditEvents
Diffstat (limited to 'archiva-modules/archiva-base/archiva-proxy')
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 ); |