mirror of
https://github.com/aceld/kis-flow.git
synced 2025-01-23 07:30:23 +08:00
35 lines
964 B
Go
35 lines
964 B
Go
package test
|
|
|
|
import (
|
|
"kis-flow/common"
|
|
"kis-flow/file"
|
|
"kis-flow/kis"
|
|
"kis-flow/test/caas"
|
|
"kis-flow/test/faas"
|
|
"testing"
|
|
)
|
|
|
|
func TestConfigExportYmal(t *testing.T) {
|
|
// 0. 注册Function 回调业务
|
|
kis.Pool().FaaS("funcName1", faas.FuncDemo1Handler)
|
|
kis.Pool().FaaS("funcName2", faas.FuncDemo2Handler)
|
|
kis.Pool().FaaS("funcName3", faas.FuncDemo3Handler)
|
|
|
|
// 0. 注册ConnectorInit 和 Connector 回调业务
|
|
kis.Pool().CaaSInit("ConnName1", caas.InitConnDemo1)
|
|
kis.Pool().CaaS("ConnName1", "funcName2", common.S, caas.CaasDemoHanler1)
|
|
|
|
// 1. 加载配置文件并构建Flow
|
|
if err := file.ConfigImportYaml("/Users/tal/gopath/src/kis-flow/test/load_conf/"); err != nil {
|
|
panic(err)
|
|
}
|
|
|
|
// 2. 讲构建的内存KisFlow结构配置导出的文件当中
|
|
flows := kis.Pool().GetFlows()
|
|
for _, flow := range flows {
|
|
if err := file.ConfigExportYaml(flow, "/Users/tal/gopath/src/kis-flow/test/export_conf/"); err != nil {
|
|
panic(err)
|
|
}
|
|
}
|
|
}
|