From 6308ea70c14f1938a0438885c9d80ee924348c0e Mon Sep 17 00:00:00 2001 From: Walter Medvedeo Date: Wed, 13 Nov 2024 16:39:11 +0100 Subject: [PATCH] checkout kie-kogito-runtimes-3770: Use the workflow id as the auto-generated value for the name, when the workflow definition has no value in the attribute name (#3771) (#77) (cherry picked from commit 5876428c38e9b0afcfa8355bead7c5b8483bead9) --- .../serverless/workflow/parser/ServerlessWorkflowParser.java | 3 +-- .../serverless/workflow/ServerlessWorkflowParsingTest.java | 2 +- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/kogito-serverless-workflow/kogito-serverless-workflow-builder/src/main/java/org/kie/kogito/serverless/workflow/parser/ServerlessWorkflowParser.java b/kogito-serverless-workflow/kogito-serverless-workflow-builder/src/main/java/org/kie/kogito/serverless/workflow/parser/ServerlessWorkflowParser.java index 49e16462cc3..5e4c075e69d 100644 --- a/kogito-serverless-workflow/kogito-serverless-workflow-builder/src/main/java/org/kie/kogito/serverless/workflow/parser/ServerlessWorkflowParser.java +++ b/kogito-serverless-workflow/kogito-serverless-workflow-builder/src/main/java/org/kie/kogito/serverless/workflow/parser/ServerlessWorkflowParser.java @@ -68,7 +68,6 @@ public class ServerlessWorkflowParser { public static final String NODE_START_NAME = "Start"; public static final String NODE_END_NAME = "End"; - public static final String DEFAULT_NAME = "workflow"; public static final String DEFAULT_PACKAGE = "org.kie.kogito.serverless"; public static final String DEFAULT_VERSION = "1.0"; @@ -127,7 +126,7 @@ private ServerlessWorkflowParser(Workflow workflow, KogitoBuildContext context) private GeneratedInfo parseProcess() { RuleFlowProcessFactory factory = RuleFlowProcessFactory.createProcess(workflow.getId(), !workflow.isKeepActive()) - .name(workflow.getName() == null ? DEFAULT_NAME : workflow.getName()) + .name(workflow.getName() == null ? workflow.getId() : workflow.getName()) .version(workflow.getVersion() == null ? DEFAULT_VERSION : workflow.getVersion()) .packageName(workflow.getMetadata() != null ? workflow.getMetadata().getOrDefault("package", DEFAULT_PACKAGE) : DEFAULT_PACKAGE) diff --git a/kogito-serverless-workflow/kogito-serverless-workflow-builder/src/test/java/org/kie/kogito/serverless/workflow/ServerlessWorkflowParsingTest.java b/kogito-serverless-workflow/kogito-serverless-workflow-builder/src/test/java/org/kie/kogito/serverless/workflow/ServerlessWorkflowParsingTest.java index e140cb54b87..6041dbbdf99 100644 --- a/kogito-serverless-workflow/kogito-serverless-workflow-builder/src/test/java/org/kie/kogito/serverless/workflow/ServerlessWorkflowParsingTest.java +++ b/kogito-serverless-workflow/kogito-serverless-workflow-builder/src/test/java/org/kie/kogito/serverless/workflow/ServerlessWorkflowParsingTest.java @@ -642,7 +642,7 @@ public void testMinimumWorkflow() { ServerlessWorkflowParser parser = ServerlessWorkflowParser.of(workflow, JavaKogitoBuildContext.builder().build()); Process process = parser.getProcessInfo().info(); assertThat(parser.getProcessInfo().info()).isSameAs(process); - assertThat(process.getName()).isEqualTo(ServerlessWorkflowParser.DEFAULT_NAME); + assertThat(process.getName()).isEqualTo(workflow.getId()); assertThat(process.getVersion()).isEqualTo(ServerlessWorkflowParser.DEFAULT_VERSION); assertThat(process.getPackageName()).isEqualTo(ServerlessWorkflowParser.DEFAULT_PACKAGE); }