!60 chain重名的检测

Merge pull request !60 from 与或非/issues/I5BR5M
This commit is contained in:
铂赛东
2022-06-13 12:57:34 +00:00
committed by Gitee
20 changed files with 176 additions and 55 deletions

View File

@@ -2,16 +2,12 @@ package com.yomahub.liteflow.test.exception;
import com.yomahub.liteflow.core.FlowExecutor;
import com.yomahub.liteflow.core.FlowExecutorHolder;
import com.yomahub.liteflow.exception.ChainNotFoundException;
import com.yomahub.liteflow.exception.ChainDuplicateException;
import com.yomahub.liteflow.exception.ConfigErrorException;
import com.yomahub.liteflow.exception.FlowExecutorNotInitException;
import com.yomahub.liteflow.exception.FlowSystemException;
import com.yomahub.liteflow.flow.LiteflowResponse;
import com.yomahub.liteflow.property.LiteflowConfig;
import com.yomahub.liteflow.property.LiteflowConfigGetter;
import com.yomahub.liteflow.slot.DefaultContext;
import com.yomahub.liteflow.test.BaseTest;
import org.junit.Assert;
import org.junit.BeforeClass;
import org.junit.Test;
@@ -33,6 +29,16 @@ public class Exception1Test extends BaseTest {
flowExecutor = FlowExecutorHolder.loadInstance(config);
}
/**
* 验证 chain 节点重复的异常
*/
@Test(expected = ChainDuplicateException.class)
public void testChainDuplicateException() {
LiteflowConfig config = LiteflowConfigGetter.get();
config.setRuleSource("exception/flow-exception.xml");
flowExecutor.init();
}
@Test(expected = ConfigErrorException.class)
public void testConfigErrorException() {
flowExecutor.setLiteflowConfig(null);

View File

@@ -0,0 +1,10 @@
<?xml version="1.0" encoding="UTF-8"?>
<flow>
<chain name="chain1">
<then value="a,b,c"/>
</chain>
<chain name="chain1">
<then value="a,b,c"/>
</chain>
</flow>