Moved rules in a dedicated folder
This commit is contained in:
parent
7eaa611767
commit
85ffffe272
|
@ -44,14 +44,22 @@ public class TestRules {
|
|||
|
||||
}
|
||||
|
||||
public File getRulesDirectory() throws Exception {
|
||||
URL logbackFileURL = TestRules.class.getClassLoader().getResource("logback-test.xml");
|
||||
File logbackFile = new File(logbackFileURL.toURI());
|
||||
File resourcesDirectory = logbackFile.getParentFile();
|
||||
return new File(resourcesDirectory, "rules");
|
||||
}
|
||||
|
||||
public void testRule(String rulePrefix) throws Exception {
|
||||
File rulesDirectory = getRulesDirectory();
|
||||
|
||||
File rulesFile = new File(rulesDirectory, rulePrefix + "-rule.json");
|
||||
ObjectMapper mapper = DSMapper.getObjectMapper();
|
||||
InputStream regexInputStream = TestRules.class.getClassLoader().getResourceAsStream(rulePrefix + "-rule.json");
|
||||
MatcherReplace matcherReplace = mapper.readValue(regexInputStream, MatcherReplace.class);
|
||||
MatcherReplace matcherReplace = mapper.readValue(rulesFile, MatcherReplace.class);
|
||||
Replacer replacer = matcherReplace.getReplacer();
|
||||
|
||||
URL url = TestRules.class.getClassLoader().getResource(rulePrefix + "-values.csv");
|
||||
File elaborationFile = new File(url.toURI());
|
||||
File elaborationFile = new File(rulesDirectory,rulePrefix + "-values.csv");
|
||||
try(BufferedReader br = new BufferedReader(new FileReader(elaborationFile))) {
|
||||
for(String line; (line = br.readLine()) != null;) {
|
||||
String[] splittedLine = line.split(",");
|
||||
|
|
Loading…
Reference in New Issue