1 package org.apache.archiva.repository.maven.metadata.storage;
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
12 * http://www.apache.org/licenses/LICENSE-2.0
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
21 import org.apache.archiva.filter.AllFilter;
22 import org.apache.archiva.filter.Filter;
23 import org.apache.archiva.metadata.model.ProjectVersionMetadata;
24 import org.apache.archiva.metadata.repository.storage.ReadMetadataRequest;
25 import org.apache.archiva.metadata.repository.storage.RepositoryStorageRuntimeException;
26 import org.apache.archiva.maven.proxy.WagonFactory;
27 import org.apache.archiva.repository.RepositoryRegistry;
28 import org.apache.archiva.repository.base.RepositoryHandlerDependencies;
29 import org.junit.Before;
30 import org.junit.Test;
32 import javax.inject.Inject;
33 import javax.inject.Named;
36 public class Maven2RepositoryMetadataResolverManagedReleaseTest
37 extends Maven2RepositoryMetadataResolverTest
39 private static final Filter<String> ALL = new AllFilter<String>();
42 @Named ( "repositoryStorage#maven2")
43 private Maven2RepositoryStorage storage;
46 RepositoryRegistry repositoryRegistry;
48 @SuppressWarnings( "unused" )
50 RepositoryHandlerDependencies repositoryHandlerDependencies;
53 private static final String TEST_REPO_ID = "test";
55 private static final String TEST_REMOTE_REPO_ID = "central";
57 private static final String ASF_SCM_CONN_BASE = "scm:svn:http://svn.apache.org/repos/asf/";
59 private static final String ASF_SCM_DEV_CONN_BASE = "scm:svn:https://svn.apache.org/repos/asf/";
61 private static final String ASF_SCM_VIEWVC_BASE = "http://svn.apache.org/viewvc/";
63 private static final String TEST_SCM_CONN_BASE = "scm:svn:http://svn.example.com/repos/";
65 private static final String TEST_SCM_DEV_CONN_BASE = "scm:svn:https://svn.example.com/repos/";
67 private static final String TEST_SCM_URL_BASE = "http://svn.example.com/repos/";
69 private static final String EMPTY_MD5 = "d41d8cd98f00b204e9800998ecf8427e";
71 private static final String EMPTY_SHA1 = "da39a3ee5e6b4b0d3255bfef95601890afd80709";
73 private WagonFactory wagonFactory;
82 testRepo.setReleases( true );
83 testRepo.setSnapshots( false );
85 configuration.save( c );
87 repositoryRegistry.reload();
89 assertFalse( c.getManagedRepositories().get( 0 ).isSnapshots() );
90 assertTrue( c.getManagedRepositories().get( 0 ).isReleases() );
96 public void testModelWithJdkProfileActivation()
99 // skygo IMHO must fail because TEST_REPO_ID ( is snap ,no release) and we seek for a snapshot
101 ReadMetadataRequest readMetadataRequest =
102 new ReadMetadataRequest().repositoryId( TEST_REPO_ID ).namespace( "org.apache.maven" ).projectId(
103 "maven-archiver" ).projectVersion( "2.4.1" );
105 ProjectVersionMetadata metadata = storage.readProjectVersionMetadata( readMetadataRequest );
108 @Test (expected = RepositoryStorageRuntimeException.class)
110 public void testGetProjectVersionMetadataForTimestampedSnapshotMissingMetadata()
113 ReadMetadataRequest readMetadataRequest =
114 new ReadMetadataRequest().repositoryId( TEST_REPO_ID ).namespace( "com.example.test" ).projectId(
115 "missing-metadata" ).projectVersion( "1.0-SNAPSHOT" );
116 storage.readProjectVersionMetadata( readMetadataRequest );
119 @Test (expected = RepositoryStorageRuntimeException.class)
121 public void testGetProjectVersionMetadataForTimestampedSnapshotMalformedMetadata()
124 ReadMetadataRequest readMetadataRequest =
125 new ReadMetadataRequest().repositoryId( TEST_REPO_ID ).namespace( "com.example.test" ).projectVersion(
126 "malformed-metadata" ).projectVersion( "1.0-SNAPSHOT" );
127 storage.readProjectVersionMetadata( readMetadataRequest );
130 @Test (expected = RepositoryStorageRuntimeException.class)
132 public void testGetProjectVersionMetadataForTimestampedSnapshot()
135 super.testGetProjectVersionMetadataForTimestampedSnapshot();
139 @Test (expected = RepositoryStorageRuntimeException.class)
141 public void testGetProjectVersionMetadataForTimestampedSnapshotIncompleteMetadata()
144 super.testGetProjectVersionMetadataForTimestampedSnapshotIncompleteMetadata();