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.

Maven2RepositoryMetadataResolverManagedReleaseTest.java 5.0KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141
  1. package org.apache.archiva.repository.maven.metadata.storage;
  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. * Unless required by applicable law or agreed to in writing,
  13. * software distributed under the License is distributed on an
  14. * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
  15. * KIND, either express or implied. See the License for the
  16. * specific language governing permissions and limitations
  17. * under the License.
  18. */
  19. import org.apache.archiva.filter.AllFilter;
  20. import org.apache.archiva.filter.Filter;
  21. import org.apache.archiva.metadata.model.ProjectVersionMetadata;
  22. import org.apache.archiva.metadata.repository.storage.ReadMetadataRequest;
  23. import org.apache.archiva.metadata.repository.storage.RepositoryStorageRuntimeException;
  24. import org.apache.archiva.proxy.maven.WagonFactory;
  25. import org.apache.archiva.repository.RepositoryRegistry;
  26. import org.junit.Before;
  27. import org.junit.Test;
  28. import javax.inject.Inject;
  29. import javax.inject.Named;
  30. public class Maven2RepositoryMetadataResolverManagedReleaseTest
  31. extends Maven2RepositoryMetadataResolverTest
  32. {
  33. private static final Filter<String> ALL = new AllFilter<String>();
  34. @Inject
  35. @Named ( "repositoryStorage#maven2")
  36. private Maven2RepositoryStorage storage;
  37. @Inject
  38. RepositoryRegistry repositoryRegistry;
  39. private static final String TEST_REPO_ID = "test";
  40. private static final String TEST_REMOTE_REPO_ID = "central";
  41. private static final String ASF_SCM_CONN_BASE = "scm:svn:http://svn.apache.org/repos/asf/";
  42. private static final String ASF_SCM_DEV_CONN_BASE = "scm:svn:https://svn.apache.org/repos/asf/";
  43. private static final String ASF_SCM_VIEWVC_BASE = "http://svn.apache.org/viewvc/";
  44. private static final String TEST_SCM_CONN_BASE = "scm:svn:http://svn.example.com/repos/";
  45. private static final String TEST_SCM_DEV_CONN_BASE = "scm:svn:https://svn.example.com/repos/";
  46. private static final String TEST_SCM_URL_BASE = "http://svn.example.com/repos/";
  47. private static final String EMPTY_MD5 = "d41d8cd98f00b204e9800998ecf8427e";
  48. private static final String EMPTY_SHA1 = "da39a3ee5e6b4b0d3255bfef95601890afd80709";
  49. private WagonFactory wagonFactory;
  50. @Before
  51. @Override
  52. public void setUp()
  53. throws Exception
  54. {
  55. super.setUp();
  56. testRepo.setReleases( true );
  57. testRepo.setSnapshots( false );
  58. configuration.save( c );
  59. repositoryRegistry.reload();
  60. assertFalse( c.getManagedRepositories().get( 0 ).isSnapshots() );
  61. assertTrue( c.getManagedRepositories().get( 0 ).isReleases() );
  62. }
  63. @Test
  64. @Override
  65. public void testModelWithJdkProfileActivation()
  66. throws Exception
  67. {
  68. // skygo IMHO must fail because TEST_REPO_ID ( is snap ,no release) and we seek for a snapshot
  69. ReadMetadataRequest readMetadataRequest =
  70. new ReadMetadataRequest().repositoryId( TEST_REPO_ID ).namespace( "org.apache.maven" ).projectId(
  71. "maven-archiver" ).projectVersion( "2.4.1" );
  72. ProjectVersionMetadata metadata = storage.readProjectVersionMetadata( readMetadataRequest );
  73. }
  74. @Test (expected = RepositoryStorageRuntimeException.class)
  75. @Override
  76. public void testGetProjectVersionMetadataForTimestampedSnapshotMissingMetadata()
  77. throws Exception
  78. {
  79. ReadMetadataRequest readMetadataRequest =
  80. new ReadMetadataRequest().repositoryId( TEST_REPO_ID ).namespace( "com.example.test" ).projectId(
  81. "missing-metadata" ).projectVersion( "1.0-SNAPSHOT" );
  82. storage.readProjectVersionMetadata( readMetadataRequest );
  83. }
  84. @Test (expected = RepositoryStorageRuntimeException.class)
  85. @Override
  86. public void testGetProjectVersionMetadataForTimestampedSnapshotMalformedMetadata()
  87. throws Exception
  88. {
  89. ReadMetadataRequest readMetadataRequest =
  90. new ReadMetadataRequest().repositoryId( TEST_REPO_ID ).namespace( "com.example.test" ).projectVersion(
  91. "malformed-metadata" ).projectVersion( "1.0-SNAPSHOT" );
  92. storage.readProjectVersionMetadata( readMetadataRequest );
  93. }
  94. @Test (expected = RepositoryStorageRuntimeException.class)
  95. @Override
  96. public void testGetProjectVersionMetadataForTimestampedSnapshot()
  97. throws Exception
  98. {
  99. super.testGetProjectVersionMetadataForTimestampedSnapshot();
  100. }
  101. @Test (expected = RepositoryStorageRuntimeException.class)
  102. @Override
  103. public void testGetProjectVersionMetadataForTimestampedSnapshotIncompleteMetadata()
  104. throws Exception
  105. {
  106. super.testGetProjectVersionMetadataForTimestampedSnapshotIncompleteMetadata();
  107. }
  108. }