Skip to content

Commit

Permalink
Merge branch 'refs/heads/main' into kie-issues#1448-2
Browse files Browse the repository at this point in the history
  • Loading branch information
yesamer committed Sep 16, 2024
2 parents 4f600ed + d7ca8b3 commit b469a84
Show file tree
Hide file tree
Showing 34 changed files with 94 additions and 89 deletions.
14 changes: 7 additions & 7 deletions drools-decisiontables/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -87,8 +87,13 @@
</dependency>

<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.assertj</groupId>
<artifactId>assertj-core</artifactId>
<scope>test</scope>
</dependency>
<!-- Logging -->
Expand All @@ -101,11 +106,6 @@
<artifactId>logback-classic</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.assertj</groupId>
<artifactId>assertj-core</artifactId>
<scope>test</scope>
</dependency>
</dependencies>

</project>
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,9 @@
import java.util.Calendar;
import java.util.concurrent.TimeUnit;

import org.junit.After;
import org.junit.Before;
import org.junit.Test;
import org.junit.jupiter.api.AfterEach;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
import org.kie.api.KieServices;
import org.kie.api.builder.KieBuilder;
import org.kie.api.builder.KieFileSystem;
Expand All @@ -42,7 +42,7 @@ public class CalendarTimerResourcesTest {

private SessionPseudoClock clock;

@Before
@BeforeEach
public void init() {

final KieServices ks = KieServices.Factory.get();
Expand All @@ -66,7 +66,7 @@ public void init() {
clock = ksession.getSessionClock();
}

@After
@AfterEach
public void tearDown() {

if (ksession != null) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
import org.drools.base.definitions.rule.impl.RuleImpl;
import org.drools.kiesession.rulebase.InternalKnowledgeBase;
import org.drools.kiesession.rulebase.KnowledgeBaseFactory;
import org.junit.Test;
import org.junit.jupiter.api.Test;
import org.kie.api.io.ResourceType;
import org.kie.internal.builder.DecisionTableConfiguration;
import org.kie.internal.builder.DecisionTableInputType;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@

import java.util.Locale;

import org.junit.After;
import org.junit.Test;
import org.junit.jupiter.api.AfterEach;
import org.junit.jupiter.api.Test;
import org.kie.api.KieServices;
import org.kie.api.builder.KieBuilder;
import org.kie.api.builder.KieFileSystem;
Expand Down Expand Up @@ -56,7 +56,7 @@ public void init() {
ksession = ks.newKieContainer(ks.getRepository().getDefaultReleaseId()).newKieSession();
}

@After
@AfterEach
public void tearDown() {
if (ksession != null) {
ksession.dispose();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,9 @@

import org.apache.commons.io.FileUtils;
import org.drools.util.IoUtils;
import org.junit.After;
import org.junit.Before;
import org.junit.Test;
import org.junit.jupiter.api.AfterEach;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
import org.kie.api.KieServices;
import org.kie.api.builder.ReleaseId;
import org.kie.api.io.Resource;
Expand Down Expand Up @@ -57,7 +57,7 @@ public class DumpGeneratedDrlTest {
private File dumpDir;
private String dumpDirPropOrigValue;

@Before
@BeforeEach
public void setUp() {
dumpDir = new File("target/drools-dump-dir");
// delete the dir before test to remove possible leftovers from previous runs
Expand All @@ -71,7 +71,7 @@ public void setUp() {
System.setProperty(DumpDirOption.PROPERTY_NAME, dumpDir.getAbsolutePath());
}

@After
@AfterEach
public void tearDown() {
if (dumpDirPropOrigValue != null) {
System.setProperty(DumpDirOption.PROPERTY_NAME, dumpDirPropOrigValue);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,33 +19,36 @@
package org.drools.decisiontable;

import org.drools.template.parser.DecisionTableParseException;
import org.junit.Test;
import org.junit.jupiter.api.Test;
import org.kie.internal.builder.DecisionTableConfiguration;
import org.kie.internal.builder.KnowledgeBuilder;
import org.kie.internal.builder.KnowledgeBuilderFactory;

import static org.assertj.core.api.Assertions.assertThatExceptionOfType;
import static org.kie.api.io.ResourceType.DTABLE;
import static org.kie.internal.builder.DecisionTableInputType.CSV;
import static org.kie.internal.builder.DecisionTableInputType.XLS;
import static org.kie.internal.io.ResourceFactory.newClassPathResource;

public class EmptyHeaderTest {

@Test(expected = DecisionTableParseException.class)
@Test
public void testEmptyConditionInXLS() {
DecisionTableConfiguration dtconf = KnowledgeBuilderFactory.newDecisionTableConfiguration();
dtconf.setInputType(XLS);
KnowledgeBuilder kbuilder = KnowledgeBuilderFactory .newKnowledgeBuilder();

kbuilder.add(newClassPathResource("emptyCondition.drl.xls", getClass()), DTABLE, dtconf);
assertThatExceptionOfType((DecisionTableParseException.class)).isThrownBy(
() -> kbuilder.add(newClassPathResource("emptyCondition.drl.xls", getClass()), DTABLE, dtconf));
}

@Test(expected = DecisionTableParseException.class)
@Test
public void testEmptyActionInCSV() {
DecisionTableConfiguration dtconf = KnowledgeBuilderFactory.newDecisionTableConfiguration();
dtconf.setInputType(CSV);
KnowledgeBuilder kbuilder = KnowledgeBuilderFactory.newKnowledgeBuilder();

kbuilder.add(newClassPathResource("emptyAction.drl.csv", getClass()), DTABLE, dtconf);
assertThatExceptionOfType((DecisionTableParseException.class)).isThrownBy(
() -> kbuilder.add(newClassPathResource("emptyAction.drl.csv", getClass()), DTABLE, dtconf));
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,8 @@
import org.drools.kiesession.rulebase.KnowledgeBaseFactory;
import org.drools.template.parser.DataListener;
import org.drools.template.parser.TemplateDataListener;
import org.junit.Before;
import org.junit.Test;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
import org.kie.api.io.ResourceType;
import org.kie.api.runtime.KieSession;
import org.kie.internal.builder.KnowledgeBuilder;
Expand All @@ -49,7 +49,7 @@ public class ExternalSpreadsheetCompilerTest {

private ExternalSpreadsheetCompiler converter;

@Before
@BeforeEach
public void setUp() {
converter = new ExternalSpreadsheetCompiler();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@

import org.drools.kiesession.rulebase.InternalKnowledgeBase;
import org.drools.kiesession.rulebase.KnowledgeBaseFactory;
import org.junit.After;
import org.junit.Test;
import org.junit.jupiter.api.AfterEach;
import org.junit.jupiter.api.Test;
import org.kie.api.io.ResourceType;
import org.kie.api.runtime.KieSession;
import org.kie.internal.builder.DecisionTableConfiguration;
Expand All @@ -40,7 +40,7 @@ public class FixedPatternTest {

private KieSession ksession;

@After
@AfterEach
public void tearDown() {
if (ksession != null) {
ksession.dispose();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@

import org.drools.kiesession.rulebase.InternalKnowledgeBase;
import org.drools.kiesession.rulebase.KnowledgeBaseFactory;
import org.junit.After;
import org.junit.Test;
import org.junit.jupiter.api.AfterEach;
import org.junit.jupiter.api.Test;
import org.kie.api.io.ResourceType;
import org.kie.api.runtime.KieSession;
import org.kie.internal.builder.DecisionTableConfiguration;
Expand All @@ -40,7 +40,7 @@ public class IgnoreNumericFormatTest {

private KieSession ksession;

@After
@AfterEach
public void tearDown() {
if (ksession != null) {
ksession.dispose();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@
import com.sample.FactData;
import org.drools.kiesession.rulebase.InternalKnowledgeBase;
import org.drools.kiesession.rulebase.KnowledgeBaseFactory;
import org.junit.After;
import org.junit.Test;
import org.junit.jupiter.api.AfterEach;
import org.junit.jupiter.api.Test;
import org.kie.api.io.ResourceType;
import org.kie.api.runtime.KieSession;
import org.kie.internal.builder.DecisionTableConfiguration;
Expand All @@ -38,7 +38,7 @@ public class LineBreakXLSTest {

private KieSession ksession;

@After
@AfterEach
public void tearDown() {
if (ksession != null) {
ksession.dispose();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@

import java.io.InputStream;

import org.junit.Test;
import org.junit.jupiter.api.Test;
import org.kie.api.KieBase;
import org.kie.api.io.ResourceType;
import org.kie.internal.io.ResourceFactory;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,19 +20,18 @@

import java.io.InputStream;

import org.junit.Ignore;
import org.junit.Test;
import org.junit.jupiter.api.Disabled;
import org.kie.api.KieBase;
import org.kie.api.io.ResourceType;
import org.kie.internal.io.ResourceFactory;
import org.kie.internal.utils.KieHelper;

import static org.assertj.core.api.Assertions.assertThat;

@Ignore
@Disabled
public class MakeSureMultiLinesWorkTest {

@Test
@org.junit.jupiter.api.Test
public void makeSureMultiLinesWork() {

KieHelper kieHelper = new KieHelper();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@
package org.drools.decisiontable;

import org.drools.base.definitions.rule.impl.RuleImpl;
import org.junit.Before;
import org.junit.Test;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
import org.kie.api.KieBase;
import org.kie.api.KieServices;
import org.kie.api.builder.KieBuilder;
Expand All @@ -33,7 +33,7 @@ public class PrioritySetWithFormulaTest {

private KieBase kieBase;

@Before
@BeforeEach
public void init() {

final KieServices ks = KieServices.Factory.get();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,8 @@
import org.drools.template.model.Global;
import org.drools.template.model.Import;
import org.drools.template.parser.DataListener;
import org.junit.Before;
import org.junit.Test;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
import org.kie.api.KieBase;
import org.kie.api.io.ResourceType;
import org.kie.api.runtime.KieSession;
Expand All @@ -61,7 +61,7 @@ public class SpreadsheetCompilerUnitTest {

private SpreadsheetCompiler converter;

@Before
@BeforeEach
public void setUp() {
converter = new SpreadsheetCompiler();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@
import java.util.List;

import org.acme.insurance.launcher.PricingRuleLauncher;
import org.junit.After;
import org.junit.Test;
import org.junit.jupiter.api.AfterEach;
import org.junit.jupiter.api.Test;
import org.kie.api.KieBase;
import org.kie.api.KieServices;
import org.kie.api.builder.KieBuilder;
Expand All @@ -44,7 +44,7 @@ public class SpreadsheetIntegrationExampleTest {

private KieSession ksession;

@After
@AfterEach
public void tearDown() {
if (ksession != null) {
ksession.dispose();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,8 @@
import org.drools.drl.extensions.DecisionTableFactory;
import org.drools.kiesession.rulebase.InternalKnowledgeBase;
import org.drools.kiesession.rulebase.KnowledgeBaseFactory;
import org.junit.After;
import org.junit.Test;
import org.junit.jupiter.api.AfterEach;
import org.junit.jupiter.api.Test;
import org.kie.api.command.Command;
import org.kie.api.io.ResourceType;
import org.kie.api.runtime.KieSession;
Expand All @@ -43,7 +43,7 @@ public class UnicodeInCSVTest {

private KieSession ksession;

@After
@AfterEach
public void tearDown() {
if (ksession != null) {
ksession.dispose();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,8 @@
import org.drools.drl.extensions.DecisionTableFactory;
import org.drools.kiesession.rulebase.InternalKnowledgeBase;
import org.drools.kiesession.rulebase.KnowledgeBaseFactory;
import org.junit.After;
import org.junit.Test;
import org.junit.jupiter.api.AfterEach;
import org.junit.jupiter.api.Test;
import org.kie.api.command.Command;
import org.kie.api.io.ResourceType;
import org.kie.api.runtime.KieSession;
Expand All @@ -43,7 +43,7 @@ public class UnicodeInXLSTest {

private KieSession ksession;

@After
@AfterEach
public void tearDown() {
if (ksession != null) {
ksession.dispose();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@
import java.util.ArrayList;
import java.util.List;

import org.junit.After;
import org.junit.Test;
import org.junit.jupiter.api.AfterEach;
import org.junit.jupiter.api.Test;
import org.kie.api.KieServices;
import org.kie.api.builder.KieBuilder;
import org.kie.api.builder.KieFileSystem;
Expand All @@ -36,7 +36,7 @@ public class XlsFormulaTest {

private KieSession ksession;

@After
@AfterEach
public void tearDown() {
if (ksession != null) {
ksession.dispose();
Expand Down
Loading

0 comments on commit b469a84

Please sign in to comment.