View Javadoc
1   package org.apache.archiva.metadata.repository.file;
2   
3   /*
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
11   *
12   *   http://www.apache.org/licenses/LICENSE-2.0
13   *
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
19   * under the License.
20   */
21  
22  import org.apache.archiva.metadata.model.MetadataFacetFactory;
23  import org.apache.archiva.metadata.repository.AbstractMetadataRepositoryTest;
24  import org.apache.commons.io.FileUtils;
25  import org.apache.archiva.configuration.ArchivaConfiguration;
26  import org.apache.archiva.configuration.Configuration;
27  import org.apache.archiva.configuration.ManagedRepositoryConfiguration;
28  import org.junit.Before;
29  import org.junit.Ignore;
30  
31  import java.io.File;
32  import java.util.Map;
33  
34  import static org.mockito.Mockito.mock;
35  import static org.mockito.Mockito.when;
36  
37  public class FileMetadataRepositoryTest
38      extends AbstractMetadataRepositoryTest
39  {
40  
41      @Before
42      @Override
43      public void setUp()
44          throws Exception
45      {
46          super.setUp();
47  
48          File directory = new File( "target/test-repositories" );
49          if (directory.exists())
50          {
51              FileUtils.deleteDirectory( directory );
52          }
53          ArchivaConfiguration config = createTestConfiguration( directory );
54          Map<String, MetadataFacetFactory> factories = createTestMetadataFacetFactories();
55  
56          this.repository = new FileMetadataRepository( factories, config );
57      }
58  
59      @Override
60      @Ignore
61      public void testGetArtifactsByProjectVersionMetadata()
62          throws Exception
63      {
64          // TODO not implemented
65      }
66  
67      @Override
68      @Ignore
69      public void testGetArtifactsByProjectVersionMetadataNoRepository()
70          throws Exception
71      {
72          // TODO not implemented
73      }
74  
75      @Override
76      @Ignore
77      public void testGetArtifactsByProjectVersionMetadataAllRepositories()
78          throws Exception
79      {
80          // TODO not implemented
81      }
82  
83      @Override
84      @Ignore
85      public void testGetArtifactsByMetadataAllRepositories()
86          throws Exception
87      {
88          // TODO not implemented
89      }
90  
91      @Override
92      @Ignore
93      public void testGetArtifactsByPropertySingleResult()
94          throws Exception
95      {
96          // TODO not implemented
97      }
98  
99      @Override
100     @Ignore
101     public void testSearchArtifactsByKey()
102         throws Exception
103     {
104         // TODO not implemented
105     }
106 
107     @Override
108     @Ignore
109     public void testSearchArtifactsByKeyExact()
110         throws Exception
111     {
112         // TODO not implemented
113     }
114 
115     @Override
116     @Ignore
117     public void testSearchArtifactsFullText()
118         throws Exception
119     {
120         // TODO not implemented
121     }
122 
123     @Override
124     @Ignore
125     public void testSearchArtifactsFullTextExact()
126         throws Exception
127     {
128         // TODO not implemented
129     }
130 
131     @Override
132     @Ignore
133     public void testSearchArtifactsByFacetKeyAllRepos()
134         throws Exception
135     {
136         // TODO not implemented
137     }
138 
139     @Override
140     @Ignore
141     public void testSearchArtifactsByFacetKey()
142         throws Exception
143     {
144         // TODO not implemented
145     }
146 
147     @Override
148     @Ignore
149     public void testSearchArtifactsFullTextByFacet()
150         throws Exception
151     {
152         // TODO not implemented
153     }
154 
155     protected static ArchivaConfiguration createTestConfiguration( File directory )
156     {
157         ArchivaConfiguration config = mock( ArchivaConfiguration.class );
158         Configuration configData = new Configuration();
159         configData.addManagedRepository( createManagedRepository( TEST_REPO_ID, directory ) );
160         configData.addManagedRepository( createManagedRepository( "other-repo", directory ) );
161         when( config.getConfiguration() ).thenReturn( configData );
162         return config;
163     }
164 
165     private static ManagedRepositoryConfiguration createManagedRepository( String repoId, File directory )
166     {
167         ManagedRepositoryConfiguration managedRepository = new ManagedRepositoryConfiguration();
168         managedRepository.setId( repoId );
169         managedRepository.setLocation( new File( directory, repoId ).getAbsolutePath() );
170         return managedRepository;
171     }
172 }