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.2KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147
  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.apache.archiva.repository.base.RepositoryHandlerDependencies;
  27. import org.junit.Before;
  28. import org.junit.Test;
  29. import javax.inject.Inject;
  30. import javax.inject.Named;
  31. public class Maven2RepositoryMetadataResolverManagedReleaseTest
  32. extends Maven2RepositoryMetadataResolverTest
  33. {
  34. private static final Filter<String> ALL = new AllFilter<String>();
  35. @Inject
  36. @Named ( "repositoryStorage#maven2")
  37. private Maven2RepositoryStorage storage;
  38. @Inject
  39. RepositoryRegistry repositoryRegistry;
  40. @SuppressWarnings( "unused" )
  41. @Inject
  42. RepositoryHandlerDependencies repositoryHandlerDependencies;
  43. private static final String TEST_REPO_ID = "test";
  44. private static final String TEST_REMOTE_REPO_ID = "central";
  45. private static final String ASF_SCM_CONN_BASE = "scm:svn:http://svn.apache.org/repos/asf/";
  46. private static final String ASF_SCM_DEV_CONN_BASE = "scm:svn:https://svn.apache.org/repos/asf/";
  47. private static final String ASF_SCM_VIEWVC_BASE = "http://svn.apache.org/viewvc/";
  48. private static final String TEST_SCM_CONN_BASE = "scm:svn:http://svn.example.com/repos/";
  49. private static final String TEST_SCM_DEV_CONN_BASE = "scm:svn:https://svn.example.com/repos/";
  50. private static final String TEST_SCM_URL_BASE = "http://svn.example.com/repos/";
  51. private static final String EMPTY_MD5 = "d41d8cd98f00b204e9800998ecf8427e";
  52. private static final String EMPTY_SHA1 = "da39a3ee5e6b4b0d3255bfef95601890afd80709";
  53. private WagonFactory wagonFactory;
  54. @Before
  55. @Override
  56. public void setUp()
  57. throws Exception
  58. {
  59. super.setUp();
  60. testRepo.setReleases( true );
  61. testRepo.setSnapshots( false );
  62. configuration.save( c );
  63. repositoryRegistry.reload();
  64. assertFalse( c.getManagedRepositories().get( 0 ).isSnapshots() );
  65. assertTrue( c.getManagedRepositories().get( 0 ).isReleases() );
  66. }
  67. @Test
  68. @Override
  69. public void testModelWithJdkProfileActivation()
  70. throws Exception
  71. {
  72. // skygo IMHO must fail because TEST_REPO_ID ( is snap ,no release) and we seek for a snapshot
  73. ReadMetadataRequest readMetadataRequest =
  74. new ReadMetadataRequest().repositoryId( TEST_REPO_ID ).namespace( "org.apache.maven" ).projectId(
  75. "maven-archiver" ).projectVersion( "2.4.1" );
  76. ProjectVersionMetadata metadata = storage.readProjectVersionMetadata( readMetadataRequest );
  77. }
  78. @Test (expected = RepositoryStorageRuntimeException.class)
  79. @Override
  80. public void testGetProjectVersionMetadataForTimestampedSnapshotMissingMetadata()
  81. throws Exception
  82. {
  83. ReadMetadataRequest readMetadataRequest =
  84. new ReadMetadataRequest().repositoryId( TEST_REPO_ID ).namespace( "com.example.test" ).projectId(
  85. "missing-metadata" ).projectVersion( "1.0-SNAPSHOT" );
  86. storage.readProjectVersionMetadata( readMetadataRequest );
  87. }
  88. @Test (expected = RepositoryStorageRuntimeException.class)
  89. @Override
  90. public void testGetProjectVersionMetadataForTimestampedSnapshotMalformedMetadata()
  91. throws Exception
  92. {
  93. ReadMetadataRequest readMetadataRequest =
  94. new ReadMetadataRequest().repositoryId( TEST_REPO_ID ).namespace( "com.example.test" ).projectVersion(
  95. "malformed-metadata" ).projectVersion( "1.0-SNAPSHOT" );
  96. storage.readProjectVersionMetadata( readMetadataRequest );
  97. }
  98. @Test (expected = RepositoryStorageRuntimeException.class)
  99. @Override
  100. public void testGetProjectVersionMetadataForTimestampedSnapshot()
  101. throws Exception
  102. {
  103. super.testGetProjectVersionMetadataForTimestampedSnapshot();
  104. }
  105. @Test (expected = RepositoryStorageRuntimeException.class)
  106. @Override
  107. public void testGetProjectVersionMetadataForTimestampedSnapshotIncompleteMetadata()
  108. throws Exception
  109. {
  110. super.testGetProjectVersionMetadataForTimestampedSnapshotIncompleteMetadata();
  111. }
  112. }