APISonar


org.kie.internal.builder.DecisionTableInputType.CSV

> org > kie > internal > builder > DecisionTableInputType > CSV
org APIs kie APIs internal APIs builder APIs DecisionTableInputType APIs CSV APIs

Example 1
public void testEmptyActionInCSV() {
		DecisionTableConfiguration dtconf = KnowledgeBuilderFactory
				.newDecisionTableConfiguration();
		dtconf.setInputType(DecisionTableInputType.CSV);
		KnowledgeBuilder kbuilder = KnowledgeBuilderFactory
				.newKnowledgeBuilder();
        kbuilder.add(ResourceFactory.newClassPathResource(
                "emptyAction.csv", getClass()), ResourceType.DTABLE, dtconf);
	}
Example 2
private KieSession getKieSessionFromCsv(final String csvFile) {
        final Resource resource =
                ResourceUtil.getDecisionTableResourceFromClasspath(csvFile, getClass(), DecisionTableInputType.CSV);

        return KieBaseUtil.getKieBaseFromResources(kieBaseTestConfiguration, resource).newKieSession();
    }
Example 3
public void testCSV() {
        final Resource decisionTable =
                ResourceUtil.getDecisionTableResourceFromClasspath("sample.csv", getClass(), DecisionTableInputType.CSV);
        final KieBase kbase = KieBaseUtil.getKieBaseFromResources(kieBaseTestConfiguration, decisionTable);

        Assertions.assertThat((long) kbase.getKiePackages().size()).as("Unexpected number of packages in kbase").isEqualTo((long) 2);

        verifyPackageWithRules(kbase, TestConstants.PACKAGE_FUNCTIONAL, 3);
        verifyPackageWithImports(kbase, TestConstants.PACKAGE_TESTCOVERAGE_MODEL);
    }
Example 4
public void testDTableWithNullSrcPathIsCorrectlyDumped() {
        DecisionTableConfiguration dtconf = KnowledgeBuilderFactory.newDecisionTableConfiguration();
        dtconf.setInputType(DecisionTableInputType.CSV);
        KnowledgeBuilder kbuilder = KnowledgeBuilderFactory.newKnowledgeBuilder();
        Resource resource = ResourceFactory.newByteArrayResource(DUMMY_DTABLE_CSV_SOURCE.getBytes(IoUtils.UTF8_CHARSET));
        kbuilder.add(resource, ResourceType.DTABLE, dtconf);
        if (kbuilder.hasErrors()) {
            Assert.fail("Unexpected Drools compilation errors: " + kbuilder.getErrors().toString());
        }
        assertGeneratedDrlExists(dumpDir, null);
    }