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