diff --git a/liteflow-spring-boot-starter/src/test/java/com/yomahub/liteflow/test/config/LiteflowConfigNoSpringTest.java b/liteflow-spring-boot-starter/src/test/java/com/yomahub/liteflow/test/config/LiteflowConfigNoSpringTest.java index 8fa625270..d8a0eb830 100644 --- a/liteflow-spring-boot-starter/src/test/java/com/yomahub/liteflow/test/config/LiteflowConfigNoSpringTest.java +++ b/liteflow-spring-boot-starter/src/test/java/com/yomahub/liteflow/test/config/LiteflowConfigNoSpringTest.java @@ -1,9 +1,12 @@ package com.yomahub.liteflow.test.config; import com.yomahub.liteflow.core.FlowExecutor; +import com.yomahub.liteflow.entity.data.LiteflowResponse; +import com.yomahub.liteflow.entity.data.Slot; import com.yomahub.liteflow.exception.ConfigErrorException; import com.yomahub.liteflow.property.LiteflowConfig; import com.yomahub.liteflow.test.BaseTest; +import org.junit.Assert; import org.junit.Test; /** @@ -19,14 +22,22 @@ public class LiteflowConfigNoSpringTest extends BaseTest { executor.init(); } - @Test(expected = ConfigErrorException.class) - public void testConfigError() throws Exception { - LiteflowConfig liteflowConfig = new LiteflowConfig(); - liteflowConfig.setRuleSource("json:127.0.0.1:2181:/"); - + @Test + public void testConfig() throws Exception { FlowExecutor executor = new FlowExecutor(); - executor.setLiteflowConfig(liteflowConfig); + LiteflowConfig config = new LiteflowConfig(); + config.setRuleSource("config/flow.json"); + executor.setLiteflowConfig(config); executor.init(); + LiteflowResponse response = executor.execute("chain1", "arg"); + Assert.assertTrue(response.isSuccess()); + Assert.assertEquals(15, config.getWhenMaxWaitSeconds().intValue()); + Assert.assertEquals(200, config.getQueueLimit().intValue()); + Assert.assertEquals(300000L, config.getDelay().longValue()); + Assert.assertEquals(300000L, config.getPeriod().longValue()); + Assert.assertFalse(config.getEnableLog()); + Assert.assertEquals(Runtime.getRuntime().availableProcessors() * 2, config.getWhenMaxWorkers().longValue()); + Assert.assertEquals(512, config.getWhenQueueLimit().longValue()); } } diff --git a/liteflow-spring-boot-starter/src/test/resources/config/application-local.xml b/liteflow-spring-boot-starter/src/test/resources/config/application-local.xml new file mode 100644 index 000000000..cf60572b1 --- /dev/null +++ b/liteflow-spring-boot-starter/src/test/resources/config/application-local.xml @@ -0,0 +1,23 @@ + + + + + + + + + + + + + + + + + \ No newline at end of file