View Javadoc

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