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
22 import com.meterware.httpunit.GetMethodWebRequest;
23 import com.meterware.httpunit.HttpUnitOptions;
24 import com.meterware.httpunit.WebRequest;
25 import com.meterware.httpunit.WebResponse;
27 import org.apache.archiva.policies.ReleasesPolicy;
28 import org.junit.Test;
31 * RepositoryServlet Tests, Proxied, Get of Release Artifacts, with varying policy settings.
34 public class RepositoryServletProxiedRelocatedTest
35 extends AbstractRepositoryServletProxiedTestCase
39 public void testGetProxiedReleaseArtifactPolicyOncePass()
43 setupCentralRemoteRepo();
44 setupCleanInternalRepo();
46 String resourcePath = "org/apache/archiva/test/1.0/test-1.0.jar";
47 String expectedRemoteContents = "archiva-test-1.0|jar-remote-contents";
48 populateRepo( remoteCentral, resourcePath, expectedRemoteContents );
50 resourcePath = "archiva/test/1.0/test-1.0.pom";
51 String pom = "<project>" +
52 "<modelVersion>4.0.0</modelVersion>" +
53 "<groupId>archiva</groupId>" +
54 "<artifactId>test</artifactId>" +
55 "<version>1.0</version>" +
56 "<distributionManagement>" +
58 "<groupId>org.apache.archiva</groupId>" +
60 "</distributionManagement>" +
62 populateRepo( remoteCentral, resourcePath, pom );
64 resourcePath = "archiva/jars/test-1.0.jar";
66 setupReleaseConnector( REPOID_INTERNAL, remoteCentral, ReleasesPolicy.ONCE );
70 // process the response code later, not via an exception.
71 HttpUnitOptions.setExceptionsThrownOnErrorStatus( false );
73 WebRequest request = new GetMethodWebRequest( "http://machine.com/repository/internal/" + resourcePath );
74 WebResponse response = getServletUnitClient().getResponse( request );
77 assertResponseOK( response );
78 assertEquals( "Expected remote file contents", expectedRemoteContents, response.getText() );