增加嵌套循环的测试用例

This commit is contained in:
everywhere.z
2023-03-21 19:47:42 +08:00
parent c5abe72521
commit 308698145a
5 changed files with 64 additions and 0 deletions

View File

@@ -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());
}
}

View File

@@ -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());
}
}

View File

@@ -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();
}
}

View File

@@ -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();
}
}

View File

@@ -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>