mirror of
https://gitee.com/dromara/liteFlow.git
synced 2026-05-14 04:02:09 +08:00
bug #IBLWJG 布尔节点设置isAccess为false,报错
This commit is contained in:
@@ -116,7 +116,7 @@ public class Slot {
|
||||
|
||||
private <T> T getThreadMetaData(String key) {
|
||||
String threadKey = StrUtil.format("{}_{}", key, Thread.currentThread().getName());
|
||||
return (T) metaDataMap.get(threadKey);
|
||||
return (T) metaDataMap.getOrDefault(threadKey, Boolean.FALSE);
|
||||
}
|
||||
|
||||
private <T> void putMetaDataMap(String key, T t) {
|
||||
@@ -245,7 +245,7 @@ public class Slot {
|
||||
putThreadMetaDataMap(IF_NODE_PREFIX + key, result);
|
||||
}
|
||||
|
||||
public boolean getIfResult(String key) {
|
||||
public Boolean getIfResult(String key) {
|
||||
return getThreadMetaData(IF_NODE_PREFIX + key);
|
||||
}
|
||||
|
||||
@@ -253,7 +253,7 @@ public class Slot {
|
||||
putThreadMetaDataMap(AND_OR_PREFIX + key, result);
|
||||
}
|
||||
|
||||
public boolean getAndOrResult(String key) {
|
||||
public Boolean getAndOrResult(String key) {
|
||||
return getThreadMetaData(AND_OR_PREFIX + key);
|
||||
}
|
||||
|
||||
@@ -261,7 +261,7 @@ public class Slot {
|
||||
putThreadMetaDataMap(NOT_PREFIX + key, result);
|
||||
}
|
||||
|
||||
public boolean getNotResult(String key) {
|
||||
public Boolean getNotResult(String key) {
|
||||
return getThreadMetaData(NOT_PREFIX + key);
|
||||
}
|
||||
|
||||
@@ -269,7 +269,7 @@ public class Slot {
|
||||
putThreadMetaDataMap(FOR_PREFIX + key, forCount);
|
||||
}
|
||||
|
||||
public int getForResult(String key) {
|
||||
public Integer getForResult(String key) {
|
||||
return getThreadMetaData(FOR_PREFIX + key);
|
||||
}
|
||||
|
||||
@@ -277,7 +277,7 @@ public class Slot {
|
||||
putThreadMetaDataMap(WHILE_PREFIX + key, whileFlag);
|
||||
}
|
||||
|
||||
public boolean getWhileResult(String key) {
|
||||
public Boolean getWhileResult(String key) {
|
||||
return getThreadMetaData(WHILE_PREFIX + key);
|
||||
}
|
||||
|
||||
@@ -285,7 +285,7 @@ public class Slot {
|
||||
putThreadMetaDataMap(BREAK_PREFIX + key, breakFlag);
|
||||
}
|
||||
|
||||
public boolean getBreakResult(String key) {
|
||||
public Boolean getBreakResult(String key) {
|
||||
return getThreadMetaData(BREAK_PREFIX + key);
|
||||
}
|
||||
|
||||
|
||||
@@ -73,4 +73,12 @@ public class BooleanOptELSpringbootTest extends BaseTest {
|
||||
Assertions.assertEquals("x1==>b", response.getExecuteStepStr());
|
||||
}
|
||||
|
||||
// 有个布尔组件isAccess为false的情况
|
||||
@Test
|
||||
public void testBooleanOpt7() throws Exception {
|
||||
LiteflowResponse response = flowExecutor.execute2Resp("chain7", "arg");
|
||||
Assertions.assertTrue(response.isSuccess());
|
||||
Assertions.assertEquals("x3==>x4==>b", response.getExecuteStepStr());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,17 @@
|
||||
package com.yomahub.liteflow.test.booleanOpt.cmp;
|
||||
|
||||
import com.yomahub.liteflow.core.NodeBooleanComponent;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
@Component("x5")
|
||||
public class X5 extends NodeBooleanComponent {
|
||||
@Override
|
||||
public boolean processBoolean() throws Exception {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isAccess() {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@@ -30,4 +30,8 @@
|
||||
IF(AND(NOT(x1), x2, x3), a, b);
|
||||
</chain>
|
||||
|
||||
<chain name="chain7">
|
||||
IF(OR(x3,x4,x5), a, b);
|
||||
</chain>
|
||||
|
||||
</flow>
|
||||
Reference in New Issue
Block a user