mirror of
https://gitee.com/dromara/liteFlow.git
synced 2026-05-14 20:22:07 +08:00
feature #I9H6GY SQL脚本在配置上支持用户自定义的过滤条件
This commit is contained in:
@@ -0,0 +1,38 @@
|
||||
package com.yomahub.liteflow.test.withSuffix;
|
||||
|
||||
import com.yomahub.liteflow.core.FlowExecutor;
|
||||
import com.yomahub.liteflow.flow.LiteflowResponse;
|
||||
import com.yomahub.liteflow.test.BaseTest;
|
||||
import org.junit.jupiter.api.Assertions;
|
||||
import org.junit.jupiter.api.Test;
|
||||
import org.junit.jupiter.api.extension.ExtendWith;
|
||||
import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
|
||||
import org.springframework.boot.test.context.SpringBootTest;
|
||||
import org.springframework.context.annotation.ComponentScan;
|
||||
import org.springframework.test.context.TestPropertySource;
|
||||
import org.springframework.test.context.junit.jupiter.SpringExtension;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import javax.sql.DataSource;
|
||||
|
||||
/**
|
||||
* @author jay li
|
||||
* @since 2.12.0
|
||||
*/
|
||||
@ExtendWith(SpringExtension.class)
|
||||
@TestPropertySource(value = "classpath:/application-data-source-with-suffix2-xml.properties")
|
||||
@SpringBootTest(classes = SQLWithXmlELWithSuffix2SpringbootTest.class)
|
||||
@EnableAutoConfiguration
|
||||
@ComponentScan({"com.yomahub.liteflow.test.sql.cmp"})
|
||||
public class SQLWithXmlELWithSuffix2SpringbootTest extends BaseTest {
|
||||
|
||||
@Resource
|
||||
private FlowExecutor flowExecutor;
|
||||
|
||||
@Test
|
||||
public void testSQLWithXmlChain1() {
|
||||
LiteflowResponse response = flowExecutor.execute2Resp("r_chain1", "arg");
|
||||
Assertions.assertEquals("c==>b==>a", response.getExecuteStepStr());
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,37 @@
|
||||
package com.yomahub.liteflow.test.withSuffix;
|
||||
|
||||
import com.yomahub.liteflow.core.FlowExecutor;
|
||||
import com.yomahub.liteflow.flow.LiteflowResponse;
|
||||
import com.yomahub.liteflow.test.BaseTest;
|
||||
import org.junit.jupiter.api.Assertions;
|
||||
import org.junit.jupiter.api.Test;
|
||||
import org.junit.jupiter.api.extension.ExtendWith;
|
||||
import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
|
||||
import org.springframework.boot.test.context.SpringBootTest;
|
||||
import org.springframework.context.annotation.ComponentScan;
|
||||
import org.springframework.test.context.TestPropertySource;
|
||||
import org.springframework.test.context.junit.jupiter.SpringExtension;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import javax.sql.DataSource;
|
||||
|
||||
/**
|
||||
* @author jay li
|
||||
* @since 2.12.0
|
||||
*/
|
||||
@ExtendWith(SpringExtension.class)
|
||||
@TestPropertySource(value = "classpath:/application-data-source-with-suffix-xml.properties")
|
||||
@SpringBootTest(classes = SQLWithXmlELWithSuffixSpringbootTest.class)
|
||||
@EnableAutoConfiguration
|
||||
@ComponentScan({"com.yomahub.liteflow.test.sql.cmp"})
|
||||
public class SQLWithXmlELWithSuffixSpringbootTest extends BaseTest {
|
||||
|
||||
@Resource
|
||||
private FlowExecutor flowExecutor;
|
||||
|
||||
@Test
|
||||
public void testSQLWithXmlChain1() {
|
||||
LiteflowResponse response = flowExecutor.execute2Resp("r_chain1", "arg");
|
||||
Assertions.assertEquals("a==>b==>c", response.getExecuteStepStr());
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,23 @@
|
||||
liteflow.rule-source-ext-data={\
|
||||
"applicationName":"demo",\
|
||||
"chainTableName":"EL_TABLE",\
|
||||
"chainApplicationNameField":"application_name",\
|
||||
"chainNameField":"chain_name",\
|
||||
"chainSuffixTypeField":"chain_suffix_type",\
|
||||
"chainSuffixType":"biz1",\
|
||||
"elDataField":"EL_DATA",\
|
||||
"scriptTableName":"script_node_table",\
|
||||
"scriptApplicationNameField":"application_name",\
|
||||
"scriptIdField":"script_node_id",\
|
||||
"scriptNameField":"script_node_name",\
|
||||
"scriptDataField":"script_node_data",\
|
||||
"scriptLanguageField":"script_language",\
|
||||
"scriptTypeField":"script_node_type"\
|
||||
}
|
||||
spring.datasource.driver-class-name=org.h2.Driver
|
||||
spring.datasource.url=jdbc:h2:mem:test_db;MODE=MySQL
|
||||
spring.datasource.username=root
|
||||
spring.datasource.password=123456
|
||||
spring.datasource.schema=classpath:/sql/schema.sql
|
||||
spring.datasource.data=classpath:/sql/data.sql
|
||||
spring.datasource.platform=h2
|
||||
@@ -0,0 +1,23 @@
|
||||
liteflow.rule-source-ext-data={\
|
||||
"applicationName":"demo",\
|
||||
"chainTableName":"EL_TABLE",\
|
||||
"chainApplicationNameField":"application_name",\
|
||||
"chainNameField":"chain_name",\
|
||||
"chainSuffixTypeField":"chain_suffix_type",\
|
||||
"chainSuffixType":"biz2",\
|
||||
"elDataField":"EL_DATA",\
|
||||
"scriptTableName":"script_node_table",\
|
||||
"scriptApplicationNameField":"application_name",\
|
||||
"scriptIdField":"script_node_id",\
|
||||
"scriptNameField":"script_node_name",\
|
||||
"scriptDataField":"script_node_data",\
|
||||
"scriptLanguageField":"script_language",\
|
||||
"scriptTypeField":"script_node_type"\
|
||||
}
|
||||
spring.datasource.driver-class-name=org.h2.Driver
|
||||
spring.datasource.url=jdbc:h2:mem:test_db;MODE=MySQL
|
||||
spring.datasource.username=root
|
||||
spring.datasource.password=123456
|
||||
spring.datasource.schema=classpath:/sql/schema.sql
|
||||
spring.datasource.data=classpath:/sql/data.sql
|
||||
spring.datasource.platform=h2
|
||||
@@ -7,6 +7,8 @@ INSERT INTO EL_TABLE (APPLICATION_NAME,CHAIN_NAME,EL_DATA) values ('demo','<chai
|
||||
INSERT INTO EL_TABLE (APPLICATION_NAME,CHAIN_NAME,EL_DATA) values ('demo','chain4','IF(x2, IF(x0, THEN(a, b)));');
|
||||
INSERT INTO EL_TABLE (APPLICATION_NAME,CHAIN_NAME,EL_DATA,ROUTE,NAMESPACE) values ('demo','r_chain1','THEN(a,b,c);','r1','ns');
|
||||
INSERT INTO EL_TABLE (APPLICATION_NAME,CHAIN_NAME,EL_DATA,ROUTE,NAMESPACE) values ('demo','r_chain2','THEN(c,b,a);','OR(r1,r2)','ns');
|
||||
INSERT INTO EL_TABLE (APPLICATION_NAME,CHAIN_NAME,EL_DATA,CHAIN_SUFFIX_TYPE) values ('demo','r_chain1','THEN(a,b,c);','biz1');
|
||||
INSERT INTO EL_TABLE (APPLICATION_NAME,CHAIN_NAME,EL_DATA,CHAIN_SUFFIX_TYPE) values ('demo','r_chain1','THEN(c,b,a);','biz2');
|
||||
|
||||
DELETE FROM SCRIPT_NODE_TABLE;
|
||||
|
||||
|
||||
@@ -6,6 +6,7 @@ create table IF NOT EXISTS `EL_TABLE`
|
||||
`el_data` varchar(1024) NOT NULL,
|
||||
`route` varchar(1024),
|
||||
`namespace` varchar(32),
|
||||
`chain_suffix_type` varchar(32),
|
||||
PRIMARY KEY (`id`)
|
||||
);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user