From 1f151c596ab9df515e274e1457a5b4abd8b4bd7b Mon Sep 17 00:00:00 2001 From: Abhiram Gundala <164050036+Abhitocode@users.noreply.github.com> Date: Fri, 28 Jun 2024 08:24:24 -0400 Subject: [PATCH] [incubator-kie-issues-1131] test migration from V7 to code generation --- .../com/sample}/BPMN2-RuleTask.bpmn2 | 0 .../com/sample}/BPMN2-RuleTask.drl | 0 .../java/org/jbpm/bpmn2/ActivityTest.java | 23 ++++++++++++------- 3 files changed, 15 insertions(+), 8 deletions(-) rename jbpm/jbpm-tests/src/test/{resources => bpmn/com/sample}/BPMN2-RuleTask.bpmn2 (100%) rename jbpm/jbpm-tests/src/test/{resources => bpmn/com/sample}/BPMN2-RuleTask.drl (100%) diff --git a/jbpm/jbpm-tests/src/test/resources/BPMN2-RuleTask.bpmn2 b/jbpm/jbpm-tests/src/test/bpmn/com/sample/BPMN2-RuleTask.bpmn2 similarity index 100% rename from jbpm/jbpm-tests/src/test/resources/BPMN2-RuleTask.bpmn2 rename to jbpm/jbpm-tests/src/test/bpmn/com/sample/BPMN2-RuleTask.bpmn2 diff --git a/jbpm/jbpm-tests/src/test/resources/BPMN2-RuleTask.drl b/jbpm/jbpm-tests/src/test/bpmn/com/sample/BPMN2-RuleTask.drl similarity index 100% rename from jbpm/jbpm-tests/src/test/resources/BPMN2-RuleTask.drl rename to jbpm/jbpm-tests/src/test/bpmn/com/sample/BPMN2-RuleTask.drl diff --git a/jbpm/jbpm-tests/src/test/java/org/jbpm/bpmn2/ActivityTest.java b/jbpm/jbpm-tests/src/test/java/org/jbpm/bpmn2/ActivityTest.java index 2578981db0b..181be575eeb 100755 --- a/jbpm/jbpm-tests/src/test/java/org/jbpm/bpmn2/ActivityTest.java +++ b/jbpm/jbpm-tests/src/test/java/org/jbpm/bpmn2/ActivityTest.java @@ -171,6 +171,9 @@ import org.kie.kogito.process.ProcessInstance; import org.kie.kogito.process.workitems.InternalKogitoWorkItem; +import com.sample.RuleTaskModel; +import com.sample.RuleTaskProcess; + import static org.assertj.core.api.Assertions.assertThat; import static org.assertj.core.api.Assertions.assertThatExceptionOfType; import static org.assertj.core.api.Assertions.fail; @@ -321,16 +324,20 @@ public void testScriptTaskWithIO() { } @Test - public void testRuleTask() throws Exception { - kruntime = createKogitoProcessRuntime("BPMN2-RuleTask.bpmn2", - "BPMN2-RuleTask.drl"); - + public void testRuleTask() { + /* + Getting compilation error for this test case + com/sample/RuleTaskProcess.java:[85,94] package org.drools.project.model.ProjectRuntime does not exist + */ + Application application = ProcessTestHelper.newApplication(); + org.kie.kogito.process.Process process = RuleTaskProcess.newProcess(application); + RuleTaskModel model = process.createModel(); + ProcessInstance instance = process.createInstance(model); List list = new ArrayList<>(); - kruntime.getKieSession().setGlobal("list", list); - KogitoProcessInstance processInstance = kruntime.startProcess("RuleTask"); - kruntime.getKieSession().setGlobal("list", list); + instance.start(Map.of("list", list)); + System.out.println("list: " + list); assertThat(list).hasSize(1); - assertProcessInstanceFinished(processInstance, kruntime); + assertThat(instance.status()).isEqualTo(ProcessInstance.STATE_COMPLETED); } @Test