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
24 import org.apache.lucene.document.Document;
25 import org.apache.lucene.index.IndexReader;
26 import org.apache.maven.index.ArtifactInfo;
27 import org.apache.maven.index.NexusIndexer;
28
29
30 public class Nexus737NexusIndexerTest
31 extends AbstractNexusIndexerTest
32 {
33 protected File repo = new File( getBasedir(), "src/test/nexus-658" );
34
35 @Override
36 protected void prepareNexusIndexer( NexusIndexer nexusIndexer )
37 throws Exception
38 {
39 context =
40 nexusIndexer.addIndexingContext( "nexus-658", "nexus-658", repo, indexDir, null, null, DEFAULT_CREATORS );
41 nexusIndexer.scan( context );
42 }
43
44 public void testValidateUINFOs()
45 throws Exception
46 {
47 IndexReader reader = context.acquireIndexSearcher().getIndexReader();
48
49 int foundCount = 0;
50
51 for ( int i = 0; i < reader.maxDoc(); i++ )
52 {
53 if ( !reader.isDeleted( i ) )
54 {
55 Document document = reader.document( i );
56
57 String uinfo = document.get( ArtifactInfo.UINFO );
58
59 if ( "org.sonatype.nexus|nexus-webapp|1.0.0-SNAPSHOT|NA".equals( uinfo )
60 || "org.sonatype.nexus|nexus-webapp|1.0.0-SNAPSHOT|bundle|zip".equals( uinfo )
61 || "org.sonatype.nexus|nexus-webapp|1.0.0-SNAPSHOT|bundle|tar.gz".equals( uinfo ) )
62 {
63 foundCount++;
64 }
65 }
66 }
67
68 assertEquals( foundCount, 3 );
69 }
70 }