1 package org.apache.maven.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.maven.archiva.model.ArtifactReference;
24 import org.apache.maven.archiva.policies.CachedFailuresPolicy;
25 import org.apache.maven.archiva.policies.ChecksumPolicy;
26 import org.apache.maven.archiva.policies.ReleasesPolicy;
27 import org.apache.maven.archiva.policies.SnapshotsPolicy;
28 import org.apache.maven.wagon.ResourceDoesNotExistException;
29 import org.junit.Test;
34 * ChecksumTransferTest
38 public class ChecksumTransferTest
39 extends AbstractProxyTestCase
42 public void testGetChecksumWhenConnectorIsDisabled()
45 String path = "org/apache/maven/test/get-checksum-both-right/1.0/get-checksum-both-right-1.0.jar";
46 setupTestableManagedRepository( path );
48 File expectedFile = new File( managedDefaultDir, path );
49 ArtifactReference artifact = managedDefaultRepository.toArtifactReference( path );
51 FileUtils.deleteDirectory( expectedFile.getParentFile() );
52 assertFalse( expectedFile.exists() );
54 // Configure Connector (usually done within archiva.xml configuration)
55 saveConnector( ID_DEFAULT_MANAGED, "proxied1", ChecksumPolicy.IGNORE, ReleasesPolicy.ALWAYS,
56 SnapshotsPolicy.ALWAYS, CachedFailuresPolicy.NO, true );
58 File downloadedFile = proxyHandler.fetchFromProxies( managedDefaultRepository, artifact );
60 assertNull(downloadedFile);
64 public void testGetChecksumBothCorrect()
67 String path = "org/apache/maven/test/get-checksum-both-right/1.0/get-checksum-both-right-1.0.jar";
68 setupTestableManagedRepository( path );
70 File expectedFile = new File( managedDefaultDir, path );
71 ArtifactReference artifact = managedDefaultRepository.toArtifactReference( path );
73 FileUtils.deleteDirectory( expectedFile.getParentFile() );
74 assertFalse( expectedFile.exists() );
76 // Configure Connector (usually done within archiva.xml configuration)
77 saveConnector( ID_DEFAULT_MANAGED, "proxied1", ChecksumPolicy.IGNORE, ReleasesPolicy.ALWAYS,
78 SnapshotsPolicy.ALWAYS, CachedFailuresPolicy.NO, false );
80 File downloadedFile = proxyHandler.fetchFromProxies( managedDefaultRepository, artifact );
82 File proxied1File = new File( REPOPATH_PROXIED1, path );
83 assertFileEquals( expectedFile, downloadedFile, proxied1File );
84 assertNoTempFiles( expectedFile );
85 assertChecksums( expectedFile, "066d76e459f7782c312c31e8a11b3c0f1e3e43a7 *get-checksum-both-right-1.0.jar",
86 "e58f30c6a150a2e843552438d18e15cb *get-checksum-both-right-1.0.jar" );
90 public void testGetChecksumCorrectSha1NoMd5()
93 String path = "org/apache/maven/test/get-checksum-sha1-only/1.0/get-checksum-sha1-only-1.0.jar";
94 setupTestableManagedRepository( path );
96 File expectedFile = new File( managedDefaultDir, path );
97 ArtifactReference artifact = managedDefaultRepository.toArtifactReference( path );
99 FileUtils.deleteDirectory( expectedFile.getParentFile() );
100 assertFalse( expectedFile.exists() );
102 // Configure Connector (usually done within archiva.xml configuration)
103 saveConnector( ID_DEFAULT_MANAGED, "proxied1", ChecksumPolicy.IGNORE, ReleasesPolicy.ALWAYS,
104 SnapshotsPolicy.ALWAYS, CachedFailuresPolicy.NO, false );
106 File downloadedFile = proxyHandler.fetchFromProxies( managedDefaultRepository, artifact );
108 File proxied1File = new File( REPOPATH_PROXIED1, path );
109 assertFileEquals( expectedFile, downloadedFile, proxied1File );
110 assertNoTempFiles( expectedFile );
111 assertChecksums( expectedFile, "748a3a013bf5eacf2bbb40a2ac7d37889b728837 *get-checksum-sha1-only-1.0.jar",
116 public void testGetChecksumNoSha1CorrectMd5()
119 String path = "org/apache/maven/test/get-checksum-md5-only/1.0/get-checksum-md5-only-1.0.jar";
120 setupTestableManagedRepository( path );
122 File expectedFile = new File( managedDefaultDir, path );
123 ArtifactReference artifact = managedDefaultRepository.toArtifactReference( path );
125 FileUtils.deleteDirectory( expectedFile.getParentFile() );
126 assertFalse( expectedFile.exists() );
128 // Configure Connector (usually done within archiva.xml configuration)
129 saveConnector( ID_DEFAULT_MANAGED, "proxied1", ChecksumPolicy.IGNORE, ReleasesPolicy.ALWAYS,
130 SnapshotsPolicy.ALWAYS, CachedFailuresPolicy.NO, false );
132 File downloadedFile = proxyHandler.fetchFromProxies( managedDefaultRepository, artifact );
134 File proxied1File = new File( REPOPATH_PROXIED1, path );
135 assertFileEquals( expectedFile, downloadedFile, proxied1File );
136 assertNoTempFiles( expectedFile );
137 assertChecksums( expectedFile, null, "f3af5201bf8da801da37db8842846e1c *get-checksum-md5-only-1.0.jar" );
141 public void testGetWithNoChecksumsUsingIgnoredSetting()
144 String path = "org/apache/maven/test/get-default-layout/1.0/get-default-layout-1.0.jar";
145 setupTestableManagedRepository( path );
147 File expectedFile = new File( managedDefaultDir, path );
148 ArtifactReference artifact = managedDefaultRepository.toArtifactReference( path );
150 FileUtils.deleteDirectory( expectedFile.getParentFile() );
151 assertFalse( expectedFile.exists() );
153 // Configure Connector (usually done within archiva.xml configuration)
154 saveConnector( ID_DEFAULT_MANAGED, "proxied1", ChecksumPolicy.IGNORE, ReleasesPolicy.ALWAYS,
155 SnapshotsPolicy.ALWAYS, CachedFailuresPolicy.NO, false );
157 File downloadedFile = proxyHandler.fetchFromProxies( managedDefaultRepository, artifact );
159 File proxied1File = new File( REPOPATH_PROXIED1, path );
160 assertFileEquals( expectedFile, downloadedFile, proxied1File );
161 assertNoTempFiles( expectedFile );
162 assertChecksums( expectedFile, null, null );
166 public void testGetChecksumBadSha1BadMd5IgnoredSetting()
169 String path = "org/apache/maven/test/get-checksum-both-bad/1.0/get-checksum-both-bad-1.0.jar";
170 setupTestableManagedRepository( path );
172 File expectedFile = new File( managedDefaultDir, path );
173 ArtifactReference artifact = managedDefaultRepository.toArtifactReference( path );
175 FileUtils.deleteDirectory( expectedFile.getParentFile() );
176 assertFalse( expectedFile.exists() );
178 // Configure Connector (usually done within archiva.xml configuration)
179 saveConnector( ID_DEFAULT_MANAGED, "proxied1", ChecksumPolicy.IGNORE, ReleasesPolicy.ALWAYS,
180 SnapshotsPolicy.ALWAYS, CachedFailuresPolicy.NO, false );
182 File downloadedFile = proxyHandler.fetchFromProxies( managedDefaultRepository, artifact );
184 File proxied1File = new File( REPOPATH_PROXIED1, path );
185 assertFileEquals( expectedFile, downloadedFile, proxied1File );
186 assertNoTempFiles( expectedFile );
187 assertChecksums( expectedFile, "invalid checksum file", "invalid checksum file" );
191 public void testGetChecksumBadSha1BadMd5FailSetting()
194 String path = "org/apache/maven/test/get-checksum-both-bad/1.0/get-checksum-both-bad-1.0.jar";
195 setupTestableManagedRepository( path );
197 File expectedFile = new File( managedDefaultDir, path );
198 ArtifactReference artifact = managedDefaultRepository.toArtifactReference( path );
200 FileUtils.deleteDirectory( expectedFile.getParentFile() );
201 assertFalse( expectedFile.exists() );
203 // Configure Connector (usually done within archiva.xml configuration)
204 saveConnector( ID_DEFAULT_MANAGED, "proxied1", ChecksumPolicy.FAIL, ReleasesPolicy.ALWAYS,
205 SnapshotsPolicy.ALWAYS, CachedFailuresPolicy.NO, false );
207 File downloadedFile = proxyHandler.fetchFromProxies( managedDefaultRepository, artifact );
209 assertNotDownloaded( downloadedFile );
210 assertChecksums( expectedFile, null, null );
214 public void testGetChecksumBadSha1BadMd5FixSetting()
217 String path = "org/apache/maven/test/get-checksum-both-bad/1.0/get-checksum-both-bad-1.0.jar";
218 setupTestableManagedRepository( path );
220 File expectedFile = new File( managedDefaultDir, path );
221 ArtifactReference artifact = managedDefaultRepository.toArtifactReference( path );
223 FileUtils.deleteDirectory( expectedFile.getParentFile() );
224 assertFalse( expectedFile.exists() );
226 // Configure Connector (usually done within archiva.xml configuration)
227 saveConnector( ID_DEFAULT_MANAGED, "proxied1", ChecksumPolicy.FIX, ReleasesPolicy.ALWAYS,
228 SnapshotsPolicy.ALWAYS, CachedFailuresPolicy.NO, false );
230 File downloadedFile = proxyHandler.fetchFromProxies( managedDefaultRepository, artifact );
232 File proxied1File = new File( REPOPATH_PROXIED1, path );
233 assertFileEquals( expectedFile, downloadedFile, proxied1File );
234 assertNoTempFiles( expectedFile );
235 assertChecksums( expectedFile, "4ec20a12dc91557330bd0b39d1805be5e329ae56 get-checksum-both-bad-1.0.jar",
236 "a292491a35925465e693a44809a078b5 get-checksum-both-bad-1.0.jar" );
240 public void testGetChecksumCorrectSha1BadMd5UsingFailSetting()
243 String path = "org/apache/maven/test/get-checksum-sha1-bad-md5/1.0/get-checksum-sha1-bad-md5-1.0.jar";
244 setupTestableManagedRepository( path );
246 File expectedFile = new File( managedDefaultDir, path );
247 ArtifactReference artifact = managedDefaultRepository.toArtifactReference( path );
249 FileUtils.deleteDirectory( expectedFile.getParentFile() );
250 assertFalse( expectedFile.exists() );
252 // Configure Connector (usually done within archiva.xml configuration)
253 saveConnector( ID_DEFAULT_MANAGED, "proxied1", ChecksumPolicy.FAIL, ReleasesPolicy.ALWAYS,
254 SnapshotsPolicy.ALWAYS, CachedFailuresPolicy.NO, false );
256 File downloadedFile = proxyHandler.fetchFromProxies( managedDefaultRepository, artifact );
258 assertNotDownloaded( downloadedFile );
259 assertChecksums( expectedFile, null, null );
263 public void testGetChecksumNoSha1CorrectMd5UsingFailSetting()
266 String path = "org/apache/maven/test/get-checksum-md5-only/1.0/get-checksum-md5-only-1.0.jar";
267 setupTestableManagedRepository( path );
269 File expectedFile = new File( managedDefaultDir, path );
270 ArtifactReference artifact = managedDefaultRepository.toArtifactReference( path );
272 FileUtils.deleteDirectory( expectedFile.getParentFile() );
273 assertFalse( expectedFile.exists() );
275 // Configure Connector (usually done within archiva.xml configuration)
276 saveConnector( ID_DEFAULT_MANAGED, "proxied1", ChecksumPolicy.FAIL, ReleasesPolicy.ALWAYS,
277 SnapshotsPolicy.ALWAYS, CachedFailuresPolicy.NO, false );
279 File downloadedFile = proxyHandler.fetchFromProxies( managedDefaultRepository, artifact );
281 // This is a success situation. No SHA1 with a Good MD5.
282 File proxied1File = new File( REPOPATH_PROXIED1, path );
283 assertFileEquals( expectedFile, downloadedFile, proxied1File );
284 assertNoTempFiles( expectedFile );
285 assertChecksums( expectedFile, null, "f3af5201bf8da801da37db8842846e1c *get-checksum-md5-only-1.0.jar" );
289 public void testGetWithNoChecksumsUsingFailSetting()
292 String path = "org/apache/maven/test/get-default-layout/1.0/get-default-layout-1.0.jar";
293 setupTestableManagedRepository( path );
295 File expectedFile = new File( managedDefaultDir, path );
296 ArtifactReference artifact = managedDefaultRepository.toArtifactReference( path );
298 FileUtils.deleteDirectory( expectedFile.getParentFile() );
299 assertFalse( expectedFile.exists() );
301 // Configure Connector (usually done within archiva.xml configuration)
302 saveConnector( ID_DEFAULT_MANAGED, "proxied1", ChecksumPolicy.FAIL, ReleasesPolicy.ALWAYS,
303 SnapshotsPolicy.ALWAYS, CachedFailuresPolicy.NO, false );
305 File downloadedFile = proxyHandler.fetchFromProxies( managedDefaultRepository, artifact );
307 assertNotDownloaded( downloadedFile );
308 assertChecksums( expectedFile, null, null );
312 public void testGetChecksumCorrectSha1BadMd5UsingIgnoredSetting()
315 String path = "org/apache/maven/test/get-checksum-sha1-bad-md5/1.0/get-checksum-sha1-bad-md5-1.0.jar";
316 setupTestableManagedRepository( path );
318 File expectedFile = new File( managedDefaultDir, path );
319 ArtifactReference artifact = managedDefaultRepository.toArtifactReference( path );
321 FileUtils.deleteDirectory( expectedFile.getParentFile() );
322 assertFalse( expectedFile.exists() );
324 // Configure Connector (usually done within archiva.xml configuration)
325 saveConnector( ID_DEFAULT_MANAGED, "proxied1", ChecksumPolicy.IGNORE, ReleasesPolicy.ALWAYS,
326 SnapshotsPolicy.ALWAYS, CachedFailuresPolicy.NO, false );
328 File downloadedFile = proxyHandler.fetchFromProxies( managedDefaultRepository, artifact );
330 File proxied1File = new File( REPOPATH_PROXIED1, path );
331 assertFileEquals( expectedFile, downloadedFile, proxied1File );
332 assertNoTempFiles( expectedFile );
333 assertChecksums( expectedFile, "3dd1a3a57b807d3ef3fbc6013d926c891cbb8670 *get-checksum-sha1-bad-md5-1.0.jar",
334 "invalid checksum file" );
338 public void testGetChecksumCorrectSha1BadMd5UsingFixSetting()
341 String path = "org/apache/maven/test/get-checksum-sha1-bad-md5/1.0/get-checksum-sha1-bad-md5-1.0.jar";
342 setupTestableManagedRepository( path );
344 File expectedFile = new File( managedDefaultDir, path );
345 ArtifactReference artifact = managedDefaultRepository.toArtifactReference( path );
347 FileUtils.deleteDirectory( expectedFile.getParentFile() );
348 assertFalse( expectedFile.exists() );
350 // Configure Connector (usually done within archiva.xml configuration)
351 saveConnector( ID_DEFAULT_MANAGED, "proxied1", ChecksumPolicy.FIX, ReleasesPolicy.ALWAYS,
352 SnapshotsPolicy.ALWAYS, CachedFailuresPolicy.NO, false );
354 File downloadedFile = proxyHandler.fetchFromProxies( managedDefaultRepository, artifact );
356 File proxied1File = new File( REPOPATH_PROXIED1, path );
357 assertFileEquals( expectedFile, downloadedFile, proxied1File );
358 assertNoTempFiles( expectedFile );
359 assertChecksums( expectedFile, "3dd1a3a57b807d3ef3fbc6013d926c891cbb8670 *get-checksum-sha1-bad-md5-1.0.jar",
360 "c35f3b76268b73a4ba617f6f275c49ab get-checksum-sha1-bad-md5-1.0.jar" );
364 public void testGetChecksumNoSha1CorrectMd5UsingFixSetting()
367 String path = "org/apache/maven/test/get-checksum-md5-only/1.0/get-checksum-md5-only-1.0.jar";
368 setupTestableManagedRepository( path );
370 File expectedFile = new File( managedDefaultDir, path );
371 ArtifactReference artifact = managedDefaultRepository.toArtifactReference( path );
373 FileUtils.deleteDirectory( expectedFile.getParentFile() );
374 assertFalse( expectedFile.exists() );
376 // Configure Connector (usually done within archiva.xml configuration)
377 saveConnector( ID_DEFAULT_MANAGED, "proxied1", ChecksumPolicy.FIX, ReleasesPolicy.ALWAYS,
378 SnapshotsPolicy.ALWAYS, CachedFailuresPolicy.NO, false );
380 File downloadedFile = proxyHandler.fetchFromProxies( managedDefaultRepository, artifact );
382 File proxied1File = new File( REPOPATH_PROXIED1, path );
383 assertFileEquals( expectedFile, downloadedFile, proxied1File );
384 assertNoTempFiles( expectedFile );
385 assertChecksums( expectedFile, "71f7dc3f72053a3f2d9fdd6fef9db055ef957ffb get-checksum-md5-only-1.0.jar",
386 "f3af5201bf8da801da37db8842846e1c *get-checksum-md5-only-1.0.jar" );
390 public void testGetWithNoChecksumsUsingFixSetting()
393 String path = "org/apache/maven/test/get-default-layout/1.0/get-default-layout-1.0.jar";
394 setupTestableManagedRepository( path );
396 File expectedFile = new File( managedDefaultDir, path );
397 ArtifactReference artifact = managedDefaultRepository.toArtifactReference( path );
399 FileUtils.deleteDirectory( expectedFile.getParentFile() );
400 assertFalse( expectedFile.exists() );
402 // Configure Connector (usually done within archiva.xml configuration)
403 saveConnector( ID_DEFAULT_MANAGED, "proxied1", ChecksumPolicy.FIX, ReleasesPolicy.ALWAYS,
404 SnapshotsPolicy.ALWAYS, CachedFailuresPolicy.NO, false );
406 File downloadedFile = proxyHandler.fetchFromProxies( managedDefaultRepository, artifact );
408 File proxied1File = new File( REPOPATH_PROXIED1, path );
409 assertFileEquals( expectedFile, downloadedFile, proxied1File );
410 assertNoTempFiles( expectedFile );
411 assertChecksums( expectedFile, "1f12821c5e43e1a0b76b9564a6ddb0548ccb9486 get-default-layout-1.0.jar",
412 "3f7341545f21226b6f49a3c2704cb9be get-default-layout-1.0.jar" );
416 public void testGetChecksumNotFoundOnRemote()
419 String path = "org/apache/maven/test/get-checksum-sha1-only/1.0/get-checksum-sha1-only-1.0.jar";
420 setupTestableManagedRepository( path );
422 File expectedFile = new File( managedDefaultDir, path );
423 ArtifactReference artifact = managedDefaultRepository.toArtifactReference( path );
425 FileUtils.deleteDirectory( expectedFile.getParentFile() );
426 assertFalse( expectedFile.getParentFile().exists() );
427 assertFalse( expectedFile.exists() );
429 saveRemoteRepositoryConfig( "badproxied", "Bad Proxied", "test://bad.machine.com/repo/", "default" );
431 // Configure Connector (usually done within archiva.xml configuration)
432 saveConnector( ID_DEFAULT_MANAGED, "badproxied", ChecksumPolicy.IGNORE, ReleasesPolicy.ALWAYS,
433 SnapshotsPolicy.ALWAYS, CachedFailuresPolicy.NO, false );
435 wagonMock.get( path, new File( expectedFile.getAbsolutePath() + ".tmp" ) );
436 wagonMockControl.setMatcher(customWagonGetMatcher);
437 wagonMockControl.setVoidCallable();
438 wagonMock.get( path + ".sha1", new File( expectedFile.getAbsolutePath() + ".sha1.tmp" ) );
439 wagonMockControl.setMatcher(customWagonGetMatcher);
440 wagonMockControl.setVoidCallable();
441 wagonMock.get( path + ".md5", new File( expectedFile.getAbsolutePath() + ".md5.tmp" ) );
442 wagonMockControl.setMatcher(customWagonGetMatcher);
443 wagonMockControl.setThrowable( new ResourceDoesNotExistException( "Resource does not exist." ) );
444 wagonMockControl.replay();
446 File downloadedFile = proxyHandler.fetchFromProxies( managedDefaultRepository, artifact );
448 wagonMockControl.verify();
450 // Do what the mock doesn't do.
451 String proxyPath = new File( REPOPATH_PROXIED1, path ).getAbsolutePath();
452 String localPath = new File( managedDefaultDir, path ).getAbsolutePath();
453 FileUtils.copyFile( new File( proxyPath ), new File( localPath ) );
454 FileUtils.copyFile( new File( proxyPath + ".sha1" ), new File( localPath + ".sha1" ) );
457 File proxied1File = new File( REPOPATH_PROXIED1, path );
458 assertFileEquals( expectedFile, downloadedFile, proxied1File );
459 assertNoTempFiles( expectedFile );
460 assertChecksums( expectedFile, "748a3a013bf5eacf2bbb40a2ac7d37889b728837 *get-checksum-sha1-only-1.0.jar",
465 public void testGetAlwaysBadChecksumPresentLocallyAbsentRemoteUsingIgnoredSetting()
468 String path = "org/apache/maven/test/get-bad-local-checksum/1.0/get-bad-local-checksum-1.0.jar";
469 setupTestableManagedRepository( path );
471 File expectedFile = new File( managedDefaultDir, path );
472 File remoteFile = new File( REPOPATH_PROXIED1, path );
474 setManagedOlderThanRemote( expectedFile, remoteFile );
476 ArtifactReference artifact = managedDefaultRepository.toArtifactReference( path );
478 // Configure Connector (usually done within archiva.xml configuration)
479 saveConnector( ID_DEFAULT_MANAGED, "proxied1", ChecksumPolicy.IGNORE, ReleasesPolicy.ALWAYS,
480 SnapshotsPolicy.ALWAYS, CachedFailuresPolicy.NO , false );
482 File downloadedFile = proxyHandler.fetchFromProxies( managedDefaultRepository, artifact );
484 File proxied1File = new File( REPOPATH_PROXIED1, path );
485 assertFileEquals( expectedFile, downloadedFile, proxied1File );
486 assertNoTempFiles( expectedFile );
487 // There are no hashcodes on the proxy side to download, hence the local ones should remain invalid.
488 assertChecksums( expectedFile, "invalid checksum file", "invalid checksum file" );
492 public void testGetAlwaysBadChecksumPresentLocallyAbsentRemoteUsingFailSetting()
495 String path = "org/apache/maven/test/get-bad-local-checksum/1.0/get-bad-local-checksum-1.0.jar";
496 setupTestableManagedRepository( path );
498 File expectedFile = new File( managedDefaultDir, path );
499 File remoteFile = new File( REPOPATH_PROXIED1, path );
501 setManagedOlderThanRemote( expectedFile, remoteFile );
503 ArtifactReference artifact = managedDefaultRepository.toArtifactReference( path );
505 // Configure Connector (usually done within archiva.xml configuration)
506 saveConnector( ID_DEFAULT_MANAGED, ID_PROXIED1, ChecksumPolicy.FAIL, ReleasesPolicy.ALWAYS,
507 SnapshotsPolicy.ALWAYS, CachedFailuresPolicy.NO , false );
509 File downloadedFile = proxyHandler.fetchFromProxies( managedDefaultRepository, artifact );
511 assertNotDownloaded( downloadedFile );
512 assertNoTempFiles( expectedFile );
513 // There are no hashcodes on the proxy side to download.
514 // The FAIL policy will delete the checksums as bad.
516 assertChecksums( expectedFile, "invalid checksum file", "invalid checksum file" );
520 public void testGetAlwaysBadChecksumPresentLocallyAbsentRemoteUsingFixSetting()
523 String path = "org/apache/maven/test/get-bad-local-checksum/1.0/get-bad-local-checksum-1.0.jar";
524 setupTestableManagedRepository( path );
526 File expectedFile = new File( managedDefaultDir, path );
527 File remoteFile = new File( REPOPATH_PROXIED1, path );
529 setManagedOlderThanRemote( expectedFile, remoteFile );
531 ArtifactReference artifact = managedDefaultRepository.toArtifactReference( path );
533 // Configure Connector (usually done within archiva.xml configuration)
534 saveConnector( ID_DEFAULT_MANAGED, "proxied1", ChecksumPolicy.FIX, ReleasesPolicy.ALWAYS,
535 SnapshotsPolicy.ALWAYS, CachedFailuresPolicy.NO , false );
537 File downloadedFile = proxyHandler.fetchFromProxies( managedDefaultRepository, artifact );
539 File proxied1File = new File( REPOPATH_PROXIED1, path );
540 assertFileEquals( expectedFile, downloadedFile, proxied1File );
541 assertNoTempFiles( expectedFile );
542 assertChecksums( expectedFile, "96a08dc80a108cba8efd3b20aec91b32a0b2cbd4 get-bad-local-checksum-1.0.jar",
543 "46fdd6ca55bf1d7a7eb0c858f41e0ccd get-bad-local-checksum-1.0.jar" );