use of org.kie.api.io.Resource in project drools by kiegroup.
the class DecisionTableTest method testLockOnActive.
@Test
public void testLockOnActive() {
final Resource decisionTable = ResourceUtil.getDecisionTableResourceFromClasspath("agenda-group.csv", getClass(), DecisionTableInputType.CSV);
final KieBase kbase = KieBaseUtil.getKieBaseFromResources(kieBaseTestConfiguration, decisionTable);
final KieSession ksession = kbase.newKieSession();
final OrderListener listener = new OrderListener();
ksession.addEventListener(listener);
ksession.insert("lockOnActive");
ksession.fireAllRules();
Assertions.assertThat(listener.size()).isEqualTo(3);
final String[] expected = { "a", "a2", "a3" };
for (int i = 0; i < listener.size(); i++) {
Assertions.assertThat(listener.get(i)).isEqualTo(expected[i]);
}
}
use of org.kie.api.io.Resource in project drools by kiegroup.
the class DecisionTableTest method testSimpleXLS.
@Test
public void testSimpleXLS() {
final Resource decisionTable = ResourceUtil.getDecisionTableResourceFromClasspath("sample.xls", getClass(), DecisionTableInputType.XLS);
testSimpleDecisionTable(decisionTable);
}
use of org.kie.api.io.Resource in project drools by kiegroup.
the class MultipleSheetsLoadingTest method buildResources.
private KieBuilder buildResources() {
final Resource resourceXlsFirst = this.createResourceWithConfig(WORKSHEET_1_NAME);
final Resource resourceXlsSecond = this.createResourceWithConfig(WORKSHEET_2_NAME);
return KieUtil.getKieBuilderFromResources(kieBaseTestConfiguration, false, resourceXlsFirst, resourceXlsSecond);
}
use of org.kie.api.io.Resource in project drools by kiegroup.
the class NonStringCompareTest method build.
private KieBuilder build(final String replacement) {
final String drl = String.format(genericDrl, replacement);
final Resource resource = KieServices.Factory.get().getResources().newReaderResource(new StringReader(drl));
resource.setTargetPath(TestConstants.DRL_TEST_TARGET_PATH);
return KieUtil.getKieBuilderFromResources(kieBaseTestConfiguration, false, resource);
}
use of org.kie.api.io.Resource in project drools by kiegroup.
the class POJOAnnotationMergeTest method testPositionFromPOJOIgnored.
/**
* Tests adding metadata in DRL to the metadata already declared in a POJO.
*/
@Test
public void testPositionFromPOJOIgnored() {
final Resource resource = KieServices.Factory.get().getResources().newReaderResource(new StringReader(DRL));
resource.setTargetPath(TestConstants.DRL_TEST_TARGET_PATH);
KieUtil.getKieBuilderFromResources(kieBaseTestConfiguration, true, resource);
}
Aggregations