View Javadoc

1   package org.apache.maven.index;
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 java.util.Set;
23  
24  import org.apache.lucene.search.Query;
25  import org.apache.maven.index.ArtifactInfo;
26  import org.apache.maven.index.FlatSearchRequest;
27  import org.apache.maven.index.FlatSearchResponse;
28  import org.apache.maven.index.NexusIndexer;
29  
30  /**
31   * @author Jason van Zyl
32   * @author Eugene Kuleshov
33   */
34  public class MinimalIndexNexusIndexerTest
35      extends AbstractRepoNexusIndexerTest
36  {
37      @Override
38      protected void prepareNexusIndexer( NexusIndexer nexusIndexer )
39          throws Exception
40      {
41          context = nexusIndexer.addIndexingContext( "test-minimal", "test", repo, indexDir, null, null, MIN_CREATORS );
42  
43          nexusIndexer.scan( context );
44      }
45  
46      public void testNEXUS2712()
47          throws Exception
48      {
49          Query q = nexusIndexer.constructQuery( MAVEN.GROUP_ID, "com.adobe.flexunit", SearchType.EXACT );// WAS SCORED
50  
51          FlatSearchResponse response = nexusIndexer.searchFlat( new FlatSearchRequest( q ) );
52  
53          Set<ArtifactInfo> r = response.getResults();
54  
55          assertEquals( 1, r.size() );
56  
57          ArtifactInfo ai = r.iterator().next();
58  
59          assertEquals( "com.adobe.flexunit", ai.groupId );
60          assertEquals( "flexunit", ai.artifactId );
61          assertEquals( "0.90", ai.version );
62          assertEquals( null, ai.classifier );
63          assertEquals( "swc", ai.packaging );
64  
65          assertEquals( "swc", ai.fextension );
66      }
67  }