Skip to content

Commit

Permalink
feat(element-template-generator): allow send tasks using connectors (#…
Browse files Browse the repository at this point in the history
…3827) (#3832)

(cherry picked from commit 2fcec35)

Co-authored-by: Ingo Richtsmeier <[email protected]>
  • Loading branch information
sbuettner and ingorichtsmeier authored Jan 7, 2025
1 parent 7cdc85a commit 352b9cb
Show file tree
Hide file tree
Showing 5 changed files with 23 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ public enum BpmnType {
SERVICE_TASK("bpmn:ServiceTask", false, "ServiceTask"),
RECEIVE_TASK("bpmn:ReceiveTask", true, "ReceiveTask"),
SCRIPT_TASK("bpmn:ScriptTask", false, "ScriptTask"),
SEND_TASK("bpmn:SendTask", false, "SendTask"),
START_EVENT("bpmn:StartEvent", false, "StartEvent"),
INTERMEDIATE_CATCH_EVENT("bpmn:IntermediateCatchEvent", true, "IntermediateCatchEvent"),
INTERMEDIATE_THROW_EVENT("bpmn:IntermediateThrowEvent", true, "IntermediateThrowEvent"),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ public class TemplateGenerationContextUtil {
private static final Set<BpmnType> OUTBOUND_SUPPORTED_ELEMENT_TYPES =
Set.of(
BpmnType.SERVICE_TASK,
BpmnType.SEND_TASK,
BpmnType.INTERMEDIATE_THROW_EVENT,
BpmnType.SCRIPT_TASK,
BpmnType.MESSAGE_END_EVENT);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,21 @@ void scriptTask() {
assertThat(template.elementType().eventDefinition()).isNull();
}

@Test
void sendTask() {
ElementTemplate template =
ElementTemplateBuilder.createOutbound()
.id("id")
.name("name")
.type("type", false)
.appliesTo(BpmnType.TASK)
.elementType(BpmnType.SEND_TASK)
.build();
assertThat(template.appliesTo()).containsExactly(BpmnType.TASK.getName());
assertThat(template.elementType().value()).isEqualTo(BpmnType.SEND_TASK.getName());
assertThat(template.elementType().eventDefinition()).isNull();
}

@Test
void messageEndEvent() {
ElementTemplate template =
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -223,13 +223,16 @@ void multipleElementTypes_definedInAnnotation() {
generator.generate(MyConnectorFunction.WithMultipleElementTypes.class, config);
boolean hasServiceTask = false,
hasScriptTask = false,
hasSendTask = false,
hasMessageThrowEvent = false,
hasMessageEndEvent = false;
for (var template : templates) {
if (template.elementType().equals(ElementTypeWrapper.from(BpmnType.SERVICE_TASK))) {
hasServiceTask = true;
} else if (template.elementType().equals(ElementTypeWrapper.from(BpmnType.SCRIPT_TASK))) {
hasScriptTask = true;
} else if (template.elementType().equals(ElementTypeWrapper.from(BpmnType.SEND_TASK))) {
hasSendTask = true;
} else if (template
.elementType()
.equals(ElementTypeWrapper.from(BpmnType.INTERMEDIATE_THROW_EVENT))) {
Expand All @@ -240,9 +243,10 @@ void multipleElementTypes_definedInAnnotation() {
hasMessageEndEvent = true;
}
}
assertThat(templates.size()).isEqualTo(4);
assertThat(templates.size()).isEqualTo(5);
assertTrue(hasServiceTask);
assertTrue(hasScriptTask);
assertTrue(hasSendTask);
assertTrue(hasMessageThrowEvent);
assertTrue(hasMessageEndEvent);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,7 @@ public static class WithDuplicatePropertyIds extends MyConnectorFunction {}
elementTypes = {
@ConnectorElementType(appliesTo = BpmnType.TASK, elementType = BpmnType.SERVICE_TASK),
@ConnectorElementType(appliesTo = BpmnType.TASK, elementType = BpmnType.SCRIPT_TASK),
@ConnectorElementType(appliesTo = BpmnType.TASK, elementType = BpmnType.SEND_TASK),
@ConnectorElementType(
appliesTo = BpmnType.END_EVENT,
elementType = BpmnType.MESSAGE_END_EVENT),
Expand Down

0 comments on commit 352b9cb

Please sign in to comment.