]> source.dussan.org Git - archiva.git/blob
ab6428654269c8be4540afe4a4370096a07419b9
[archiva.git] /
1 package org.apache.maven.archiva.webdav;
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 import java.io.File;
23
24 /**
25  * RepositoryServlet Tests, Proxied, Get of Metadata, exists on remote repository only. 
26  *
27  * @version $Id$
28  */
29 public class RepositoryServletProxiedMetadataRemoteOnlyTest
30     extends AbstractRepositoryServletProxiedMetadataTestCase
31 {
32     public void testGetProxiedSnapshotVersionMetadataRemoteOnly()
33         throws Exception
34     {
35         // --- Setup
36         setupSnapshotsRemoteRepo();
37         setupPrivateSnapshotsRemoteRepo();
38         setupCleanInternalRepo();
39
40         String path = "org/apache/archiva/archivatest-maven-plugin/4.0-alpha-1-SNAPSHOT/maven-metadata.xml";
41         String version = "4.0-alpha-1-SNAPSHOT";
42         String timestamp = "20040305.112233";
43         String buildNumber = "2";
44         String lastUpdated = "20040305112233";
45         String expectedMetadata = createVersionMetadata( "org.apache.archiva", "archivatest-maven-plugin",
46                                                          version, timestamp, buildNumber, lastUpdated);
47
48         File metadataFile = populateRepo( remoteSnapshots, path, expectedMetadata );
49
50         setupConnector( REPOID_INTERNAL, remoteSnapshots );
51         setupConnector( REPOID_INTERNAL, remotePrivateSnapshots );
52         saveConfiguration();
53
54         // --- Execution
55         String actualMetadata = requestMetadataOK( path );
56
57         // --- Verification
58         assertExpectedMetadata( expectedMetadata, actualMetadata );
59     }
60
61     public void testGetProxiedPluginSnapshotVersionMetadataRemoteOnly()
62         throws Exception
63     {
64         // --- Setup
65         setupSnapshotsRemoteRepo();
66         setupPrivateSnapshotsRemoteRepo();
67         setupCleanInternalRepo();
68         
69         String path = "org/apache/maven/plugins/maven-assembly-plugin/2.2-beta-2-SNAPSHOT/maven-metadata.xml";
70         String version = "2.2-beta-2-SNAPSHOT";
71         String timestamp = "20071017.162810";
72         String buildNumber = "20";
73         String lastUpdated = "20071017162810";
74         String expectedMetadata = createVersionMetadata( "org.apache.maven.plugins", "maven-assembly-plugin", version,
75                                                          timestamp, buildNumber, lastUpdated );
76
77         File metadataFile = populateRepo( remoteSnapshots, path, expectedMetadata );
78
79         setupConnector( REPOID_INTERNAL, remoteSnapshots );
80         setupConnector( REPOID_INTERNAL, remotePrivateSnapshots );
81         saveConfiguration();
82
83         // --- Execution
84         String actualMetadata = requestMetadataOK( path );
85
86         // --- Verification
87         assertExpectedMetadata( expectedMetadata, actualMetadata );
88     }
89
90     public void testGetProxiedVersionMetadataRemoteOnly()
91         throws Exception
92     {
93         // --- Setup
94         setupSnapshotsRemoteRepo();
95         setupPrivateSnapshotsRemoteRepo();
96         setupCleanInternalRepo();
97
98         String path = "org/apache/archiva/archivatest-maven-plugin/4.0-alpha-2/maven-metadata.xml";
99         String expectedMetadata = createVersionMetadata( "org.apache.archiva", "archivatest-maven-plugin",
100                                                          "4.0-alpha-2" );
101
102         File managedFile = populateRepo( remoteSnapshots, path, expectedMetadata );
103
104         setupConnector( REPOID_INTERNAL, remoteSnapshots );
105         setupConnector( REPOID_INTERNAL, remotePrivateSnapshots );
106         saveConfiguration();
107
108         // --- Execution
109         String actualMetadata = requestMetadataOK( path );
110
111         // --- Verification
112         assertExpectedMetadata( expectedMetadata, actualMetadata );
113     }
114
115     public void testGetProxiedProjectMetadataRemoteOnly()
116         throws Exception
117     {
118         // --- Setup
119         setupSnapshotsRemoteRepo();
120         setupPrivateSnapshotsRemoteRepo();
121         setupCleanInternalRepo();
122
123         String path = "org/apache/archiva/archivatest-maven-plugin/maven-metadata.xml";
124         String latest = "1.0-alpha-4";
125         String release = "1.0-alpha-4";
126         String expectedMetadata = createProjectMetadata( "org.apache.archiva", "archivatest-maven-plugin",
127                                                          latest, release, new String[] { "1.0-alpha-4" } );
128
129         File managedFile = populateRepo( remoteSnapshots, path, expectedMetadata );
130
131         setupConnector( REPOID_INTERNAL, remoteSnapshots );
132         setupConnector( REPOID_INTERNAL, remotePrivateSnapshots );
133         saveConfiguration();
134
135         // --- Execution
136         String actualMetadata = requestMetadataOK( path );
137
138         // --- Verification
139         assertExpectedMetadata( expectedMetadata, actualMetadata );
140     }
141
142     public void testGetProxiedGroupMetadataRemoteOnly()
143         throws Exception
144     {
145         // --- Setup
146         setupSnapshotsRemoteRepo();
147         setupPrivateSnapshotsRemoteRepo();
148         setupCleanInternalRepo();
149
150         String path = "org/apache/archiva/maven-metadata.xml";
151         String expectedMetadata = createGroupMetadata( "org.apache.archiva", new String[] { "archivatest-maven-plugin" } );
152
153         File managedFile = populateRepo( remoteSnapshots, path, expectedMetadata );
154
155         setupConnector( REPOID_INTERNAL, remoteSnapshots );
156         setupConnector( REPOID_INTERNAL, remotePrivateSnapshots );
157         saveConfiguration();
158
159         // --- Execution
160         String actualMetadata = requestMetadataOK( path );
161
162         // --- Verification
163         assertExpectedMetadata( expectedMetadata, actualMetadata );
164     }
165 }