2024-01-12 17:27:43 +08:00
|
|
|
package test
|
|
|
|
|
|
|
|
import (
|
2024-03-20 17:57:41 +08:00
|
|
|
"fmt"
|
2024-04-16 15:11:23 +08:00
|
|
|
"testing"
|
|
|
|
|
2024-03-26 14:54:50 +08:00
|
|
|
"github.com/aceld/kis-flow/file"
|
|
|
|
"github.com/aceld/kis-flow/kis"
|
2024-01-12 17:27:43 +08:00
|
|
|
)
|
|
|
|
|
2024-04-15 17:50:02 +08:00
|
|
|
func TestConfigExportYaml(t *testing.T) {
|
2024-01-12 17:27:43 +08:00
|
|
|
|
2024-04-15 17:50:02 +08:00
|
|
|
// 1. Load the configuration file and build the Flow
|
2024-03-20 18:09:08 +08:00
|
|
|
if err := file.ConfigImportYaml("load_conf/"); err != nil {
|
2024-03-20 17:57:41 +08:00
|
|
|
fmt.Println("Wrong Config Yaml Path!")
|
2024-01-12 17:27:43 +08:00
|
|
|
panic(err)
|
|
|
|
}
|
|
|
|
|
2024-04-15 17:50:02 +08:00
|
|
|
// 2. Export the built memory KisFlow structure configuration to files
|
2024-01-12 17:27:43 +08:00
|
|
|
flows := kis.Pool().GetFlows()
|
|
|
|
for _, flow := range flows {
|
2024-03-20 17:57:41 +08:00
|
|
|
if err := file.ConfigExportYaml(flow, "/Users/Aceld/go/src/kis-flow/test/export_conf/"); err != nil {
|
2024-01-12 17:27:43 +08:00
|
|
|
panic(err)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|