From: James William Dumay Date: Tue, 19 Aug 2008 09:12:41 +0000 (+0000) Subject: MRM-541 - convenient way to take Archiva proxies "offline" X-Git-Tag: archiva-1.2-M1~73^2~2 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=2903962dfabae82dcdc2c38539ad7569f06511c1;p=archiva.git MRM-541 - convenient way to take Archiva proxies "offline" git-svn-id: https://svn.apache.org/repos/asf/archiva/branches/MRM-541@687001 13f79535-47bb-0310-9956-ffa450edef68 --- diff --git a/archiva-modules/archiva-base/archiva-proxy/src/main/java/org/apache/maven/archiva/proxy/DefaultRepositoryProxyConnectors.java b/archiva-modules/archiva-base/archiva-proxy/src/main/java/org/apache/maven/archiva/proxy/DefaultRepositoryProxyConnectors.java index 9c81b53ed..68406c1de 100644 --- a/archiva-modules/archiva-base/archiva-proxy/src/main/java/org/apache/maven/archiva/proxy/DefaultRepositoryProxyConnectors.java +++ b/archiva-modules/archiva-base/archiva-proxy/src/main/java/org/apache/maven/archiva/proxy/DefaultRepositoryProxyConnectors.java @@ -1076,6 +1076,7 @@ public class DefaultRepositoryProxyConnectors connector.setProxyId( proxyConfig.getProxyId() ); connector.setPolicies( proxyConfig.getPolicies() ); connector.setOrder( proxyConfig.getOrder() ); + connector.setDisabled( proxyConfig.isDisabled() ); // Copy any blacklist patterns. List blacklist = new ArrayList(); diff --git a/archiva-modules/archiva-base/archiva-proxy/src/test/java/org/apache/maven/archiva/proxy/AbstractProxyTestCase.java b/archiva-modules/archiva-base/archiva-proxy/src/test/java/org/apache/maven/archiva/proxy/AbstractProxyTestCase.java index 344e5fc10..eed4394e6 100644 --- a/archiva-modules/archiva-base/archiva-proxy/src/test/java/org/apache/maven/archiva/proxy/AbstractProxyTestCase.java +++ b/archiva-modules/archiva-base/archiva-proxy/src/test/java/org/apache/maven/archiva/proxy/AbstractProxyTestCase.java @@ -338,29 +338,29 @@ public abstract class AbstractProxyTestCase } } - protected void saveConnector( String sourceRepoId, String targetRepoId ) + protected void saveConnector( String sourceRepoId, String targetRepoId, boolean disabled ) { saveConnector( sourceRepoId, targetRepoId, ChecksumPolicy.IGNORE, ReleasesPolicy.ALWAYS, - SnapshotsPolicy.ALWAYS, CachedFailuresPolicy.NO ); + SnapshotsPolicy.ALWAYS, CachedFailuresPolicy.NO, disabled ); } protected void saveConnector( String sourceRepoId, String targetRepoId, String checksumPolicy, String releasePolicy, - String snapshotPolicy, String cacheFailuresPolicy ) + String snapshotPolicy, String cacheFailuresPolicy, boolean disabled ) { saveConnector( sourceRepoId, targetRepoId, checksumPolicy, releasePolicy, snapshotPolicy, cacheFailuresPolicy, - PropagateErrorsDownloadPolicy.QUEUE ); + PropagateErrorsDownloadPolicy.QUEUE, disabled ); } protected void saveConnector( String sourceRepoId, String targetRepoId, String checksumPolicy, String releasePolicy, - String snapshotPolicy, String cacheFailuresPolicy, String errorPolicy ) + String snapshotPolicy, String cacheFailuresPolicy, String errorPolicy, boolean disabled ) { saveConnector( sourceRepoId, targetRepoId, checksumPolicy, releasePolicy, snapshotPolicy, cacheFailuresPolicy, - errorPolicy, PropagateErrorsOnUpdateDownloadPolicy.NOT_PRESENT ); + errorPolicy, PropagateErrorsOnUpdateDownloadPolicy.NOT_PRESENT, disabled ); } protected void saveConnector( String sourceRepoId, String targetRepoId, String checksumPolicy, String releasePolicy, String snapshotPolicy, String cacheFailuresPolicy, String errorPolicy, - String errorOnUpdatePolicy ) + String errorOnUpdatePolicy, boolean disabled ) { ProxyConnectorConfiguration connectorConfig = new ProxyConnectorConfiguration(); connectorConfig.setSourceRepoId( sourceRepoId ); @@ -371,6 +371,7 @@ public abstract class AbstractProxyTestCase connectorConfig.addPolicy( ProxyConnectorConfiguration.POLICY_CACHE_FAILURES, cacheFailuresPolicy ); connectorConfig.addPolicy( ProxyConnectorConfiguration.POLICY_PROPAGATE_ERRORS, errorPolicy ); connectorConfig.addPolicy( ProxyConnectorConfiguration.POLICY_PROPAGATE_ERRORS_ON_UPDATE, errorOnUpdatePolicy ); + connectorConfig.setDisabled(disabled); int count = config.getConfiguration().getProxyConnectors().size(); config.getConfiguration().addProxyConnector( connectorConfig ); diff --git a/archiva-modules/archiva-base/archiva-proxy/src/test/java/org/apache/maven/archiva/proxy/CacheFailuresTransferTest.java b/archiva-modules/archiva-base/archiva-proxy/src/test/java/org/apache/maven/archiva/proxy/CacheFailuresTransferTest.java index 119211d6c..6a509570a 100644 --- a/archiva-modules/archiva-base/archiva-proxy/src/test/java/org/apache/maven/archiva/proxy/CacheFailuresTransferTest.java +++ b/archiva-modules/archiva-base/archiva-proxy/src/test/java/org/apache/maven/archiva/proxy/CacheFailuresTransferTest.java @@ -60,9 +60,9 @@ public class CacheFailuresTransferTest // Configure Connector (usually done within archiva.xml configuration) saveConnector( ID_DEFAULT_MANAGED, "badproxied1", ChecksumPolicy.FIX, ReleasesPolicy.ALWAYS, - SnapshotsPolicy.ALWAYS, CachedFailuresPolicy.YES ); + SnapshotsPolicy.ALWAYS, CachedFailuresPolicy.YES, false ); saveConnector( ID_DEFAULT_MANAGED, "badproxied2", ChecksumPolicy.FIX, ReleasesPolicy.ALWAYS, - SnapshotsPolicy.ALWAYS, CachedFailuresPolicy.YES ); + SnapshotsPolicy.ALWAYS, CachedFailuresPolicy.YES, false ); wagonMock.get( path, new File( expectedFile.getParentFile(), expectedFile.getName() + ".tmp" ) ); @@ -103,9 +103,9 @@ public class CacheFailuresTransferTest // Configure Connector (usually done within archiva.xml configuration) saveConnector( ID_DEFAULT_MANAGED, "badproxied1", ChecksumPolicy.FIX, ReleasesPolicy.ALWAYS, - SnapshotsPolicy.ALWAYS, CachedFailuresPolicy.NO ); + SnapshotsPolicy.ALWAYS, CachedFailuresPolicy.NO, false ); saveConnector( ID_DEFAULT_MANAGED, "badproxied2", ChecksumPolicy.FIX, ReleasesPolicy.ALWAYS, - SnapshotsPolicy.ALWAYS, CachedFailuresPolicy.NO ); + SnapshotsPolicy.ALWAYS, CachedFailuresPolicy.NO, false ); wagonMock.get( path, new File( expectedFile.getParentFile(), expectedFile.getName() + ".tmp" ) ); @@ -153,9 +153,9 @@ public class CacheFailuresTransferTest // Configure Connector (usually done within archiva.xml configuration) saveConnector( ID_DEFAULT_MANAGED, "proxied1", ChecksumPolicy.FIX, ReleasesPolicy.ALWAYS, - SnapshotsPolicy.ALWAYS, CachedFailuresPolicy.YES ); + SnapshotsPolicy.ALWAYS, CachedFailuresPolicy.YES, false ); saveConnector( ID_DEFAULT_MANAGED, "proxied2", ChecksumPolicy.FIX, ReleasesPolicy.ALWAYS, - SnapshotsPolicy.ALWAYS, CachedFailuresPolicy.YES ); + SnapshotsPolicy.ALWAYS, CachedFailuresPolicy.YES, false ); File downloadedFile = proxyHandler.fetchFromProxies( managedDefaultRepository, artifact ); diff --git a/archiva-modules/archiva-base/archiva-proxy/src/test/java/org/apache/maven/archiva/proxy/ChecksumTransferTest.java b/archiva-modules/archiva-base/archiva-proxy/src/test/java/org/apache/maven/archiva/proxy/ChecksumTransferTest.java index 784787987..13d23dab3 100644 --- a/archiva-modules/archiva-base/archiva-proxy/src/test/java/org/apache/maven/archiva/proxy/ChecksumTransferTest.java +++ b/archiva-modules/archiva-base/archiva-proxy/src/test/java/org/apache/maven/archiva/proxy/ChecksumTransferTest.java @@ -39,6 +39,27 @@ import java.io.File; public class ChecksumTransferTest extends AbstractProxyTestCase { + public void testGetChecksumWhenConnectorIsDisabled() + throws Exception + { + String path = "org/apache/maven/test/get-checksum-both-right/1.0/get-checksum-both-right-1.0.jar"; + setupTestableManagedRepository( path ); + + File expectedFile = new File( managedDefaultDir, path ); + ArtifactReference artifact = managedDefaultRepository.toArtifactReference( path ); + + FileUtils.deleteDirectory( expectedFile.getParentFile() ); + assertFalse( expectedFile.exists() ); + + // Configure Connector (usually done within archiva.xml configuration) + saveConnector( ID_DEFAULT_MANAGED, "proxied1", ChecksumPolicy.IGNORE, ReleasesPolicy.ALWAYS, + SnapshotsPolicy.ALWAYS, CachedFailuresPolicy.NO, true ); + + File downloadedFile = proxyHandler.fetchFromProxies( managedDefaultRepository, artifact ); + + assertNull(downloadedFile); + } + public void testGetChecksumBothCorrect() throws Exception { @@ -53,7 +74,7 @@ public class ChecksumTransferTest // Configure Connector (usually done within archiva.xml configuration) saveConnector( ID_DEFAULT_MANAGED, "proxied1", ChecksumPolicy.IGNORE, ReleasesPolicy.ALWAYS, - SnapshotsPolicy.ALWAYS, CachedFailuresPolicy.NO ); + SnapshotsPolicy.ALWAYS, CachedFailuresPolicy.NO, false ); File downloadedFile = proxyHandler.fetchFromProxies( managedDefaultRepository, artifact ); @@ -78,7 +99,7 @@ public class ChecksumTransferTest // Configure Connector (usually done within archiva.xml configuration) saveConnector( ID_DEFAULT_MANAGED, "proxied1", ChecksumPolicy.IGNORE, ReleasesPolicy.ALWAYS, - SnapshotsPolicy.ALWAYS, CachedFailuresPolicy.NO ); + SnapshotsPolicy.ALWAYS, CachedFailuresPolicy.NO, false ); File downloadedFile = proxyHandler.fetchFromProxies( managedDefaultRepository, artifact ); @@ -103,7 +124,7 @@ public class ChecksumTransferTest // Configure Connector (usually done within archiva.xml configuration) saveConnector( ID_DEFAULT_MANAGED, "proxied1", ChecksumPolicy.IGNORE, ReleasesPolicy.ALWAYS, - SnapshotsPolicy.ALWAYS, CachedFailuresPolicy.NO ); + SnapshotsPolicy.ALWAYS, CachedFailuresPolicy.NO, false ); File downloadedFile = proxyHandler.fetchFromProxies( managedDefaultRepository, artifact ); @@ -127,7 +148,7 @@ public class ChecksumTransferTest // Configure Connector (usually done within archiva.xml configuration) saveConnector( ID_DEFAULT_MANAGED, "proxied1", ChecksumPolicy.IGNORE, ReleasesPolicy.ALWAYS, - SnapshotsPolicy.ALWAYS, CachedFailuresPolicy.NO ); + SnapshotsPolicy.ALWAYS, CachedFailuresPolicy.NO, false ); File downloadedFile = proxyHandler.fetchFromProxies( managedDefaultRepository, artifact ); @@ -151,7 +172,7 @@ public class ChecksumTransferTest // Configure Connector (usually done within archiva.xml configuration) saveConnector( ID_DEFAULT_MANAGED, "proxied1", ChecksumPolicy.IGNORE, ReleasesPolicy.ALWAYS, - SnapshotsPolicy.ALWAYS, CachedFailuresPolicy.NO ); + SnapshotsPolicy.ALWAYS, CachedFailuresPolicy.NO, false ); File downloadedFile = proxyHandler.fetchFromProxies( managedDefaultRepository, artifact ); @@ -175,7 +196,7 @@ public class ChecksumTransferTest // Configure Connector (usually done within archiva.xml configuration) saveConnector( ID_DEFAULT_MANAGED, "proxied1", ChecksumPolicy.FAIL, ReleasesPolicy.ALWAYS, - SnapshotsPolicy.ALWAYS, CachedFailuresPolicy.NO ); + SnapshotsPolicy.ALWAYS, CachedFailuresPolicy.NO, false ); File downloadedFile = proxyHandler.fetchFromProxies( managedDefaultRepository, artifact ); @@ -197,7 +218,7 @@ public class ChecksumTransferTest // Configure Connector (usually done within archiva.xml configuration) saveConnector( ID_DEFAULT_MANAGED, "proxied1", ChecksumPolicy.FIX, ReleasesPolicy.ALWAYS, - SnapshotsPolicy.ALWAYS, CachedFailuresPolicy.NO ); + SnapshotsPolicy.ALWAYS, CachedFailuresPolicy.NO, false ); File downloadedFile = proxyHandler.fetchFromProxies( managedDefaultRepository, artifact ); @@ -222,7 +243,7 @@ public class ChecksumTransferTest // Configure Connector (usually done within archiva.xml configuration) saveConnector( ID_DEFAULT_MANAGED, "proxied1", ChecksumPolicy.FAIL, ReleasesPolicy.ALWAYS, - SnapshotsPolicy.ALWAYS, CachedFailuresPolicy.NO ); + SnapshotsPolicy.ALWAYS, CachedFailuresPolicy.NO, false ); File downloadedFile = proxyHandler.fetchFromProxies( managedDefaultRepository, artifact ); @@ -244,7 +265,7 @@ public class ChecksumTransferTest // Configure Connector (usually done within archiva.xml configuration) saveConnector( ID_DEFAULT_MANAGED, "proxied1", ChecksumPolicy.FAIL, ReleasesPolicy.ALWAYS, - SnapshotsPolicy.ALWAYS, CachedFailuresPolicy.NO ); + SnapshotsPolicy.ALWAYS, CachedFailuresPolicy.NO, false ); File downloadedFile = proxyHandler.fetchFromProxies( managedDefaultRepository, artifact ); @@ -269,7 +290,7 @@ public class ChecksumTransferTest // Configure Connector (usually done within archiva.xml configuration) saveConnector( ID_DEFAULT_MANAGED, "proxied1", ChecksumPolicy.FAIL, ReleasesPolicy.ALWAYS, - SnapshotsPolicy.ALWAYS, CachedFailuresPolicy.NO ); + SnapshotsPolicy.ALWAYS, CachedFailuresPolicy.NO, false ); File downloadedFile = proxyHandler.fetchFromProxies( managedDefaultRepository, artifact ); @@ -291,7 +312,7 @@ public class ChecksumTransferTest // Configure Connector (usually done within archiva.xml configuration) saveConnector( ID_DEFAULT_MANAGED, "proxied1", ChecksumPolicy.IGNORE, ReleasesPolicy.ALWAYS, - SnapshotsPolicy.ALWAYS, CachedFailuresPolicy.NO ); + SnapshotsPolicy.ALWAYS, CachedFailuresPolicy.NO, false ); File downloadedFile = proxyHandler.fetchFromProxies( managedDefaultRepository, artifact ); @@ -316,7 +337,7 @@ public class ChecksumTransferTest // Configure Connector (usually done within archiva.xml configuration) saveConnector( ID_DEFAULT_MANAGED, "proxied1", ChecksumPolicy.FIX, ReleasesPolicy.ALWAYS, - SnapshotsPolicy.ALWAYS, CachedFailuresPolicy.NO ); + SnapshotsPolicy.ALWAYS, CachedFailuresPolicy.NO, false ); File downloadedFile = proxyHandler.fetchFromProxies( managedDefaultRepository, artifact ); @@ -341,7 +362,7 @@ public class ChecksumTransferTest // Configure Connector (usually done within archiva.xml configuration) saveConnector( ID_DEFAULT_MANAGED, "proxied1", ChecksumPolicy.FIX, ReleasesPolicy.ALWAYS, - SnapshotsPolicy.ALWAYS, CachedFailuresPolicy.NO ); + SnapshotsPolicy.ALWAYS, CachedFailuresPolicy.NO, false ); File downloadedFile = proxyHandler.fetchFromProxies( managedDefaultRepository, artifact ); @@ -366,7 +387,7 @@ public class ChecksumTransferTest // Configure Connector (usually done within archiva.xml configuration) saveConnector( ID_DEFAULT_MANAGED, "proxied1", ChecksumPolicy.FIX, ReleasesPolicy.ALWAYS, - SnapshotsPolicy.ALWAYS, CachedFailuresPolicy.NO ); + SnapshotsPolicy.ALWAYS, CachedFailuresPolicy.NO, false ); File downloadedFile = proxyHandler.fetchFromProxies( managedDefaultRepository, artifact ); @@ -394,7 +415,7 @@ public class ChecksumTransferTest // Configure Connector (usually done within archiva.xml configuration) saveConnector( ID_DEFAULT_MANAGED, "badproxied", ChecksumPolicy.IGNORE, ReleasesPolicy.ALWAYS, - SnapshotsPolicy.ALWAYS, CachedFailuresPolicy.NO ); + SnapshotsPolicy.ALWAYS, CachedFailuresPolicy.NO, false ); wagonMock.get( path, new File( expectedFile.getAbsolutePath() + ".tmp" ) ); wagonMockControl.setMatcher(customWagonGetMatcher); @@ -440,7 +461,7 @@ public class ChecksumTransferTest // Configure Connector (usually done within archiva.xml configuration) saveConnector( ID_DEFAULT_MANAGED, "proxied1", ChecksumPolicy.IGNORE, ReleasesPolicy.ALWAYS, - SnapshotsPolicy.ALWAYS, CachedFailuresPolicy.NO ); + SnapshotsPolicy.ALWAYS, CachedFailuresPolicy.NO , false ); File downloadedFile = proxyHandler.fetchFromProxies( managedDefaultRepository, artifact ); @@ -466,7 +487,7 @@ public class ChecksumTransferTest // Configure Connector (usually done within archiva.xml configuration) saveConnector( ID_DEFAULT_MANAGED, ID_PROXIED1, ChecksumPolicy.FAIL, ReleasesPolicy.ALWAYS, - SnapshotsPolicy.ALWAYS, CachedFailuresPolicy.NO ); + SnapshotsPolicy.ALWAYS, CachedFailuresPolicy.NO , false ); File downloadedFile = proxyHandler.fetchFromProxies( managedDefaultRepository, artifact ); @@ -493,7 +514,7 @@ public class ChecksumTransferTest // Configure Connector (usually done within archiva.xml configuration) saveConnector( ID_DEFAULT_MANAGED, "proxied1", ChecksumPolicy.FIX, ReleasesPolicy.ALWAYS, - SnapshotsPolicy.ALWAYS, CachedFailuresPolicy.NO ); + SnapshotsPolicy.ALWAYS, CachedFailuresPolicy.NO , false ); File downloadedFile = proxyHandler.fetchFromProxies( managedDefaultRepository, artifact ); diff --git a/archiva-modules/archiva-base/archiva-proxy/src/test/java/org/apache/maven/archiva/proxy/ErrorHandlingTest.java b/archiva-modules/archiva-base/archiva-proxy/src/test/java/org/apache/maven/archiva/proxy/ErrorHandlingTest.java index 4b96766c7..9a9c03bd4 100644 --- a/archiva-modules/archiva-base/archiva-proxy/src/test/java/org/apache/maven/archiva/proxy/ErrorHandlingTest.java +++ b/archiva-modules/archiva-base/archiva-proxy/src/test/java/org/apache/maven/archiva/proxy/ErrorHandlingTest.java @@ -63,7 +63,7 @@ public class ErrorHandlingTest File expectedFile = setupRepositoriesWithLocalFileNotPresent( path ); createMockedProxyConnector( ID_MOCKED_PROXIED1, NAME_MOCKED_PROXIED1, PropagateErrorsDownloadPolicy.STOP ); - saveConnector( ID_DEFAULT_MANAGED, ID_PROXIED2 ); + saveConnector( ID_DEFAULT_MANAGED, ID_PROXIED2, false ); simulateGetError( path, expectedFile, createTransferException() ); @@ -92,7 +92,7 @@ public class ErrorHandlingTest String path = PATH_IN_BOTH_REMOTES_NOT_LOCAL; File expectedFile = setupRepositoriesWithLocalFileNotPresent( path ); - saveConnector( ID_DEFAULT_MANAGED, ID_PROXIED1 ); + saveConnector( ID_DEFAULT_MANAGED, ID_PROXIED1, false ); createMockedProxyConnector( ID_MOCKED_PROXIED2, NAME_MOCKED_PROXIED2, PropagateErrorsDownloadPolicy.STOP ); @@ -107,7 +107,7 @@ public class ErrorHandlingTest createMockedProxyConnector( ID_MOCKED_PROXIED1, NAME_MOCKED_PROXIED1, PropagateErrorsDownloadPolicy.STOP ); - saveConnector( ID_DEFAULT_MANAGED, ID_PROXIED2 ); + saveConnector( ID_DEFAULT_MANAGED, ID_PROXIED2, false ); simulateGetError( path, expectedFile, createResourceNotFoundException() ); @@ -122,7 +122,7 @@ public class ErrorHandlingTest createMockedProxyConnector( ID_MOCKED_PROXIED1, NAME_MOCKED_PROXIED1, PropagateErrorsDownloadPolicy.STOP ); - saveConnector( ID_DEFAULT_MANAGED, ID_PROXIED2 ); + saveConnector( ID_DEFAULT_MANAGED, ID_PROXIED2, false ); simulateGetError( path, expectedFile, createTransferException() ); @@ -135,7 +135,7 @@ public class ErrorHandlingTest String path = PATH_IN_BOTH_REMOTES_NOT_LOCAL; File expectedFile = setupRepositoriesWithLocalFileNotPresent( path ); - saveConnector( ID_DEFAULT_MANAGED, ID_PROXIED1 ); + saveConnector( ID_DEFAULT_MANAGED, ID_PROXIED1, false ); createMockedProxyConnector( ID_MOCKED_PROXIED2, NAME_MOCKED_PROXIED2, PropagateErrorsDownloadPolicy.QUEUE ); @@ -201,7 +201,7 @@ public class ErrorHandlingTest createMockedProxyConnector( ID_MOCKED_PROXIED1, NAME_MOCKED_PROXIED1, PropagateErrorsDownloadPolicy.QUEUE ); - saveConnector( ID_DEFAULT_MANAGED, ID_PROXIED2 ); + saveConnector( ID_DEFAULT_MANAGED, ID_PROXIED2, false ); simulateGetError( path, expectedFile, createResourceNotFoundException() ); @@ -216,7 +216,7 @@ public class ErrorHandlingTest createMockedProxyConnector( ID_MOCKED_PROXIED1, NAME_MOCKED_PROXIED1, PropagateErrorsDownloadPolicy.IGNORE ); - saveConnector( ID_DEFAULT_MANAGED, ID_PROXIED2 ); + saveConnector( ID_DEFAULT_MANAGED, ID_PROXIED2, false ); simulateGetError( path, expectedFile, createTransferException() ); @@ -229,7 +229,7 @@ public class ErrorHandlingTest String path = PATH_IN_BOTH_REMOTES_NOT_LOCAL; File expectedFile = setupRepositoriesWithLocalFileNotPresent( path ); - saveConnector( ID_DEFAULT_MANAGED, ID_PROXIED1 ); + saveConnector( ID_DEFAULT_MANAGED, ID_PROXIED1, false ); createMockedProxyConnector( ID_MOCKED_PROXIED2, NAME_MOCKED_PROXIED2, PropagateErrorsDownloadPolicy.IGNORE ); @@ -499,14 +499,14 @@ public class ErrorHandlingTest { saveRemoteRepositoryConfig( id, name, "test://bad.machine.com/repo/", "default" ); saveConnector( ID_DEFAULT_MANAGED, id, ChecksumPolicy.FIX, ReleasesPolicy.ALWAYS, SnapshotsPolicy.ALWAYS, - CachedFailuresPolicy.NO, errorPolicy ); + CachedFailuresPolicy.NO, errorPolicy, false ); } private void createMockedProxyConnector( String id, String name, String errorPolicy, String errorOnUpdatePolicy ) { saveRemoteRepositoryConfig( id, name, "test://bad.machine.com/repo/", "default" ); saveConnector( ID_DEFAULT_MANAGED, id, ChecksumPolicy.FIX, ReleasesPolicy.ALWAYS, SnapshotsPolicy.ALWAYS, - CachedFailuresPolicy.NO, errorPolicy, errorOnUpdatePolicy ); + CachedFailuresPolicy.NO, errorPolicy, errorOnUpdatePolicy, false ); } private File setupRepositoriesWithLocalFileNotPresent( String path ) diff --git a/archiva-modules/archiva-base/archiva-proxy/src/test/java/org/apache/maven/archiva/proxy/ManagedDefaultTransferTest.java b/archiva-modules/archiva-base/archiva-proxy/src/test/java/org/apache/maven/archiva/proxy/ManagedDefaultTransferTest.java index 878e96d50..bb3a1c793 100644 --- a/archiva-modules/archiva-base/archiva-proxy/src/test/java/org/apache/maven/archiva/proxy/ManagedDefaultTransferTest.java +++ b/archiva-modules/archiva-base/archiva-proxy/src/test/java/org/apache/maven/archiva/proxy/ManagedDefaultTransferTest.java @@ -40,6 +40,27 @@ import java.io.File; public class ManagedDefaultTransferTest extends AbstractProxyTestCase { + public void testGetDefaultLayoutNotPresentConnectorOffline() + throws Exception + { + String path = "org/apache/maven/test/get-default-layout/1.0/get-default-layout-1.0.jar"; + setupTestableManagedRepository( path ); + + File expectedFile = new File( managedDefaultDir, path ); + ArtifactReference artifact = managedDefaultRepository.toArtifactReference( path ); + + // Ensure file isn't present first. + assertNotExistsInManagedDefaultRepo( expectedFile ); + + // Configure Connector (usually done within archiva.xml configuration) + saveConnector( ID_DEFAULT_MANAGED, ID_PROXIED1, ChecksumPolicy.FIX, ReleasesPolicy.ONCE, SnapshotsPolicy.ONCE, + CachedFailuresPolicy.NO, true ); + + // Attempt the proxy fetch. + File downloadedFile = proxyHandler.fetchFromProxies( managedDefaultRepository, artifact ); + assertNull("File should not have been downloaded", downloadedFile); + } + public void testGetDefaultLayoutNotPresent() throws Exception { @@ -54,7 +75,7 @@ public class ManagedDefaultTransferTest // Configure Connector (usually done within archiva.xml configuration) saveConnector( ID_DEFAULT_MANAGED, ID_PROXIED1, ChecksumPolicy.FIX, ReleasesPolicy.ONCE, SnapshotsPolicy.ONCE, - CachedFailuresPolicy.NO ); + CachedFailuresPolicy.NO, false ); // Attempt the proxy fetch. File downloadedFile = proxyHandler.fetchFromProxies( managedDefaultRepository, artifact ); @@ -77,7 +98,7 @@ public class ManagedDefaultTransferTest // Configure Connector (usually done within archiva.xml configuration) saveConnector( ID_DEFAULT_MANAGED, ID_PROXIED1, ChecksumPolicy.FIX, ReleasesPolicy.ONCE, SnapshotsPolicy.ONCE, - CachedFailuresPolicy.NO ); + CachedFailuresPolicy.NO, false ); // Attempt the proxy fetch. File downloadedFile = proxyHandler.fetchFromProxies( managedDefaultRepository, path ); @@ -111,7 +132,7 @@ public class ManagedDefaultTransferTest // Configure Connector (usually done within archiva.xml configuration) saveConnector( ID_DEFAULT_MANAGED, ID_PROXIED1, ChecksumPolicy.FIX, ReleasesPolicy.ONCE, SnapshotsPolicy.ONCE, - CachedFailuresPolicy.NO ); + CachedFailuresPolicy.NO, false ); // Attempt the proxy fetch. File downloadedFile = proxyHandler.fetchFromProxies( managedDefaultRepository, artifact ); @@ -144,7 +165,7 @@ public class ManagedDefaultTransferTest // Configure Connector (usually done within archiva.xml configuration) saveConnector( ID_DEFAULT_MANAGED, ID_PROXIED1, ChecksumPolicy.FIX, ReleasesPolicy.ONCE, SnapshotsPolicy.ONCE, - CachedFailuresPolicy.NO ); + CachedFailuresPolicy.NO, false ); // Attempt the proxy fetch. File downloadedFile = proxyHandler.fetchFromProxies( managedDefaultRepository, path ); @@ -189,7 +210,7 @@ public class ManagedDefaultTransferTest // Configure Connector (usually done within archiva.xml configuration) saveConnector( ID_DEFAULT_MANAGED, ID_PROXIED1, ChecksumPolicy.FIX, ReleasesPolicy.ALWAYS, - SnapshotsPolicy.ALWAYS, CachedFailuresPolicy.NO ); + SnapshotsPolicy.ALWAYS, CachedFailuresPolicy.NO, false ); // Attempt the proxy fetch. File downloadedFile = proxyHandler.fetchFromProxies( managedDefaultRepository, artifact ); @@ -233,7 +254,7 @@ public class ManagedDefaultTransferTest // Configure Connector (usually done within archiva.xml configuration) saveConnector( ID_DEFAULT_MANAGED, ID_PROXIED1, ChecksumPolicy.FIX, ReleasesPolicy.ALWAYS, - SnapshotsPolicy.ALWAYS, CachedFailuresPolicy.NO ); + SnapshotsPolicy.ALWAYS, CachedFailuresPolicy.NO, false ); // Attempt the proxy fetch. File downloadedFile = proxyHandler.fetchFromProxies( managedDefaultRepository, artifact ); @@ -264,7 +285,7 @@ public class ManagedDefaultTransferTest // Configure Connector (usually done within archiva.xml configuration) saveConnector( ID_DEFAULT_MANAGED, ID_PROXIED1, ChecksumPolicy.FIX, ReleasesPolicy.DAILY, SnapshotsPolicy.DAILY, - CachedFailuresPolicy.NO ); + CachedFailuresPolicy.NO, false ); // Attempt the proxy fetch. File downloadedFile = proxyHandler.fetchFromProxies( managedDefaultRepository, artifact ); @@ -286,8 +307,8 @@ public class ManagedDefaultTransferTest assertNotExistsInManagedDefaultRepo( expectedFile ); // Configure Connector (usually done within archiva.xml configuration) - saveConnector( ID_DEFAULT_MANAGED, ID_PROXIED1 ); - saveConnector( ID_DEFAULT_MANAGED, ID_PROXIED2 ); + saveConnector( ID_DEFAULT_MANAGED, ID_PROXIED1 , false ); + saveConnector( ID_DEFAULT_MANAGED, ID_PROXIED2 , false ); // Attempt the proxy fetch. File downloadedFile = proxyHandler.fetchFromProxies( managedDefaultRepository, artifact ); @@ -316,8 +337,8 @@ public class ManagedDefaultTransferTest assertNotExistsInManagedDefaultRepo( expectedFile ); // Configure Connector (usually done within archiva.xml configuration) - saveConnector( ID_DEFAULT_MANAGED, ID_PROXIED1 ); - saveConnector( ID_DEFAULT_MANAGED, ID_PROXIED2 ); + saveConnector( ID_DEFAULT_MANAGED, ID_PROXIED1, false ); + saveConnector( ID_DEFAULT_MANAGED, ID_PROXIED2, false ); // Attempt the proxy fetch. File downloadedFile = proxyHandler.fetchFromProxies( managedDefaultRepository, artifact ); @@ -339,9 +360,9 @@ public class ManagedDefaultTransferTest assertNotExistsInManagedDefaultRepo( expectedFile ); // Configure Connector (usually done within archiva.xml configuration) - saveConnector( ID_DEFAULT_MANAGED, ID_PROXIED1 ); - saveConnector( ID_DEFAULT_MANAGED, ID_PROXIED2 ); - saveConnector( ID_DEFAULT_MANAGED, ID_LEGACY_PROXIED ); + saveConnector( ID_DEFAULT_MANAGED, ID_PROXIED1, false ); + saveConnector( ID_DEFAULT_MANAGED, ID_PROXIED2, false ); + saveConnector( ID_DEFAULT_MANAGED, ID_LEGACY_PROXIED, false ); // Attempt the proxy fetch. File downloadedFile = proxyHandler.fetchFromProxies( managedDefaultRepository, artifact ); @@ -371,8 +392,8 @@ public class ManagedDefaultTransferTest wagonMockControl.replay(); // Configure Connector (usually done within archiva.xml configuration) - saveConnector( ID_DEFAULT_MANAGED, "badproxied" ); - saveConnector( ID_DEFAULT_MANAGED, ID_PROXIED2 ); + saveConnector( ID_DEFAULT_MANAGED, "badproxied", false ); + saveConnector( ID_DEFAULT_MANAGED, ID_PROXIED2, false ); // Attempt the proxy fetch. File downloadedFile = proxyHandler.fetchFromProxies( managedDefaultRepository, artifact ); @@ -400,8 +421,8 @@ public class ManagedDefaultTransferTest saveRemoteRepositoryConfig( "badproxied2", "Bad Proxied 2", "test://dead.machine.com/repo/", "default" ); // Configure Connector (usually done within archiva.xml configuration) - saveConnector( ID_DEFAULT_MANAGED, "badproxied1" ); - saveConnector( ID_DEFAULT_MANAGED, "badproxied2" ); + saveConnector( ID_DEFAULT_MANAGED, "badproxied1", false ); + saveConnector( ID_DEFAULT_MANAGED, "badproxied2", false ); File tmpFile = new File( expectedFile.getParentFile(), expectedFile.getName() + ".tmp" ); wagonMock.get( path, tmpFile ); @@ -446,7 +467,7 @@ public class ManagedDefaultTransferTest assertTrue( expectedFile.exists() ); // Configure Connector (usually done within archiva.xml configuration) - saveConnector( ID_DEFAULT_MANAGED, ID_LEGACY_PROXIED ); + saveConnector( ID_DEFAULT_MANAGED, ID_LEGACY_PROXIED, false ); File downloadedFile = proxyHandler.fetchFromProxies( managedDefaultRepository, artifact ); @@ -473,7 +494,7 @@ public class ManagedDefaultTransferTest assertTrue( expectedFile.exists() ); // Configure Connector (usually done within archiva.xml configuration) - saveConnector( ID_DEFAULT_MANAGED, ID_LEGACY_PROXIED ); + saveConnector( ID_DEFAULT_MANAGED, ID_LEGACY_PROXIED, false ); File downloadedFile = proxyHandler.fetchFromProxies( managedDefaultRepository, artifact ); @@ -495,7 +516,7 @@ public class ManagedDefaultTransferTest assertNotExistsInManagedDefaultRepo( expectedFile ); // Configure Connector (usually done within archiva.xml configuration) - saveConnector( ID_DEFAULT_MANAGED, ID_LEGACY_PROXIED ); + saveConnector( ID_DEFAULT_MANAGED, ID_LEGACY_PROXIED, false); File downloadedFile = proxyHandler.fetchFromProxies( managedDefaultRepository, artifact ); @@ -517,7 +538,7 @@ public class ManagedDefaultTransferTest assertNotExistsInManagedDefaultRepo( expectedFile ); // Configure Connector (usually done within archiva.xml configuration) - saveConnector( ID_DEFAULT_MANAGED, ID_LEGACY_PROXIED ); + saveConnector( ID_DEFAULT_MANAGED, ID_LEGACY_PROXIED, false ); File downloadedFile = proxyHandler.fetchFromProxies( managedDefaultRepository, artifact ); diff --git a/archiva-modules/archiva-base/archiva-proxy/src/test/java/org/apache/maven/archiva/proxy/ManagedLegacyTransferTest.java b/archiva-modules/archiva-base/archiva-proxy/src/test/java/org/apache/maven/archiva/proxy/ManagedLegacyTransferTest.java index 662897857..5940ef682 100644 --- a/archiva-modules/archiva-base/archiva-proxy/src/test/java/org/apache/maven/archiva/proxy/ManagedLegacyTransferTest.java +++ b/archiva-modules/archiva-base/archiva-proxy/src/test/java/org/apache/maven/archiva/proxy/ManagedLegacyTransferTest.java @@ -51,7 +51,7 @@ public class ManagedLegacyTransferTest assertNotExistsInManagedLegacyRepo( expectedFile ); // Configure Connector (usually done within archiva.xml configuration) - saveConnector( ID_LEGACY_MANAGED, ID_PROXIED1 ); + saveConnector( ID_LEGACY_MANAGED, ID_PROXIED1, false ); File downloadedFile = proxyHandler.fetchFromProxies( managedLegacyRepository, artifact ); @@ -80,7 +80,7 @@ public class ManagedLegacyTransferTest // Configure Connector (usually done within archiva.xml configuration) saveConnector( ID_LEGACY_MANAGED, ID_PROXIED1, ChecksumPolicy.FIX, ReleasesPolicy.ALWAYS, - SnapshotsPolicy.ALWAYS, CachedFailuresPolicy.NO ); + SnapshotsPolicy.ALWAYS, CachedFailuresPolicy.NO, false ); File downloadedFile = proxyHandler.fetchFromProxies( managedLegacyRepository, artifact ); @@ -102,7 +102,7 @@ public class ManagedLegacyTransferTest assertNotExistsInManagedLegacyRepo( expectedFile ); // Configure Connector (usually done within archiva.xml configuration) - saveConnector( ID_LEGACY_MANAGED, ID_LEGACY_PROXIED ); + saveConnector( ID_LEGACY_MANAGED, ID_LEGACY_PROXIED, false ); File downloadedFile = proxyHandler.fetchFromProxies( managedLegacyRepository, artifact ); @@ -127,7 +127,7 @@ public class ManagedLegacyTransferTest ArtifactReference artifact = managedLegacyRepository.toArtifactReference( path ); // Configure Connector (usually done within archiva.xml configuration) - saveConnector( ID_LEGACY_MANAGED, ID_LEGACY_PROXIED ); + saveConnector( ID_LEGACY_MANAGED, ID_LEGACY_PROXIED, false ); File downloadedFile = proxyHandler.fetchFromProxies( managedLegacyRepository, artifact ); @@ -149,7 +149,7 @@ public class ManagedLegacyTransferTest assertTrue( expectedFile.exists() ); // Configure Connector (usually done within archiva.xml configuration) - saveConnector( ID_LEGACY_MANAGED, ID_LEGACY_PROXIED ); + saveConnector( ID_LEGACY_MANAGED, ID_LEGACY_PROXIED, false ); File downloadedFile = proxyHandler.fetchFromProxies( managedLegacyRepository, artifact ); @@ -171,7 +171,7 @@ public class ManagedLegacyTransferTest assertTrue( expectedFile.exists() ); // Configure Connector (usually done within archiva.xml configuration) - saveConnector( ID_LEGACY_MANAGED, ID_PROXIED1 ); + saveConnector( ID_LEGACY_MANAGED, ID_PROXIED1, false ); File downloadedFile = proxyHandler.fetchFromProxies( managedLegacyRepository, artifact ); @@ -193,7 +193,7 @@ public class ManagedLegacyTransferTest assertNotExistsInManagedLegacyRepo( expectedFile ); // Configure Connector (usually done within archiva.xml configuration) - saveConnector( ID_LEGACY_MANAGED, ID_LEGACY_PROXIED ); + saveConnector( ID_LEGACY_MANAGED, ID_LEGACY_PROXIED, false ); File downloadedFile = proxyHandler.fetchFromProxies( managedLegacyRepository, artifact ); @@ -215,7 +215,7 @@ public class ManagedLegacyTransferTest assertNotExistsInManagedLegacyRepo( expectedFile ); // Configure Connector (usually done within archiva.xml configuration) - saveConnector( ID_LEGACY_MANAGED, ID_PROXIED1 ); + saveConnector( ID_LEGACY_MANAGED, ID_PROXIED1, false ); File downloadedFile = proxyHandler.fetchFromProxies( managedLegacyRepository, artifact ); diff --git a/archiva-modules/archiva-base/archiva-proxy/src/test/java/org/apache/maven/archiva/proxy/MetadataTransferTest.java b/archiva-modules/archiva-base/archiva-proxy/src/test/java/org/apache/maven/archiva/proxy/MetadataTransferTest.java index 8e7d20d68..fa6a4b968 100644 --- a/archiva-modules/archiva-base/archiva-proxy/src/test/java/org/apache/maven/archiva/proxy/MetadataTransferTest.java +++ b/archiva-modules/archiva-base/archiva-proxy/src/test/java/org/apache/maven/archiva/proxy/MetadataTransferTest.java @@ -95,6 +95,30 @@ public class MetadataTransferTest * @plexus.requirement */ private MetadataTools metadataTools; + + public void testGetProjectMetadataProxiedNotLocalOnRemoteConnectoDisabled() + throws Exception + { + // New project metadata that does not exist locally but exists on remote. + String requestedResource = "org/apache/maven/test/get-found-in-proxy/maven-metadata.xml"; + setupTestableManagedRepository( requestedResource ); + + // Configure Connector (usually done within archiva.xml configuration) + saveConnector( ID_DEFAULT_MANAGED, ID_PROXIED1, ChecksumPolicy.FIX, ReleasesPolicy.ALWAYS, + SnapshotsPolicy.ALWAYS, CachedFailuresPolicy.NO, true); + + assertResourceNotFound( requestedResource ); + assertNoRepoMetadata( ID_PROXIED1, requestedResource ); + + File expectedFile = new File( managedDefaultDir, requestedResource ); + + ProjectReference metadata = createProjectReference( requestedResource ); + + File downloadedFile = proxyHandler.fetchMetatadaFromProxies( managedDefaultRepository, managedDefaultRepository.toMetadataPath(metadata) ); + + assertNull( "Should not have downloaded a file.", downloadedFile ); + assertNoTempFiles( expectedFile ); + } // TODO: same test for other fetch* methods public void testFetchFromTwoProxiesWhenFirstConnectionFails() @@ -108,9 +132,9 @@ public class MetadataTransferTest // Configure Connector (usually done within archiva.xml configuration) saveConnector( ID_DEFAULT_MANAGED, "badproxied1", ChecksumPolicy.FIX, ReleasesPolicy.ALWAYS, - SnapshotsPolicy.ALWAYS, CachedFailuresPolicy.NO ); + SnapshotsPolicy.ALWAYS, CachedFailuresPolicy.NO, false ); saveConnector( ID_DEFAULT_MANAGED, ID_PROXIED2, ChecksumPolicy.FIX, ReleasesPolicy.ALWAYS, - SnapshotsPolicy.ALWAYS, CachedFailuresPolicy.NO ); + SnapshotsPolicy.ALWAYS, CachedFailuresPolicy.NO, false ); assertResourceNotFound( requestedResource ); assertNoRepoMetadata( "badproxied1", requestedResource ); @@ -185,9 +209,9 @@ public class MetadataTransferTest // Configure Connector (usually done within archiva.xml configuration) saveConnector( ID_DEFAULT_MANAGED, ID_PROXIED1, ChecksumPolicy.FIX, ReleasesPolicy.ALWAYS, - SnapshotsPolicy.ALWAYS, CachedFailuresPolicy.NO ); + SnapshotsPolicy.ALWAYS, CachedFailuresPolicy.NO, false ); saveConnector( ID_DEFAULT_MANAGED, ID_PROXIED2, ChecksumPolicy.FIX, ReleasesPolicy.ALWAYS, - SnapshotsPolicy.ALWAYS, CachedFailuresPolicy.NO ); + SnapshotsPolicy.ALWAYS, CachedFailuresPolicy.NO, false ); assertResourceNotFound( requestedResource ); assertNoRepoMetadata( ID_PROXIED1, requestedResource ); @@ -211,9 +235,9 @@ public class MetadataTransferTest // Configure Connector (usually done within archiva.xml configuration) saveConnector( ID_DEFAULT_MANAGED, ID_PROXIED1, ChecksumPolicy.FIX, ReleasesPolicy.ALWAYS, - SnapshotsPolicy.ALWAYS, CachedFailuresPolicy.NO ); + SnapshotsPolicy.ALWAYS, CachedFailuresPolicy.NO, false ); saveConnector( ID_DEFAULT_MANAGED, ID_PROXIED2, ChecksumPolicy.FIX, ReleasesPolicy.ALWAYS, - SnapshotsPolicy.ALWAYS, CachedFailuresPolicy.NO ); + SnapshotsPolicy.ALWAYS, CachedFailuresPolicy.NO, false ); assertResourceNotFound( requestedResource ); assertNoRepoMetadata( ID_PROXIED1, requestedResource ); @@ -237,7 +261,7 @@ public class MetadataTransferTest // Configure Connector (usually done within archiva.xml configuration) saveConnector( ID_DEFAULT_MANAGED, ID_PROXIED1, ChecksumPolicy.FIX, ReleasesPolicy.ALWAYS, - SnapshotsPolicy.ALWAYS, CachedFailuresPolicy.NO ); + SnapshotsPolicy.ALWAYS, CachedFailuresPolicy.NO, false); assertResourceNotFound( requestedResource ); assertNoRepoMetadata( ID_PROXIED1, requestedResource ); @@ -259,9 +283,9 @@ public class MetadataTransferTest // Configure Connector (usually done within archiva.xml configuration) saveConnector( ID_DEFAULT_MANAGED, ID_PROXIED1, ChecksumPolicy.FIX, ReleasesPolicy.ALWAYS, - SnapshotsPolicy.ALWAYS, CachedFailuresPolicy.NO ); + SnapshotsPolicy.ALWAYS, CachedFailuresPolicy.NO, false); saveConnector( ID_DEFAULT_MANAGED, ID_PROXIED2, ChecksumPolicy.FIX, ReleasesPolicy.ALWAYS, - SnapshotsPolicy.ALWAYS, CachedFailuresPolicy.NO ); + SnapshotsPolicy.ALWAYS, CachedFailuresPolicy.NO, false); assertProjectMetadataContents( requestedResource, new String[] { "1.0" }, null, null ); assertNoRepoMetadata( ID_PROXIED1, requestedResource ); @@ -285,9 +309,9 @@ public class MetadataTransferTest // Configure Connector (usually done within archiva.xml configuration) saveConnector( ID_DEFAULT_MANAGED, ID_PROXIED1, ChecksumPolicy.FIX, ReleasesPolicy.ALWAYS, - SnapshotsPolicy.ALWAYS, CachedFailuresPolicy.NO ); + SnapshotsPolicy.ALWAYS, CachedFailuresPolicy.NO, false); saveConnector( ID_DEFAULT_MANAGED, ID_PROXIED2, ChecksumPolicy.FIX, ReleasesPolicy.ALWAYS, - SnapshotsPolicy.ALWAYS, CachedFailuresPolicy.NO ); + SnapshotsPolicy.ALWAYS, CachedFailuresPolicy.NO, false); assertProjectMetadataContents( requestedResource, new String[] { "1.0-beta-2" }, null, null ); assertNoRepoMetadata( ID_PROXIED1, requestedResource ); @@ -313,7 +337,7 @@ public class MetadataTransferTest // Configure Connector (usually done within archiva.xml configuration) saveConnector( ID_DEFAULT_MANAGED, ID_PROXIED1, ChecksumPolicy.FIX, ReleasesPolicy.ALWAYS, - SnapshotsPolicy.ALWAYS, CachedFailuresPolicy.NO ); + SnapshotsPolicy.ALWAYS, CachedFailuresPolicy.NO, false); assertProjectMetadataContents( requestedResource, new String[] { "1.0.8", "1.0.22" }, null, null ); assertNoRepoMetadata( ID_PROXIED1, requestedResource ); @@ -386,9 +410,9 @@ public class MetadataTransferTest // Configure Connector (usually done within archiva.xml configuration) saveConnector( ID_DEFAULT_MANAGED, ID_PROXIED1, ChecksumPolicy.FIX, ReleasesPolicy.ALWAYS, - SnapshotsPolicy.ALWAYS, CachedFailuresPolicy.NO ); + SnapshotsPolicy.ALWAYS, CachedFailuresPolicy.NO, false); saveConnector( ID_DEFAULT_MANAGED, ID_PROXIED2, ChecksumPolicy.FIX, ReleasesPolicy.ALWAYS, - SnapshotsPolicy.ALWAYS, CachedFailuresPolicy.NO ); + SnapshotsPolicy.ALWAYS, CachedFailuresPolicy.NO, false); assertResourceNotFound( requestedResource ); assertNoRepoMetadata( ID_PROXIED1, requestedResource ); @@ -416,7 +440,7 @@ public class MetadataTransferTest // Configure Connector (usually done within archiva.xml configuration) saveConnector( ID_DEFAULT_MANAGED, ID_PROXIED1, ChecksumPolicy.FIX, ReleasesPolicy.ALWAYS, - SnapshotsPolicy.ALWAYS, CachedFailuresPolicy.NO ); + SnapshotsPolicy.ALWAYS, CachedFailuresPolicy.NO, false); assertResourceNotFound( requestedResource ); @@ -443,7 +467,7 @@ public class MetadataTransferTest // Configure Connector (usually done within archiva.xml configuration) saveConnector( ID_DEFAULT_MANAGED, ID_PROXIED1, ChecksumPolicy.FIX, ReleasesPolicy.ALWAYS, - SnapshotsPolicy.ALWAYS, CachedFailuresPolicy.NO ); + SnapshotsPolicy.ALWAYS, CachedFailuresPolicy.NO, false ); assertNoRepoMetadata( ID_PROXIED1, requestedResource ); @@ -470,7 +494,7 @@ public class MetadataTransferTest // Configure Connector (usually done within archiva.xml configuration) saveConnector( ID_DEFAULT_MANAGED, ID_PROXIED1, ChecksumPolicy.FIX, ReleasesPolicy.ALWAYS, - SnapshotsPolicy.ALWAYS, CachedFailuresPolicy.NO ); + SnapshotsPolicy.ALWAYS, CachedFailuresPolicy.NO, false); assertReleaseMetadataContents( requestedResource ); @@ -496,9 +520,9 @@ public class MetadataTransferTest // Configure Connector (usually done within archiva.xml configuration) saveConnector( ID_DEFAULT_MANAGED, ID_PROXIED1, ChecksumPolicy.FIX, ReleasesPolicy.ALWAYS, - SnapshotsPolicy.ALWAYS, CachedFailuresPolicy.NO ); + SnapshotsPolicy.ALWAYS, CachedFailuresPolicy.NO, false); saveConnector( ID_DEFAULT_MANAGED, ID_PROXIED2, ChecksumPolicy.FIX, ReleasesPolicy.ALWAYS, - SnapshotsPolicy.ALWAYS, CachedFailuresPolicy.NO ); + SnapshotsPolicy.ALWAYS, CachedFailuresPolicy.NO, false); assertReleaseMetadataContents( requestedResource ); assertNoRepoMetadata( ID_PROXIED1, requestedResource ); @@ -527,7 +551,7 @@ public class MetadataTransferTest // Configure Connector (usually done within archiva.xml configuration) saveConnector( ID_DEFAULT_MANAGED, ID_PROXIED1, ChecksumPolicy.FIX, ReleasesPolicy.ALWAYS, - SnapshotsPolicy.ALWAYS, CachedFailuresPolicy.NO ); + SnapshotsPolicy.ALWAYS, CachedFailuresPolicy.NO, false); assertReleaseMetadataContents( requestedResource ); assertNoRepoMetadata( ID_PROXIED1, requestedResource ); @@ -578,9 +602,9 @@ public class MetadataTransferTest // Configure Connector (usually done within archiva.xml configuration) saveConnector( ID_DEFAULT_MANAGED, ID_PROXIED1, ChecksumPolicy.FIX, ReleasesPolicy.ALWAYS, - SnapshotsPolicy.ALWAYS, CachedFailuresPolicy.NO ); + SnapshotsPolicy.ALWAYS, CachedFailuresPolicy.NO, false); saveConnector( ID_DEFAULT_MANAGED, ID_PROXIED2, ChecksumPolicy.FIX, ReleasesPolicy.ALWAYS, - SnapshotsPolicy.ALWAYS, CachedFailuresPolicy.NO ); + SnapshotsPolicy.ALWAYS, CachedFailuresPolicy.NO, false); assertResourceNotFound( requestedResource ); assertNoRepoMetadata( ID_PROXIED1, requestedResource ); @@ -603,7 +627,7 @@ public class MetadataTransferTest // Configure Connector (usually done within archiva.xml configuration) saveConnector( ID_DEFAULT_MANAGED, ID_PROXIED1, ChecksumPolicy.FIX, ReleasesPolicy.ALWAYS, - SnapshotsPolicy.ALWAYS, CachedFailuresPolicy.NO ); + SnapshotsPolicy.ALWAYS, CachedFailuresPolicy.NO, false); assertNoMetadata( requestedResource ); @@ -624,7 +648,7 @@ public class MetadataTransferTest // Configure Connector (usually done within archiva.xml configuration) saveConnector( ID_DEFAULT_MANAGED, ID_PROXIED1, ChecksumPolicy.FIX, ReleasesPolicy.ALWAYS, - SnapshotsPolicy.ALWAYS, CachedFailuresPolicy.NO ); + SnapshotsPolicy.ALWAYS, CachedFailuresPolicy.NO, false); assertResourceNotFound( requestedResource ); @@ -644,9 +668,9 @@ public class MetadataTransferTest // Configure Connector (usually done within archiva.xml configuration) saveConnector( ID_DEFAULT_MANAGED, ID_PROXIED1, ChecksumPolicy.FIX, ReleasesPolicy.ALWAYS, - SnapshotsPolicy.ALWAYS, CachedFailuresPolicy.NO ); + SnapshotsPolicy.ALWAYS, CachedFailuresPolicy.NO, false); saveConnector( ID_DEFAULT_MANAGED, ID_PROXIED2, ChecksumPolicy.FIX, ReleasesPolicy.ALWAYS, - SnapshotsPolicy.ALWAYS, CachedFailuresPolicy.NO ); + SnapshotsPolicy.ALWAYS, CachedFailuresPolicy.NO, false); assertSnapshotMetadataContents( requestedResource, "20070822", "021008", 3 ); assertNoRepoMetadata( ID_PROXIED1, requestedResource ); @@ -669,9 +693,9 @@ public class MetadataTransferTest // Configure Connector (usually done within archiva.xml configuration) saveConnector( ID_DEFAULT_MANAGED, ID_PROXIED1, ChecksumPolicy.FIX, ReleasesPolicy.ALWAYS, - SnapshotsPolicy.ALWAYS, CachedFailuresPolicy.NO ); + SnapshotsPolicy.ALWAYS, CachedFailuresPolicy.NO, false); saveConnector( ID_DEFAULT_MANAGED, ID_PROXIED2, ChecksumPolicy.FIX, ReleasesPolicy.ALWAYS, - SnapshotsPolicy.ALWAYS, CachedFailuresPolicy.NO ); + SnapshotsPolicy.ALWAYS, CachedFailuresPolicy.NO, false); assertResourceExists( requestedResource ); assertNoRepoMetadata( ID_PROXIED1, requestedResource ); @@ -695,7 +719,7 @@ public class MetadataTransferTest // Configure Connector (usually done within archiva.xml configuration) saveConnector( ID_DEFAULT_MANAGED, ID_PROXIED1, ChecksumPolicy.FIX, ReleasesPolicy.ALWAYS, - SnapshotsPolicy.ALWAYS, CachedFailuresPolicy.NO ); + SnapshotsPolicy.ALWAYS, CachedFailuresPolicy.NO, false); assertSnapshotMetadataContents( requestedResource, "20050831", "101112", 1 ); assertNoRepoMetadata( ID_PROXIED1, requestedResource ); @@ -751,9 +775,9 @@ public class MetadataTransferTest // Configure Connector (usually done within archiva.xml configuration) saveConnector( ID_DEFAULT_MANAGED, ID_PROXIED1, ChecksumPolicy.FIX, ReleasesPolicy.ALWAYS, - SnapshotsPolicy.ALWAYS, CachedFailuresPolicy.NO ); + SnapshotsPolicy.ALWAYS, CachedFailuresPolicy.NO, false); saveConnector( ID_DEFAULT_MANAGED, ID_PROXIED2, ChecksumPolicy.FIX, ReleasesPolicy.ALWAYS, - SnapshotsPolicy.ALWAYS, CachedFailuresPolicy.NO ); + SnapshotsPolicy.ALWAYS, CachedFailuresPolicy.NO, false); assertResourceNotFound( requestedResource ); assertNoRepoMetadata( ID_PROXIED1, requestedResource ); @@ -777,9 +801,9 @@ public class MetadataTransferTest // Configure Connector (usually done within archiva.xml configuration) saveConnector( ID_DEFAULT_MANAGED, ID_PROXIED1, ChecksumPolicy.FIX, ReleasesPolicy.ALWAYS, - SnapshotsPolicy.ALWAYS, CachedFailuresPolicy.NO ); + SnapshotsPolicy.ALWAYS, CachedFailuresPolicy.NO, false); saveConnector( ID_DEFAULT_MANAGED, ID_PROXIED2, ChecksumPolicy.FIX, ReleasesPolicy.ALWAYS, - SnapshotsPolicy.ALWAYS, CachedFailuresPolicy.NO ); + SnapshotsPolicy.ALWAYS, CachedFailuresPolicy.NO, false ); assertResourceNotFound( requestedResource ); assertNoRepoMetadata( ID_PROXIED1, requestedResource ); @@ -803,7 +827,7 @@ public class MetadataTransferTest // Configure Connector (usually done within archiva.xml configuration) saveConnector( ID_DEFAULT_MANAGED, ID_PROXIED1, ChecksumPolicy.FIX, ReleasesPolicy.ALWAYS, - SnapshotsPolicy.ALWAYS, CachedFailuresPolicy.NO ); + SnapshotsPolicy.ALWAYS, CachedFailuresPolicy.NO, false ); assertResourceNotFound( requestedResource ); assertNoRepoMetadata( ID_PROXIED1, requestedResource ); @@ -825,9 +849,9 @@ public class MetadataTransferTest // Configure Connector (usually done within archiva.xml configuration) saveConnector( ID_DEFAULT_MANAGED, ID_PROXIED1, ChecksumPolicy.FIX, ReleasesPolicy.ALWAYS, - SnapshotsPolicy.ALWAYS, CachedFailuresPolicy.NO ); + SnapshotsPolicy.ALWAYS, CachedFailuresPolicy.NO, false ); saveConnector( ID_DEFAULT_MANAGED, ID_PROXIED2, ChecksumPolicy.FIX, ReleasesPolicy.ALWAYS, - SnapshotsPolicy.ALWAYS, CachedFailuresPolicy.NO ); + SnapshotsPolicy.ALWAYS, CachedFailuresPolicy.NO, false ); assertGroupMetadataContents( requestedResource, new String[] { "plugin1" } ); assertNoRepoMetadata( ID_PROXIED1, requestedResource ); @@ -851,9 +875,9 @@ public class MetadataTransferTest // Configure Connector (usually done within archiva.xml configuration) saveConnector( ID_DEFAULT_MANAGED, ID_PROXIED1, ChecksumPolicy.FIX, ReleasesPolicy.ALWAYS, - SnapshotsPolicy.ALWAYS, CachedFailuresPolicy.NO ); + SnapshotsPolicy.ALWAYS, CachedFailuresPolicy.NO, false ); saveConnector( ID_DEFAULT_MANAGED, ID_PROXIED2, ChecksumPolicy.FIX, ReleasesPolicy.ALWAYS, - SnapshotsPolicy.ALWAYS, CachedFailuresPolicy.NO ); + SnapshotsPolicy.ALWAYS, CachedFailuresPolicy.NO, false ); assertGroupMetadataContents( requestedResource, new String[] { "plugin5" } ); assertNoRepoMetadata( ID_PROXIED1, requestedResource ); @@ -879,7 +903,7 @@ public class MetadataTransferTest // Configure Connector (usually done within archiva.xml configuration) saveConnector( ID_DEFAULT_MANAGED, ID_PROXIED1, ChecksumPolicy.FIX, ReleasesPolicy.ALWAYS, - SnapshotsPolicy.ALWAYS, CachedFailuresPolicy.NO ); + SnapshotsPolicy.ALWAYS, CachedFailuresPolicy.NO, false ); assertGroupMetadataContents( requestedResource, new String[] { "plugin6", "plugin7" } ); assertNoRepoMetadata( ID_PROXIED1, requestedResource ); diff --git a/archiva-modules/archiva-base/archiva-proxy/src/test/java/org/apache/maven/archiva/proxy/SnapshotTransferTest.java b/archiva-modules/archiva-base/archiva-proxy/src/test/java/org/apache/maven/archiva/proxy/SnapshotTransferTest.java index 23a36e6c2..d610dbab9 100644 --- a/archiva-modules/archiva-base/archiva-proxy/src/test/java/org/apache/maven/archiva/proxy/SnapshotTransferTest.java +++ b/archiva-modules/archiva-base/archiva-proxy/src/test/java/org/apache/maven/archiva/proxy/SnapshotTransferTest.java @@ -50,7 +50,7 @@ public class SnapshotTransferTest assertFalse( expectedFile.exists() ); // Configure Connector (usually done within archiva.xml configuration) - saveConnector( ID_DEFAULT_MANAGED, ID_PROXIED1); + saveConnector( ID_DEFAULT_MANAGED, ID_PROXIED1, false); File downloadedFile = proxyHandler.fetchFromProxies( managedDefaultRepository, artifact ); assertNotDownloaded( downloadedFile ); @@ -70,7 +70,7 @@ public class SnapshotTransferTest assertFalse( expectedFile.exists() ); // Configure Connector (usually done within archiva.xml configuration) - saveConnector( ID_DEFAULT_MANAGED, ID_PROXIED1); + saveConnector( ID_DEFAULT_MANAGED, ID_PROXIED1, false); File downloadedFile = proxyHandler.fetchFromProxies( managedDefaultRepository, artifact ); @@ -92,7 +92,7 @@ public class SnapshotTransferTest expectedFile.setLastModified( getPastDate().getTime() ); // Configure Connector (usually done within archiva.xml configuration) - saveConnector( ID_DEFAULT_MANAGED, ID_PROXIED1); + saveConnector( ID_DEFAULT_MANAGED, ID_PROXIED1, false); File downloadedFile = proxyHandler.fetchFromProxies( managedDefaultRepository, artifact ); @@ -115,7 +115,7 @@ public class SnapshotTransferTest ArtifactReference artifact = managedDefaultRepository.toArtifactReference( path ); // Configure Connector (usually done within archiva.xml configuration) - saveConnector( ID_DEFAULT_MANAGED, ID_PROXIED1 ); + saveConnector( ID_DEFAULT_MANAGED, ID_PROXIED1, false ); // Attempt to download. File downloadedFile = proxyHandler.fetchFromProxies( managedDefaultRepository, artifact ); @@ -207,7 +207,7 @@ public class SnapshotTransferTest proxiedFile.setLastModified( getFutureDate().getTime() ); // Configure Connector (usually done within archiva.xml configuration) - saveConnector( ID_DEFAULT_MANAGED, ID_PROXIED1); + saveConnector( ID_DEFAULT_MANAGED, ID_PROXIED1, false); File downloadedFile = proxyHandler.fetchFromProxies( managedDefaultRepository, artifact ); @@ -230,7 +230,7 @@ public class SnapshotTransferTest ArtifactReference artifact = managedDefaultRepository.toArtifactReference( path ); // Configure Connector (usually done within archiva.xml configuration) - saveConnector( ID_DEFAULT_MANAGED, ID_PROXIED1); + saveConnector( ID_DEFAULT_MANAGED, ID_PROXIED1, false); File downloadedFile = proxyHandler.fetchFromProxies( managedDefaultRepository, artifact ); @@ -253,9 +253,9 @@ public class SnapshotTransferTest // Configure Connector (usually done within archiva.xml configuration) saveConnector( ID_DEFAULT_MANAGED, ID_PROXIED1, ChecksumPolicy.IGNORE, ReleasesPolicy.ALWAYS, - SnapshotsPolicy.ALWAYS, CachedFailuresPolicy.YES ); + SnapshotsPolicy.ALWAYS, CachedFailuresPolicy.YES , false); saveConnector( ID_DEFAULT_MANAGED, ID_PROXIED2, ChecksumPolicy.IGNORE, ReleasesPolicy.ALWAYS, - SnapshotsPolicy.ALWAYS, CachedFailuresPolicy.YES ); + SnapshotsPolicy.ALWAYS, CachedFailuresPolicy.YES , false); File downloadedFile = proxyHandler.fetchFromProxies( managedDefaultRepository, artifact ); @@ -277,7 +277,7 @@ public class SnapshotTransferTest assertFalse( expectedFile.exists() ); // Configure Connector (usually done within archiva.xml configuration) - saveConnector( ID_DEFAULT_MANAGED, ID_PROXIED1); + saveConnector( ID_DEFAULT_MANAGED, ID_PROXIED1, false); File downloadedFile = proxyHandler.fetchFromProxies( managedDefaultRepository, artifact ); @@ -303,7 +303,7 @@ public class SnapshotTransferTest expectedFile.setLastModified( getPastDate().getTime() ); // Configure Connector (usually done within archiva.xml configuration) - saveConnector( ID_DEFAULT_MANAGED, ID_PROXIED1); + saveConnector( ID_DEFAULT_MANAGED, ID_PROXIED1, false); File downloadedFile = proxyHandler.fetchFromProxies( managedDefaultRepository, artifact );