1 package org.apache.archiva.metadata.repository.file;
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
14 * Unless required by applicable law or agreed to in writing,
15 * software distributed under the License is distributed on an
16 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
17 * KIND, either express or implied. See the License for the
18 * specific language governing permissions and limitations
22 import org.apache.archiva.configuration.ArchivaConfiguration;
23 import org.apache.archiva.configuration.Configuration;
24 import org.apache.archiva.configuration.ManagedRepositoryConfiguration;
25 import org.apache.archiva.metadata.model.MetadataFacetFactory;
26 import org.apache.archiva.metadata.repository.AbstractMetadataRepositoryTest;
27 import org.apache.archiva.metadata.repository.MetadataRepository;
28 import org.apache.archiva.metadata.repository.MetadataService;
29 import org.apache.archiva.metadata.repository.RepositorySessionFactory;
30 import org.junit.Before;
31 import org.junit.Ignore;
33 import java.nio.file.Files;
34 import java.nio.file.Path;
35 import java.nio.file.Paths;
36 import java.util.List;
39 import static org.mockito.Mockito.mock;
40 import static org.mockito.Mockito.when;
42 public class FileMetadataRepositoryTest
43 extends AbstractMetadataRepositoryTest
46 private FileMetadataRepository repository;
47 private RepositorySessionFactory sessionFactory = new FileRepositorySessionFactory();
50 protected MetadataRepository getRepository( )
52 return this.repository;
56 protected RepositorySessionFactory getSessionFactory( )
58 return this.sessionFactory;
68 assertRetrySleepMs = 10;
70 Path directory = Paths.get( "target/test-repositories" );
71 if (Files.exists(directory))
73 org.apache.archiva.common.utils.FileUtils.deleteDirectory( directory );
75 ArchivaConfiguration config = createTestConfiguration( directory );
76 List<MetadataFacetFactory> factories = createTestMetadataFacetFactories();
77 MetadataService metadataService = new MetadataService( );
78 metadataService.setMetadataFacetFactories( factories );
80 this.repository = new FileMetadataRepository( metadataService, config );
85 public void testGetArtifactsByProjectVersionMetadata()
88 // TODO not implemented
93 public void testGetArtifactsByProjectVersionMetadataNoRepository()
96 // TODO not implemented
101 public void testGetArtifactsByProjectVersionMetadataAllRepositories()
104 // TODO not implemented
109 public void testGetArtifactsByMetadataAllRepositories()
112 // TODO not implemented
117 public void testGetArtifactsByPropertySingleResult()
120 // TODO not implemented
125 public void testSearchArtifactsByKey()
128 // TODO not implemented
133 public void testSearchArtifactsByKeyExact()
136 // TODO not implemented
141 public void testSearchArtifactsFullText()
144 // TODO not implemented
149 public void testSearchArtifactsFullTextExact()
152 // TODO not implemented
157 public void testSearchArtifactsByFacetKeyAllRepos()
160 // TODO not implemented
165 public void testSearchArtifactsByFacetKey()
168 // TODO not implemented
173 public void testSearchArtifactsFullTextByFacet()
176 // TODO not implemented
179 protected static ArchivaConfiguration createTestConfiguration( Path directory )
181 ArchivaConfiguration config = mock( ArchivaConfiguration.class );
182 Configuration configData = new Configuration();
183 configData.addManagedRepository( createManagedRepository( TEST_REPO_ID, directory ) );
184 configData.addManagedRepository( createManagedRepository( "other-repo", directory ) );
185 when( config.getConfiguration() ).thenReturn( configData );
189 private static ManagedRepositoryConfiguration createManagedRepository( String repoId, Path directory )
191 ManagedRepositoryConfiguration managedRepository = new ManagedRepositoryConfiguration();
192 managedRepository.setId( repoId );
193 managedRepository.setLocation( directory.resolve( repoId ).toAbsolutePath().toString() );
194 return managedRepository;