Search in sources :

Example 36 with Variable

use of org.drools.model.Variable in project drools by kiegroup.

the class FireAndAlarmTest method testFireAndAlarm.

@Test
public void testFireAndAlarm() {
    Variable<Room> room = any(Room.class);
    Variable<Fire> fire = any(Fire.class);
    Variable<Sprinkler> sprinkler = any(Sprinkler.class);
    Variable<Alarm> alarm = any(Alarm.class);
    Rule r1 = rule("When there is a fire turn on the sprinkler").build(expr(sprinkler, s -> !s.isOn()), expr(sprinkler, fire, (s, f) -> s.getRoom().equals(f.getRoom())), on(sprinkler).execute(s -> {
        System.out.println("Turn on the sprinkler for room " + s.getRoom().getName());
        s.setOn(true);
    }).update(sprinkler, "on"));
    Rule r2 = rule("When the fire is gone turn off the sprinkler").build(expr(sprinkler, Sprinkler::isOn), not(fire, sprinkler, (f, s) -> f.getRoom().equals(s.getRoom())), on(sprinkler).execute(s -> {
        System.out.println("Turn off the sprinkler for room " + s.getRoom().getName());
        s.setOn(false);
    }).update(sprinkler, "on"));
    Rule r3 = rule("Raise the alarm when we have one or more fires").build(exists(fire), execute(() -> System.out.println("Raise the alarm")).insert(() -> new Alarm()));
    Rule r4 = rule("Lower the alarm when all the fires have gone").build(not(fire), input(alarm), execute(() -> System.out.println("Lower the alarm")).delete(alarm));
    Rule r5 = rule("Status output when things are ok").build(not(alarm), not(sprinkler, Sprinkler::isOn), execute(() -> System.out.println("Everything is ok")));
    Model model = new ModelImpl().withRules(asList(r1, r2, r3, r4, r5));
    KieBase kieBase = KieBaseBuilder.createKieBaseFromModel(model);
    KieSession ksession = kieBase.newKieSession();
    // phase 1
    Room room1 = new Room("Room 1");
    ksession.insert(room1);
    FactHandle fireFact1 = ksession.insert(new Fire(room1));
    ksession.fireAllRules();
    // phase 2
    Sprinkler sprinkler1 = new Sprinkler(room1);
    ksession.insert(sprinkler1);
    ksession.fireAllRules();
    assertTrue(sprinkler1.isOn());
    // phase 3
    ksession.delete(fireFact1);
    ksession.fireAllRules();
}
Also used : Fire(org.drools.modelcompiler.fireandalarm.model.Fire) Room(org.drools.modelcompiler.fireandalarm.model.Room) Variable(org.drools.model.Variable) Assert.assertTrue(org.junit.Assert.assertTrue) Test(org.junit.Test) FactHandle(org.kie.api.runtime.rule.FactHandle) KieBaseBuilder(org.drools.modelcompiler.builder.KieBaseBuilder) FlowDSL(org.drools.model.FlowDSL) Sprinkler(org.drools.modelcompiler.fireandalarm.model.Sprinkler) Alarm(org.drools.modelcompiler.fireandalarm.model.Alarm) Arrays.asList(java.util.Arrays.asList) Rule(org.drools.model.Rule) KieBase(org.kie.api.KieBase) KieSession(org.kie.api.runtime.KieSession) Model(org.drools.model.Model) ModelImpl(org.drools.model.impl.ModelImpl) FactHandle(org.kie.api.runtime.rule.FactHandle) Sprinkler(org.drools.modelcompiler.fireandalarm.model.Sprinkler) KieBase(org.kie.api.KieBase) Fire(org.drools.modelcompiler.fireandalarm.model.Fire) Alarm(org.drools.modelcompiler.fireandalarm.model.Alarm) Model(org.drools.model.Model) KieSession(org.kie.api.runtime.KieSession) Rule(org.drools.model.Rule) ModelImpl(org.drools.model.impl.ModelImpl) Room(org.drools.modelcompiler.fireandalarm.model.Room) Test(org.junit.Test)

Example 37 with Variable

use of org.drools.model.Variable in project drools by kiegroup.

the class FireAndAlarmUsingDroolsTest method testFireAndAlarmUsingDroolsInConsequences.

@Test
public void testFireAndAlarmUsingDroolsInConsequences() {
    Variable<Room> room = any(Room.class);
    Variable<Fire> fire = any(Fire.class);
    Variable<Sprinkler> sprinkler = any(Sprinkler.class);
    Variable<Alarm> alarm = any(Alarm.class);
    Rule r1 = rule("When there is a fire turn on the sprinkler").build(expr(sprinkler, s -> !s.isOn()), expr(sprinkler, fire, (s, f) -> s.getRoom().equals(f.getRoom())), on(sprinkler).execute((drools, s) -> {
        System.out.println("Turn on the sprinkler for room " + s.getRoom().getName());
        s.setOn(true);
        drools.update(s, "on");
    }));
    BitMask r2_mask1 = BitMask.getPatternMask(Sprinkler.class, "on");
    Rule r2 = rule("When the fire is gone turn off the sprinkler").build(expr(sprinkler, Sprinkler::isOn), not(fire, sprinkler, (f, s) -> f.getRoom().equals(s.getRoom())), on(sprinkler).execute((drools, s) -> {
        System.out.println("Turn off the sprinkler for room " + s.getRoom().getName());
        s.setOn(false);
        drools.update(s, r2_mask1);
    }));
    Rule r3 = rule("Raise the alarm when we have one or more fires").build(exists(fire), execute(drools -> {
        System.out.println("Raise the alarm");
        drools.insert(new Alarm());
    }));
    Rule r4 = rule("Lower the alarm when all the fires have gone").build(not(fire), on(alarm).execute((drools, a) -> {
        System.out.println("Lower the alarm");
        drools.delete(a);
    }));
    Rule r5 = rule("Status output when things are ok").build(not(alarm), not(sprinkler, Sprinkler::isOn), execute(() -> System.out.println("Everything is ok")));
    Model model = new ModelImpl().withRules(asList(r1, r2, r3, r4, r5));
    KieBase kieBase = KieBaseBuilder.createKieBaseFromModel(model);
    KieSession ksession = kieBase.newKieSession();
    // phase 1
    Room room1 = new Room("Room 1");
    ksession.insert(room1);
    FactHandle fireFact1 = ksession.insert(new Fire(room1));
    ksession.fireAllRules();
    // phase 2
    Sprinkler sprinkler1 = new Sprinkler(room1);
    ksession.insert(sprinkler1);
    ksession.fireAllRules();
    assertTrue(sprinkler1.isOn());
    // phase 3
    ksession.delete(fireFact1);
    ksession.fireAllRules();
}
Also used : BitMask(org.drools.model.BitMask) Fire(org.drools.modelcompiler.fireandalarm.model.Fire) Room(org.drools.modelcompiler.fireandalarm.model.Room) Variable(org.drools.model.Variable) Assert.assertTrue(org.junit.Assert.assertTrue) Test(org.junit.Test) FactHandle(org.kie.api.runtime.rule.FactHandle) KieBaseBuilder(org.drools.modelcompiler.builder.KieBaseBuilder) FlowDSL(org.drools.model.FlowDSL) Sprinkler(org.drools.modelcompiler.fireandalarm.model.Sprinkler) Alarm(org.drools.modelcompiler.fireandalarm.model.Alarm) Arrays.asList(java.util.Arrays.asList) Rule(org.drools.model.Rule) KieBase(org.kie.api.KieBase) KieSession(org.kie.api.runtime.KieSession) Model(org.drools.model.Model) ModelImpl(org.drools.model.impl.ModelImpl) FactHandle(org.kie.api.runtime.rule.FactHandle) Sprinkler(org.drools.modelcompiler.fireandalarm.model.Sprinkler) BitMask(org.drools.model.BitMask) KieBase(org.kie.api.KieBase) Fire(org.drools.modelcompiler.fireandalarm.model.Fire) Alarm(org.drools.modelcompiler.fireandalarm.model.Alarm) Model(org.drools.model.Model) KieSession(org.kie.api.runtime.KieSession) Rule(org.drools.model.Rule) ModelImpl(org.drools.model.impl.ModelImpl) Room(org.drools.modelcompiler.fireandalarm.model.Room) Test(org.junit.Test)

Example 38 with Variable

use of org.drools.model.Variable in project drools by kiegroup.

the class FactTemplateTest method testBetaMixingClassAndFact.

@Test
public void testBetaMixingClassAndFact() {
    Prototype personFact = prototype("org.drools", "FactPerson", field("name", Integer.class), field("age", String.class));
    PrototypeVariable markV = declarationOf(personFact);
    Variable<Person> olderV = declarationOf(Person.class);
    Rule rule = rule("beta").build(pattern(markV).expr("exprA", p -> p.get("name").equals("Mark"), alphaIndexedBy(String.class, Index.ConstraintType.EQUAL, 1, p -> (String) p.get("name"), "Mark"), reactOn("name", "age")), pattern(olderV).expr("exprB", p -> !p.getName().equals("Mark"), alphaIndexedBy(String.class, Index.ConstraintType.NOT_EQUAL, 1, p -> p.getName(), "Mark"), reactOn("name")).expr("exprC", markV, (p1, p2) -> p1.getAge() > (int) p2.get("age"), betaIndexedBy(int.class, Index.ConstraintType.GREATER_THAN, 0, p -> p.getAge(), p -> (int) p.get("age")), reactOn("age")), on(olderV, markV).execute((drools, p1, p2) -> drools.insert(new Result(p1.getName() + " is older than " + p2.get("name")))));
    Model model = new ModelImpl().addRule(rule);
    KieBase kieBase = KieBaseBuilder.createKieBaseFromModel(model);
    KieSession ksession = kieBase.newKieSession();
    assertTrue(hasFactTemplateObjectType(ksession, "FactPerson"));
    Fact mark = createMapBasedFact(personFact);
    mark.setFieldValue("name", "Mark");
    mark.setFieldValue("age", 37);
    ksession.insert(mark);
    FactHandle edsonFH = ksession.insert(new Person("Edson", 35));
    FactHandle marioFH = ksession.insert(new Person("Mario", 40));
    ksession.fireAllRules();
    Collection<Result> results = getObjectsIntoList(ksession, Result.class);
    assertThat(results, hasItem(new Result("Mario is older than Mark")));
}
Also used : CoreMatchers.hasItem(org.hamcrest.CoreMatchers.hasItem) Prototype(org.drools.model.Prototype) PrototypeVariable(org.drools.model.PrototypeVariable) PatternDSL.reactOn(org.drools.model.PatternDSL.reactOn) DSL.prototype(org.drools.model.DSL.prototype) FactFactory.createMapBasedFact(org.drools.modelcompiler.facttemplate.FactFactory.createMapBasedFact) Result(org.drools.modelcompiler.domain.Result) BaseModelTest.getObjectsIntoList(org.drools.modelcompiler.BaseModelTest.getObjectsIntoList) Assert.assertThat(org.junit.Assert.assertThat) PatternDSL.declarationOf(org.drools.model.PatternDSL.declarationOf) PatternDSL.alphaIndexedBy(org.drools.model.PatternDSL.alphaIndexedBy) EntryPointNode(org.drools.core.reteoo.EntryPointNode) KieBase(org.kie.api.KieBase) KieSession(org.kie.api.runtime.KieSession) Model(org.drools.model.Model) PatternDSL.rule(org.drools.model.PatternDSL.rule) Fact(org.drools.core.facttemplates.Fact) Variable(org.drools.model.Variable) Collection(java.util.Collection) DSL.field(org.drools.model.DSL.field) Assert.assertTrue(org.junit.Assert.assertTrue) Test(org.junit.Test) Index(org.drools.model.Index) PatternDSL.on(org.drools.model.PatternDSL.on) PatternDSL.pattern(org.drools.model.PatternDSL.pattern) FactHandle(org.kie.api.runtime.rule.FactHandle) KieBaseBuilder(org.drools.modelcompiler.builder.KieBaseBuilder) Assert.assertNull(org.junit.Assert.assertNull) FactTemplateObjectType(org.drools.core.facttemplates.FactTemplateObjectType) InternalKnowledgeBase(org.drools.core.impl.InternalKnowledgeBase) Rule(org.drools.model.Rule) Person(org.drools.modelcompiler.domain.Person) PatternDSL.betaIndexedBy(org.drools.model.PatternDSL.betaIndexedBy) ObjectTypeNode(org.drools.core.reteoo.ObjectTypeNode) Assert.assertEquals(org.junit.Assert.assertEquals) ModelImpl(org.drools.model.impl.ModelImpl) Prototype(org.drools.model.Prototype) FactHandle(org.kie.api.runtime.rule.FactHandle) PrototypeVariable(org.drools.model.PrototypeVariable) FactFactory.createMapBasedFact(org.drools.modelcompiler.facttemplate.FactFactory.createMapBasedFact) Fact(org.drools.core.facttemplates.Fact) Result(org.drools.modelcompiler.domain.Result) KieBase(org.kie.api.KieBase) Model(org.drools.model.Model) KieSession(org.kie.api.runtime.KieSession) Rule(org.drools.model.Rule) ModelImpl(org.drools.model.impl.ModelImpl) Person(org.drools.modelcompiler.domain.Person) Test(org.junit.Test)

Example 39 with Variable

use of org.drools.model.Variable in project drools by kiegroup.

the class FlowTest method testFromAccumulate.

@Test
public void testFromAccumulate() {
    final Variable<Number> var_$sum = declarationOf(Number.class, "$sum");
    final Variable<Person> var_$p = declarationOf(Person.class, "$p");
    final Variable<Integer> var_$expr$3$ = declarationOf(Integer.class, "$expr$3$");
    org.drools.model.Rule rule = rule("X").build(bind(var_$expr$3$).as(var_$p, (_this) -> _this.getAge()), expr("$expr$1$", var_$sum, (_this) -> _this.intValue() > 0).reactOn("intValue"), accumulate(expr("$expr$2$", var_$p, (_this) -> _this.getName().startsWith("M")), accFunction(org.drools.core.base.accumulators.IntegerSumAccumulateFunction.class, var_$expr$3$).as(var_$sum)), on(var_$sum).execute((drools, $sum) -> {
        drools.insert(new Result($sum));
    }));
    Model model = new ModelImpl().addRule(rule);
    KieBase kieBase = KieBaseBuilder.createKieBaseFromModel(model);
    KieSession ksession = kieBase.newKieSession();
    ksession.insert(new Person("Mark", 37));
    ksession.insert(new Person("Edson", 35));
    ksession.insert(new Person("Mario", 40));
    ksession.fireAllRules();
    Collection<Result> results = getObjectsIntoList(ksession, Result.class);
    assertEquals(1, results.size());
    assertEquals(77, results.iterator().next().getValue());
}
Also used : Arrays(java.util.Arrays) CoreMatchers.hasItem(org.hamcrest.CoreMatchers.hasItem) FlowDSL.eval(org.drools.model.FlowDSL.eval) ObjectOutput(java.io.ObjectOutput) Man(org.drools.modelcompiler.domain.Man) Global(org.drools.model.Global) FlowDSL.not(org.drools.model.FlowDSL.not) Toy(org.drools.modelcompiler.domain.Toy) FlowDSL.and(org.drools.model.FlowDSL.and) FlowDSL.accFunction(org.drools.model.FlowDSL.accFunction) Relationship(org.drools.modelcompiler.domain.Relationship) BaseModelTest.getObjectsIntoList(org.drools.modelcompiler.BaseModelTest.getObjectsIntoList) Assert.assertThat(org.junit.Assert.assertThat) Query2Def(org.drools.model.Query2Def) Child(org.drools.modelcompiler.domain.Child) ClassObjectFilter(org.kie.api.runtime.ClassObjectFilter) AccumulateFunction(org.kie.api.runtime.rule.AccumulateFunction) FlowDSL.from(org.drools.model.FlowDSL.from) QueryResults(org.kie.api.runtime.rule.QueryResults) Arrays.asList(java.util.Arrays.asList) Map(java.util.Map) FlowDSL.reactiveFrom(org.drools.model.FlowDSL.reactiveFrom) Assertions(org.assertj.core.api.Assertions) KieSession(org.kie.api.runtime.KieSession) FlowDSL.declarationOf(org.drools.model.FlowDSL.declarationOf) TargetPolicy(org.drools.modelcompiler.domain.TargetPolicy) FlowDSL.or(org.drools.model.FlowDSL.or) EventProcessingOption(org.kie.api.conf.EventProcessingOption) Collection(java.util.Collection) FlowDSL.on(org.drools.model.FlowDSL.on) Customer(org.drools.modelcompiler.domain.Customer) Serializable(java.io.Serializable) ConstraintType(org.drools.model.Index.ConstraintType) List(java.util.List) Query(org.drools.model.Query) FlowDSL.executeScript(org.drools.model.FlowDSL.executeScript) InternationalAddress(org.drools.modelcompiler.oopathdtables.InternationalAddress) Assert.assertFalse(org.junit.Assert.assertFalse) KnowledgeBaseFactory(org.drools.core.impl.KnowledgeBaseFactory) FlowDSL.bind(org.drools.model.FlowDSL.bind) FlowDSL.valueOf(org.drools.model.FlowDSL.valueOf) Person(org.drools.modelcompiler.domain.Person) ObjectInput(java.io.ObjectInput) InOperator(org.drools.model.operators.InOperator) FlowDSL.when(org.drools.model.FlowDSL.when) ModelImpl(org.drools.model.impl.ModelImpl) FlowDSL.globalOf(org.drools.model.FlowDSL.globalOf) StockTick(org.drools.modelcompiler.domain.StockTick) Employee.createEmployee(org.drools.modelcompiler.domain.Employee.createEmployee) ClockType(org.drools.core.ClockType) FlowDSL.accumulate(org.drools.model.FlowDSL.accumulate) ArrayList(java.util.ArrayList) Result(org.drools.modelcompiler.domain.Result) KieSessionConfiguration(org.kie.api.runtime.KieSessionConfiguration) Adult(org.drools.modelcompiler.domain.Adult) Employee(org.drools.modelcompiler.domain.Employee) FlowDSL.execute(org.drools.model.FlowDSL.execute) Woman(org.drools.modelcompiler.domain.Woman) KieBase(org.kie.api.KieBase) Model(org.drools.model.Model) FlowDSL.rule(org.drools.model.FlowDSL.rule) FlowDSL.expr(org.drools.model.FlowDSL.expr) Variable(org.drools.model.Variable) FlowDSL.query(org.drools.model.FlowDSL.query) Address(org.drools.modelcompiler.domain.Address) FlowDSL.window(org.drools.model.FlowDSL.window) Assert.assertTrue(org.junit.Assert.assertTrue) IOException(java.io.IOException) Test(org.junit.Test) FlowDSL.input(org.drools.model.FlowDSL.input) SessionPseudoClock(org.kie.api.time.SessionPseudoClock) FactHandle(org.kie.api.runtime.rule.FactHandle) TimeUnit(java.util.concurrent.TimeUnit) KieBaseBuilder(org.drools.modelcompiler.builder.KieBaseBuilder) ClockTypeOption(org.kie.api.runtime.conf.ClockTypeOption) Assert.assertNull(org.junit.Assert.assertNull) FlowDSL.forall(org.drools.model.FlowDSL.forall) Rule(org.drools.model.Rule) Query1Def(org.drools.model.Query1Def) Assert.assertEquals(org.junit.Assert.assertEquals) Result(org.drools.modelcompiler.domain.Result) KieBase(org.kie.api.KieBase) Rule(org.drools.model.Rule) Model(org.drools.model.Model) KieSession(org.kie.api.runtime.KieSession) ModelImpl(org.drools.model.impl.ModelImpl) Person(org.drools.modelcompiler.domain.Person) Test(org.junit.Test)

Example 40 with Variable

use of org.drools.model.Variable in project drools by kiegroup.

the class FlowTest method testDeclaredSlidingWindow.

@Test
public void testDeclaredSlidingWindow() {
    org.drools.model.WindowReference var_DeclaredWindow = window(org.drools.model.WindowDefinition.Type.TIME, 5, java.util.concurrent.TimeUnit.SECONDS, StockTick.class, (_this) -> _this.getCompany().equals("DROO"));
    final Variable<StockTick> var_$a = declarationOf(StockTick.class, "$a", var_DeclaredWindow);
    org.drools.model.Rule rule = rule("R").build(on(var_$a).execute(($a) -> {
        System.out.println($a.getCompany());
    }));
    Model model = new ModelImpl().addRule(rule);
    KieBase kieBase = KieBaseBuilder.createKieBaseFromModel(model, EventProcessingOption.STREAM);
    KieSessionConfiguration sessionConfig = KnowledgeBaseFactory.newKnowledgeSessionConfiguration();
    sessionConfig.setOption(ClockTypeOption.get(ClockType.PSEUDO_CLOCK.getId()));
    KieSession ksession = kieBase.newKieSession(sessionConfig, null);
    SessionPseudoClock clock = ksession.getSessionClock();
    clock.advanceTime(2, TimeUnit.SECONDS);
    ksession.insert(new StockTick("DROO"));
    clock.advanceTime(2, TimeUnit.SECONDS);
    ksession.insert(new StockTick("DROO"));
    clock.advanceTime(2, TimeUnit.SECONDS);
    ksession.insert(new StockTick("ACME"));
    clock.advanceTime(2, TimeUnit.SECONDS);
    ksession.insert(new StockTick("DROO"));
    assertEquals(2, ksession.fireAllRules());
}
Also used : Arrays(java.util.Arrays) CoreMatchers.hasItem(org.hamcrest.CoreMatchers.hasItem) FlowDSL.eval(org.drools.model.FlowDSL.eval) ObjectOutput(java.io.ObjectOutput) Man(org.drools.modelcompiler.domain.Man) Global(org.drools.model.Global) FlowDSL.not(org.drools.model.FlowDSL.not) Toy(org.drools.modelcompiler.domain.Toy) FlowDSL.and(org.drools.model.FlowDSL.and) FlowDSL.accFunction(org.drools.model.FlowDSL.accFunction) Relationship(org.drools.modelcompiler.domain.Relationship) BaseModelTest.getObjectsIntoList(org.drools.modelcompiler.BaseModelTest.getObjectsIntoList) Assert.assertThat(org.junit.Assert.assertThat) Query2Def(org.drools.model.Query2Def) Child(org.drools.modelcompiler.domain.Child) ClassObjectFilter(org.kie.api.runtime.ClassObjectFilter) AccumulateFunction(org.kie.api.runtime.rule.AccumulateFunction) FlowDSL.from(org.drools.model.FlowDSL.from) QueryResults(org.kie.api.runtime.rule.QueryResults) Arrays.asList(java.util.Arrays.asList) Map(java.util.Map) FlowDSL.reactiveFrom(org.drools.model.FlowDSL.reactiveFrom) Assertions(org.assertj.core.api.Assertions) KieSession(org.kie.api.runtime.KieSession) FlowDSL.declarationOf(org.drools.model.FlowDSL.declarationOf) TargetPolicy(org.drools.modelcompiler.domain.TargetPolicy) FlowDSL.or(org.drools.model.FlowDSL.or) EventProcessingOption(org.kie.api.conf.EventProcessingOption) Collection(java.util.Collection) FlowDSL.on(org.drools.model.FlowDSL.on) Customer(org.drools.modelcompiler.domain.Customer) Serializable(java.io.Serializable) ConstraintType(org.drools.model.Index.ConstraintType) List(java.util.List) Query(org.drools.model.Query) FlowDSL.executeScript(org.drools.model.FlowDSL.executeScript) InternationalAddress(org.drools.modelcompiler.oopathdtables.InternationalAddress) Assert.assertFalse(org.junit.Assert.assertFalse) KnowledgeBaseFactory(org.drools.core.impl.KnowledgeBaseFactory) FlowDSL.bind(org.drools.model.FlowDSL.bind) FlowDSL.valueOf(org.drools.model.FlowDSL.valueOf) Person(org.drools.modelcompiler.domain.Person) ObjectInput(java.io.ObjectInput) InOperator(org.drools.model.operators.InOperator) FlowDSL.when(org.drools.model.FlowDSL.when) ModelImpl(org.drools.model.impl.ModelImpl) FlowDSL.globalOf(org.drools.model.FlowDSL.globalOf) StockTick(org.drools.modelcompiler.domain.StockTick) Employee.createEmployee(org.drools.modelcompiler.domain.Employee.createEmployee) ClockType(org.drools.core.ClockType) FlowDSL.accumulate(org.drools.model.FlowDSL.accumulate) ArrayList(java.util.ArrayList) Result(org.drools.modelcompiler.domain.Result) KieSessionConfiguration(org.kie.api.runtime.KieSessionConfiguration) Adult(org.drools.modelcompiler.domain.Adult) Employee(org.drools.modelcompiler.domain.Employee) FlowDSL.execute(org.drools.model.FlowDSL.execute) Woman(org.drools.modelcompiler.domain.Woman) KieBase(org.kie.api.KieBase) Model(org.drools.model.Model) FlowDSL.rule(org.drools.model.FlowDSL.rule) FlowDSL.expr(org.drools.model.FlowDSL.expr) Variable(org.drools.model.Variable) FlowDSL.query(org.drools.model.FlowDSL.query) Address(org.drools.modelcompiler.domain.Address) FlowDSL.window(org.drools.model.FlowDSL.window) Assert.assertTrue(org.junit.Assert.assertTrue) IOException(java.io.IOException) Test(org.junit.Test) FlowDSL.input(org.drools.model.FlowDSL.input) SessionPseudoClock(org.kie.api.time.SessionPseudoClock) FactHandle(org.kie.api.runtime.rule.FactHandle) TimeUnit(java.util.concurrent.TimeUnit) KieBaseBuilder(org.drools.modelcompiler.builder.KieBaseBuilder) ClockTypeOption(org.kie.api.runtime.conf.ClockTypeOption) Assert.assertNull(org.junit.Assert.assertNull) FlowDSL.forall(org.drools.model.FlowDSL.forall) Rule(org.drools.model.Rule) Query1Def(org.drools.model.Query1Def) Assert.assertEquals(org.junit.Assert.assertEquals) SessionPseudoClock(org.kie.api.time.SessionPseudoClock) StockTick(org.drools.modelcompiler.domain.StockTick) KieBase(org.kie.api.KieBase) Rule(org.drools.model.Rule) Model(org.drools.model.Model) KieSession(org.kie.api.runtime.KieSession) ModelImpl(org.drools.model.impl.ModelImpl) KieSessionConfiguration(org.kie.api.runtime.KieSessionConfiguration) Test(org.junit.Test)

Aggregations

Variable (org.drools.model.Variable)69 Model (org.drools.model.Model)57 Rule (org.drools.model.Rule)57 ModelImpl (org.drools.model.impl.ModelImpl)57 KieBaseBuilder (org.drools.modelcompiler.builder.KieBaseBuilder)57 Test (org.junit.Test)57 KieBase (org.kie.api.KieBase)57 ArrayList (java.util.ArrayList)56 KieSession (org.kie.api.runtime.KieSession)55 List (java.util.List)54 Assert.assertEquals (org.junit.Assert.assertEquals)53 Assertions (org.assertj.core.api.Assertions)52 Global (org.drools.model.Global)52 Child (org.drools.modelcompiler.domain.Child)52 Man (org.drools.modelcompiler.domain.Man)52 Toy (org.drools.modelcompiler.domain.Toy)52 Woman (org.drools.modelcompiler.domain.Woman)52 QueryResults (org.kie.api.runtime.rule.QueryResults)52 Person (org.drools.modelcompiler.domain.Person)50 FactHandle (org.kie.api.runtime.rule.FactHandle)50