1 package org.apache.archiva.proxy;
4 * Licensed to the Apache Software Foundation (ASF) under one
5 * or more contributor license agreements. See the NOTICE file
6 * distributed with this work for additional information
7 * regarding copyright ownership. The ASF licenses this file
8 * to you under the Apache License, Version 2.0 (the
9 * "License"); you may not use this file except in compliance
10 * with the License. You may obtain a copy of the License at
12 * http://www.apache.org/licenses/LICENSE-2.0
14 * Unless required by applicable law or agreed to in writing,
15 * software distributed under the License is distributed on an
16 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
17 * KIND, either express or implied. See the License for the
18 * specific language governing permissions and limitations
22 import org.apache.commons.io.FileUtils;
23 import org.apache.archiva.model.ArtifactReference;
24 import org.apache.archiva.policies.CachedFailuresPolicy;
25 import org.apache.archiva.policies.ChecksumPolicy;
26 import org.apache.archiva.policies.ReleasesPolicy;
27 import org.apache.archiva.policies.SnapshotsPolicy;
28 import org.apache.maven.wagon.ResourceDoesNotExistException;
29 import org.junit.Test;
33 import static org.junit.Assert.assertFalse;
34 import static org.junit.Assert.assertNull;
37 * ChecksumTransferTest
41 public class ChecksumTransferTest
42 extends AbstractProxyTestCase
45 public void testGetChecksumWhenConnectorIsDisabled()
48 String path = "org/apache/maven/test/get-checksum-both-right/1.0/get-checksum-both-right-1.0.jar";
49 setupTestableManagedRepository( path );
51 File expectedFile = new File( managedDefaultDir, path );
52 ArtifactReference artifact = managedDefaultRepository.toArtifactReference( path );
54 FileUtils.deleteDirectory( expectedFile.getParentFile() );
55 assertFalse( expectedFile.exists() );
57 // Configure Connector (usually done within archiva.xml configuration)
58 saveConnector( ID_DEFAULT_MANAGED, "proxied1", ChecksumPolicy.IGNORE, ReleasesPolicy.ALWAYS,
59 SnapshotsPolicy.ALWAYS, CachedFailuresPolicy.NO, true );
61 File downloadedFile = proxyHandler.fetchFromProxies( managedDefaultRepository, artifact );
63 assertNull( downloadedFile );
67 public void testGetChecksumBothCorrect()
70 String path = "org/apache/maven/test/get-checksum-both-right/1.0/get-checksum-both-right-1.0.jar";
71 setupTestableManagedRepository( path );
73 File expectedFile = new File( managedDefaultDir, path );
74 ArtifactReference artifact = managedDefaultRepository.toArtifactReference( path );
76 FileUtils.deleteDirectory( expectedFile.getParentFile() );
77 assertFalse( expectedFile.exists() );
79 // Configure Connector (usually done within archiva.xml configuration)
80 saveConnector( ID_DEFAULT_MANAGED, "proxied1", ChecksumPolicy.IGNORE, ReleasesPolicy.ALWAYS,
81 SnapshotsPolicy.ALWAYS, CachedFailuresPolicy.NO, false );
83 File downloadedFile = proxyHandler.fetchFromProxies( managedDefaultRepository, artifact );
85 File proxied1File = new File( REPOPATH_PROXIED1, path );
86 assertFileEquals( expectedFile, downloadedFile, proxied1File );
87 assertNoTempFiles( expectedFile );
88 assertChecksums( expectedFile, "066d76e459f7782c312c31e8a11b3c0f1e3e43a7 *get-checksum-both-right-1.0.jar",
89 "e58f30c6a150a2e843552438d18e15cb *get-checksum-both-right-1.0.jar" );
93 public void testGetChecksumCorrectSha1NoMd5()
96 String path = "org/apache/maven/test/get-checksum-sha1-only/1.0/get-checksum-sha1-only-1.0.jar";
97 setupTestableManagedRepository( path );
99 File expectedFile = new File( managedDefaultDir, path );
100 ArtifactReference artifact = managedDefaultRepository.toArtifactReference( path );
102 FileUtils.deleteDirectory( expectedFile.getParentFile() );
103 assertFalse( expectedFile.exists() );
105 // Configure Connector (usually done within archiva.xml configuration)
106 saveConnector( ID_DEFAULT_MANAGED, "proxied1", ChecksumPolicy.IGNORE, ReleasesPolicy.ALWAYS,
107 SnapshotsPolicy.ALWAYS, CachedFailuresPolicy.NO, false );
109 File downloadedFile = proxyHandler.fetchFromProxies( managedDefaultRepository, artifact );
111 File proxied1File = new File( REPOPATH_PROXIED1, path );
112 assertFileEquals( expectedFile, downloadedFile, proxied1File );
113 assertNoTempFiles( expectedFile );
114 assertChecksums( expectedFile, "748a3a013bf5eacf2bbb40a2ac7d37889b728837 *get-checksum-sha1-only-1.0.jar",
119 public void testGetChecksumNoSha1CorrectMd5()
122 String path = "org/apache/maven/test/get-checksum-md5-only/1.0/get-checksum-md5-only-1.0.jar";
123 setupTestableManagedRepository( path );
125 File expectedFile = new File( managedDefaultDir, path );
126 ArtifactReference artifact = managedDefaultRepository.toArtifactReference( path );
128 FileUtils.deleteDirectory( expectedFile.getParentFile() );
129 assertFalse( expectedFile.exists() );
131 // Configure Connector (usually done within archiva.xml configuration)
132 saveConnector( ID_DEFAULT_MANAGED, "proxied1", ChecksumPolicy.IGNORE, ReleasesPolicy.ALWAYS,
133 SnapshotsPolicy.ALWAYS, CachedFailuresPolicy.NO, false );
135 File downloadedFile = proxyHandler.fetchFromProxies( managedDefaultRepository, artifact );
137 File proxied1File = new File( REPOPATH_PROXIED1, path );
138 assertFileEquals( expectedFile, downloadedFile, proxied1File );
139 assertNoTempFiles( expectedFile );
140 assertChecksums( expectedFile, null, "f3af5201bf8da801da37db8842846e1c *get-checksum-md5-only-1.0.jar" );
144 public void testGetWithNoChecksumsUsingIgnoredSetting()
147 String path = "org/apache/maven/test/get-default-layout/1.0/get-default-layout-1.0.jar";
148 setupTestableManagedRepository( path );
150 File expectedFile = new File( managedDefaultDir, path );
151 ArtifactReference artifact = managedDefaultRepository.toArtifactReference( path );
153 FileUtils.deleteDirectory( expectedFile.getParentFile() );
154 assertFalse( expectedFile.exists() );
156 // Configure Connector (usually done within archiva.xml configuration)
157 saveConnector( ID_DEFAULT_MANAGED, "proxied1", ChecksumPolicy.IGNORE, ReleasesPolicy.ALWAYS,
158 SnapshotsPolicy.ALWAYS, CachedFailuresPolicy.NO, false );
160 File downloadedFile = proxyHandler.fetchFromProxies( managedDefaultRepository, artifact );
162 File proxied1File = new File( REPOPATH_PROXIED1, path );
163 assertFileEquals( expectedFile, downloadedFile, proxied1File );
164 assertNoTempFiles( expectedFile );
165 assertChecksums( expectedFile, null, null );
169 public void testGetChecksumBadSha1BadMd5IgnoredSetting()
172 String path = "org/apache/maven/test/get-checksum-both-bad/1.0/get-checksum-both-bad-1.0.jar";
173 setupTestableManagedRepository( path );
175 File expectedFile = new File( managedDefaultDir, path );
176 ArtifactReference artifact = managedDefaultRepository.toArtifactReference( path );
178 FileUtils.deleteDirectory( expectedFile.getParentFile() );
179 assertFalse( expectedFile.exists() );
181 // Configure Connector (usually done within archiva.xml configuration)
182 saveConnector( ID_DEFAULT_MANAGED, "proxied1", ChecksumPolicy.IGNORE, ReleasesPolicy.ALWAYS,
183 SnapshotsPolicy.ALWAYS, CachedFailuresPolicy.NO, false );
185 File downloadedFile = proxyHandler.fetchFromProxies( managedDefaultRepository, artifact );
187 File proxied1File = new File( REPOPATH_PROXIED1, path );
188 assertFileEquals( expectedFile, downloadedFile, proxied1File );
189 assertNoTempFiles( expectedFile );
190 assertChecksums( expectedFile, "invalid checksum file", "invalid checksum file" );
194 public void testGetChecksumBadSha1BadMd5FailSetting()
197 String path = "org/apache/maven/test/get-checksum-both-bad/1.0/get-checksum-both-bad-1.0.jar";
198 setupTestableManagedRepository( path );
200 File expectedFile = new File( managedDefaultDir, path );
201 ArtifactReference artifact = managedDefaultRepository.toArtifactReference( path );
203 FileUtils.deleteDirectory( expectedFile.getParentFile() );
204 assertFalse( expectedFile.exists() );
206 // Configure Connector (usually done within archiva.xml configuration)
207 saveConnector( ID_DEFAULT_MANAGED, "proxied1", ChecksumPolicy.FAIL, ReleasesPolicy.ALWAYS,
208 SnapshotsPolicy.ALWAYS, CachedFailuresPolicy.NO, false );
210 File downloadedFile = proxyHandler.fetchFromProxies( managedDefaultRepository, artifact );
212 assertNotDownloaded( downloadedFile );
213 assertChecksums( expectedFile, null, null );
217 public void testGetChecksumBadSha1BadMd5FixSetting()
220 String path = "org/apache/maven/test/get-checksum-both-bad/1.0/get-checksum-both-bad-1.0.jar";
221 setupTestableManagedRepository( path );
223 File expectedFile = new File( managedDefaultDir, path );
224 ArtifactReference artifact = managedDefaultRepository.toArtifactReference( path );
226 FileUtils.deleteDirectory( expectedFile.getParentFile() );
227 assertFalse( expectedFile.exists() );
229 // Configure Connector (usually done within archiva.xml configuration)
230 saveConnector( ID_DEFAULT_MANAGED, "proxied1", ChecksumPolicy.FIX, ReleasesPolicy.ALWAYS,
231 SnapshotsPolicy.ALWAYS, CachedFailuresPolicy.NO, false );
233 File downloadedFile = proxyHandler.fetchFromProxies( managedDefaultRepository, artifact );
235 File proxied1File = new File( REPOPATH_PROXIED1, path );
236 assertFileEquals( expectedFile, downloadedFile, proxied1File );
237 assertNoTempFiles( expectedFile );
238 assertChecksums( expectedFile, "4ec20a12dc91557330bd0b39d1805be5e329ae56 get-checksum-both-bad-1.0.jar",
239 "a292491a35925465e693a44809a078b5 get-checksum-both-bad-1.0.jar" );
243 public void testGetChecksumCorrectSha1BadMd5UsingFailSetting()
246 String path = "org/apache/maven/test/get-checksum-sha1-bad-md5/1.0/get-checksum-sha1-bad-md5-1.0.jar";
247 setupTestableManagedRepository( path );
249 File expectedFile = new File( managedDefaultDir, path );
250 ArtifactReference artifact = managedDefaultRepository.toArtifactReference( path );
252 FileUtils.deleteDirectory( expectedFile.getParentFile() );
253 assertFalse( expectedFile.exists() );
255 // Configure Connector (usually done within archiva.xml configuration)
256 saveConnector( ID_DEFAULT_MANAGED, "proxied1", ChecksumPolicy.FAIL, ReleasesPolicy.ALWAYS,
257 SnapshotsPolicy.ALWAYS, CachedFailuresPolicy.NO, false );
259 File downloadedFile = proxyHandler.fetchFromProxies( managedDefaultRepository, artifact );
261 assertNotDownloaded( downloadedFile );
262 assertChecksums( expectedFile, null, null );
266 public void testGetChecksumNoSha1CorrectMd5UsingFailSetting()
269 String path = "org/apache/maven/test/get-checksum-md5-only/1.0/get-checksum-md5-only-1.0.jar";
270 setupTestableManagedRepository( path );
272 File expectedFile = new File( managedDefaultDir, path );
273 ArtifactReference artifact = managedDefaultRepository.toArtifactReference( path );
275 FileUtils.deleteDirectory( expectedFile.getParentFile() );
276 assertFalse( expectedFile.exists() );
278 // Configure Connector (usually done within archiva.xml configuration)
279 saveConnector( ID_DEFAULT_MANAGED, "proxied1", ChecksumPolicy.FAIL, ReleasesPolicy.ALWAYS,
280 SnapshotsPolicy.ALWAYS, CachedFailuresPolicy.NO, false );
282 File downloadedFile = proxyHandler.fetchFromProxies( managedDefaultRepository, artifact );
284 // This is a success situation. No SHA1 with a Good MD5.
285 File proxied1File = new File( REPOPATH_PROXIED1, path );
286 assertFileEquals( expectedFile, downloadedFile, proxied1File );
287 assertNoTempFiles( expectedFile );
288 assertChecksums( expectedFile, null, "f3af5201bf8da801da37db8842846e1c *get-checksum-md5-only-1.0.jar" );
292 public void testGetWithNoChecksumsUsingFailSetting()
295 String path = "org/apache/maven/test/get-default-layout/1.0/get-default-layout-1.0.jar";
296 setupTestableManagedRepository( path );
298 File expectedFile = new File( managedDefaultDir, path );
299 ArtifactReference artifact = managedDefaultRepository.toArtifactReference( path );
301 FileUtils.deleteDirectory( expectedFile.getParentFile() );
302 assertFalse( expectedFile.exists() );
304 // Configure Connector (usually done within archiva.xml configuration)
305 saveConnector( ID_DEFAULT_MANAGED, "proxied1", ChecksumPolicy.FAIL, ReleasesPolicy.ALWAYS,
306 SnapshotsPolicy.ALWAYS, CachedFailuresPolicy.NO, false );
308 File downloadedFile = proxyHandler.fetchFromProxies( managedDefaultRepository, artifact );
310 assertNotDownloaded( downloadedFile );
311 assertChecksums( expectedFile, null, null );
315 public void testGetChecksumCorrectSha1BadMd5UsingIgnoredSetting()
318 String path = "org/apache/maven/test/get-checksum-sha1-bad-md5/1.0/get-checksum-sha1-bad-md5-1.0.jar";
319 setupTestableManagedRepository( path );
321 File expectedFile = new File( managedDefaultDir, path );
322 ArtifactReference artifact = managedDefaultRepository.toArtifactReference( path );
324 FileUtils.deleteDirectory( expectedFile.getParentFile() );
325 assertFalse( expectedFile.exists() );
327 // Configure Connector (usually done within archiva.xml configuration)
328 saveConnector( ID_DEFAULT_MANAGED, "proxied1", ChecksumPolicy.IGNORE, ReleasesPolicy.ALWAYS,
329 SnapshotsPolicy.ALWAYS, CachedFailuresPolicy.NO, false );
331 File downloadedFile = proxyHandler.fetchFromProxies( managedDefaultRepository, artifact );
333 File proxied1File = new File( REPOPATH_PROXIED1, path );
334 assertFileEquals( expectedFile, downloadedFile, proxied1File );
335 assertNoTempFiles( expectedFile );
336 assertChecksums( expectedFile, "3dd1a3a57b807d3ef3fbc6013d926c891cbb8670 *get-checksum-sha1-bad-md5-1.0.jar",
337 "invalid checksum file" );
341 public void testGetChecksumCorrectSha1BadMd5UsingFixSetting()
344 String path = "org/apache/maven/test/get-checksum-sha1-bad-md5/1.0/get-checksum-sha1-bad-md5-1.0.jar";
345 setupTestableManagedRepository( path );
347 File expectedFile = new File( managedDefaultDir, path );
348 ArtifactReference artifact = managedDefaultRepository.toArtifactReference( path );
350 FileUtils.deleteDirectory( expectedFile.getParentFile() );
351 assertFalse( expectedFile.exists() );
353 // Configure Connector (usually done within archiva.xml configuration)
354 saveConnector( ID_DEFAULT_MANAGED, "proxied1", ChecksumPolicy.FIX, ReleasesPolicy.ALWAYS,
355 SnapshotsPolicy.ALWAYS, CachedFailuresPolicy.NO, false );
357 File downloadedFile = proxyHandler.fetchFromProxies( managedDefaultRepository, artifact );
359 File proxied1File = new File( REPOPATH_PROXIED1, path );
360 assertFileEquals( expectedFile, downloadedFile, proxied1File );
361 assertNoTempFiles( expectedFile );
362 assertChecksums( expectedFile, "3dd1a3a57b807d3ef3fbc6013d926c891cbb8670 *get-checksum-sha1-bad-md5-1.0.jar",
363 "c35f3b76268b73a4ba617f6f275c49ab get-checksum-sha1-bad-md5-1.0.jar" );
367 public void testGetChecksumNoSha1CorrectMd5UsingFixSetting()
370 String path = "org/apache/maven/test/get-checksum-md5-only/1.0/get-checksum-md5-only-1.0.jar";
371 setupTestableManagedRepository( path );
373 File expectedFile = new File( managedDefaultDir, path );
374 ArtifactReference artifact = managedDefaultRepository.toArtifactReference( path );
376 FileUtils.deleteDirectory( expectedFile.getParentFile() );
377 assertFalse( expectedFile.exists() );
379 // Configure Connector (usually done within archiva.xml configuration)
380 saveConnector( ID_DEFAULT_MANAGED, "proxied1", ChecksumPolicy.FIX, ReleasesPolicy.ALWAYS,
381 SnapshotsPolicy.ALWAYS, CachedFailuresPolicy.NO, false );
383 File downloadedFile = proxyHandler.fetchFromProxies( managedDefaultRepository, artifact );
385 File proxied1File = new File( REPOPATH_PROXIED1, path );
386 assertFileEquals( expectedFile, downloadedFile, proxied1File );
387 assertNoTempFiles( expectedFile );
388 assertChecksums( expectedFile, "71f7dc3f72053a3f2d9fdd6fef9db055ef957ffb get-checksum-md5-only-1.0.jar",
389 "f3af5201bf8da801da37db8842846e1c *get-checksum-md5-only-1.0.jar" );
393 public void testGetWithNoChecksumsUsingFixSetting()
396 String path = "org/apache/maven/test/get-default-layout/1.0/get-default-layout-1.0.jar";
397 setupTestableManagedRepository( path );
399 File expectedFile = new File( managedDefaultDir, path );
400 ArtifactReference artifact = managedDefaultRepository.toArtifactReference( path );
402 FileUtils.deleteDirectory( expectedFile.getParentFile() );
403 assertFalse( expectedFile.exists() );
405 // Configure Connector (usually done within archiva.xml configuration)
406 saveConnector( ID_DEFAULT_MANAGED, "proxied1", ChecksumPolicy.FIX, ReleasesPolicy.ALWAYS,
407 SnapshotsPolicy.ALWAYS, CachedFailuresPolicy.NO, false );
409 File downloadedFile = proxyHandler.fetchFromProxies( managedDefaultRepository, artifact );
411 File proxied1File = new File( REPOPATH_PROXIED1, path );
412 assertFileEquals( expectedFile, downloadedFile, proxied1File );
413 assertNoTempFiles( expectedFile );
414 assertChecksums( expectedFile, "1f12821c5e43e1a0b76b9564a6ddb0548ccb9486 get-default-layout-1.0.jar",
415 "3f7341545f21226b6f49a3c2704cb9be get-default-layout-1.0.jar" );
419 public void testGetChecksumNotFoundOnRemote()
422 String path = "org/apache/maven/test/get-checksum-sha1-only/1.0/get-checksum-sha1-only-1.0.jar";
423 setupTestableManagedRepository( path );
425 File expectedFile = new File( managedDefaultDir, path );
426 ArtifactReference artifact = managedDefaultRepository.toArtifactReference( path );
428 FileUtils.deleteDirectory( expectedFile.getParentFile() );
429 assertFalse( expectedFile.getParentFile().exists() );
430 assertFalse( expectedFile.exists() );
432 saveRemoteRepositoryConfig( "badproxied", "Bad Proxied", "test://bad.machine.com/repo/", "default" );
434 // Configure Connector (usually done within archiva.xml configuration)
435 saveConnector( ID_DEFAULT_MANAGED, "badproxied", ChecksumPolicy.IGNORE, ReleasesPolicy.ALWAYS,
436 SnapshotsPolicy.ALWAYS, CachedFailuresPolicy.NO, false );
438 wagonMock.get( path, new File( expectedFile.getAbsolutePath() + ".tmp" ) );
439 wagonMockControl.setMatcher( customWagonGetMatcher );
440 wagonMockControl.setVoidCallable();
441 wagonMock.get( path + ".sha1", new File( expectedFile.getAbsolutePath() + ".sha1.tmp" ) );
442 wagonMockControl.setMatcher( customWagonGetMatcher );
443 wagonMockControl.setVoidCallable();
444 wagonMock.get( path + ".md5", new File( expectedFile.getAbsolutePath() + ".md5.tmp" ) );
445 wagonMockControl.setMatcher( customWagonGetMatcher );
446 wagonMockControl.setThrowable( new ResourceDoesNotExistException( "Resource does not exist." ) );
447 wagonMockControl.replay();
449 File downloadedFile = proxyHandler.fetchFromProxies( managedDefaultRepository, artifact );
451 wagonMockControl.verify();
453 // Do what the mock doesn't do.
454 String proxyPath = new File( REPOPATH_PROXIED1, path ).getAbsolutePath();
455 String localPath = new File( managedDefaultDir, path ).getAbsolutePath();
456 FileUtils.copyFile( new File( proxyPath ), new File( localPath ) );
457 FileUtils.copyFile( new File( proxyPath + ".sha1" ), new File( localPath + ".sha1" ) );
460 File proxied1File = new File( REPOPATH_PROXIED1, path );
461 assertFileEquals( expectedFile, downloadedFile, proxied1File );
462 assertNoTempFiles( expectedFile );
463 assertChecksums( expectedFile, "748a3a013bf5eacf2bbb40a2ac7d37889b728837 *get-checksum-sha1-only-1.0.jar",
468 public void testGetAlwaysBadChecksumPresentLocallyAbsentRemoteUsingIgnoredSetting()
471 String path = "org/apache/maven/test/get-bad-local-checksum/1.0/get-bad-local-checksum-1.0.jar";
472 setupTestableManagedRepository( path );
474 File expectedFile = new File( managedDefaultDir, path );
475 File remoteFile = new File( REPOPATH_PROXIED1, path );
477 setManagedOlderThanRemote( expectedFile, remoteFile );
479 ArtifactReference artifact = managedDefaultRepository.toArtifactReference( path );
481 // Configure Connector (usually done within archiva.xml configuration)
482 saveConnector( ID_DEFAULT_MANAGED, "proxied1", ChecksumPolicy.IGNORE, ReleasesPolicy.ALWAYS,
483 SnapshotsPolicy.ALWAYS, CachedFailuresPolicy.NO, false );
485 File downloadedFile = proxyHandler.fetchFromProxies( managedDefaultRepository, artifact );
487 File proxied1File = new File( REPOPATH_PROXIED1, path );
488 assertFileEquals( expectedFile, downloadedFile, proxied1File );
489 assertNoTempFiles( expectedFile );
490 // There are no hashcodes on the proxy side to download, hence the local ones should remain invalid.
491 assertChecksums( expectedFile, "invalid checksum file", "invalid checksum file" );
495 public void testGetAlwaysBadChecksumPresentLocallyAbsentRemoteUsingFailSetting()
498 String path = "org/apache/maven/test/get-bad-local-checksum/1.0/get-bad-local-checksum-1.0.jar";
499 setupTestableManagedRepository( path );
501 File expectedFile = new File( managedDefaultDir, path );
502 File remoteFile = new File( REPOPATH_PROXIED1, path );
504 setManagedOlderThanRemote( expectedFile, remoteFile );
506 ArtifactReference artifact = managedDefaultRepository.toArtifactReference( path );
508 // Configure Connector (usually done within archiva.xml configuration)
509 saveConnector( ID_DEFAULT_MANAGED, ID_PROXIED1, ChecksumPolicy.FAIL, ReleasesPolicy.ALWAYS,
510 SnapshotsPolicy.ALWAYS, CachedFailuresPolicy.NO, false );
512 File downloadedFile = proxyHandler.fetchFromProxies( managedDefaultRepository, artifact );
514 assertNotDownloaded( downloadedFile );
515 assertNoTempFiles( expectedFile );
516 // There are no hashcodes on the proxy side to download.
517 // The FAIL policy will delete the checksums as bad.
519 assertChecksums( expectedFile, "invalid checksum file", "invalid checksum file" );
523 public void testGetAlwaysBadChecksumPresentLocallyAbsentRemoteUsingFixSetting()
526 String path = "org/apache/maven/test/get-bad-local-checksum/1.0/get-bad-local-checksum-1.0.jar";
527 setupTestableManagedRepository( path );
529 File expectedFile = new File( managedDefaultDir, path );
530 File remoteFile = new File( REPOPATH_PROXIED1, path );
532 setManagedOlderThanRemote( expectedFile, remoteFile );
534 ArtifactReference artifact = managedDefaultRepository.toArtifactReference( path );
536 // Configure Connector (usually done within archiva.xml configuration)
537 saveConnector( ID_DEFAULT_MANAGED, "proxied1", ChecksumPolicy.FIX, ReleasesPolicy.ALWAYS,
538 SnapshotsPolicy.ALWAYS, CachedFailuresPolicy.NO, false );
540 File downloadedFile = proxyHandler.fetchFromProxies( managedDefaultRepository, artifact );
542 File proxied1File = new File( REPOPATH_PROXIED1, path );
543 assertFileEquals( expectedFile, downloadedFile, proxied1File );
544 assertNoTempFiles( expectedFile );
545 assertChecksums( expectedFile, "96a08dc80a108cba8efd3b20aec91b32a0b2cbd4 get-bad-local-checksum-1.0.jar",
546 "46fdd6ca55bf1d7a7eb0c858f41e0ccd get-bad-local-checksum-1.0.jar" );