1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19 package org.apache.maven.index;
20
21 import java.io.File;
22 import java.util.Collection;
23 import java.util.Set;
24
25 import org.junit.Test;
26
27 import static org.junit.Assert.assertEquals;
28 import static org.junit.Assert.assertTrue;
29
30 public class Nexus4674GavPathReindexTest extends AbstractNexusIndexerTest {
31 protected File repo = new File(getBasedir(), "src/test/repo");
32
33 @Override
34 protected void prepareNexusIndexer(NexusIndexer nexusIndexer) throws Exception {
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 @Test
42 public void testRootGroups() throws Exception {
43 Set<String> rootGroups = context.getRootGroups();
44 assertEquals(rootGroups.toString(), 1, rootGroups.size());
45
46 assertGroup(4, "org", context);
47
48 assertGroup(4, "org.slf4j", context);
49 }
50
51 @Test
52 public void testIdentify() throws Exception {
53 Collection<ArtifactInfo> ais;
54 File artifact;
55
56
57 artifact = new File(repo, "qdox/qdox/1.5/qdox-1.5.jar");
58
59 ais = nexusIndexer.identify(artifact);
60
61 assertTrue("Should not be able to identify it!", ais.isEmpty());
62
63
64 artifact = new File(repo, "org/slf4j/slf4j-api/1.4.2/slf4j-api-1.4.2.jar");
65
66 ais = nexusIndexer.identify(artifact);
67
68 assertEquals("Should not be able to identify it!", 1, ais.size());
69 }
70 }