1 package org.apache.maven.plugin.verifier;
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.plugin.logging.Log;
23
24
25
26
27 public class ConsoleVerificationResultPrinter
28 implements VerificationResultPrinter
29 {
30 private Log log;
31
32
33
34
35 public ConsoleVerificationResultPrinter( Log log )
36 {
37 this.log = log;
38 }
39
40
41
42
43 public void print( VerificationResult results )
44 {
45 printExistenceFailures( results );
46 printNonExistenceFailures( results );
47 printContentFailures( results );
48 }
49
50 private void printExistenceFailures( VerificationResult results )
51 {
52 for ( Object o : results.getExistenceFailures() )
53 {
54 org.apache.maven.plugin.verifier.model.File file = (org.apache.maven.plugin.verifier.model.File) o;
55
56 printMessage( "File not found [" + file.getLocation() + "]" );
57 }
58 }
59
60 private void printNonExistenceFailures( VerificationResult results )
61 {
62 for ( Object o : results.getNonExistenceFailures() )
63 {
64 org.apache.maven.plugin.verifier.model.File file = (org.apache.maven.plugin.verifier.model.File) o;
65
66 printMessage( "File should not exist [" + file.getLocation() + "]" );
67 }
68 }
69
70 private void printContentFailures( VerificationResult results )
71 {
72 for ( Object o : results.getContentFailures() )
73 {
74 org.apache.maven.plugin.verifier.model.File file = (org.apache.maven.plugin.verifier.model.File) o;
75
76 printMessage( "File [" + file.getLocation() + "] does not match regexp [" + file.getContains() + "]" );
77 }
78 }
79
80 private void printMessage( String message )
81 {
82 this.log.error( "[Verifier] " + message );
83 }
84 }