Skip to content

Commit

Permalink
Re-use boundary event executions + related data for same activity and…
Browse files Browse the repository at this point in the history
… same event definition
  • Loading branch information
tijsrademakers committed Jun 10, 2024
1 parent 90b4b50 commit 727841e
Show file tree
Hide file tree
Showing 5 changed files with 305 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -473,6 +473,7 @@ protected void processCriteria(CmmnModel cmmnModel, List<Criterion> criteria) {
Association association = new Association();
association.setTargetElement(criterion);
association.setTargetRef(criterion.getId());
criterion.addIncomingAssociation(association);

association.setSourceElement(source);
association.setSourceRef(source.getId());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,10 @@

import org.assertj.core.api.Fail;
import org.flowable.cmmn.converter.util.PlanItemUtil;
import org.flowable.cmmn.model.Association;
import org.flowable.cmmn.model.CmmnModel;
import org.flowable.cmmn.model.Criterion;
import org.flowable.cmmn.model.GraphicInfo;
import org.flowable.cmmn.model.PlanFragment;
import org.flowable.cmmn.model.PlanItem;
import org.flowable.cmmn.model.PlanItemDefinition;
Expand All @@ -36,6 +39,27 @@ public class PlanFragmentCmmnXmlConverterTest {
@CmmnXmlConverterTest("org/flowable/test/cmmn/converter/plan-fragment.cmmn")
public void validateModel(CmmnModel cmmnModel) {
Stage planModel = cmmnModel.getPrimaryCase().getPlanModel();

assertThat(cmmnModel.getAssociations()).hasSize(2);
String entryAssociationId = null;
String exitAssociationId = null;
for (Association association : cmmnModel.getAssociations()) {
if ("planItem2".equals(association.getSourceRef()) && "entryCriterion1".equals(association.getTargetRef())) {
entryAssociationId = association.getId();

} else if ("planItem3".equals(association.getSourceRef()) && "exitCriterion1".equals(association.getTargetRef())) {
exitAssociationId = association.getId();
}
}

assertThat(entryAssociationId).isNotNull();
assertThat(cmmnModel.getFlowLocationGraphicInfo(entryAssociationId)).isNotNull();
List<GraphicInfo> entryInfoList = cmmnModel.getFlowLocationGraphicInfo(entryAssociationId);
assertThat(entryInfoList).hasSize(4);
assertThat(exitAssociationId).isNotNull();
assertThat(cmmnModel.getFlowLocationGraphicInfo(exitAssociationId)).isNotNull();
List<GraphicInfo> exitInfoList = cmmnModel.getFlowLocationGraphicInfo(exitAssociationId);
assertThat(exitInfoList).hasSize(4);

// Assert parent-child relations

Expand All @@ -48,6 +72,15 @@ public void validateModel(CmmnModel cmmnModel) {
assertThat(planFragment1ChildPlanItems).extracting(PlanItem::getName).containsOnly("B", "C");
assertNoChildPlanItems(planFragment1ChildPlanItems, "B");
assertNoChildPlanItems(planFragment1ChildPlanItems, "C");
PlanItem planItemFragment = planModel.getPlanItem("planItem4");
assertThat(planItemFragment.getDefinitionRef()).isEqualTo("expandedPlanFragment1");
PlanFragment planFragment = (PlanFragment) planItemFragment.getPlanItemDefinition();
assertThat(planFragment.getPlanItems()).hasSize(2);
PlanItem taskPlanItem = planFragment.getPlanItem("planItem3");
assertThat(taskPlanItem.getEntryCriteria()).hasSize(1);
Criterion criterion = taskPlanItem.getEntryCriteria().iterator().next();
assertThat(criterion.getId()).isEqualTo("entryCriterion1");
assertThat(criterion.getIncomingAssociations()).hasSize(1);

List<PlanItem> stageOneChildPlanItems = getChildPlanItems(rootLevelPlanItems, "Stage one");
assertThat(stageOneChildPlanItems).extracting(PlanItem::getName).containsOnly("PF2", "F");
Expand Down
Loading

0 comments on commit 727841e

Please sign in to comment.