1 package org.apache.archiva.repository.maven.content;
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.metadata.repository.storage.RepositoryPathTranslator;
22 import org.apache.archiva.repository.ManagedRepositoryContent;
23 import org.apache.archiva.repository.RemoteRepository;
24 import org.apache.archiva.repository.RepositoryContent;
25 import org.apache.archiva.repository.content.Artifact;
26 import org.apache.archiva.repository.content.ItemSelector;
27 import org.apache.archiva.repository.content.LayoutException;
28 import org.apache.archiva.repository.maven.metadata.storage.ArtifactMappingProvider;
29 import org.junit.Before;
31 import javax.inject.Inject;
32 import javax.inject.Named;
33 import java.util.List;
36 * RemoteDefaultRepositoryContentTest
38 public class RemoteDefaultRepositoryContentTest
39 extends AbstractRepositoryContentTest
43 private List<? extends ArtifactMappingProvider> artifactMappingProviders;
46 @Named( "repositoryPathTranslator#maven2" )
47 RepositoryPathTranslator pathTranslator;
49 private RemoteDefaultRepositoryContent repoContent;
55 RemoteRepository repository =
56 createRemoteRepository( "testRemoteRepo", "Unit Test Remote Repo", "http://repo1.maven.org/maven2/" );
58 repoContent = new RemoteDefaultRepositoryContent();
59 repoContent.setArtifactMappingProviders( artifactMappingProviders );
60 repoContent.setPathTranslator( pathTranslator );
62 //repoContent = (RemoteRepositoryContent) lookup( RemoteRepositoryContent.class, "default" );
63 repoContent.setRepository( repository );
67 protected Artifact createArtifact( String groupId, String artifactId, String version, String classifier, String type ) throws LayoutException
74 protected String toPath( Artifact reference ) throws LayoutException
76 ItemSelector selector = toItemSelector( reference.getAsset( ).getPath( ) );
77 return repoContent.toPath( selector );
81 protected ItemSelector toItemSelector( String path ) throws LayoutException
83 return repoContent.toItemSelector( path );
87 protected ManagedRepositoryContent getManaged( )
93 protected RepositoryContent getContent( )
99 protected String toPath( ItemSelector selector ) {
100 return repoContent.toPath( selector );