Work
This commit is contained in:
parent
474d3bf5b1
commit
0d40acdd39
6 changed files with 65 additions and 76 deletions
|
|
@ -1,6 +0,0 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<module version="4">
|
||||
<component name="NewModuleRootManager" inherit-compiler-output="false">
|
||||
<orderEntry type="sourceFolder" forTests="false" />
|
||||
</component>
|
||||
</module>
|
||||
|
|
@ -1,34 +0,0 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<module org.jetbrains.idea.maven.project.MavenProjectsManager.isMavenModule="true" type="JAVA_MODULE" version="4">
|
||||
<component name="NewModuleRootManager" LANGUAGE_LEVEL="JDK_1_7" inherit-compiler-output="false">
|
||||
<output url="file://$MODULE_DIR$/target/classes" />
|
||||
<output-test url="file://$MODULE_DIR$/target/test-classes" />
|
||||
<content url="file://$MODULE_DIR$">
|
||||
<sourceFolder url="file://$MODULE_DIR$/src/main/java" isTestSource="false" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/src/main/resources" type="java-resource" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/src/test/java" isTestSource="true" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/target" />
|
||||
</content>
|
||||
<orderEntry type="inheritedJdk" />
|
||||
<orderEntry type="sourceFolder" forTests="false" />
|
||||
<orderEntry type="library" name="Maven: org.drools:drools-compiler:6.4.0.Final" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.drools:drools-core:6.4.0.Final" level="project" />
|
||||
<orderEntry type="library" name="Maven: commons-codec:commons-codec:1.4" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.kie:kie-internal:6.4.0.Final" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.antlr:antlr-runtime:3.5" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.mvel:mvel2:2.2.8.Final" level="project" />
|
||||
<orderEntry type="library" name="Maven: com.thoughtworks.xstream:xstream:1.4.7" level="project" />
|
||||
<orderEntry type="library" name="Maven: xmlpull:xmlpull:1.1.3.1" level="project" />
|
||||
<orderEntry type="library" name="Maven: xpp3:xpp3_min:1.1.4c" level="project" />
|
||||
<orderEntry type="library" name="Maven: com.google.protobuf:protobuf-java:2.6.0" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.slf4j:slf4j-api:1.7.2" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.eclipse.jdt.core.compiler:ecj:3.5.1" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.jbpm:jbpm-bpmn2:6.4.0.Final" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.jbpm:jbpm-flow-builder:6.4.0.Final" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.jbpm:jbpm-flow:6.4.0.Final" level="project" />
|
||||
<orderEntry type="library" name="Maven: joda-time:joda-time:2.2" level="project" />
|
||||
<orderEntry type="library" scope="TEST" name="Maven: junit:junit:4.5" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.kie:kie-api:6.4.0.Final" level="project" />
|
||||
<orderEntry type="module" module-name="drools-lesson-pojo" />
|
||||
</component>
|
||||
</module>
|
||||
|
|
@ -1,34 +1,6 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<module org.jetbrains.idea.maven.project.MavenProjectsManager.isMavenModule="true" type="JAVA_MODULE" version="4">
|
||||
<component name="NewModuleRootManager" LANGUAGE_LEVEL="JDK_1_7" inherit-compiler-output="false">
|
||||
<output url="file://$MODULE_DIR$/target/classes" />
|
||||
<output-test url="file://$MODULE_DIR$/target/test-classes" />
|
||||
<content url="file://$MODULE_DIR$">
|
||||
<sourceFolder url="file://$MODULE_DIR$/src/main/java" isTestSource="false" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/src/main/resources" type="java-resource" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/src/test/java" isTestSource="true" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/target" />
|
||||
</content>
|
||||
<orderEntry type="inheritedJdk" />
|
||||
<module version="4">
|
||||
<component name="NewModuleRootManager" inherit-compiler-output="false">
|
||||
<orderEntry type="sourceFolder" forTests="false" />
|
||||
<orderEntry type="library" name="Maven: org.drools:drools-compiler:6.4.0.Final" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.drools:drools-core:6.4.0.Final" level="project" />
|
||||
<orderEntry type="library" name="Maven: commons-codec:commons-codec:1.4" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.kie:kie-internal:6.4.0.Final" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.antlr:antlr-runtime:3.5" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.mvel:mvel2:2.2.8.Final" level="project" />
|
||||
<orderEntry type="library" name="Maven: com.thoughtworks.xstream:xstream:1.4.7" level="project" />
|
||||
<orderEntry type="library" name="Maven: xmlpull:xmlpull:1.1.3.1" level="project" />
|
||||
<orderEntry type="library" name="Maven: xpp3:xpp3_min:1.1.4c" level="project" />
|
||||
<orderEntry type="library" name="Maven: com.google.protobuf:protobuf-java:2.6.0" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.slf4j:slf4j-api:1.7.2" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.eclipse.jdt.core.compiler:ecj:3.5.1" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.jbpm:jbpm-bpmn2:6.4.0.Final" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.jbpm:jbpm-flow-builder:6.4.0.Final" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.jbpm:jbpm-flow:6.4.0.Final" level="project" />
|
||||
<orderEntry type="library" name="Maven: joda-time:joda-time:2.2" level="project" />
|
||||
<orderEntry type="library" scope="TEST" name="Maven: junit:junit:4.5" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.kie:kie-api:6.4.0.Final" level="project" />
|
||||
<orderEntry type="module" module-name="drools-lesson-pojo" />
|
||||
</component>
|
||||
</module>
|
||||
|
|
@ -11,14 +11,16 @@ import droolscours.util.OutputDisplay;
|
|||
//#declare any global variables here
|
||||
global OutputDisplay showResult;
|
||||
|
||||
rule "Le cashFlow est du crédit ou du débit"
|
||||
rule "The cashFlow can be a credit or a debit"
|
||||
|
||||
when
|
||||
$cash :CashFlow(type in ( CashFlow.DEBIT,CashFlow.CREDIT) )
|
||||
|
||||
then
|
||||
showResult.showText("Cash Flow est un crédit ou un débit");
|
||||
showResult.showText("The cashFlow is a credit or a debit");
|
||||
end
|
||||
|
||||
|
||||
rule "Accessor"
|
||||
|
||||
when
|
||||
|
|
|
|||
|
|
@ -1,5 +1,6 @@
|
|||
package droolscours;
|
||||
|
||||
import droolscours.util.OutputDisplay;
|
||||
import org.junit.BeforeClass;
|
||||
import org.junit.Test;
|
||||
import org.kie.api.runtime.KieContainer;
|
||||
|
|
@ -19,11 +20,65 @@ public class Testlesson31 {
|
|||
}
|
||||
|
||||
@Test
|
||||
public void testUnFaitSansFait() {
|
||||
public void testInConstrait() throws Exception {
|
||||
sessionStatefull = KnowledgeSessionHelper
|
||||
.getStatefulKnowledgeSession(kieContainer, "lesson3-session");
|
||||
.getStatefulKnowledgeSessionWithCallback(kieContainer, "lesson31-session");
|
||||
OutputDisplay display = new OutputDisplay();
|
||||
sessionStatefull.setGlobal("showResult", display);
|
||||
CashFlow cashFlow = new CashFlow();
|
||||
cashFlow.setType(CashFlow.CREDIT);
|
||||
sessionStatefull.insert(cashFlow);
|
||||
sessionStatefull.fireAllRules();
|
||||
System.out.println("Did you see something ?");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testNestedAccessor() throws Exception {
|
||||
sessionStatefull = KnowledgeSessionHelper
|
||||
.getStatefulKnowledgeSessionWithCallback(kieContainer, "lesson31-session");
|
||||
OutputDisplay display = new OutputDisplay();
|
||||
sessionStatefull.setGlobal("showResult", display);
|
||||
Customer customer = new Customer();
|
||||
customer.setName("Héron");
|
||||
customer.setSurname("Nicolas");
|
||||
PrivateAccount pAccount = new PrivateAccount();
|
||||
pAccount.setOwner(customer);
|
||||
sessionStatefull.insert(pAccount);
|
||||
sessionStatefull.fireAllRules();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testInOrFact() throws Exception {
|
||||
sessionStatefull = KnowledgeSessionHelper
|
||||
.getStatefulKnowledgeSessionWithCallback(kieContainer, "lesson31-session");
|
||||
OutputDisplay display = new OutputDisplay();
|
||||
sessionStatefull.setGlobal("showResult", display);
|
||||
Customer customer = new Customer();
|
||||
|
||||
customer.setCountry("GB");
|
||||
sessionStatefull.insert(customer);
|
||||
PrivateAccount pAccount = new PrivateAccount();
|
||||
pAccount.setOwner(customer);
|
||||
sessionStatefull.insert(pAccount);
|
||||
sessionStatefull.fireAllRules();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testNotCondition() throws Exception {
|
||||
sessionStatefull = KnowledgeSessionHelper
|
||||
.getStatefulKnowledgeSessionWithCallback(kieContainer, "lesson31-session");
|
||||
OutputDisplay display = new OutputDisplay();
|
||||
sessionStatefull.setGlobal("showResult", display);
|
||||
sessionStatefull.fireAllRules();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testExistsCondition() throws Exception {
|
||||
sessionStatefull = KnowledgeSessionHelper
|
||||
.getStatefulKnowledgeSessionWithCallback(kieContainer, "lesson31-session");
|
||||
OutputDisplay display = new OutputDisplay();
|
||||
sessionStatefull.setGlobal("showResult", display);
|
||||
Account pAccount = new Account();
|
||||
sessionStatefull.insert(pAccount);
|
||||
sessionStatefull.fireAllRules();
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -20,7 +20,7 @@ public class Testlesson8 {
|
|||
@Test
|
||||
public void testUnFaitSansFait() {
|
||||
sessionStatefull = KnowledgeSessionHelper
|
||||
.getStatefulKnowledgeSession(kieContainer,"lesson1-session");
|
||||
.getStatefulKnowledgeSession(kieContainer, "lesson8-session");
|
||||
sessionStatefull.fireAllRules();
|
||||
System.out.println("Did you see something ?");
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
editor.link_modal.header
Reference in a new issue