]> source.dussan.org Git - archiva.git/blob
883f382524b668fa1e2d97a70a212f675cdbc37f
[archiva.git] /
1 package org.apache.maven.archiva.web.repository;
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  * RepositoryServlet Tests, Proxied, Get of Metadata, exists on local managed repository only. 
24  *
25  * @author <a href="mailto:joakime@apache.org">Joakim Erdfelt</a>
26  * @version $Id$
27  */
28 public class RepositoryServletProxiedMetadataLocalOnlyTest
29     extends AbstractRepositoryServletProxiedMetadataTestCase
30 {
31     public void testGetProxiedSnapshotVersionMetadataLocalOnly()
32         throws Exception
33     {
34         // --- Setup
35         setupSnapshotsRemoteRepo();
36         setupPrivateSnapshotsRemoteRepo();
37         setupCleanInternalRepo();
38
39         String path = "org/apache/archiva/archivatest-maven-plugin/4.0-alpha-1-SNAPSHOT/maven-metadata.xml";
40         String expectedMetadata = createVersionMetadata( "org.apache.archiva", "archivatest-maven-plugin",
41                                                          "4.0-alpha-1-SNAPSHOT" );
42
43         populateRepo( repoRootInternal, path, expectedMetadata );
44
45         setupConnector( REPOID_INTERNAL, remoteSnapshots );
46         setupConnector( REPOID_INTERNAL, remotePrivateSnapshots );
47
48         // --- Execution
49         String actualMetadata = requestMetadataOK( path );
50
51         // --- Verification
52         assertExpectedMetadata( expectedMetadata, actualMetadata );
53     }
54
55     public void testGetProxiedVersionMetadataLocalOnly()
56         throws Exception
57     {
58         // --- Setup
59         setupSnapshotsRemoteRepo();
60         setupPrivateSnapshotsRemoteRepo();
61         setupCleanInternalRepo();
62
63         String path = "org/apache/archiva/archivatest-maven-plugin/4.0-alpha-2/maven-metadata.xml";
64         String expectedMetadata = createVersionMetadata( "org.apache.archiva", "archivatest-maven-plugin",
65                                                          "4.0-alpha-2" );
66
67         populateRepo( repoRootInternal, path, expectedMetadata );
68
69         // --- Execution
70         String actualMetadata = requestMetadataOK( path );
71
72         // --- Verification
73         assertExpectedMetadata( expectedMetadata, actualMetadata );
74     }
75
76     public void testGetProxiedProjectMetadataLocalOnly()
77         throws Exception
78     {
79         // --- Setup
80         setupSnapshotsRemoteRepo();
81         setupPrivateSnapshotsRemoteRepo();
82         setupCleanInternalRepo();
83
84         String path = "org/apache/archiva/archivatest-maven-plugin/maven-metadata.xml";
85         String version = "1.0-alpha-4";
86         String release = "1.0-alpha-4";
87         String expectedMetadata = createProjectMetadata( "org.apache.archiva", "archivatest-maven-plugin", version,
88                                                          release, new String[] { "1.0-alpha-4" } );
89
90         populateRepo( repoRootInternal, path, expectedMetadata );
91
92         // --- Execution
93         String actualMetadata = requestMetadataOK( path );
94
95         // --- Verification
96         assertExpectedMetadata( expectedMetadata, actualMetadata );
97     }
98
99     public void testGetProxiedGroupMetadataLocalOnly()
100         throws Exception
101     {
102         // --- Setup
103         setupSnapshotsRemoteRepo();
104         setupPrivateSnapshotsRemoteRepo();
105         setupCleanInternalRepo();
106
107         String path = "org/apache/archiva/maven-metadata.xml";
108         String expectedMetadata = createGroupMetadata( "org.apache.archiva", new String[] { "archivatest-maven-plugin" } );
109
110         populateRepo( repoRootInternal, path, expectedMetadata );
111
112         // --- Execution
113         String actualMetadata = requestMetadataOK( path );
114
115         // --- Verification
116         assertExpectedMetadata( expectedMetadata, actualMetadata );
117     }
118 }