mirror of
https://gitee.com/dromara/liteFlow.git
synced 2026-05-14 12:12:08 +08:00
bug #I4PA2A 在NodeComponent的isAccess中获取tag失败
This commit is contained in:
@@ -108,14 +108,13 @@ public class Node implements Executable,Cloneable{
|
||||
Slot slot = DataBus.getSlot(slotIndex);
|
||||
|
||||
try {
|
||||
//把tag和condNodeMap赋给NodeComponent
|
||||
//这里为什么要这么做?因为tag和condNodeMap从某种意义上来说是属于某个chain本身范围,并非全局的
|
||||
instance.setTag(tag);
|
||||
instance.setCondNodeMap(condNodeMap);
|
||||
|
||||
//判断是否可执行,所以isAccess经常作为一个组件进入的实际判断要素,用作检查slot里的参数的完备性
|
||||
if (instance.isAccess()) {
|
||||
|
||||
//把tag和condNodeMap赋给NodeComponent
|
||||
//这里为什么要这么做?因为tag和condNodeMap从某种意义上来说是属于某个chain本身范围,并非全局的
|
||||
instance.setTag(tag);
|
||||
instance.setCondNodeMap(condNodeMap);
|
||||
|
||||
//这里开始进行重试的逻辑和主逻辑的运行
|
||||
int retryCount = instance.getRetryCount();
|
||||
List<Class<? extends Exception>> forExceptions = Arrays.asList(instance.getRetryForExceptions());
|
||||
|
||||
@@ -56,4 +56,12 @@ public class NodeTagSpringbootJsonTest extends BaseTest {
|
||||
Assert.assertEquals(3, testSet.size());
|
||||
}
|
||||
}
|
||||
|
||||
//测试tag是否能在isAccess中起效
|
||||
@Test
|
||||
public void testTag4() throws Exception{
|
||||
LiteflowResponse<DefaultSlot> response = flowExecutor.execute2Resp("chain4", "arg");
|
||||
Assert.assertTrue(response.isSuccess());
|
||||
Assert.assertEquals("g", response.getSlot().printStep());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -56,4 +56,12 @@ public class NodeTagSpringbootXmlTest extends BaseTest {
|
||||
Assert.assertEquals(3, testSet.size());
|
||||
}
|
||||
}
|
||||
|
||||
//测试tag是否能在isAccess中起效
|
||||
@Test
|
||||
public void testTag4() throws Exception{
|
||||
LiteflowResponse<DefaultSlot> response = flowExecutor.execute2Resp("chain4", "arg");
|
||||
Assert.assertTrue(response.isSuccess());
|
||||
Assert.assertEquals("g", response.getSlot().printStep());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,25 @@
|
||||
/**
|
||||
* <p>Title: liteflow</p>
|
||||
* <p>Description: 轻量级的组件式流程框架</p>
|
||||
* @author Bryan.Zhang
|
||||
* @email weenyc31@163.com
|
||||
* @Date 2020/4/1
|
||||
*/
|
||||
package com.yomahub.liteflow.test.tag.cmp;
|
||||
|
||||
import com.yomahub.liteflow.annotation.LiteflowComponent;
|
||||
import com.yomahub.liteflow.core.NodeComponent;
|
||||
|
||||
@LiteflowComponent("f")
|
||||
public class FCmp extends NodeComponent {
|
||||
|
||||
@Override
|
||||
public void process() {
|
||||
System.out.println("FCmp executed!");
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isAccess() {
|
||||
return Boolean.parseBoolean(this.getTag());
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,20 @@
|
||||
/**
|
||||
* <p>Title: liteflow</p>
|
||||
* <p>Description: 轻量级的组件式流程框架</p>
|
||||
* @author Bryan.Zhang
|
||||
* @email weenyc31@163.com
|
||||
* @Date 2020/4/1
|
||||
*/
|
||||
package com.yomahub.liteflow.test.tag.cmp;
|
||||
|
||||
import com.yomahub.liteflow.annotation.LiteflowComponent;
|
||||
import com.yomahub.liteflow.core.NodeComponent;
|
||||
|
||||
@LiteflowComponent("g")
|
||||
public class GCmp extends NodeComponent {
|
||||
|
||||
@Override
|
||||
public void process() {
|
||||
System.out.println("GCmp executed!");
|
||||
}
|
||||
}
|
||||
@@ -19,6 +19,12 @@
|
||||
{"type": "then", "value": "b1"},
|
||||
{"type": "when", "value": "b[1],b[2],b[3]"}
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "chain4",
|
||||
"condition": [
|
||||
{"type": "then", "value": "f[false],g"}
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
|
||||
@@ -12,4 +12,8 @@
|
||||
<then value="b1"/>
|
||||
<when value="b[1],b[2],b[3]"/>
|
||||
</chain>
|
||||
|
||||
<chain name="chain4">
|
||||
<then value="f[false],g"/>
|
||||
</chain>
|
||||
</flow>
|
||||
Reference in New Issue
Block a user