1 package org.apache.maven.archiva.webdav;
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22 import com.meterware.httpunit.GetMethodWebRequest;
23 import com.meterware.httpunit.HttpUnitOptions;
24 import com.meterware.httpunit.WebRequest;
25 import com.meterware.httpunit.WebResponse;
26
27 import org.apache.maven.archiva.policies.ReleasesPolicy;
28
29
30
31
32
33
34 public class RepositoryServletProxiedRelocatedTest
35 extends AbstractRepositoryServletProxiedTestCase
36 {
37 public void testGetProxiedReleaseArtifactPolicyOncePass()
38 throws Exception
39 {
40
41 setupCentralRemoteRepo();
42 setupCleanInternalRepo();
43
44 String resourcePath = "org/apache/archiva/test/1.0/test-1.0.jar";
45 String expectedRemoteContents = "archiva-test-1.0|jar-remote-contents";
46 populateRepo( remoteCentral, resourcePath, expectedRemoteContents );
47
48 resourcePath = "archiva/test/1.0/test-1.0.pom";
49 String pom = "<project>" +
50 "<modelVersion>4.0.0</modelVersion>" +
51 "<groupId>archiva</groupId>" +
52 "<artifactId>test</artifactId>" +
53 "<version>1.0</version>" +
54 "<distributionManagement>" +
55 "<relocation>" +
56 "<groupId>org.apache.archiva</groupId>" +
57 "</relocation>" +
58 "</distributionManagement>" +
59 "</project>";
60 populateRepo( remoteCentral, resourcePath, pom );
61
62 resourcePath = "archiva/jars/test-1.0.jar";
63
64 setupReleaseConnector( REPOID_INTERNAL, remoteCentral, ReleasesPolicy.ONCE );
65 saveConfiguration();
66
67
68
69 HttpUnitOptions.setExceptionsThrownOnErrorStatus( false );
70
71 WebRequest request = new GetMethodWebRequest( "http://machine.com/repository/internal/" + resourcePath );
72 WebResponse response = sc.getResponse( request );
73
74
75 assertResponseOK( response );
76 assertEquals( "Expected remote file contents", expectedRemoteContents, response.getText() );
77 }
78 }