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.util.Arrays;
22
23 import org.apache.lucene.store.ByteBuffersDirectory;
24 import org.apache.lucene.store.Directory;
25 import org.apache.maven.index.context.IndexingContext;
26
27 import static org.junit.Assert.assertNotNull;
28
29
30
31
32
33
34
35 public class ConcurrentUseWithMergedContextTest extends ConcurrentUseTest {
36 protected Directory indexDir1 = new ByteBuffersDirectory();
37
38 protected IndexingContext context1;
39
40 protected Directory indexDir2 = new ByteBuffersDirectory();
41
42 protected IndexingContext context2;
43
44 @Override
45 protected void prepareNexusIndexer(NexusIndexer nexusIndexer) throws Exception {
46 context1 = nexusIndexer.addIndexingContext(
47 "test-default-member1", "test1", repo, indexDir1, null, null, DEFAULT_CREATORS);
48
49 nexusIndexer.scan(context1);
50
51 context2 = nexusIndexer.addIndexingContext(
52 "test-default-member2", "test2", repo, indexDir2, null, null, DEFAULT_CREATORS);
53
54 nexusIndexer.scan(context2);
55
56 context = nexusIndexer.addMergedIndexingContext(
57 "test-default", "test", repo, indexDir, true, Arrays.asList(context1, context2));
58
59
60
61
62
63
64 assertNotNull(context.getTimestamp());
65 }
66
67 @Override
68 protected IndexUserThread createThread(final ArtifactInfo ai) {
69
70 return new IndexUserThread(this, nexusIndexer, context, context1, ai);
71 }
72 }