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.jupiter.api.BeforeEach;
31 import org.junit.jupiter.api.Disabled;
33 import java.nio.file.Files;
34 import java.nio.file.Path;
35 import java.nio.file.Paths;
36 import java.util.List;
38 import static org.mockito.Mockito.mock;
39 import static org.mockito.Mockito.when;
41 public class FileMetadataRepositoryTest
42 extends AbstractMetadataRepositoryTest
45 private FileMetadataRepository repository;
46 private RepositorySessionFactory sessionFactory = new FileRepositorySessionFactory();
49 protected MetadataRepository getRepository( )
51 return this.repository;
55 protected RepositorySessionFactory getSessionFactory( )
57 return this.sessionFactory;
67 assertRetrySleepMs = 10;
69 Path directory = Paths.get( "target/test-repositories" );
70 if (Files.exists(directory))
72 org.apache.archiva.common.utils.FileUtils.deleteDirectory( directory );
74 ArchivaConfiguration config = createTestConfiguration( directory );
75 List<MetadataFacetFactory> factories = createTestMetadataFacetFactories();
76 MetadataService metadataService = new MetadataService( );
77 metadataService.setMetadataFacetFactories( factories );
79 this.repository = new FileMetadataRepository( metadataService, config );
84 public void testGetArtifactsByProjectVersionMetadata()
87 // TODO not implemented
92 public void testGetArtifactsByProjectVersionMetadataNoRepository()
95 // TODO not implemented
100 public void testGetArtifactsByProjectVersionMetadataAllRepositories()
103 // TODO not implemented
108 public void testGetArtifactsByMetadataAllRepositories()
111 // TODO not implemented
116 public void testGetArtifactsByPropertySingleResult()
119 // TODO not implemented
124 public void testSearchArtifactsByKey()
127 // TODO not implemented
132 public void testSearchArtifactsByKeyExact()
135 // TODO not implemented
140 public void testSearchArtifactsFullText()
143 // TODO not implemented
148 public void testSearchArtifactsFullTextExact()
151 // TODO not implemented
156 public void testSearchArtifactsByFacetKeyAllRepos()
159 // TODO not implemented
164 public void testSearchArtifactsByFacetKey()
167 // TODO not implemented
172 public void testSearchArtifactsFullTextByFacet()
175 // TODO not implemented
178 protected static ArchivaConfiguration createTestConfiguration( Path directory )
180 ArchivaConfiguration config = mock( ArchivaConfiguration.class );
181 Configuration configData = new Configuration();
182 configData.addManagedRepository( createManagedRepository( TEST_REPO_ID, directory ) );
183 configData.addManagedRepository( createManagedRepository( "other-repo", directory ) );
184 when( config.getConfiguration() ).thenReturn( configData );
188 private static ManagedRepositoryConfiguration createManagedRepository( String repoId, Path directory )
190 ManagedRepositoryConfiguration managedRepository = new ManagedRepositoryConfiguration();
191 managedRepository.setId( repoId );
192 managedRepository.setLocation( directory.resolve( repoId ).toAbsolutePath().toString() );
193 return managedRepository;