1 package org.apache.archiva.webdav;
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
23 import com.gargoylesoftware.htmlunit.WebRequest;
24 import com.gargoylesoftware.htmlunit.WebResponse;
25 import org.apache.archiva.configuration.ProxyConnectorConfiguration;
26 import org.junit.After;
27 import org.junit.Before;
28 import org.junit.Test;
29 import org.springframework.mock.web.MockHttpServletRequest;
30 import org.springframework.mock.web.MockHttpServletResponse;
32 import javax.servlet.http.HttpServletResponse;
33 import java.nio.charset.Charset;
34 import java.nio.file.Files;
35 import java.nio.file.Path;
36 import java.util.ArrayList;
39 * RepositoryServletTest
41 public class RepositoryServletNoProxyTest
42 extends AbstractRepositoryServletTestCase
51 archivaConfiguration.getConfiguration().setProxyConnectors( new ArrayList<ProxyConnectorConfiguration>() );
57 public void tearDown( ) throws Exception
63 public void testLastModifiedHeaderExists()
66 String commonsLangSha1 = "commons-lang/commons-lang/2.1/commons-lang-2.1.jar.sha1";
68 Path checksumFile = repoRootInternal.resolve( commonsLangSha1 );
69 Files.createDirectories(checksumFile.getParent());
71 org.apache.archiva.common.utils.FileUtils.writeStringToFile( checksumFile, Charset.defaultCharset(), "dummy-checksum" );
73 //WebRequest request = new GetMethodWebRequest( "http://machine.com/repository/internal/" + commonsLangSha1 );
74 WebResponse response = getWebResponse( "/repository/internal/" + commonsLangSha1 );
75 assertNotNull( response.getResponseHeaderValue( "Last-Modified" ) );
79 public void testGetNoProxyChecksumDefaultLayout()
82 String commonsLangSha1 = "commons-lang/commons-lang/2.1/commons-lang-2.1.jar.sha1";
84 Path checksumFile = repoRootInternal.resolve(commonsLangSha1);
85 Files.createDirectories(checksumFile.getParent());
87 org.apache.archiva.common.utils.FileUtils.writeStringToFile( checksumFile, Charset.defaultCharset(), "dummy-checksum");
89 //WebRequest request = new WebRequest( "http://machine.com/repository/internal/" + commonsLangSha1 );
90 WebResponse response = getWebResponse( "/repository/internal/" + commonsLangSha1 );
91 assertResponseOK( response );
93 assertEquals( "Expected file contents", "dummy-checksum", response.getContentAsString() );
97 public void testGetNoProxyChecksumLegacyLayout()
100 String commonsLangSha1 = "commons-lang/commons-lang/2.1/commons-lang-2.1.jar.sha1";
102 Path checksumFile = repoRootInternal.resolve(commonsLangSha1);
103 Files.createDirectories(checksumFile.getParent());
105 org.apache.archiva.common.utils.FileUtils.writeStringToFile( checksumFile, Charset.defaultCharset() , "dummy-checksum");
107 //WebRequest request = new GetMethodWebRequest(
108 // "http://machine.com/repository/internal/" + "commons-lang/jars/commons-lang-2.1.jar.sha1" );
109 WebResponse response =
110 getWebResponse( "/repository/internal/" + "commons-lang/jars/commons-lang-2.1.jar.sha1" );
111 assertResponseNotFound( response );
115 public void testGetNoProxyVersionedMetadataDefaultLayout()
118 String commonsLangMetadata = "commons-lang/commons-lang/2.1/maven-metadata.xml";
119 String expectedMetadataContents = "dummy-versioned-metadata";
121 Path metadataFile = repoRootInternal.resolve(commonsLangMetadata);
122 Files.createDirectories(metadataFile.getParent());
124 org.apache.archiva.common.utils.FileUtils.writeStringToFile( metadataFile, Charset.defaultCharset(), expectedMetadataContents );
126 //WebRequest request = new GetMethodWebRequest( "http://machine.com/repository/internal/" + commonsLangMetadata );
127 WebResponse response = getWebResponse( "/repository/internal/" + commonsLangMetadata );
128 assertResponseOK( response );
130 assertEquals( "Expected file contents", expectedMetadataContents, response.getContentAsString() );
134 public void testGetNoProxyProjectMetadataDefaultLayout()
137 String commonsLangMetadata = "commons-lang/commons-lang/maven-metadata.xml";
138 String expectedMetadataContents = "dummy-project-metadata";
140 Path metadataFile = repoRootInternal.resolve(commonsLangMetadata);
141 Files.createDirectories(metadataFile.getParent());
143 org.apache.archiva.common.utils.FileUtils.writeStringToFile( metadataFile, Charset.defaultCharset(), expectedMetadataContents );
145 //WebRequest request = new GetMethodWebRequest( "http://machine.com/repository/internal/" + commonsLangMetadata );
146 WebResponse response = getWebResponse( "/repository/internal/" + commonsLangMetadata );
147 assertResponseOK( response );
149 assertEquals( "Expected file contents", expectedMetadataContents, response.getContentAsString() );
153 public void testGetNoProxyGroupMetadataDefaultLayout()
156 String commonsLangMetadata = "commons-lang/maven-metadata.xml";
157 String expectedMetadataContents = "dummy-group-metadata";
159 Path metadataFile = repoRootInternal.resolve(commonsLangMetadata);
160 Files.createDirectories(metadataFile.getParent());
162 org.apache.archiva.common.utils.FileUtils.writeStringToFile( metadataFile, Charset.defaultCharset(), expectedMetadataContents );
164 //WebRequest request = new GetMethodWebRequest( "http://machine.com/repository/internal/" + commonsLangMetadata );
165 WebResponse response = getWebResponse( "/repository/internal/" + commonsLangMetadata );
166 assertResponseOK( response );
168 assertEquals( "Expected file contents", expectedMetadataContents, response.getContentAsString() );
172 public void testGetNoProxyArtifactDefaultLayout()
175 String commonsLangJar = "commons-lang/commons-lang/2.1/commons-lang-2.1.jar";
176 String expectedArtifactContents = "dummy-commons-lang-artifact";
178 Path artifactFile = repoRootInternal.resolve(commonsLangJar);
179 Files.createDirectories(artifactFile.getParent());
181 org.apache.archiva.common.utils.FileUtils.writeStringToFile( artifactFile, Charset.defaultCharset(), expectedArtifactContents );
183 //WebRequest request = new GetMethodWebRequest( "http://machine.com/repository/internal/" + commonsLangJar );
184 WebResponse response = getWebResponse( "/repository/internal/" + commonsLangJar );
185 assertResponseOK( response );
187 assertEquals( "Expected file contents", expectedArtifactContents, response.getContentAsString() );
191 public void testGetNoProxyArtifactLegacyLayout()
194 String commonsLangJar = "commons-lang/commons-lang/2.1/commons-lang-2.1.jar";
195 String expectedArtifactContents = "dummy-commons-lang-artifact";
197 Path artifactFile = repoRootInternal.resolve(commonsLangJar);
198 Files.createDirectories(artifactFile.getParent());
200 org.apache.archiva.common.utils.FileUtils.writeStringToFile( artifactFile, Charset.defaultCharset(), expectedArtifactContents );
202 //WebRequest request = new GetMethodWebRequest(
203 // "http://machine.com/repository/internal/" + "commons-lang/jars/commons-lang-2.1.jar" );
204 WebResponse response = getWebResponse( "/repository/internal/" + "commons-lang/jars/commons-lang-2.1.jar" );
205 assertResponseNotFound( response );
210 public void testGetNoProxySnapshotArtifactDefaultLayout()
213 String commonsLangJar = "commons-lang/commons-lang/2.1-SNAPSHOT/commons-lang-2.1-SNAPSHOT.jar";
214 String expectedArtifactContents = "dummy-commons-lang-snapshot-artifact";
216 Path artifactFile = repoRootInternal.resolve(commonsLangJar);
217 Files.createDirectories(artifactFile.getParent());
219 org.apache.archiva.common.utils.FileUtils.writeStringToFile( artifactFile, Charset.defaultCharset() , expectedArtifactContents);
221 //WebRequest request = new GetMethodWebRequest( "http://machine.com/repository/internal/" + commonsLangJar );
222 WebResponse response = getWebResponse( "/repository/internal/" + commonsLangJar );
223 assertResponseOK( response );
225 assertEquals( "Expected file contents", expectedArtifactContents, response.getContentAsString() );
229 public void testGetNoProxySnapshotArtifactLegacyLayout()
232 String commonsLangJar = "commons-lang/commons-lang/2.1-SNAPSHOT/commons-lang-2.1-SNAPSHOT.jar";
233 String expectedArtifactContents = "dummy-commons-lang-snapshot-artifact";
235 Path artifactFile = repoRootInternal.resolve(commonsLangJar);
236 Files.createDirectories(artifactFile.getParent());
238 org.apache.archiva.common.utils.FileUtils.writeStringToFile( artifactFile, Charset.defaultCharset() , expectedArtifactContents);
240 //WebRequest request = new GetMethodWebRequest(
241 // "http://machine.com/repository/internal/" + "commons-lang/jars/commons-lang-2.1-SNAPSHOT.jar" );
242 WebResponse response = getWebResponse( "/repository/internal/commons-lang/jars/commons-lang-2.1-SNAPSHOT.jar" );
243 assertResponseNotFound( response );
247 public void testGetNoProxyTimestampedSnapshotArtifactDefaultLayout()
250 String commonsLangJar = "commons-lang/commons-lang/2.1-SNAPSHOT/commons-lang-2.1-20050821.023400-1.jar";
251 String expectedArtifactContents = "dummy-commons-lang-snapshot-artifact";
253 Path artifactFile = repoRootInternal.resolve(commonsLangJar);
254 Files.createDirectories(artifactFile.getParent());
256 org.apache.archiva.common.utils.FileUtils.writeStringToFile(artifactFile, Charset.defaultCharset(), expectedArtifactContents);
258 //WebRequest request = new GetMethodWebRequest( "http://machine.com/repository/internal/" + commonsLangJar );
259 WebResponse response = getWebResponse( "/repository/internal/" + commonsLangJar );
260 assertResponseOK( response );
262 assertEquals( "Expected file contents", expectedArtifactContents, response.getContentAsString() );
266 public void testGetNoProxyTimestampedSnapshotArtifactLegacyLayout()
269 String commonsLangJar = "commons-lang/commons-lang/2.1-SNAPSHOT/commons-lang-2.1-20050821.023400-1.jar";
270 String expectedArtifactContents = "dummy-commons-lang-snapshot-artifact";
272 Path artifactFile = repoRootInternal.resolve(commonsLangJar);
273 Files.createDirectories(artifactFile.getParent());
275 org.apache.archiva.common.utils.FileUtils.writeStringToFile(artifactFile, Charset.defaultCharset(), expectedArtifactContents);
277 WebRequest request = new GetMethodWebRequest(
278 "http://machine.com/repository/internal/" + "commons-lang/jars/commons-lang-2.1-20050821.023400-1.jar" );
279 WebResponse response = getServletUnitClient().getResponse( request );
280 assertResponseNotFound( response );
284 * [MRM-481] Artifact requests with a .xml.zip extension fail with a 404 Error
287 public void testGetNoProxyDualExtensionDefaultLayout()
290 String expectedContents = "the-contents-of-the-dual-extension";
291 String dualExtensionPath = "org/project/example-presentation/3.2/example-presentation-3.2.xml.zip";
293 Path checksumFile = repoRootInternal.resolve(dualExtensionPath);
294 Files.createDirectories(checksumFile.getParent());
296 org.apache.archiva.common.utils.FileUtils.writeStringToFile(checksumFile, Charset.defaultCharset(), expectedContents);
298 WebRequest request = new GetMethodWebRequest( "http://machine.com/repository/internal/" + dualExtensionPath );
299 WebResponse response = getServletUnitClient().getResponse( request );
300 assertResponseOK( response );
302 assertEquals( "Expected file contents", expectedContents, response.getContentAsString() );
306 public void testGetNoProxyDistributionLegacyLayout()
309 String expectedContents = "the-contents-of-the-dual-extension";
310 String dualExtensionPath = "org/project/example-presentation/3.2/example-presentation-3.2.zip";
312 Path checksumFile = repoRootInternal.resolve(dualExtensionPath);
313 Files.createDirectories(checksumFile.getParent());
315 org.apache.archiva.common.utils.FileUtils.writeStringToFile(checksumFile, Charset.defaultCharset(), expectedContents);
317 WebRequest request = new GetMethodWebRequest(
318 "http://machine.com/repository/internal/" + "org.project/distributions/example-presentation-3.2.zip" );
319 WebResponse response = getServletUnitClient().getResponse( request );
320 assertResponseNotFound( response );
325 public void testGetNoProxyChecksumDefaultLayoutManagedLegacy()
328 String commonsLangSha1 = "commons-lang/commons-lang/2.1/commons-lang-2.1.jar.sha1";
330 Path checksumFile = repoRootLegacy.resolve( "commons-lang/jars/commons-lang-2.1.jar.sha1" );
331 Files.createDirectories(checksumFile.getParent());
333 org.apache.archiva.common.utils.FileUtils.writeStringToFile( checksumFile, Charset.defaultCharset(), "dummy-checksum" );
335 WebRequest request = new GetMethodWebRequest( "http://machine.com/repository/legacy/" + commonsLangSha1 );
336 WebResponse response = getServletUnitClient().getResponse( request );
337 assertResponseNotFound( response );
341 public void testGetNoProxyChecksumLegacyLayoutManagedLegacy()
344 String commonsLangSha1 = "commons-lang/jars/commons-lang-2.1.jar.sha1";
345 Path checksumFile = repoRootLegacy.resolve(commonsLangSha1);
346 Files.createDirectories(checksumFile.getParent());
348 org.apache.archiva.common.utils.FileUtils.writeStringToFile(checksumFile, Charset.defaultCharset(), "dummy-checksum");
350 WebRequest request = new GetMethodWebRequest( "http://machine.com/repository/legacy/" + commonsLangSha1 );
351 WebResponse response = getServletUnitClient().getResponse( request );
352 assertResponseNotFound( response );
356 public void testGetNoProxyVersionedMetadataDefaultLayoutManagedLegacy()
359 String commonsLangMetadata = "commons-lang/commons-lang/2.1/maven-metadata.xml";
360 String expectedMetadataContents = "dummy-versioned-metadata";
362 // TODO: find out what this should be from maven-artifact
363 Path metadataFile = repoRootLegacy.resolve(commonsLangMetadata);
364 Files.createDirectories(metadataFile.getParent());
366 org.apache.archiva.common.utils.FileUtils.writeStringToFile(metadataFile, Charset.defaultCharset(), expectedMetadataContents);
368 WebRequest request = new GetMethodWebRequest( "http://machine.com/repository/legacy/" + commonsLangMetadata );
369 WebResponse response = getServletUnitClient().getResponse( request );
370 assertResponseNotFound( response );
374 public void testGetNoProxyProjectMetadataDefaultLayoutManagedLegacy()
377 // TODO: find out what it is meant to be from maven-artifact
378 String commonsLangMetadata = "commons-lang/commons-lang/maven-metadata.xml";
379 String expectedMetadataContents = "dummy-project-metadata";
381 Path metadataFile = repoRootLegacy.resolve(commonsLangMetadata);
382 Files.createDirectories(metadataFile.getParent());
384 org.apache.archiva.common.utils.FileUtils.writeStringToFile(metadataFile, Charset.defaultCharset(), expectedMetadataContents);
386 WebRequest request = new GetMethodWebRequest( "http://machine.com/repository/legacy/" + commonsLangMetadata );
387 WebResponse response = getServletUnitClient().getResponse( request );
388 assertResponseNotFound( response );
392 public void testGetNoProxyGroupMetadataDefaultLayoutManagedLegacy()
395 String commonsLangMetadata = "commons-lang/maven-metadata.xml";
396 String expectedMetadataContents = "dummy-group-metadata";
398 Path metadataFile = repoRootLegacy.resolve(commonsLangMetadata);
399 Files.createDirectories(metadataFile.getParent());
401 org.apache.archiva.common.utils.FileUtils.writeStringToFile(metadataFile, Charset.defaultCharset(), expectedMetadataContents);
403 WebRequest request = new GetMethodWebRequest( "http://machine.com/repository/legacy/" + commonsLangMetadata );
404 WebResponse response = getServletUnitClient().getResponse( request );
405 assertResponseNotFound( response );
409 public void testGetNoProxyArtifactDefaultLayoutManagedLegacy()
412 String commonsLangJar = "commons-lang/commons-lang/2.1/commons-lang-2.1.jar";
413 String expectedArtifactContents = "dummy-commons-lang-artifact";
415 Path artifactFile = repoRootLegacy.resolve("commons-lang/jars/commons-lang-2.1.jar" );
416 Files.createDirectories(artifactFile.getParent());
418 org.apache.archiva.common.utils.FileUtils.writeStringToFile(artifactFile, Charset.defaultCharset(), expectedArtifactContents);
420 WebRequest request = new GetMethodWebRequest( "http://machine.com/repository/legacy/" + commonsLangJar );
421 WebResponse response = getServletUnitClient().getResponse( request );
422 assertResponseNotFound( response );
426 public void testGetNoProxyArtifactLegacyLayoutManagedLegacy()
429 String commonsLangJar = "commons-lang/jars/commons-lang-2.1.jar";
430 String expectedArtifactContents = "dummy-commons-lang-artifact";
432 Path artifactFile = repoRootLegacy.resolve(commonsLangJar);
433 Files.createDirectories(artifactFile.getParent());
435 org.apache.archiva.common.utils.FileUtils.writeStringToFile(artifactFile, Charset.defaultCharset(), expectedArtifactContents);
437 WebRequest request = new GetMethodWebRequest( "http://machine.com/repository/legacy/" + commonsLangJar );
438 WebResponse response = getServletUnitClient().getResponse( request );
439 assertResponseNotFound( response );
443 public void testGetNoProxySnapshotArtifactDefaultLayoutManagedLegacy()
446 String commonsLangJar = "commons-lang/commons-lang/2.1-SNAPSHOT/commons-lang-2.1-SNAPSHOT.jar";
447 String expectedArtifactContents = "dummy-commons-lang-snapshot-artifact";
449 Path artifactFile = repoRootLegacy.resolve( "commons-lang/jars/commons-lang-2.1-SNAPSHOT.jar" );
450 Files.createDirectories(artifactFile.getParent());
452 org.apache.archiva.common.utils.FileUtils.writeStringToFile(artifactFile, Charset.defaultCharset(), expectedArtifactContents);
454 WebRequest request = new GetMethodWebRequest( "http://machine.com/repository/legacy/" + commonsLangJar );
455 WebResponse response = getServletUnitClient().getResponse( request );
456 assertResponseNotFound( response );
460 public void testGetNoProxySnapshotArtifactLegacyLayoutManagedLegacy()
463 String commonsLangJar = "commons-lang/jars/commons-lang-2.1-SNAPSHOT.jar";
464 String expectedArtifactContents = "dummy-commons-lang-snapshot-artifact";
466 Path artifactFile = repoRootLegacy.resolve(commonsLangJar);
467 Files.createDirectories(artifactFile.getParent());
469 org.apache.archiva.common.utils.FileUtils.writeStringToFile(artifactFile, Charset.defaultCharset(), expectedArtifactContents);
471 WebRequest request = new GetMethodWebRequest( "http://machine.com/repository/legacy/" + commonsLangJar );
472 WebResponse response = getServletUnitClient().getResponse( request );
473 assertResponseNotFound( response );
477 public void testGetNoProxyTimestampedSnapshotArtifactDefaultLayoutManagedLegacy()
480 String filename = "commons-lang-2.1-20050821.023400-1.jar";
481 String commonsLangJar = "commons-lang/commons-lang/2.1-SNAPSHOT/" + filename;
482 String expectedArtifactContents = "dummy-commons-lang-snapshot-artifact";
484 Path artifactFile = repoRootLegacy.resolve( "commons-lang/jars/" + filename );
485 Files.createDirectories(artifactFile.getParent());
487 org.apache.archiva.common.utils.FileUtils.writeStringToFile(artifactFile, Charset.defaultCharset(), expectedArtifactContents);
489 WebRequest request = new GetMethodWebRequest( "http://machine.com/repository/legacy/" + commonsLangJar );
490 WebResponse response = getServletUnitClient().getResponse( request );
491 assertResponseNotFound( response );
495 public void testGetNoProxyTimestampedSnapshotArtifactLegacyLayoutManagedLegacy()
498 String commonsLangJar = "commons-lang/jars/commons-lang-2.1-20050821.023400-1.jar";
499 String expectedArtifactContents = "dummy-commons-lang-snapshot-artifact";
501 Path artifactFile = repoRootLegacy.resolve(commonsLangJar);
502 Files.createDirectories(artifactFile.getParent());
504 org.apache.archiva.common.utils.FileUtils.writeStringToFile(artifactFile, Charset.defaultCharset(), expectedArtifactContents);
506 WebRequest request = new GetMethodWebRequest( "http://machine.com/repository/legacy/" + commonsLangJar );
507 WebResponse response = getServletUnitClient().getResponse( request );
508 assertResponseNotFound( response );
512 * [MRM-481] Artifact requests with a .xml.zip extension fail with a 404 Error
515 public void testGetNoProxyDualExtensionDefaultLayoutManagedLegacy()
518 String expectedContents = "the-contents-of-the-dual-extension";
519 String dualExtensionPath = "org/project/example-presentation/3.2/example-presentation-3.2.xml.zip";
521 Path checksumFile = repoRootLegacy.resolve( "org.project/distributions/example-presentation-3.2.xml.zip" );
522 Files.createDirectories(checksumFile.getParent());
524 org.apache.archiva.common.utils.FileUtils.writeStringToFile(checksumFile, Charset.defaultCharset(), expectedContents);
526 WebRequest request = new GetMethodWebRequest( "http://machine.com/repository/legacy/" + dualExtensionPath );
527 WebResponse response = getServletUnitClient().getResponse( request );
528 assertResponseNotFound( response );
532 public void testGetNoProxyDistributionLegacyLayoutManagedLegacy()
535 String expectedContents = "the-contents-of-the-dual-extension";
536 String dualExtensionPath = "org.project/distributions/example-presentation-3.2.zip";
538 Path checksumFile = repoRootLegacy.resolve(dualExtensionPath);
539 Files.createDirectories(checksumFile.getParent());
541 org.apache.archiva.common.utils.FileUtils.writeStringToFile(checksumFile, Charset.defaultCharset(), expectedContents);
543 WebRequest request = new GetMethodWebRequest( "http://machine.com/repository/legacy/" + dualExtensionPath );
544 WebResponse response = getServletUnitClient().getResponse( request );
545 assertResponseNotFound( response );
549 public void testGetNoProxySnapshotRedirectToTimestampedSnapshot()
552 String commonsLangQuery = "commons-lang/commons-lang/2.1-SNAPSHOT/commons-lang-2.1-SNAPSHOT.jar";
553 String commonsLangMetadata = "commons-lang/commons-lang/2.1-SNAPSHOT/maven-metadata.xml";
554 String commonsLangJar = "commons-lang/commons-lang/2.1-SNAPSHOT/commons-lang-2.1-20050821.023400-1.jar";
555 String expectedArtifactContents = "dummy-commons-lang-snapshot-artifact";
557 archivaConfiguration.getConfiguration().getWebapp().getUi().setApplicationUrl("http://localhost");
559 Path artifactFile = repoRootInternal.resolve(commonsLangJar);
560 Files.createDirectories(artifactFile.getParent());
561 org.apache.archiva.common.utils.FileUtils.writeStringToFile(artifactFile, Charset.defaultCharset(), expectedArtifactContents);
563 Path metadataFile = repoRootInternal.resolve(commonsLangMetadata);
564 Files.createDirectories(metadataFile.getParent());
565 org.apache.archiva.common.utils.FileUtils.writeStringToFile( metadataFile, Charset.defaultCharset(), createVersionMetadata("commons-lang", "commons-lang",
566 "2.1-SNAPSHOT", "20050821.023400", "1", "20050821.023400"));
568 WebRequest webRequest = new GetMethodWebRequest(
569 "http://localhost/repository/internal/" + commonsLangQuery );
571 MockHttpServletRequest request = new MockHttpServletRequest();
572 request.setRequestURI( webRequest.getUrl().getPath() );
573 request.addHeader( "User-Agent", "Apache Archiva unit test" );
574 request.setMethod( webRequest.getHttpMethod().name() );
576 final MockHttpServletResponse response = execute( request );
578 assertEquals( HttpServletResponse.SC_MOVED_TEMPORARILY,
579 response.getStatus() );
581 assertEquals( "http://localhost/repository/internal/" + commonsLangJar,
582 response.getHeader("Location") );