mirror of
https://gitee.com/dromara/liteFlow.git
synced 2026-05-14 12:12:08 +08:00
增加嵌套循环的测试用例
This commit is contained in:
@@ -54,4 +54,10 @@ public class IteratorELSpringbootTest extends BaseTest {
|
||||
Assert.assertEquals("12", str);
|
||||
}
|
||||
|
||||
// 多层迭代
|
||||
@Test
|
||||
public void testIt3() throws Exception {
|
||||
LiteflowResponse response = flowExecutor.execute2Resp("chain3");
|
||||
Assert.assertTrue(response.isSuccess());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,14 @@
|
||||
|
||||
package com.yomahub.liteflow.test.iterator.cmp;
|
||||
|
||||
import com.yomahub.liteflow.core.NodeComponent;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
@Component("c")
|
||||
public class CCmp extends NodeComponent {
|
||||
|
||||
@Override
|
||||
public void process() throws Exception {
|
||||
System.out.println(this.getCurrLoopObj().toString());
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,17 @@
|
||||
package com.yomahub.liteflow.test.iterator.cmp;
|
||||
|
||||
import cn.hutool.core.collection.ListUtil;
|
||||
import com.yomahub.liteflow.annotation.LiteflowComponent;
|
||||
import com.yomahub.liteflow.core.NodeIteratorComponent;
|
||||
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
|
||||
@LiteflowComponent("x1")
|
||||
public class X1Cmp extends NodeIteratorComponent {
|
||||
@Override
|
||||
public Iterator<?> processIterator() throws Exception {
|
||||
List<String> list = ListUtil.toList("a", "b", "c");
|
||||
return list.iterator();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,17 @@
|
||||
package com.yomahub.liteflow.test.iterator.cmp;
|
||||
|
||||
import cn.hutool.core.collection.ListUtil;
|
||||
import com.yomahub.liteflow.annotation.LiteflowComponent;
|
||||
import com.yomahub.liteflow.core.NodeIteratorComponent;
|
||||
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
|
||||
@LiteflowComponent("x2")
|
||||
public class X2Cmp extends NodeIteratorComponent {
|
||||
@Override
|
||||
public Iterator<?> processIterator() throws Exception {
|
||||
List<String> list = ListUtil.toList("11", "22");
|
||||
return list.iterator();
|
||||
}
|
||||
}
|
||||
@@ -8,4 +8,14 @@
|
||||
<chain name="chain2">
|
||||
ITERATOR(it).DO(a).BREAK(b);
|
||||
</chain>
|
||||
|
||||
<chain name="chain3">
|
||||
ITERATOR(x1).DO(
|
||||
THEN(
|
||||
c,
|
||||
ITERATOR(x2).DO(c)
|
||||
)
|
||||
|
||||
);
|
||||
</chain>
|
||||
</flow>
|
||||
Reference in New Issue
Block a user