You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

RepositoryServletProxiedMetadataRemoteOnlyTest.java 6.2KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194
  1. package org.apache.archiva.webdav;
  2. /*
  3. * Licensed to the Apache Software Foundation (ASF) under one
  4. * or more contributor license agreements. See the NOTICE file
  5. * distributed with this work for additional information
  6. * regarding copyright ownership. The ASF licenses this file
  7. * to you under the Apache License, Version 2.0 (the
  8. * "License"); you may not use this file except in compliance
  9. * with the License. You may obtain a copy of the License at
  10. *
  11. * http://www.apache.org/licenses/LICENSE-2.0
  12. *
  13. * Unless required by applicable law or agreed to in writing,
  14. * software distributed under the License is distributed on an
  15. * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
  16. * KIND, either express or implied. See the License for the
  17. * specific language governing permissions and limitations
  18. * under the License.
  19. */
  20. import org.junit.After;
  21. import org.junit.Before;
  22. import org.junit.Test;
  23. /**
  24. * RepositoryServlet Tests, Proxied, Get of Metadata, exists on remote repository only.
  25. *
  26. *
  27. */
  28. public class RepositoryServletProxiedMetadataRemoteOnlyTest
  29. extends AbstractRepositoryServletProxiedMetadataTestCase
  30. {
  31. @Before
  32. public void setup()
  33. throws Exception
  34. {
  35. super.setUp();
  36. }
  37. @After
  38. @Override
  39. public void tearDown()
  40. throws Exception
  41. {
  42. super.tearDown();
  43. }
  44. @Test
  45. public void testGetProxiedSnapshotVersionMetadataRemoteOnly()
  46. throws Exception
  47. {
  48. // --- Setup
  49. setupSnapshotsRemoteRepo();
  50. setupPrivateSnapshotsRemoteRepo();
  51. setupCleanInternalRepo();
  52. String path = "org/apache/archiva/archivatest-maven-plugin/4.0-alpha-1-SNAPSHOT/maven-metadata.xml";
  53. String version = "4.0-alpha-1-SNAPSHOT";
  54. String timestamp = "20040305.112233";
  55. String buildNumber = "2";
  56. String lastUpdated = "20040305112233";
  57. String expectedMetadata =
  58. createVersionMetadata( "org.apache.archiva", "archivatest-maven-plugin", version, timestamp, buildNumber,
  59. lastUpdated );
  60. populateRepo( remoteSnapshots, path, expectedMetadata );
  61. setupConnector( REPOID_INTERNAL, remoteSnapshots );
  62. setupConnector( REPOID_INTERNAL, remotePrivateSnapshots );
  63. saveConfiguration();
  64. // --- Execution
  65. String actualMetadata = requestMetadataOK( path );
  66. // --- Verification
  67. assertExpectedMetadata( expectedMetadata, actualMetadata );
  68. }
  69. @Test
  70. public void testGetProxiedPluginSnapshotVersionMetadataRemoteOnly()
  71. throws Exception
  72. {
  73. // --- Setup
  74. setupSnapshotsRemoteRepo();
  75. setupPrivateSnapshotsRemoteRepo();
  76. setupCleanInternalRepo();
  77. String path = "org/apache/maven/plugins/maven-assembly-plugin/2.2-beta-2-SNAPSHOT/maven-metadata.xml";
  78. String version = "2.2-beta-2-SNAPSHOT";
  79. String timestamp = "20071017.162810";
  80. String buildNumber = "20";
  81. String lastUpdated = "20071017162810";
  82. String expectedMetadata =
  83. createVersionMetadata( "org.apache.maven.plugins", "maven-assembly-plugin", version, timestamp, buildNumber,
  84. lastUpdated );
  85. populateRepo( remoteSnapshots, path, expectedMetadata );
  86. setupConnector( REPOID_INTERNAL, remoteSnapshots );
  87. setupConnector( REPOID_INTERNAL, remotePrivateSnapshots );
  88. saveConfiguration();
  89. // --- Execution
  90. String actualMetadata = requestMetadataOK( path );
  91. // --- Verification
  92. assertExpectedMetadata( expectedMetadata, actualMetadata );
  93. }
  94. @Test
  95. public void testGetProxiedVersionMetadataRemoteOnly()
  96. throws Exception
  97. {
  98. // --- Setup
  99. setupSnapshotsRemoteRepo();
  100. setupPrivateSnapshotsRemoteRepo();
  101. setupCleanInternalRepo();
  102. String path = "org/apache/archiva/archivatest-maven-plugin/4.0-alpha-2/maven-metadata.xml";
  103. String expectedMetadata =
  104. createVersionMetadata( "org.apache.archiva", "archivatest-maven-plugin", "4.0-alpha-2" );
  105. populateRepo( remoteSnapshots, path, expectedMetadata );
  106. setupConnector( REPOID_INTERNAL, remoteSnapshots );
  107. setupConnector( REPOID_INTERNAL, remotePrivateSnapshots );
  108. saveConfiguration();
  109. // --- Execution
  110. String actualMetadata = requestMetadataOK( path );
  111. // --- Verification
  112. assertExpectedMetadata( expectedMetadata, actualMetadata );
  113. }
  114. @Test
  115. public void testGetProxiedProjectMetadataRemoteOnly()
  116. throws Exception
  117. {
  118. // --- Setup
  119. setupSnapshotsRemoteRepo();
  120. setupPrivateSnapshotsRemoteRepo();
  121. setupCleanInternalRepo();
  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 =
  126. createProjectMetadata( "org.apache.archiva", "archivatest-maven-plugin", latest, release,
  127. new String[]{ "1.0-alpha-4" } );
  128. populateRepo( remoteSnapshots, path, expectedMetadata );
  129. setupConnector( REPOID_INTERNAL, remoteSnapshots );
  130. setupConnector( REPOID_INTERNAL, remotePrivateSnapshots );
  131. saveConfiguration();
  132. // --- Execution
  133. String actualMetadata = requestMetadataOK( path );
  134. // --- Verification
  135. assertExpectedMetadata( expectedMetadata, actualMetadata );
  136. }
  137. @Test
  138. public void testGetProxiedGroupMetadataRemoteOnly()
  139. throws Exception
  140. {
  141. // --- Setup
  142. setupSnapshotsRemoteRepo();
  143. setupPrivateSnapshotsRemoteRepo();
  144. setupCleanInternalRepo();
  145. String path = "org/apache/archiva/maven-metadata.xml";
  146. String expectedMetadata =
  147. createGroupMetadata( "org.apache.archiva", new String[]{ "archivatest-maven-plugin" } );
  148. populateRepo( remoteSnapshots, path, expectedMetadata );
  149. setupConnector( REPOID_INTERNAL, remoteSnapshots );
  150. setupConnector( REPOID_INTERNAL, remotePrivateSnapshots );
  151. saveConfiguration();
  152. // --- Execution
  153. String actualMetadata = requestMetadataOK( path );
  154. // --- Verification
  155. assertExpectedMetadata( expectedMetadata, actualMetadata );
  156. }
  157. }