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.Collection;
24 import java.util.Set;
25
26 public class Nexus4674GavPathReindexTest
27 extends AbstractNexusIndexerTest
28 {
29 protected File repo = new File( getBasedir(), "src/test/repo" );
30
31 @Override
32 protected void prepareNexusIndexer( NexusIndexer nexusIndexer )
33 throws Exception
34 {
35 context = nexusIndexer.addIndexingContext( "test-minimal", "test", repo, indexDir, null, null, MIN_CREATORS );
36
37 nexusIndexer.scan( context, "/org/slf4j/slf4j-api", null, false );
38 nexusIndexer.scan( context, "/org/slf4j/slf4j-api/1.4.1", null, true );
39 }
40
41 public void testRootGroups()
42 throws Exception
43 {
44 Set<String> rootGroups = context.getRootGroups();
45 assertEquals( rootGroups.toString(), 1, rootGroups.size() );
46
47 assertGroup( 4, "org", context );
48
49 assertGroup( 4, "org.slf4j", context );
50 }
51
52 public void testIdentify()
53 throws Exception
54 {
55 Collection<ArtifactInfo> ais;
56 File artifact;
57
58
59 artifact = new File( repo, "qdox/qdox/1.5/qdox-1.5.jar" );
60
61 ais = nexusIndexer.identify( artifact );
62
63 assertTrue( "Should not be able to identify it!", ais.isEmpty() );
64
65
66 artifact = new File( repo, "org/slf4j/slf4j-api/1.4.2/slf4j-api-1.4.2.jar" );
67
68 ais = nexusIndexer.identify( artifact );
69
70 assertEquals( "Should not be able to identify it!", 1, ais.size() );
71 }
72
73 }