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