Skip to content

Commit

Permalink
[incubator-kie-issues-1131] v7 migration to code generation
Browse files Browse the repository at this point in the history
  • Loading branch information
Abhitocode committed Aug 6, 2024
1 parent ef502f0 commit fef7d70
Showing 1 changed file with 29 additions and 24 deletions.
53 changes: 29 additions & 24 deletions jbpm/jbpm-tests/src/test/java/org/jbpm/bpmn2/DataTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -58,14 +58,13 @@
import org.jbpm.bpmn2.data.EvaluationProcess;
import org.jbpm.bpmn2.data.ImportModel;
import org.jbpm.bpmn2.data.ImportProcess;
import org.jbpm.bpmn2.flow.DataInputAssociationsTwoAssignsModel;
import org.jbpm.bpmn2.flow.DataInputAssociationsTwoAssignsProcess;
import org.jbpm.bpmn2.flow.DataOutputAssociationsHumanTaskModel;
import org.jbpm.bpmn2.flow.DataOutputAssociationsHumanTaskProcess;
import org.jbpm.bpmn2.xml.ProcessHandler;
import org.jbpm.process.core.datatype.impl.type.ObjectDataType;
import org.jbpm.process.instance.impl.demo.SystemOutWorkItemHandler;
import org.jbpm.test.utils.ProcessTestHelper;
import org.junit.jupiter.api.Disabled;
import org.junit.jupiter.api.Test;
import org.kie.kogito.Application;
import org.kie.kogito.internal.process.runtime.KogitoProcessInstance;
Expand Down Expand Up @@ -351,33 +350,39 @@ public void executeWorkItem(KogitoWorkItem workItem, KogitoWorkItemManager mgr)
* TODO testDataInputAssociationsWithTwoAssigns
*/
@Test
@Disabled
public void testDataInputAssociationsWithTwoAssigns() throws Exception {
Application app = ProcessTestHelper.newApplication();
ProcessTestHelper.registerHandler(app, "Human Task", new KogitoWorkItemHandler() {
@Override
public void abortWorkItem(KogitoWorkItem workItem, KogitoWorkItemManager mgr) {
}

@Override
public void executeWorkItem(KogitoWorkItem workItem, KogitoWorkItemManager mgr) {
assertThat(((Element) workItem.getParameter("Comment")).getNodeName()).isEqualTo("foo");
// assertEquals("mynode", ((Element) workItem.getParameter("Comment")).getFirstChild().getNodeName());
// assertEquals("user", ((Element) workItem.getParameter("Comment")).getFirstChild().getFirstChild().getNodeName());
// assertEquals("hello world", ((Element) workItem.getParameter("coId")).getFirstChild().getFirstChild().getAttributes().getNamedItem("hello").getNodeValue());
}
});

kruntime = createKogitoProcessRuntime("BPMN2-DataInputAssociations-two-assigns.bpmn2");
kruntime.getKogitoWorkItemManager().registerWorkItemHandler("Human Task",
new KogitoWorkItemHandler() {

public void abortWorkItem(KogitoWorkItem manager,
KogitoWorkItemManager mgr) {

}

public void executeWorkItem(KogitoWorkItem workItem,
KogitoWorkItemManager mgr) {
assertThat(((Element) workItem.getParameter("Comment")).getNodeName()).isEqualTo("foo");
// assertEquals("mynode", ((Element)
// workItem.getParameter("Comment")).getFirstChild().getNodeName());
// assertEquals("user", ((Element)
// workItem.getParameter("Comment")).getFirstChild().getFirstChild().getNodeName());
// assertEquals("hello world", ((Element)
// workItem.getParameter("coId")).getFirstChild().getFirstChild().getAttributes().getNamedItem("hello").getNodeValue());
}

});
Document document = DocumentBuilderFactory
.newInstance()
.newDocumentBuilder()
.parse(new ByteArrayInputStream("<user hello='hello world' />".getBytes()));

org.kie.kogito.process.Process<DataInputAssociationsTwoAssignsModel> processDefinition = DataInputAssociationsTwoAssignsProcess.newProcess(app);
DataInputAssociationsTwoAssignsModel model = processDefinition.createModel();
model.setInstanceMetadata(document.getFirstChild());
.parse(new ByteArrayInputStream("<user hello='hello world' />"
.getBytes()));
Map<String, Object> params = new HashMap<>();
params.put("instanceMetadata", document.getFirstChild());
KogitoProcessInstance processInstance = kruntime.startProcess("process",
params);

org.kie.kogito.process.ProcessInstance<DataInputAssociationsTwoAssignsModel> instance = processDefinition.createInstance(model);
instance.start();
}

@Test
Expand Down

0 comments on commit fef7d70

Please sign in to comment.