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.
33 * @version $Id: RepositoryServletProxiedReleasePolicyTest.java 590908 2007-11-01 06:21:26Z joakime $
35 public class RepositoryServletProxiedRelocatedTest
36 extends AbstractRepositoryServletProxiedTestCase
40 public void testGetProxiedReleaseArtifactPolicyOncePass()
44 setupCentralRemoteRepo();
45 setupCleanInternalRepo();
47 String resourcePath = "org/apache/archiva/test/1.0/test-1.0.jar";
48 String expectedRemoteContents = "archiva-test-1.0|jar-remote-contents";
49 populateRepo( remoteCentral, resourcePath, expectedRemoteContents );
51 resourcePath = "archiva/test/1.0/test-1.0.pom";
52 String pom = "<project>" +
53 "<modelVersion>4.0.0</modelVersion>" +
54 "<groupId>archiva</groupId>" +
55 "<artifactId>test</artifactId>" +
56 "<version>1.0</version>" +
57 "<distributionManagement>" +
59 "<groupId>org.apache.archiva</groupId>" +
61 "</distributionManagement>" +
63 populateRepo( remoteCentral, resourcePath, pom );
65 resourcePath = "archiva/jars/test-1.0.jar";
67 setupReleaseConnector( REPOID_INTERNAL, remoteCentral, ReleasesPolicy.ONCE );
71 // process the response code later, not via an exception.
72 HttpUnitOptions.setExceptionsThrownOnErrorStatus( false );
74 WebRequest request = new GetMethodWebRequest( "http://machine.com/repository/internal/" + resourcePath );
75 WebResponse response = getServletUnitClient().getResponse( request );
78 assertResponseOK( response );
79 assertEquals( "Expected remote file contents", expectedRemoteContents, response.getText() );