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 SubPathReindexTest
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 }
39
40 public void testRootGroups()
41 throws Exception
42 {
43 Set<String> rootGroups = context.getRootGroups();
44 assertEquals( rootGroups.toString(), 1, rootGroups.size() );
45
46 assertGroup( 0, "com.adobe", context );
47 assertGroup( 0, "com.adobe.flexunit", context );
48
49 assertGroup( 0, "qdox", context );
50
51 assertGroup( 0, "proptest", context );
52
53 assertGroup( 0, "junit", context );
54
55 assertGroup( 0, "commons-logging", context );
56
57 assertGroup( 0, "regexp", context );
58
59 assertGroup( 0, "commons-cli", context );
60
61 assertGroup( 4, "org", context );
62
63 assertGroup( 4, "org.slf4j", context );
64
65 assertGroup( 0, "org.testng", context );
66
67 assertGroup( 0, "org.apache", context );
68
69 assertGroup( 0, "org.apache.directory", context );
70 assertGroup( 0, "org.apache.directory.server", context );
71
72 assertGroup( 0, "org.apache.maven", context );
73 assertGroup( 0, "org.apache.maven.plugins", context );
74 assertGroup( 0, "org.apache.maven.plugins.maven-core-it-plugin", context );
75 }
76
77 public void testIdentify()
78 throws Exception
79 {
80 Collection<ArtifactInfo> ais;
81 File artifact;
82
83
84 artifact = new File( repo, "qdox/qdox/1.5/qdox-1.5.jar" );
85
86 ais = nexusIndexer.identify( artifact );
87
88 assertTrue( "Should not be able to identify it!", ais.isEmpty() );
89
90
91 artifact = new File( repo, "org/slf4j/slf4j-api/1.4.2/slf4j-api-1.4.2.jar" );
92
93 ais = nexusIndexer.identify( artifact );
94
95 assertEquals( "Should not be able to identify it!", 1, ais.size() );
96 }
97
98 }