1 package org.apache.maven.index;
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22 import java.io.File;
23 import java.util.ArrayList;
24 import java.util.Collection;
25 import java.util.List;
26
27 import org.apache.lucene.search.Query;
28 import org.apache.maven.index.expr.UserInputSearchExpression;
29
30 public class Mindexer35NexusIndexerTest
31 extends AbstractNexusIndexerTest
32 {
33 protected File repo = new File( getBasedir(), "src/test/mindexer-35" );
34
35 @Override
36 protected void prepareNexusIndexer( NexusIndexer nexusIndexer )
37 throws Exception
38 {
39 context =
40 nexusIndexer.addIndexingContext( "mindexer-35", "mindexer-35", repo, indexDir, null, null, FULL_CREATORS );
41 nexusIndexer.scan( context );
42 }
43
44 public void testSearchWar()
45 throws Exception
46 {
47 Query q = nexusIndexer.constructQuery( MAVEN.CLASSNAMES, new UserInputSearchExpression( "WebappClass" ) );
48
49 FlatSearchResponse response = nexusIndexer.searchFlat( new FlatSearchRequest( q ) );
50
51 Collection<ArtifactInfo> r = response.getResults();
52
53 assertEquals( 1, r.size() );
54
55 List<ArtifactInfo> list = new ArrayList<ArtifactInfo>( r );
56
57 ArtifactInfo ai = null;
58
59
60 ai = list.get( 0 );
61
62 assertEquals( "org.apache.maven.indexer.test", ai.groupId );
63 assertEquals( "sample-war", ai.artifactId );
64 assertEquals( "1.0-SNAPSHOT", ai.version );
65 assertEquals( "war", ai.packaging );
66 assertEquals( null, ai.classifier );
67 assertEquals( "mindexer-35", ai.repository );
68 assertEquals( "war", ai.fextension );
69 }
70 }