代码拉取完成,页面将自动刷新
package flow_engine
import (
"fmt"
"gitee.com/whit/flow-engine/model"
"testing"
)
func getDefaultTestEngine() *FlowEngine {
cfg := &Config{
Mysql: struct{ Datasource string }{
Datasource: "root:123456@tcp(10.10.10.200:23306)/oatest-flowengine?charset=utf8&parseTime=true&loc=Asia%2FShanghai",
},
}
return NewFlowEngine(cfg, func(event Event, taskId int64, engine *FlowEngine) {
fmt.Println(event, taskId)
}, func(inst *model.ProcInst, engine *FlowEngine) {
fmt.Println(json.Marshal(inst))
}, func(roleId string) (*User, error) {
return &User{
Id: "1",
Name: "诸葛掘机",
}, nil
}, func(userId string, level int) (*User, error) {
return &User{
Id: "2",
Name: "诸葛建国",
}, nil
}, func(taskKey string, forms []string) (string, error) {
return forms[0], nil
})
}
func TestFlowEngine_AddProcDef(t *testing.T) {
engine := getDefaultTestEngine()
def := model.ProcDefNode{
Type: model.NtStart,
NextNodes: append(make([]model.ProcDefNode, 0), model.ProcDefNode{
Type: model.NtTask,
Prop: &model.ProcDefNodeProp{
Name: "主管审批",
Key: "leave_request",
Desc: "请假条审批",
Actors: append(make([]model.ProcDefActor, 0), model.ProcDefActor{
Id: "1",
Type: model.AtUser,
Name: "诸葛掘机",
}),
},
NextNodes: append(make([]model.ProcDefNode, 0), model.ProcDefNode{
Type: model.NtEnd,
}),
}),
}
_, err := engine.AddProcDef(&model.ProcDef{
Key: "leave_req",
Group: "0",
Title: "请假审批",
Content: def.ToJsonStr(),
})
if err != nil {
t.Error(err)
}
}
func TestFlowEngine_StartProcess(t *testing.T) {
engine := getDefaultTestEngine()
id, err := engine.StartProcess("5", 1, "{\"title\":\"测试表单\"}")
if err != nil {
t.Error(err)
}
print(id)
}
func TestFlowEngine_UpdateProcDef(t *testing.T) {
//engine := getDefaultTestEngine()
//if err := engine
}
func TestFlowEngine_DelProcDef(t *testing.T) {
}
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。