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 org.apache.maven.index.context.IndexingContext;
23 import org.apache.maven.index.packer.IndexPacker;
24 import org.apache.maven.index.packer.IndexPackingRequest;
25
26 import java.io.File;
27 import java.io.IOException;
28 import java.util.concurrent.atomic.AtomicInteger;
29
30
31
32
33
34
35
36 public class ConcurrentUseWithMergedContextPublishingTest
37 extends ConcurrentUseWithMergedContextTest
38 {
39 protected IndexPacker packer;
40
41 protected File repoPublish = new File( getBasedir(), "target/repo-publish" );
42
43 protected final AtomicInteger counter = new AtomicInteger();
44
45 @Override
46 protected void setUp()
47 throws Exception
48 {
49 super.setUp();
50
51 packer = lookup( IndexPacker.class );
52 }
53
54 @Override
55 protected void tearDown()
56 throws Exception
57 {
58 File props = new File( IndexingContext.INDEX_PACKER_PROPERTIES_FILE );
59 if ( props.exists() )
60 {
61 props.delete();
62 }
63 super.tearDown();
64 }
65
66 @Override
67 protected int readIndex( final NexusIndexer nexusIndexer, final IndexingContext indexingContext )
68 throws IOException
69 {
70
71
72
73
74 final File publish = new File( repoPublish, "publish-" + counter.getAndIncrement() );
75
76 final IndexPackingRequest request = new IndexPackingRequest( context, publish );
77
78 request.setCreateIncrementalChunks( false );
79
80 packer.packIndex( request );
81
82 return 1;
83 }
84 }