spring环境下的自定义配置源功能测试

This commit is contained in:
dongguo.tao
2021-04-07 15:31:51 +08:00
parent 8844dba4ff
commit 1beab89c76
3 changed files with 62 additions and 0 deletions

View File

@@ -0,0 +1,33 @@
package com.yomahub.liteflow.test.parsecustom;
import com.yomahub.liteflow.core.FlowExecutor;
import com.yomahub.liteflow.entity.data.LiteflowResponse;
import com.yomahub.liteflow.entity.data.Slot;
import com.yomahub.liteflow.test.BaseTest;
import org.junit.Assert;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.junit4.SpringRunner;
import javax.annotation.Resource;
/**
* spring环境的自定义json parser单元测试
* @author dongguo.tao
* @since 2.5.0
*/
@RunWith(SpringRunner.class)
@ContextConfiguration("classpath:/parsecustom/application.xml")
public class CustomParserJsonSpringTest extends BaseTest {
@Resource
private FlowExecutor flowExecutor;
//测试spring场景的自定义json parser
@Test
public void testSpringboot() throws Exception{
LiteflowResponse<Slot> response = flowExecutor.execute("chain1", "args");
Assert.assertTrue(response.isSuccess());
}
}

View File

@@ -17,6 +17,7 @@ import javax.annotation.Resource;
/**
* springboot环境的自定义json parser单元测试
* @author dongguo.tao
* @since 2.5.0
*/
@RunWith(SpringRunner.class)

View File

@@ -0,0 +1,28 @@
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns="http://www.springframework.org/schema/beans"
xmlns:context="http://www.springframework.org/schema/context"
xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-4.0.xsd
http://www.springframework.org/schema/context
http://www.springframework.org/schema/context/spring-context-4.0.xsd">
<context:component-scan base-package="com.yomahub.liteflow.test.parsecustom.cmp" />
<bean id="liteflowConfig" class="com.yomahub.liteflow.property.LiteflowConfig">
<property name="ruleSource" value="com.yomahub.liteflow.test.parsecustom.CustomJsonFlowParser"/>
</bean>
<bean id="flowExecutor" class="com.yomahub.liteflow.core.FlowExecutor">
<property name="liteflowConfig" ref="liteflowConfig"/>
</bean>
<!-- <bean id="flowExecutor" class="com.yomahub.liteflow.core.FlowExecutor">-->
<!-- <property name="rulePath">-->
<!-- <list>-->
<!-- <value>com.yomahub.liteflow.test.parsecustom.CustomJsonFlowParser</value>-->
<!-- </list>-->
<!-- </property>-->
<!-- </bean>-->
</beans>