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   * RepositoryServlet Tests, Proxied, Get of Metadata, exists on local managed repository only. 
24   *
25   * @version $Id: RepositoryServletProxiedMetadataLocalOnlyTest.java 718864 2008-11-19 06:33:35Z brett $
26   */
27  public class RepositoryServletProxiedMetadataLocalOnlyTest
28      extends AbstractRepositoryServletProxiedMetadataTestCase
29  {
30      public void testGetProxiedSnapshotVersionMetadataLocalOnly()
31          throws Exception
32      {
33          // --- Setup
34          setupSnapshotsRemoteRepo();
35          setupPrivateSnapshotsRemoteRepo();
36          setupCleanInternalRepo();
37  
38          String path = "org/apache/archiva/archivatest-maven-plugin/4.0-alpha-1-SNAPSHOT/maven-metadata.xml";
39          String expectedMetadata = createVersionMetadata( "org.apache.archiva", "archivatest-maven-plugin",
40                                                           "4.0-alpha-1-SNAPSHOT" );
41  
42          populateRepo( repoRootInternal, path, expectedMetadata );
43  
44          setupConnector( REPOID_INTERNAL, remoteSnapshots );
45          setupConnector( REPOID_INTERNAL, remotePrivateSnapshots );
46  
47          // --- Execution
48          String actualMetadata = requestMetadataOK( path );
49  
50          // --- Verification
51          assertExpectedMetadata( expectedMetadata, actualMetadata );
52      }
53  
54      public void testGetProxiedVersionMetadataLocalOnly()
55          throws Exception
56      {
57          // --- Setup
58          setupSnapshotsRemoteRepo();
59          setupPrivateSnapshotsRemoteRepo();
60          setupCleanInternalRepo();
61  
62          String path = "org/apache/archiva/archivatest-maven-plugin/4.0-alpha-2/maven-metadata.xml";
63          String expectedMetadata = createVersionMetadata( "org.apache.archiva", "archivatest-maven-plugin",
64                                                           "4.0-alpha-2" );
65  
66          populateRepo( repoRootInternal, path, expectedMetadata );
67  
68          // --- Execution
69          String actualMetadata = requestMetadataOK( path );
70  
71          // --- Verification
72          assertExpectedMetadata( expectedMetadata, actualMetadata );
73      }
74  
75      public void testGetProxiedProjectMetadataLocalOnly()
76          throws Exception
77      {
78          // --- Setup
79          setupSnapshotsRemoteRepo();
80          setupPrivateSnapshotsRemoteRepo();
81          setupCleanInternalRepo();
82  
83          String path = "org/apache/archiva/archivatest-maven-plugin/maven-metadata.xml";
84          String version = "1.0-alpha-4";
85          String release = "1.0-alpha-4";
86          String expectedMetadata = createProjectMetadata( "org.apache.archiva", "archivatest-maven-plugin", version,
87                                                           release, new String[] { "1.0-alpha-4" } );
88  
89          populateRepo( repoRootInternal, path, expectedMetadata );
90  
91          // --- Execution
92          String actualMetadata = requestMetadataOK( path );
93  
94          // --- Verification
95          assertExpectedMetadata( expectedMetadata, actualMetadata );
96      }
97  
98      public void testGetProxiedGroupMetadataLocalOnly()
99          throws Exception
100     {
101         // --- Setup
102         setupSnapshotsRemoteRepo();
103         setupPrivateSnapshotsRemoteRepo();
104         setupCleanInternalRepo();
105 
106         String path = "org/apache/archiva/maven-metadata.xml";
107         String expectedMetadata = createGroupMetadata( "org.apache.archiva", new String[] { "archivatest-maven-plugin" } );
108 
109         populateRepo( repoRootInternal, path, expectedMetadata );
110 
111         // --- Execution
112         String actualMetadata = requestMetadataOK( path );
113 
114         // --- Verification
115         assertExpectedMetadata( expectedMetadata, actualMetadata );
116     }
117 }