]> source.dussan.org Git - archiva.git/blob
e183c0753db0adeb8ecfe6991e396ea404071560
[archiva.git] /
1 package org.apache.archiva.webdav;
2
3 /*
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
11  *
12  *  http://www.apache.org/licenses/LICENSE-2.0
13  *
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
19  * under the License.
20  */
21
22
23 import com.gargoylesoftware.htmlunit.WebRequest;
24 import com.gargoylesoftware.htmlunit.WebResponse;
25 import org.apache.archiva.configuration.ProxyConnectorConfiguration;
26 import org.apache.commons.io.FileUtils;
27 import org.junit.Before;
28 import org.junit.Test;
29
30 import java.io.File;
31 import java.nio.charset.Charset;
32 import java.util.ArrayList;
33
34 /**
35  * RepositoryServletTest
36  *
37  *
38  */
39 public class RepositoryServletNoProxyTest
40     extends AbstractRepositoryServletTestCase
41 {
42
43     @Before
44     @Override
45     public void setUp()
46         throws Exception
47     {
48         super.setUp();
49         archivaConfiguration.getConfiguration().setProxyConnectors( new ArrayList<ProxyConnectorConfiguration>() );
50         startRepository();
51     }
52
53     @Test
54     public void testLastModifiedHeaderExists()
55         throws Exception
56     {
57         String commonsLangSha1 = "commons-lang/commons-lang/2.1/commons-lang-2.1.jar.sha1";
58
59         File checksumFile = new File( repoRootInternal, commonsLangSha1 );
60         checksumFile.getParentFile().mkdirs();
61
62         FileUtils.writeStringToFile( checksumFile, "dummy-checksum", Charset.defaultCharset()  );
63
64         //WebRequest request = new GetMethodWebRequest( "http://machine.com/repository/internal/" + commonsLangSha1 );
65         WebResponse response = getWebResponse( "/repository/internal/" + commonsLangSha1 );
66         assertNotNull( response.getResponseHeaderValue( "Last-Modified" ) );
67     }
68
69     @Test
70     public void testGetNoProxyChecksumDefaultLayout()
71         throws Exception
72     {
73         String commonsLangSha1 = "commons-lang/commons-lang/2.1/commons-lang-2.1.jar.sha1";
74
75         File checksumFile = new File( repoRootInternal, commonsLangSha1 );
76         checksumFile.getParentFile().mkdirs();
77
78         FileUtils.writeStringToFile( checksumFile, "dummy-checksum", Charset.defaultCharset()  );
79
80         //WebRequest request = new WebRequest( "http://machine.com/repository/internal/" + commonsLangSha1 );
81         WebResponse response = getWebResponse( "/repository/internal/" + commonsLangSha1 );
82         assertResponseOK( response );
83
84         assertEquals( "Expected file contents", "dummy-checksum", response.getContentAsString() );
85     }
86
87     @Test
88     public void testGetNoProxyChecksumLegacyLayout()
89         throws Exception
90     {
91         String commonsLangSha1 = "commons-lang/commons-lang/2.1/commons-lang-2.1.jar.sha1";
92
93         File checksumFile = new File( repoRootInternal, commonsLangSha1 );
94         checksumFile.getParentFile().mkdirs();
95
96         FileUtils.writeStringToFile( checksumFile, "dummy-checksum", Charset.defaultCharset()  );
97
98         //WebRequest request = new GetMethodWebRequest(
99         //    "http://machine.com/repository/internal/" + "commons-lang/jars/commons-lang-2.1.jar.sha1" );
100         WebResponse response = getWebResponse( "/repository/internal/" + "commons-lang/jars/commons-lang-2.1.jar.sha1" );
101         assertResponseOK( response );
102
103         assertEquals( "Expected file contents", "dummy-checksum", response.getContentAsString() );
104     }
105
106     @Test
107     public void testGetNoProxyVersionedMetadataDefaultLayout()
108         throws Exception
109     {
110         String commonsLangMetadata = "commons-lang/commons-lang/2.1/maven-metadata.xml";
111         String expectedMetadataContents = "dummy-versioned-metadata";
112
113         File metadataFile = new File( repoRootInternal, commonsLangMetadata );
114         metadataFile.getParentFile().mkdirs();
115
116         FileUtils.writeStringToFile( metadataFile, expectedMetadataContents, Charset.defaultCharset()  );
117
118         //WebRequest request = new GetMethodWebRequest( "http://machine.com/repository/internal/" + commonsLangMetadata );
119         WebResponse response = getWebResponse( "/repository/internal/" + commonsLangMetadata );
120         assertResponseOK( response );
121
122         assertEquals( "Expected file contents", expectedMetadataContents, response.getContentAsString() );
123     }
124
125     @Test
126     public void testGetNoProxyProjectMetadataDefaultLayout()
127         throws Exception
128     {
129         String commonsLangMetadata = "commons-lang/commons-lang/maven-metadata.xml";
130         String expectedMetadataContents = "dummy-project-metadata";
131
132         File metadataFile = new File( repoRootInternal, commonsLangMetadata );
133         metadataFile.getParentFile().mkdirs();
134
135         FileUtils.writeStringToFile( metadataFile, expectedMetadataContents, Charset.defaultCharset()  );
136
137         //WebRequest request = new GetMethodWebRequest( "http://machine.com/repository/internal/" + commonsLangMetadata );
138         WebResponse response = getWebResponse( "/repository/internal/" + commonsLangMetadata );
139         assertResponseOK( response );
140
141         assertEquals( "Expected file contents", expectedMetadataContents, response.getContentAsString() );
142     }
143
144     @Test
145     public void testGetNoProxyGroupMetadataDefaultLayout()
146         throws Exception
147     {
148         String commonsLangMetadata = "commons-lang/maven-metadata.xml";
149         String expectedMetadataContents = "dummy-group-metadata";
150
151         File metadataFile = new File( repoRootInternal, commonsLangMetadata );
152         metadataFile.getParentFile().mkdirs();
153
154         FileUtils.writeStringToFile( metadataFile, expectedMetadataContents, Charset.defaultCharset()  );
155
156         //WebRequest request = new GetMethodWebRequest( "http://machine.com/repository/internal/" + commonsLangMetadata );
157         WebResponse response = getWebResponse( "/repository/internal/" + commonsLangMetadata );
158         assertResponseOK( response );
159
160         assertEquals( "Expected file contents", expectedMetadataContents, response.getContentAsString() );
161     }
162
163     @Test
164     public void testGetNoProxyArtifactDefaultLayout()
165         throws Exception
166     {
167         String commonsLangJar = "commons-lang/commons-lang/2.1/commons-lang-2.1.jar";
168         String expectedArtifactContents = "dummy-commons-lang-artifact";
169
170         File artifactFile = new File( repoRootInternal, commonsLangJar );
171         artifactFile.getParentFile().mkdirs();
172
173         FileUtils.writeStringToFile( artifactFile, expectedArtifactContents, Charset.defaultCharset()  );
174
175         //WebRequest request = new GetMethodWebRequest( "http://machine.com/repository/internal/" + commonsLangJar );
176         WebResponse response = getWebResponse( "/repository/internal/" + commonsLangJar );
177         assertResponseOK( response );
178
179         assertEquals( "Expected file contents", expectedArtifactContents, response.getContentAsString() );
180     }
181
182     @Test
183     public void testGetNoProxyArtifactLegacyLayout()
184         throws Exception
185     {
186         String commonsLangJar = "commons-lang/commons-lang/2.1/commons-lang-2.1.jar";
187         String expectedArtifactContents = "dummy-commons-lang-artifact";
188
189         File artifactFile = new File( repoRootInternal, commonsLangJar );
190         artifactFile.getParentFile().mkdirs();
191
192         FileUtils.writeStringToFile( artifactFile, expectedArtifactContents, Charset.defaultCharset()  );
193
194         //WebRequest request = new GetMethodWebRequest(
195         //    "http://machine.com/repository/internal/" + "commons-lang/jars/commons-lang-2.1.jar" );
196         WebResponse response = getWebResponse( "/repository/internal/" + "commons-lang/jars/commons-lang-2.1.jar" );
197         assertResponseOK( response );
198
199         assertEquals( "Expected file contents", expectedArtifactContents, response.getContentAsString() );
200     }
201
202     @Test
203     public void testGetNoProxySnapshotArtifactDefaultLayout()
204         throws Exception
205     {
206         String commonsLangJar = "commons-lang/commons-lang/2.1-SNAPSHOT/commons-lang-2.1-SNAPSHOT.jar";
207         String expectedArtifactContents = "dummy-commons-lang-snapshot-artifact";
208
209         File artifactFile = new File( repoRootInternal, commonsLangJar );
210         artifactFile.getParentFile().mkdirs();
211
212         FileUtils.writeStringToFile( artifactFile, expectedArtifactContents, Charset.defaultCharset()  );
213
214         //WebRequest request = new GetMethodWebRequest( "http://machine.com/repository/internal/" + commonsLangJar );
215         WebResponse response = getWebResponse( "/repository/internal/" + commonsLangJar );
216         assertResponseOK( response );
217
218         assertEquals( "Expected file contents", expectedArtifactContents, response.getContentAsString() );
219     }
220
221     @Test
222     public void testGetNoProxySnapshotArtifactLegacyLayout()
223         throws Exception
224     {
225         String commonsLangJar = "commons-lang/commons-lang/2.1-SNAPSHOT/commons-lang-2.1-SNAPSHOT.jar";
226         String expectedArtifactContents = "dummy-commons-lang-snapshot-artifact";
227
228         File artifactFile = new File( repoRootInternal, commonsLangJar );
229         artifactFile.getParentFile().mkdirs();
230
231         FileUtils.writeStringToFile( artifactFile, expectedArtifactContents, Charset.defaultCharset()  );
232
233         //WebRequest request = new GetMethodWebRequest(
234         //    "http://machine.com/repository/internal/" + "commons-lang/jars/commons-lang-2.1-SNAPSHOT.jar" );
235         WebResponse response = getWebResponse( "/repository/internal/commons-lang/jars/commons-lang-2.1-SNAPSHOT.jar" );
236         assertResponseOK( response );
237
238         assertEquals( "Expected file contents", expectedArtifactContents, response.getContentAsString() );
239     }
240
241     @Test
242     public void testGetNoProxyTimestampedSnapshotArtifactDefaultLayout()
243         throws Exception
244     {
245         String commonsLangJar = "commons-lang/commons-lang/2.1-SNAPSHOT/commons-lang-2.1-20050821.023400-1.jar";
246         String expectedArtifactContents = "dummy-commons-lang-snapshot-artifact";
247
248         File artifactFile = new File( repoRootInternal, commonsLangJar );
249         artifactFile.getParentFile().mkdirs();
250
251         FileUtils.writeStringToFile( artifactFile, expectedArtifactContents, Charset.defaultCharset()  );
252
253         //WebRequest request = new GetMethodWebRequest( "http://machine.com/repository/internal/" + commonsLangJar );
254         WebResponse response = getWebResponse( "/repository/internal/" + commonsLangJar );
255         assertResponseOK( response );
256
257         assertEquals( "Expected file contents", expectedArtifactContents, response.getContentAsString() );
258     }
259
260     @Test
261     public void testGetNoProxyTimestampedSnapshotArtifactLegacyLayout()
262         throws Exception
263     {
264         String commonsLangJar = "commons-lang/commons-lang/2.1-SNAPSHOT/commons-lang-2.1-20050821.023400-1.jar";
265         String expectedArtifactContents = "dummy-commons-lang-snapshot-artifact";
266
267         File artifactFile = new File( repoRootInternal, commonsLangJar );
268         artifactFile.getParentFile().mkdirs();
269
270         FileUtils.writeStringToFile( artifactFile, expectedArtifactContents, Charset.defaultCharset()  );
271
272         WebRequest request = new GetMethodWebRequest(
273             "http://machine.com/repository/internal/" + "commons-lang/jars/commons-lang-2.1-20050821.023400-1.jar" );
274         WebResponse response = getServletUnitClient().getResponse( request );
275         assertResponseOK( response );
276
277         assertEquals( "Expected file contents", expectedArtifactContents, response.getContentAsString() );
278     }
279
280     /**
281      * [MRM-481] Artifact requests with a .xml.zip extension fail with a 404 Error
282      */
283     @Test
284     public void testGetNoProxyDualExtensionDefaultLayout()
285         throws Exception
286     {
287         String expectedContents = "the-contents-of-the-dual-extension";
288         String dualExtensionPath = "org/project/example-presentation/3.2/example-presentation-3.2.xml.zip";
289
290         File checksumFile = new File( repoRootInternal, dualExtensionPath );
291         checksumFile.getParentFile().mkdirs();
292
293         FileUtils.writeStringToFile( checksumFile, expectedContents, Charset.defaultCharset()  );
294
295         WebRequest request = new GetMethodWebRequest( "http://machine.com/repository/internal/" + dualExtensionPath );
296         WebResponse response = getServletUnitClient().getResponse( request );
297         assertResponseOK( response );
298
299         assertEquals( "Expected file contents", expectedContents, response.getContentAsString() );
300     }
301
302     @Test
303     public void testGetNoProxyDistributionLegacyLayout()
304         throws Exception
305     {
306         String expectedContents = "the-contents-of-the-dual-extension";
307         String dualExtensionPath = "org/project/example-presentation/3.2/example-presentation-3.2.zip";
308
309         File checksumFile = new File( repoRootInternal, dualExtensionPath );
310         checksumFile.getParentFile().mkdirs();
311
312         FileUtils.writeStringToFile( checksumFile, expectedContents, Charset.defaultCharset()  );
313
314         WebRequest request = new GetMethodWebRequest(
315             "http://machine.com/repository/internal/" + "org.project/distributions/example-presentation-3.2.zip" );
316         WebResponse response = getServletUnitClient().getResponse( request );
317         assertResponseOK( response );
318
319         assertEquals( "Expected file contents", expectedContents, response.getContentAsString() );
320     }
321
322     @Test
323     public void testGetNoProxyChecksumDefaultLayoutManagedLegacy()
324         throws Exception
325     {
326         String commonsLangSha1 = "commons-lang/commons-lang/2.1/commons-lang-2.1.jar.sha1";
327
328         File checksumFile = new File( repoRootLegacy, "commons-lang/jars/commons-lang-2.1.jar.sha1" );
329         checksumFile.getParentFile().mkdirs();
330
331         FileUtils.writeStringToFile( checksumFile, "dummy-checksum", Charset.defaultCharset()  );
332
333         WebRequest request = new GetMethodWebRequest( "http://machine.com/repository/legacy/" + commonsLangSha1 );
334         WebResponse response = getServletUnitClient().getResponse( request );
335         assertResponseOK( response );
336
337         assertEquals( "Expected file contents", "dummy-checksum", response.getContentAsString() );
338     }
339
340     @Test
341     public void testGetNoProxyChecksumLegacyLayoutManagedLegacy()
342         throws Exception
343     {
344         String commonsLangSha1 = "commons-lang/jars/commons-lang-2.1.jar.sha1";
345         File checksumFile = new File( repoRootLegacy, commonsLangSha1 );
346         checksumFile.getParentFile().mkdirs();
347
348         FileUtils.writeStringToFile( checksumFile, "dummy-checksum", Charset.defaultCharset()  );
349
350         WebRequest request = new GetMethodWebRequest( "http://machine.com/repository/legacy/" + commonsLangSha1 );
351         WebResponse response = getServletUnitClient().getResponse( request );
352         assertResponseOK( response );
353
354         assertEquals( "Expected file contents", "dummy-checksum", response.getContentAsString() );
355     }
356
357     @Test
358     public void testGetNoProxyVersionedMetadataDefaultLayoutManagedLegacy()
359         throws Exception
360     {
361         String commonsLangMetadata = "commons-lang/commons-lang/2.1/maven-metadata.xml";
362         String expectedMetadataContents = "dummy-versioned-metadata";
363
364         // TODO: find out what this should be from maven-artifact
365         File metadataFile = new File( repoRootLegacy, commonsLangMetadata );
366         metadataFile.getParentFile().mkdirs();
367
368         FileUtils.writeStringToFile( metadataFile, expectedMetadataContents, Charset.defaultCharset()  );
369
370         WebRequest request = new GetMethodWebRequest( "http://machine.com/repository/legacy/" + commonsLangMetadata );
371         WebResponse response = getServletUnitClient().getResponse( request );
372         assertResponseOK( response );
373
374         assertEquals( "Expected file contents", expectedMetadataContents, response.getContentAsString() );
375     }
376
377     @Test
378     public void testGetNoProxyProjectMetadataDefaultLayoutManagedLegacy()
379         throws Exception
380     {
381         // TODO: find out what it is meant to be from maven-artifact
382         String commonsLangMetadata = "commons-lang/commons-lang/maven-metadata.xml";
383         String expectedMetadataContents = "dummy-project-metadata";
384
385         File metadataFile = new File( repoRootLegacy, commonsLangMetadata );
386         metadataFile.getParentFile().mkdirs();
387
388         FileUtils.writeStringToFile( metadataFile, expectedMetadataContents, Charset.defaultCharset()  );
389
390         WebRequest request = new GetMethodWebRequest( "http://machine.com/repository/legacy/" + commonsLangMetadata );
391         WebResponse response = getServletUnitClient().getResponse( request );
392         assertResponseOK( response );
393
394         assertEquals( "Expected file contents", expectedMetadataContents, response.getContentAsString() );
395     }
396
397     @Test
398     public void testGetNoProxyGroupMetadataDefaultLayoutManagedLegacy()
399         throws Exception
400     {
401         String commonsLangMetadata = "commons-lang/maven-metadata.xml";
402         String expectedMetadataContents = "dummy-group-metadata";
403
404         File metadataFile = new File( repoRootLegacy, commonsLangMetadata );
405         metadataFile.getParentFile().mkdirs();
406
407         FileUtils.writeStringToFile( metadataFile, expectedMetadataContents, Charset.defaultCharset()  );
408
409         WebRequest request = new GetMethodWebRequest( "http://machine.com/repository/legacy/" + commonsLangMetadata );
410         WebResponse response = getServletUnitClient().getResponse( request );
411         assertResponseOK( response );
412
413         assertEquals( "Expected file contents", expectedMetadataContents, response.getContentAsString() );
414     }
415
416     @Test
417     public void testGetNoProxyArtifactDefaultLayoutManagedLegacy()
418         throws Exception
419     {
420         String commonsLangJar = "commons-lang/commons-lang/2.1/commons-lang-2.1.jar";
421         String expectedArtifactContents = "dummy-commons-lang-artifact";
422
423         File artifactFile = new File( repoRootLegacy, "commons-lang/jars/commons-lang-2.1.jar" );
424         artifactFile.getParentFile().mkdirs();
425
426         FileUtils.writeStringToFile( artifactFile, expectedArtifactContents, Charset.defaultCharset()  );
427
428         WebRequest request = new GetMethodWebRequest( "http://machine.com/repository/legacy/" + commonsLangJar );
429         WebResponse response = getServletUnitClient().getResponse( request );
430         assertResponseOK( response );
431
432         assertEquals( "Expected file contents", expectedArtifactContents, response.getContentAsString() );
433     }
434
435     @Test
436     public void testGetNoProxyArtifactLegacyLayoutManagedLegacy()
437         throws Exception
438     {
439         String commonsLangJar = "commons-lang/jars/commons-lang-2.1.jar";
440         String expectedArtifactContents = "dummy-commons-lang-artifact";
441
442         File artifactFile = new File( repoRootLegacy, commonsLangJar );
443         artifactFile.getParentFile().mkdirs();
444
445         FileUtils.writeStringToFile( artifactFile, expectedArtifactContents, Charset.defaultCharset()  );
446
447         WebRequest request = new GetMethodWebRequest( "http://machine.com/repository/legacy/" + commonsLangJar );
448         WebResponse response = getServletUnitClient().getResponse( request );
449         assertResponseOK( response );
450
451         assertEquals( "Expected file contents", expectedArtifactContents, response.getContentAsString() );
452     }
453
454     @Test
455     public void testGetNoProxySnapshotArtifactDefaultLayoutManagedLegacy()
456         throws Exception
457     {
458         String commonsLangJar = "commons-lang/commons-lang/2.1-SNAPSHOT/commons-lang-2.1-SNAPSHOT.jar";
459         String expectedArtifactContents = "dummy-commons-lang-snapshot-artifact";
460
461         File artifactFile = new File( repoRootLegacy, "commons-lang/jars/commons-lang-2.1-SNAPSHOT.jar" );
462         artifactFile.getParentFile().mkdirs();
463
464         FileUtils.writeStringToFile( artifactFile, expectedArtifactContents, Charset.defaultCharset()  );
465
466         WebRequest request = new GetMethodWebRequest( "http://machine.com/repository/legacy/" + commonsLangJar );
467         WebResponse response = getServletUnitClient().getResponse( request );
468         assertResponseOK( response );
469
470         assertEquals( "Expected file contents", expectedArtifactContents, response.getContentAsString() );
471     }
472
473     @Test
474     public void testGetNoProxySnapshotArtifactLegacyLayoutManagedLegacy()
475         throws Exception
476     {
477         String commonsLangJar = "commons-lang/jars/commons-lang-2.1-SNAPSHOT.jar";
478         String expectedArtifactContents = "dummy-commons-lang-snapshot-artifact";
479
480         File artifactFile = new File( repoRootLegacy, commonsLangJar );
481         artifactFile.getParentFile().mkdirs();
482
483         FileUtils.writeStringToFile( artifactFile, expectedArtifactContents, Charset.defaultCharset()  );
484
485         WebRequest request = new GetMethodWebRequest( "http://machine.com/repository/legacy/" + commonsLangJar );
486         WebResponse response = getServletUnitClient().getResponse( request );
487         assertResponseOK( response );
488
489         assertEquals( "Expected file contents", expectedArtifactContents, response.getContentAsString() );
490     }
491
492     @Test
493     public void testGetNoProxyTimestampedSnapshotArtifactDefaultLayoutManagedLegacy()
494         throws Exception
495     {
496         String filename = "commons-lang-2.1-20050821.023400-1.jar";
497         String commonsLangJar = "commons-lang/commons-lang/2.1-SNAPSHOT/" + filename;
498         String expectedArtifactContents = "dummy-commons-lang-snapshot-artifact";
499
500         File artifactFile = new File( repoRootLegacy, "commons-lang/jars/" + filename );
501         artifactFile.getParentFile().mkdirs();
502
503         FileUtils.writeStringToFile( artifactFile, expectedArtifactContents, Charset.defaultCharset()  );
504
505         WebRequest request = new GetMethodWebRequest( "http://machine.com/repository/legacy/" + commonsLangJar );
506         WebResponse response = getServletUnitClient().getResponse( request );
507         assertResponseOK( response );
508
509         assertEquals( "Expected file contents", expectedArtifactContents, response.getContentAsString() );
510     }
511
512     @Test
513     public void testGetNoProxyTimestampedSnapshotArtifactLegacyLayoutManagedLegacy()
514         throws Exception
515     {
516         String commonsLangJar = "commons-lang/jars/commons-lang-2.1-20050821.023400-1.jar";
517         String expectedArtifactContents = "dummy-commons-lang-snapshot-artifact";
518
519         File artifactFile = new File( repoRootLegacy, commonsLangJar );
520         artifactFile.getParentFile().mkdirs();
521
522         FileUtils.writeStringToFile( artifactFile, expectedArtifactContents, Charset.defaultCharset()  );
523
524         WebRequest request = new GetMethodWebRequest( "http://machine.com/repository/legacy/" + commonsLangJar );
525         WebResponse response = getServletUnitClient().getResponse( request );
526         assertResponseOK( response );
527
528         assertEquals( "Expected file contents", expectedArtifactContents, response.getContentAsString() );
529     }
530
531     /**
532      * [MRM-481] Artifact requests with a .xml.zip extension fail with a 404 Error
533      */
534     @Test
535     public void testGetNoProxyDualExtensionDefaultLayoutManagedLegacy()
536         throws Exception
537     {
538         String expectedContents = "the-contents-of-the-dual-extension";
539         String dualExtensionPath = "org/project/example-presentation/3.2/example-presentation-3.2.xml.zip";
540
541         File checksumFile = new File( repoRootLegacy, "org.project/distributions/example-presentation-3.2.xml.zip" );
542         checksumFile.getParentFile().mkdirs();
543
544         FileUtils.writeStringToFile( checksumFile, expectedContents, Charset.defaultCharset()  );
545
546         WebRequest request = new GetMethodWebRequest( "http://machine.com/repository/legacy/" + dualExtensionPath );
547         WebResponse response = getServletUnitClient().getResponse( request );
548         assertResponseOK( response );
549
550         assertEquals( "Expected file contents", expectedContents, response.getContentAsString() );
551     }
552
553     @Test
554     public void testGetNoProxyDistributionLegacyLayoutManagedLegacy()
555         throws Exception
556     {
557         String expectedContents = "the-contents-of-the-dual-extension";
558         String dualExtensionPath = "org.project/distributions/example-presentation-3.2.zip";
559
560         File checksumFile = new File( repoRootLegacy, dualExtensionPath );
561         checksumFile.getParentFile().mkdirs();
562
563         FileUtils.writeStringToFile( checksumFile, expectedContents, Charset.defaultCharset()  );
564
565         WebRequest request = new GetMethodWebRequest( "http://machine.com/repository/legacy/" + dualExtensionPath );
566         WebResponse response = getServletUnitClient().getResponse( request );
567         assertResponseOK( response );
568
569         assertEquals( "Expected file contents", expectedContents, response.getContentAsString() );
570     }
571
572 }