Skip to content

Commit afa6ee7

Browse files
committed
3847 SF
1 parent 7c7a229 commit afa6ee7

File tree

1 file changed

+9
-15
lines changed

1 file changed

+9
-15
lines changed

server/libs/platform/platform-configuration/platform-configuration-service/src/test/java/com/bytechef/platform/configuration/facade/WorkflowNodeParameterFacadeTest.java

Lines changed: 9 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616

1717
package com.bytechef.platform.configuration.facade;
1818

19+
import static org.apache.commons.lang3.RandomStringUtils.secure;
1920
import static org.junit.jupiter.api.Assertions.assertEquals;
2021
import static org.junit.jupiter.api.Assertions.assertFalse;
2122
import static org.junit.jupiter.api.Assertions.assertNotNull;
@@ -57,7 +58,6 @@
5758
import java.util.List;
5859
import java.util.Map;
5960
import java.util.TreeMap;
60-
import org.apache.commons.lang3.RandomStringUtils;
6161
import org.junit.jupiter.api.BeforeEach;
6262
import org.junit.jupiter.api.Test;
6363
import org.junit.jupiter.api.extension.ExtendWith;
@@ -1395,14 +1395,14 @@ void testGetWorkflowNodeDisplayConditionsWithArrayItemInLoopItems() {
13951395
task.put("name", "loop1");
13961396
task.put("type", "loop/v1");
13971397

1398-
List<String> arrayItem = List.of(RandomStringUtils.randomAlphanumeric(20));
1398+
List<String> arrayItem = List.of(secure().nextAlphanumeric(20));
13991399
Map<String, Object> parameters = new TreeMap<>();
14001400
parameters.put("items", List.of(arrayItem));
14011401

14021402
Map<String, Object> iteratee = new HashMap<>();
14031403
iteratee.put("name", "logger1");
14041404
iteratee.put("type", "logger/v1/info");
1405-
iteratee.put("parameters", Map.of("text", RandomStringUtils.randomAlphanumeric(20)));
1405+
iteratee.put("parameters", Map.of("text", secure().nextAlphanumeric(20)));
14061406
iteratee.put("metadata", new HashMap<>());
14071407

14081408
parameters.put("iteratee", List.of(iteratee));
@@ -2332,13 +2332,12 @@ void testUpdateWorkflowNodeParameterMultipleArrayIndexes() {
23322332
}
23332333

23342334
@Test
2335+
@SuppressWarnings({
2336+
"checkstyle:methodlengthcheck", "rawtypes", "unchecked"
2337+
})
23352338
void testUpdateWorkflowNodeParameterDisplayConditionNotEvaluatedForWrongType() {
23362339
// Given - Testing bug where display conditions for NUMBER type properties are evaluated when updating STRING
23372340
// type parameters.
2338-
//
2339-
// Real scenario: When conditions[0][0] is set to STRING variant (e.g., by setting value1 first),
2340-
// and then updating value2, only STRING variant display conditions should be evaluated.
2341-
// The bug was that ALL variants (NUMBER, BOOLEAN, etc.) were being checked.
23422341
String workflowId = "678a28b3-1e50-4356-b3d6-1fa8128698c9";
23432342
String workflowNodeName = "condition_1";
23442343
String parameterPath = "conditions[0][0].value2";
@@ -2432,15 +2431,10 @@ void testUpdateWorkflowNodeParameterDisplayConditionNotEvaluatedForWrongType() {
24322431
String condition = (String) map.get("displayCondition");
24332432

24342433
// Simulate all conditions evaluating to true for this test
2435-
if (condition.equals("=rawExpression == false")) {
2436-
return Map.of("displayCondition", true);
2437-
}
2438-
2439-
if (condition.equals("=conditions[0][0].operation != 'EMPTY'")) {
2440-
return Map.of("displayCondition", true);
2441-
}
2434+
if (condition.equals("=rawExpression == false") ||
2435+
condition.equals("=conditions[0][0].operation != 'EMPTY'") ||
2436+
condition.equals("=!contains({'EMPTY','REGEX'}, conditions[0][0].operation)")) {
24422437

2443-
if (condition.equals("=!contains({'EMPTY','REGEX'}, conditions[0][0].operation)")) {
24442438
return Map.of("displayCondition", true);
24452439
}
24462440
}

0 commit comments

Comments
 (0)