Fxing and adding rules

master
Luca Frosini 4 years ago
parent e229f7278e
commit e3d4611bb9

@ -48,16 +48,21 @@ public class Harmonizer implements FieldAction {
List<MatcherReplace> matcherReplaceList = RegexRulesAggregator.getInstance().getMatcherReplaceList();
String calledMethod = (String) value;
for(MatcherReplace matcherReplace : matcherReplaceList) {
Replace replace = matcherReplace.check(serviceClass, serviceName, (String) value);
Replace replace = matcherReplace.check(serviceClass, serviceName, calledMethod);
if(replace != null) {
serviceUsageRecord.setServiceClass(replace.getServiceClass());
serviceUsageRecord.setServiceName(replace.getServiceName());
return replace.getCalledMethod();
serviceClass = replace.getServiceClass();
serviceName = replace.getServiceName();
calledMethod = replace.getCalledMethod();
}
}
return value;
serviceUsageRecord.setServiceClass(serviceClass);
serviceUsageRecord.setServiceName(serviceName);
return calledMethod;
}
}

@ -219,8 +219,8 @@ public class TestRules extends ContextTest {
public void testSingleRule() throws Exception {
allRules();
File rulesDirectory = getRulesDirectory();
File rulesDirFile = new File(rulesDirectory, "SmartExecutor");
File ruleFile = new File(rulesDirFile, "SmartExecutor-getAvailablePlugins.json");
File rulesDirFile = new File(rulesDirectory, "WhnManager");
File ruleFile = new File(rulesDirFile, "WhnManager-OTHER.json");
testRule(ruleFile);
}

@ -2,7 +2,7 @@
"match": {
"serviceClassRegex": "VREManagement",
"serviceNameRegex": "(SmartExecutor)|(smart-executor)",
"calledMethodRegex": ".*(UNKNOWN)|(OTHER).*"
"calledMethodRegex": "^((UNKNOWN)|(OTHER))$"
},
"replace": {
"serviceClass": "VREManagement",

@ -0,0 +1,2 @@
VREManagement,WhnManager,OTHER
VREManagement,WhnManager,gcube/vremanagement/ws/whnmanager
1 VREManagement WhnManager OTHER
2 VREManagement WhnManager gcube/vremanagement/ws/whnmanager

@ -0,0 +1,12 @@
{
"match": {
"serviceClassRegex": "VREManagement",
"serviceNameRegex": "WhnManager",
"calledMethodRegex": "(OTHER)|((\/){0,1}gcube\/vremanagement\/ws\/whnmanager)"
},
"replace": {
"serviceClass": "VREManagement",
"serviceName": "WhnManager",
"calledMethod": "OTHER"
}
}
Loading…
Cancel
Save