Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Process test migration from v7 legacy runtime to code generation (Issue #1131) #3505

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
57 changes: 36 additions & 21 deletions jbpm/jbpm-tests/src/test/java/org/jbpm/bpmn2/ActivityTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
import java.util.Map;

import org.drools.compiler.rule.builder.PackageBuildContext;
import org.jbpm.bpmn2.flow.*;
import org.jbpm.bpmn2.handler.ReceiveTaskHandler;
import org.jbpm.bpmn2.handler.SendTaskHandler;
import org.jbpm.bpmn2.handler.ServiceTaskHandler;
Expand All @@ -36,6 +37,8 @@
import org.jbpm.bpmn2.objects.TestWorkItemHandler;
import org.jbpm.bpmn2.subprocess.SubProcessWithEntryExitScriptsModel;
import org.jbpm.bpmn2.subprocess.SubProcessWithEntryExitScriptsProcess;
import org.jbpm.bpmn2.task.SendTaskModel;
import org.jbpm.bpmn2.task.SendTaskProcess;
import org.jbpm.bpmn2.test.RequirePersistence;
import org.jbpm.process.builder.ActionBuilder;
import org.jbpm.process.builder.AssignmentBuilder;
Expand Down Expand Up @@ -99,30 +102,42 @@ public class ActivityTest extends JbpmBpmn2TestCase {

@Test
public void testMinimalProcess() throws Exception {
kruntime = createKogitoProcessRuntime("org/jbpm/bpmn2/flow/BPMN2-MinimalProcess.bpmn2");
KogitoProcessInstance processInstance = kruntime.startProcess("Minimal");
assertProcessInstanceCompleted(processInstance);
Application app = ProcessTestHelper.newApplication();
org.kie.kogito.process.Process<MinimalModel> minimalProcess = MinimalProcess.newProcess(app);
MinimalModel model = minimalProcess.createModel();
org.kie.kogito.process.ProcessInstance<MinimalModel> instance = minimalProcess.createInstance(model);
instance.start();
assertThat(instance.status()).isEqualTo(org.kie.kogito.process.ProcessInstance.STATE_COMPLETED);
}

@Test
public void testMinimalProcessImplicit() throws Exception {
kruntime = createKogitoProcessRuntime("org/jbpm/bpmn2/flow/BPMN2-MinimalProcessImplicit.bpmn2");
KogitoProcessInstance processInstance = kruntime.startProcess("MinimalImplicit");
assertProcessInstanceCompleted(processInstance);
Application app = ProcessTestHelper.newApplication();
org.kie.kogito.process.Process<MinimalImplicitModel> minimalImplicitProcess = MinimalImplicitProcess.newProcess(app);
MinimalImplicitModel model = minimalImplicitProcess.createModel();
ProcessInstance<MinimalImplicitModel> instance = minimalImplicitProcess.createInstance(model);
instance.start();
assertThat(instance.status()).isEqualTo(ProcessInstance.STATE_COMPLETED);
}

@Test
public void testMinimalProcessWithGraphical() throws Exception {
kruntime = createKogitoProcessRuntime("org/jbpm/bpmn2/flow/BPMN2-MinimalProcessWithGraphical.bpmn2");
KogitoProcessInstance processInstance = kruntime.startProcess("MinimalWithGraphical");
assertProcessInstanceCompleted(processInstance);
Application app = ProcessTestHelper.newApplication();
org.kie.kogito.process.Process<MinimalWithGraphicalModel> minimalwithgraphicalprocess = MinimalWithGraphicalProcess.newProcess(app);
MinimalWithGraphicalModel model = minimalwithgraphicalprocess.createModel();
ProcessInstance<MinimalWithGraphicalModel> instance = minimalwithgraphicalprocess.createInstance(model);
instance.start();
assertThat(instance.status()).isEqualTo(ProcessInstance.STATE_COMPLETED);
}

@Test
public void testMinimalProcessWithDIGraphical() throws Exception {
kruntime = createKogitoProcessRuntime("org/jbpm/bpmn2/flow/BPMN2-MinimalProcessWithDIGraphical.bpmn2");
KogitoProcessInstance processInstance = kruntime.startProcess("MinimalWithDIGraphical");
assertProcessInstanceCompleted(processInstance);
Application app = ProcessTestHelper.newApplication();
org.kie.kogito.process.Process<MinimalWithDIGraphicalModel> minimalwithdigraphicalprocess = MinimalWithDIGraphicalProcess.newProcess(app);
MinimalWithDIGraphicalModel model = minimalwithdigraphicalprocess.createModel();
ProcessInstance<MinimalWithDIGraphicalModel> instance = minimalwithdigraphicalprocess.createInstance(model);
instance.start();
assertThat(instance.status()).isEqualTo(ProcessInstance.STATE_COMPLETED);
}

@Test
Expand Down Expand Up @@ -828,15 +843,14 @@ public void executeWorkItem(KogitoWorkItem workItem, KogitoWorkItemManager manag

@Test
public void testSendTask() throws Exception {
kruntime = createKogitoProcessRuntime("org/jbpm/bpmn2/task/BPMN2-SendTask.bpmn2");

kruntime.getKogitoWorkItemManager().registerWorkItemHandler("Send Task",
new SendTaskHandler());
Map<String, Object> params = new HashMap<>();
params.put("s", "john");
KogitoWorkflowProcessInstance processInstance = (KogitoWorkflowProcessInstance) kruntime
.startProcess("SendTask", params);
assertProcessInstanceFinished(processInstance, kruntime);
Application app = ProcessTestHelper.newApplication();
ProcessTestHelper.registerHandler(app, "Send Task", new SendTaskHandler());
org.kie.kogito.process.Process<SendTaskModel> processDefinition = SendTaskProcess.newProcess(app);
SendTaskModel model = processDefinition.createModel();
model.setS("john");
org.kie.kogito.process.ProcessInstance<SendTaskModel> instance = processDefinition.createInstance(model);
instance.start();
assertThat(instance.status()).isEqualTo(org.kie.kogito.process.ProcessInstance.STATE_COMPLETED);
}

@Test
Expand Down Expand Up @@ -936,6 +950,7 @@ public void testBusinessRuleTaskWithContionalEvent() throws Exception {
assertThat(list).hasSize(1);
}

// The model does not have set myVar
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

avoid to add noise in here. If you want to annotate something like this won't be migrated but was want to focus attention to it. just add
@category with something like V7_ENGINE

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Okay, will make the changes.

@Test
public void testScriptTaskWithVariableByName() throws Exception {
Map<String, Object> params = new HashMap<>();
Expand Down
Loading