1 package org.apache.archiva.metadata.repository.storage.maven2;
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22 import org.apache.archiva.metadata.model.ProjectVersionMetadata;
23 import org.apache.archiva.metadata.repository.filter.AllFilter;
24 import org.apache.archiva.metadata.repository.filter.Filter;
25 import org.apache.archiva.metadata.repository.storage.ReadMetadataRequest;
26 import org.apache.archiva.metadata.repository.storage.RepositoryStorageRuntimeException;
27 import org.apache.archiva.proxy.common.WagonFactory;
28 import org.junit.Before;
29 import org.junit.Test;
30
31 import javax.inject.Inject;
32 import javax.inject.Named;
33
34
35 public class Maven2RepositoryMetadataResolverManagedReleaseTest
36 extends Maven2RepositoryMetadataResolverTest
37 {
38 private static final Filter<String> ALL = new AllFilter<String>();
39
40 @Inject
41 @Named ( "repositoryStorage#maven2")
42 private Maven2RepositoryStorage storage;
43
44 private static final String TEST_REPO_ID = "test";
45
46 private static final String TEST_REMOTE_REPO_ID = "central";
47
48 private static final String ASF_SCM_CONN_BASE = "scm:svn:http://svn.apache.org/repos/asf/";
49
50 private static final String ASF_SCM_DEV_CONN_BASE = "scm:svn:https://svn.apache.org/repos/asf/";
51
52 private static final String ASF_SCM_VIEWVC_BASE = "http://svn.apache.org/viewvc/";
53
54 private static final String TEST_SCM_CONN_BASE = "scm:svn:http://svn.example.com/repos/";
55
56 private static final String TEST_SCM_DEV_CONN_BASE = "scm:svn:https://svn.example.com/repos/";
57
58 private static final String TEST_SCM_URL_BASE = "http://svn.example.com/repos/";
59
60 private static final String EMPTY_MD5 = "d41d8cd98f00b204e9800998ecf8427e";
61
62 private static final String EMPTY_SHA1 = "da39a3ee5e6b4b0d3255bfef95601890afd80709";
63
64 private WagonFactory wagonFactory;
65
66 @Before
67 @Override
68 public void setUp()
69 throws Exception
70 {
71 super.setUp();
72
73 testRepo.setReleases( true );
74 testRepo.setSnapshots( false );
75
76 configuration.save( c );
77
78 assertFalse( c.getManagedRepositories().get( 0 ).isSnapshots() );
79 assertTrue( c.getManagedRepositories().get( 0 ).isReleases() );
80
81 }
82
83 @Test
84 @Override
85 public void testModelWithJdkProfileActivation()
86 throws Exception
87 {
88
89
90 ReadMetadataRequest readMetadataRequest =
91 new ReadMetadataRequest().repositoryId( TEST_REPO_ID ).namespace( "org.apache.maven" ).projectId(
92 "maven-archiver" ).projectVersion( "2.4.1" );
93
94 ProjectVersionMetadata metadata = storage.readProjectVersionMetadata( readMetadataRequest );
95 }
96
97 @Test (expected = RepositoryStorageRuntimeException.class)
98 @Override
99 public void testGetProjectVersionMetadataForTimestampedSnapshotMissingMetadata()
100 throws Exception
101 {
102 ReadMetadataRequest readMetadataRequest =
103 new ReadMetadataRequest().repositoryId( TEST_REPO_ID ).namespace( "com.example.test" ).projectId(
104 "missing-metadata" ).projectVersion( "1.0-SNAPSHOT" );
105 storage.readProjectVersionMetadata( readMetadataRequest );
106 }
107
108 @Test (expected = RepositoryStorageRuntimeException.class)
109 @Override
110 public void testGetProjectVersionMetadataForTimestampedSnapshotMalformedMetadata()
111 throws Exception
112 {
113 ReadMetadataRequest readMetadataRequest =
114 new ReadMetadataRequest().repositoryId( TEST_REPO_ID ).namespace( "com.example.test" ).projectVersion(
115 "malformed-metadata" ).projectVersion( "1.0-SNAPSHOT" );
116 storage.readProjectVersionMetadata( readMetadataRequest );
117 }
118
119 @Test (expected = RepositoryStorageRuntimeException.class)
120 @Override
121 public void testGetProjectVersionMetadataForTimestampedSnapshot()
122 throws Exception
123 {
124 super.testGetProjectVersionMetadataForTimestampedSnapshot();
125 }
126
127
128 @Test (expected = RepositoryStorageRuntimeException.class)
129 @Override
130 public void testGetProjectVersionMetadataForTimestampedSnapshotIncompleteMetadata()
131 throws Exception
132 {
133 super.testGetProjectVersionMetadataForTimestampedSnapshotIncompleteMetadata();
134 }
135
136 }