Skip to content

Commit

Permalink
#8 test rule
Browse files Browse the repository at this point in the history
  • Loading branch information
pethers committed Feb 26, 2018
1 parent d78bead commit be15f96
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,9 @@ public void afterMatchFired(AfterMatchFiredEvent event) {
private static final String politicianDrlFile2 = "rules/PoliticianTimeToRetire.drl";

private static final String politicianDrlFile3 = "rules/PoliticianBusySchedule.drl";

private static final String politicianDrlFile4 = "rules/PoliticianMinisterWithoutParliamentExperience.drl";




Expand Down Expand Up @@ -108,7 +111,8 @@ public void ruleEngineTest() throws Exception {
KieFileSystem kieFileSystem = kieServices.newKieFileSystem();
kieFileSystem.write(ResourceFactory.newClassPathResource(politicianDrlFile));
kieFileSystem.write(ResourceFactory.newClassPathResource(politicianDrlFile2));
kieFileSystem.write(ResourceFactory.newClassPathResource(politicianDrlFile3));
kieFileSystem.write(ResourceFactory.newClassPathResource(politicianDrlFile3));
kieFileSystem.write(ResourceFactory.newClassPathResource(politicianDrlFile4));
kieFileSystem.write(ResourceFactory.newClassPathResource(partyDrlFile));

KieBuilder kieBuilder = kieServices.newKieBuilder(kieFileSystem);
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
package com.hack23.cia.service.impl.rules

import com.hack23.cia.model.internal.application.data.politician.impl.ViewRiksdagenPolitician
import com.hack23.cia.service.api.action.kpi.Status
import com.hack23.cia.service.impl.rules.PoliticianComplianceCheckImpl

rule "We have an politician minister that has no experience from parliament"
dialect "java"
when
$p : PoliticianComplianceCheckImpl(politician.activeGovernment == true && politician.totalDaysServedCommittee == 0)
then
modify( $p ) {
setStatus( Status.MINOR )
}
end

0 comments on commit be15f96

Please sign in to comment.