|
16 | 16 |
|
17 | 17 | package com.bytechef.platform.configuration.facade; |
18 | 18 |
|
| 19 | +import static org.apache.commons.lang3.RandomStringUtils.secure; |
19 | 20 | import static org.junit.jupiter.api.Assertions.assertEquals; |
20 | 21 | import static org.junit.jupiter.api.Assertions.assertFalse; |
21 | 22 | import static org.junit.jupiter.api.Assertions.assertNotNull; |
|
57 | 58 | import java.util.List; |
58 | 59 | import java.util.Map; |
59 | 60 | import java.util.TreeMap; |
60 | | -import org.apache.commons.lang3.RandomStringUtils; |
61 | 61 | import org.junit.jupiter.api.BeforeEach; |
62 | 62 | import org.junit.jupiter.api.Test; |
63 | 63 | import org.junit.jupiter.api.extension.ExtendWith; |
@@ -1395,14 +1395,14 @@ void testGetWorkflowNodeDisplayConditionsWithArrayItemInLoopItems() { |
1395 | 1395 | task.put("name", "loop1"); |
1396 | 1396 | task.put("type", "loop/v1"); |
1397 | 1397 |
|
1398 | | - List<String> arrayItem = List.of(RandomStringUtils.randomAlphanumeric(20)); |
| 1398 | + List<String> arrayItem = List.of(secure().nextAlphanumeric(20)); |
1399 | 1399 | Map<String, Object> parameters = new TreeMap<>(); |
1400 | 1400 | parameters.put("items", List.of(arrayItem)); |
1401 | 1401 |
|
1402 | 1402 | Map<String, Object> iteratee = new HashMap<>(); |
1403 | 1403 | iteratee.put("name", "logger1"); |
1404 | 1404 | 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))); |
1406 | 1406 | iteratee.put("metadata", new HashMap<>()); |
1407 | 1407 |
|
1408 | 1408 | parameters.put("iteratee", List.of(iteratee)); |
@@ -2332,13 +2332,12 @@ void testUpdateWorkflowNodeParameterMultipleArrayIndexes() { |
2332 | 2332 | } |
2333 | 2333 |
|
2334 | 2334 | @Test |
| 2335 | + @SuppressWarnings({ |
| 2336 | + "checkstyle:methodlengthcheck", "rawtypes", "unchecked" |
| 2337 | + }) |
2335 | 2338 | void testUpdateWorkflowNodeParameterDisplayConditionNotEvaluatedForWrongType() { |
2336 | 2339 | // Given - Testing bug where display conditions for NUMBER type properties are evaluated when updating STRING |
2337 | 2340 | // 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. |
2342 | 2341 | String workflowId = "678a28b3-1e50-4356-b3d6-1fa8128698c9"; |
2343 | 2342 | String workflowNodeName = "condition_1"; |
2344 | 2343 | String parameterPath = "conditions[0][0].value2"; |
@@ -2432,15 +2431,10 @@ void testUpdateWorkflowNodeParameterDisplayConditionNotEvaluatedForWrongType() { |
2432 | 2431 | String condition = (String) map.get("displayCondition"); |
2433 | 2432 |
|
2434 | 2433 | // 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)")) { |
2442 | 2437 |
|
2443 | | - if (condition.equals("=!contains({'EMPTY','REGEX'}, conditions[0][0].operation)")) { |
2444 | 2438 | return Map.of("displayCondition", true); |
2445 | 2439 | } |
2446 | 2440 | } |
|
0 commit comments