Fixed bug
This commit is contained in:
parent
45e1577dfe
commit
d17a98cbaa
|
@ -37,13 +37,22 @@ public class MatcherReplace {
|
|||
Replace replace;
|
||||
if(matched) {
|
||||
replace = new Replace();
|
||||
|
||||
Matcher serviceClassMatcher = multiMatcher.getServiceClassPattern().matcher(serviceClass);
|
||||
replace.setServiceClass(serviceClassMatcher.replaceFirst(replacementRegex.getServiceClass()));
|
||||
Matcher serviceNameMatcher = multiMatcher.getServiceClassPattern().matcher(serviceName);
|
||||
replace.setServiceName(serviceNameMatcher.replaceFirst(replacementRegex.getServiceName()));
|
||||
String replacementServiceClass = replacementRegex.getServiceClass();
|
||||
String replaceServiceClass = serviceClassMatcher.replaceFirst(replacementServiceClass);
|
||||
replace.setServiceClass(replaceServiceClass);
|
||||
|
||||
Matcher serviceNameMatcher = multiMatcher.getServiceNamePattern().matcher(serviceName);
|
||||
String replacementServiceName = replacementRegex.getServiceName();
|
||||
String replaceServiceName = serviceNameMatcher.replaceFirst(replacementServiceName);
|
||||
replace.setServiceName(replaceServiceName);
|
||||
|
||||
Matcher calledMethodMatcher = multiMatcher.getCalledMethodPattern().matcher(calledMethod);
|
||||
String cm = calledMethodMatcher.replaceFirst(replacementRegex.getCalledMethod());
|
||||
replace.setCalledMethod(cm);
|
||||
String replacementCalledMethod = replacementRegex.getCalledMethod();
|
||||
String replaceCalledMethod = calledMethodMatcher.replaceFirst(replacementCalledMethod);
|
||||
replace.setCalledMethod(replaceCalledMethod);
|
||||
|
||||
}else {
|
||||
replace = null;
|
||||
}
|
||||
|
|
|
@ -230,4 +230,20 @@ public class TestRules extends ContextTest {
|
|||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testMatcherReplace() throws Exception {
|
||||
File rulesDirectory = getRulesDirectory();
|
||||
File rulesDirFile = new File(rulesDirectory, "FullTextIndexNode");
|
||||
File rulesFile = new File(rulesDirFile, "FullTextIndexNode-OTHER.json");
|
||||
|
||||
ObjectMapper mapper = DSMapper.getObjectMapper();
|
||||
MatcherReplace matcherReplace = mapper.readValue(rulesFile, MatcherReplace.class);
|
||||
|
||||
Replace replace = matcherReplace.check("Index","FullTextIndexNode","/delete/1b9c6e34baddd4cebe9215fd381a63f4f17957f3463f94675c9d656148b99311/oai:archimer.ifremer.fr:11267");
|
||||
|
||||
logger.info("{}", replace);
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue