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