Rules Tester
This commit is contained in:
parent
07ffeab3ae
commit
2c4350b8f3
@ -29,4 +29,7 @@ public interface RedactionResource {
|
|||||||
@PostMapping(value = "/rules/update"+RULE_SET_PATH_VARIABLE, consumes = MediaType.APPLICATION_JSON_VALUE)
|
@PostMapping(value = "/rules/update"+RULE_SET_PATH_VARIABLE, consumes = MediaType.APPLICATION_JSON_VALUE)
|
||||||
void updateRules(@PathVariable(RULE_SET_PARAMETER_NAME) String ruleSetId);
|
void updateRules(@PathVariable(RULE_SET_PARAMETER_NAME) String ruleSetId);
|
||||||
|
|
||||||
|
@PostMapping(value = "/rules/test", consumes = MediaType.APPLICATION_JSON_VALUE)
|
||||||
|
void testRules(@RequestBody String rules);
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -139,6 +139,11 @@ public class RedactionController implements RedactionResource {
|
|||||||
droolsExecutionService.updateRules(ruleSetId);
|
droolsExecutionService.updateRules(ruleSetId);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void testRules(@RequestBody String rules) {
|
||||||
|
droolsExecutionService.testRules(rules);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
private RedactionResult convert(PDDocument document, int numberOfPages, String ruleSetId) throws IOException {
|
private RedactionResult convert(PDDocument document, int numberOfPages, String ruleSetId) throws IOException {
|
||||||
|
|
||||||
|
|||||||
@ -103,4 +103,11 @@ public class DroolsExecutionService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public void testRules(String rules) {
|
||||||
|
KieServices kieServices = KieServices.Factory.get();
|
||||||
|
KieModule kieModule = getKieModule("test-rules", rules, kieServices);
|
||||||
|
var container = kieServices.newKieContainer(kieModule.getReleaseId());
|
||||||
|
container.newKieSession();
|
||||||
|
container.dispose();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
Loading…
x
Reference in New Issue
Block a user