1 package org.apache.maven.archiva.scheduled;
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22 import java.util.ArrayList;
23 import java.util.List;
24
25 import org.apache.maven.archiva.consumers.AbstractMonitoredConsumer;
26 import org.apache.maven.archiva.consumers.ConsumerException;
27 import org.apache.maven.archiva.database.updater.DatabaseUnprocessedArtifactConsumer;
28 import org.apache.maven.archiva.model.ArchivaArtifact;
29 import org.slf4j.Logger;
30 import org.slf4j.LoggerFactory;
31
32
33
34
35
36
37 public class TestDatabaseUnprocessedConsumer
38 extends AbstractMonitoredConsumer
39 implements DatabaseUnprocessedArtifactConsumer
40 {
41 private Logger log = LoggerFactory.getLogger( TestDatabaseUnprocessedConsumer.class );
42
43 private int countBegin = 0;
44
45 private int countComplete = 0;
46
47 private int countProcessed = 0;
48
49 public void resetCount()
50 {
51 countBegin = 0;
52 countProcessed = 0;
53 countComplete = 0;
54 }
55
56 public void beginScan()
57 {
58 countBegin++;
59 }
60
61 public void completeScan()
62 {
63 countComplete++;
64 }
65
66 public List<String> getIncludedTypes()
67 {
68 List<String> types = new ArrayList<String>();
69 types.add( "pom" );
70 types.add( "jar" );
71 return types;
72 }
73
74 public void processArchivaArtifact( ArchivaArtifact artifact )
75 throws ConsumerException
76 {
77 log.info( "Processing Artifact: " + artifact );
78 countProcessed++;
79 }
80
81 public String getDescription()
82 {
83 return "Test Consumer for Database Unprocessed";
84 }
85
86 public String getId()
87 {
88 return "test-db-unprocessed";
89 }
90
91 public boolean isPermanent()
92 {
93 return false;
94 }
95
96 public int getCountBegin()
97 {
98 return countBegin;
99 }
100
101 public int getCountComplete()
102 {
103 return countComplete;
104 }
105
106 public int getCountProcessed()
107 {
108 return countProcessed;
109 }
110 }