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