Search in sources :

Example 1 with KieBaseTestConfiguration

use of org.drools.testcoverage.common.util.KieBaseTestConfiguration in project drools by kiegroup.

the class GuidedDecisionTableTest method initKieSession.

private void initKieSession(String... resourceNames) {
    KieResources kieResources = KieServices.get().getResources();
    final Resource[] resources = Stream.of(resourceNames).map(resource -> kieResources.newClassPathResource(resource, GuidedDecisionTableTest.class)).toArray(Resource[]::new);
    final KieBase kBase = KieBaseUtil.getKieBaseFromResources(kieBaseTestConfiguration, resources);
    kSession = kBase.newKieSession();
    rulesFired = new TrackingAgendaEventListener();
    kSession.addEventListener(rulesFired);
    rulesFired.clear();
}
Also used : Address(org.drools.testcoverage.common.model.Address) Collection(java.util.Collection) RunWith(org.junit.runner.RunWith) Test(org.junit.Test) KieBaseTestConfiguration(org.drools.testcoverage.common.util.KieBaseTestConfiguration) KieResources(org.kie.api.io.KieResources) FactHandle(org.kie.api.runtime.rule.FactHandle) Resource(org.kie.api.io.Resource) Stream(java.util.stream.Stream) Person(org.drools.testcoverage.common.model.Person) KieServices(org.kie.api.KieServices) Assertions(org.assertj.core.api.Assertions) KieBaseUtil(org.drools.testcoverage.common.util.KieBaseUtil) TestParametersUtil(org.drools.testcoverage.common.util.TestParametersUtil) KieBase(org.kie.api.KieBase) KieSession(org.kie.api.runtime.KieSession) TrackingAgendaEventListener(org.drools.testcoverage.common.listener.TrackingAgendaEventListener) Parameterized(org.junit.runners.Parameterized) Before(org.junit.Before) TrackingAgendaEventListener(org.drools.testcoverage.common.listener.TrackingAgendaEventListener) KieBase(org.kie.api.KieBase) Resource(org.kie.api.io.Resource) KieResources(org.kie.api.io.KieResources)

Aggregations

Collection (java.util.Collection)1 Stream (java.util.stream.Stream)1 Assertions (org.assertj.core.api.Assertions)1 TrackingAgendaEventListener (org.drools.testcoverage.common.listener.TrackingAgendaEventListener)1 Address (org.drools.testcoverage.common.model.Address)1 Person (org.drools.testcoverage.common.model.Person)1 KieBaseTestConfiguration (org.drools.testcoverage.common.util.KieBaseTestConfiguration)1 KieBaseUtil (org.drools.testcoverage.common.util.KieBaseUtil)1 TestParametersUtil (org.drools.testcoverage.common.util.TestParametersUtil)1 Before (org.junit.Before)1 Test (org.junit.Test)1 RunWith (org.junit.runner.RunWith)1 Parameterized (org.junit.runners.Parameterized)1 KieBase (org.kie.api.KieBase)1 KieServices (org.kie.api.KieServices)1 KieResources (org.kie.api.io.KieResources)1 Resource (org.kie.api.io.Resource)1 KieSession (org.kie.api.runtime.KieSession)1 FactHandle (org.kie.api.runtime.rule.FactHandle)1