View Javadoc
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   *
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      @Override
44      public void tearDown()
45          throws Exception
46      {
47          super.tearDown();
48      }
49  
50      @Test
51      public void testGetProxiedSnapshotVersionMetadataLocalOnly()
52          throws Exception
53      {
54          // --- Setup
55          setupSnapshotsRemoteRepo();
56          setupPrivateSnapshotsRemoteRepo();
57          setupCleanInternalRepo();
58  
59          String path = "org/apache/archiva/archivatest-maven-plugin/4.0-alpha-1-SNAPSHOT/maven-metadata.xml";
60          String expectedMetadata = createVersionMetadata( "org.apache.archiva", "archivatest-maven-plugin",
61                                                           "4.0-alpha-1-SNAPSHOT" );
62  
63          populateRepo( repoRootInternal, path, expectedMetadata );
64  
65          setupConnector( REPOID_INTERNAL, remoteSnapshots );
66          setupConnector( REPOID_INTERNAL, remotePrivateSnapshots );
67  
68          // --- Execution
69          String actualMetadata = requestMetadataOK( path );
70  
71          // --- Verification
72          assertExpectedMetadata( expectedMetadata, actualMetadata );
73      }
74  
75      @Test
76      public void testGetProxiedVersionMetadataLocalOnly()
77          throws Exception
78      {
79          // --- Setup
80          setupSnapshotsRemoteRepo();
81          setupPrivateSnapshotsRemoteRepo();
82          setupCleanInternalRepo();
83  
84          String path = "org/apache/archiva/archivatest-maven-plugin/4.0-alpha-2/maven-metadata.xml";
85          String expectedMetadata = createVersionMetadata( "org.apache.archiva", "archivatest-maven-plugin",
86                                                           "4.0-alpha-2" );
87  
88          populateRepo( repoRootInternal, path, expectedMetadata );
89  
90          // --- Execution
91          String actualMetadata = requestMetadataOK( path );
92  
93          // --- Verification
94          assertExpectedMetadata( expectedMetadata, actualMetadata );
95      }
96  
97      @Test
98      public void testGetProxiedProjectMetadataLocalOnly()
99          throws Exception
100     {
101         // --- Setup
102         setupSnapshotsRemoteRepo();
103         setupPrivateSnapshotsRemoteRepo();
104         setupCleanInternalRepo();
105 
106         String path = "org/apache/archiva/archivatest-maven-plugin/maven-metadata.xml";
107         String version = "1.0-alpha-4";
108         String release = "1.0-alpha-4";
109         String expectedMetadata = createProjectMetadata( "org.apache.archiva", "archivatest-maven-plugin", version,
110                                                          release, new String[] { "1.0-alpha-4" } );
111 
112         populateRepo( repoRootInternal, path, expectedMetadata );
113 
114         // --- Execution
115         String actualMetadata = requestMetadataOK( path );
116 
117         // --- Verification
118         assertExpectedMetadata( expectedMetadata, actualMetadata );
119     }
120 
121     @Test
122     public void testGetProxiedGroupMetadataLocalOnly()
123         throws Exception
124     {
125         // --- Setup
126         setupSnapshotsRemoteRepo();
127         setupPrivateSnapshotsRemoteRepo();
128         setupCleanInternalRepo();
129 
130         String path = "org/apache/archiva/maven-metadata.xml";
131         String expectedMetadata = createGroupMetadata( "org.apache.archiva", new String[] { "archivatest-maven-plugin" } );
132 
133         populateRepo( repoRootInternal, path, expectedMetadata );
134 
135         // --- Execution
136         String actualMetadata = requestMetadataOK( path );
137 
138         // --- Verification
139         assertExpectedMetadata( expectedMetadata, actualMetadata );
140     }
141 }