1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20 package com.puppycrawl.tools.checkstyle.internal.testmodules;
21
22 import java.io.File;
23 import java.util.ArrayList;
24 import java.util.Collections;
25 import java.util.List;
26
27 import com.puppycrawl.tools.checkstyle.api.AuditListener;
28 import com.puppycrawl.tools.checkstyle.api.CheckstyleException;
29 import com.puppycrawl.tools.checkstyle.api.Configuration;
30 import com.puppycrawl.tools.checkstyle.api.RootModule;
31
32 public class TestRootModuleChecker implements RootModule {
33
34 private static boolean processed;
35 private static List<File> filesToCheck;
36 private static Configuration config;
37 private static boolean destroyed;
38 private static String property;
39
40 @Override
41 public void configure(Configuration configuration) throws CheckstyleException {
42 config = configuration;
43 property = configuration.getProperty("property");
44 }
45
46 @Override
47 public void destroy() {
48 destroyed = true;
49 }
50
51 @Override
52 public int process(List<File> files) {
53 processed = true;
54 filesToCheck = new ArrayList<>(files);
55 return 0;
56 }
57
58 @Override
59 public void addListener(AuditListener listener) {
60
61 }
62
63 @Override
64 public void setModuleClassLoader(ClassLoader moduleClassLoader) {
65
66 }
67
68 public static boolean isProcessed() {
69 return processed;
70 }
71
72 public static boolean isDestroyed() {
73 return destroyed;
74 }
75
76 public static String getProperty() {
77 return property;
78 }
79
80 public static void reset() {
81 processed = false;
82 destroyed = false;
83 filesToCheck = null;
84 config = null;
85 property = null;
86 }
87
88 public static List<File> getFilesToCheck() {
89 return Collections.unmodifiableList(filesToCheck);
90 }
91
92 public static Configuration getConfig() {
93 return config;
94 }
95
96 }