gmunozfe commented on code in PR #3459:
URL: 
https://github.com/apache/incubator-kie-kogito-runtimes/pull/3459#discussion_r1548587665


##########
kogito-serverless-workflow/kogito-serverless-workflow-executor-core/src/test/java/org/kie/kogito/serverless/workflow/executor/StaticWorkflowApplicationTest.java:
##########
@@ -76,6 +78,19 @@ void helloWorldFile() throws IOException {
         }
     }
 
+    @Test
+    void switchFile() throws IOException {
+        try (
+                StaticWorkflowApplication application = 
StaticWorkflowApplication.create();
+                Reader reader = new 
InputStreamReader(Thread.currentThread().getContextClassLoader().getResourceAsStream("switch.yaml")))
 {
+            Workflow workflow = ServerlessWorkflowUtils.getWorkflow(reader, 
WorkflowFormat.YAML);
+            assertThat(application.execute(workflow, Map.of("condition1", 
false, "condition2", false)).getWorkflowdata().get("output")).isEqualTo(new 
TextNode("default"));
+            assertThat(application.execute(workflow, Map.of("condition1", 
true, "condition2", false)).getWorkflowdata().get("output")).isEqualTo(new 
TextNode("branch1"));
+            assertThat(application.execute(workflow, Map.of("condition1", 
false, "condition2", true)).getWorkflowdata().get("output")).isEqualTo(new 
TextNode("branch1"));
+            assertThat(application.execute(workflow, Map.of("condition1", 
true, "condition2", true)).getWorkflowdata().get("output")).isEqualTo(new 
TextNode("branch1"));

Review Comment:
   check indentation



##########
jbpm/jbpm-flow/src/main/java/org/jbpm/workflow/core/impl/NodeImpl.java:
##########
@@ -398,7 +401,7 @@ public void setMetaData(Map<String, Object> metaData) {
         this.metaData = metaData;
     }
 
-    public Constraint getConstraint(final Connection connection) {
+    public Collection<Constraint> getConstraint(final Connection connection) {

Review Comment:
   Probably `getConstraints` in plural is more appropriated here



##########
jbpm/jbpm-flow/src/main/java/org/jbpm/workflow/core/node/Split.java:
##########
@@ -86,23 +85,24 @@ public boolean isDefault(final Connection connection) {
 
         if (this.type == TYPE_OR || this.type == TYPE_XOR) {
             ConnectionRef ref = new ConnectionRef((String) 
connection.getMetaData().get("UniqueId"), connection.getTo().getId(), 
connection.getToType());
-            Constraint constraint = this.constraints.get(ref);
+            Collection<Constraint> constraints = this.constraints.get(ref);
+            if (constraints != null) {
+                for (Constraint constraint : constraints) {
+                    if (constraint != null) {
+                        return constraint.isDefault();
+                    }
+                }
+            }
             String defaultConnection = (String) getMetaData().get("Default");
             String connectionId = (String) 
connection.getMetaData().get("UniqueId");
-            if (constraint != null) {
-                return constraint.isDefault();
-            } else if (constraint == null && 
connectionId.equals(defaultConnection)) {
-                return true;
-            } else {
-                return false;
-            }
+            return connectionId.equals(defaultConnection);
         }
         throw new UnsupportedOperationException("Constraints are " +
                 "only supported with XOR or OR split types, not with: " + 
getType());
     }
 
     @Override
-    public Constraint getConstraint(final Connection connection) {
+    public Collection<Constraint> getConstraint(final Connection connection) {

Review Comment:
   Same here



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to