|
@ -88,9 +88,9 @@ func TestNodeHandler_CZ(t *testing.T) { |
|
|
"taskId": "ec9410fa-a9f1-4ba2-831a-aa52331558d6", |
|
|
"taskId": "ec9410fa-a9f1-4ba2-831a-aa52331558d6", |
|
|
"jobId": 3, |
|
|
"jobId": 3, |
|
|
"jobRepeatId": 1, |
|
|
"jobRepeatId": 1, |
|
|
"triggerTime": "2024-07-08T11:09:32+08:00", |
|
|
"triggerTime": "2024-08-08T00:09:32+08:00", |
|
|
"realTime": "0001-01-01T00:00:00Z", |
|
|
"realTime": "0001-01-01T00:00:00Z", |
|
|
"finishTime": "2024-07-08T11:09:41.34+08:00", |
|
|
"finishTime": "2024-08-08T00:09:41.34+08:00", |
|
|
"seq": 0, |
|
|
"seq": 0, |
|
|
"released": false, |
|
|
"released": false, |
|
|
"data": { |
|
|
"data": { |
|
@ -99,9 +99,9 @@ func TestNodeHandler_CZ(t *testing.T) { |
|
|
"axieSpeed": "71", |
|
|
"axieSpeed": "71", |
|
|
"axieWeight": "[\"0.9\",\"0.4\",\"0\",\"0\",\"0\",\"0\",\"0\",\"0\",\"0\",\"0\"]", |
|
|
"axieWeight": "[\"0.9\",\"0.4\",\"0\",\"0\",\"0\",\"0\",\"0\",\"0\",\"0\",\"0\"]", |
|
|
"axisnum": "2", |
|
|
"axisnum": "2", |
|
|
"cmsLength": "2457", |
|
|
"cmsLength": "3100", |
|
|
"crossRoad": "1", |
|
|
"crossRoad": "22", |
|
|
"direction": "2", |
|
|
"direction": "1", |
|
|
"grossWeight": 6.3, |
|
|
"grossWeight": 6.3, |
|
|
"overload": "未超载", |
|
|
"overload": "未超载", |
|
|
"totalBase": "0", |
|
|
"totalBase": "0", |
|
@ -131,6 +131,8 @@ func TestNodeHandler_CZ(t *testing.T) { |
|
|
nodeStageManage.AddStages(infoHandler.GetStage()) |
|
|
nodeStageManage.AddStages(infoHandler.GetStage()) |
|
|
calcHandler := et_calc.NewCalcHandler() |
|
|
calcHandler := et_calc.NewCalcHandler() |
|
|
nodeStageManage.AddStages(calcHandler.GetStage()) |
|
|
nodeStageManage.AddStages(calcHandler.GetStage()) |
|
|
|
|
|
cacheHandler := et_cache.NewCacheHandler() |
|
|
|
|
|
nodeStageManage.AddStages(cacheHandler.GetStage()) |
|
|
sinkThemeHandler := et_sink.NewSinkThemeHandler() |
|
|
sinkThemeHandler := et_sink.NewSinkThemeHandler() |
|
|
nodeStageManage.AddStages(sinkThemeHandler.GetStage()) |
|
|
nodeStageManage.AddStages(sinkThemeHandler.GetStage()) |
|
|
publishHandler := et_push.NewPushHandler() |
|
|
publishHandler := et_push.NewPushHandler() |
|
@ -143,6 +145,131 @@ func TestNodeHandler_CZ(t *testing.T) { |
|
|
time.Sleep(time.Second * 20) |
|
|
time.Sleep(time.Second * 20) |
|
|
log.Println("测试结束") |
|
|
log.Println("测试结束") |
|
|
} |
|
|
} |
|
|
|
|
|
func TestNodeHandler_CZ2(t *testing.T) { |
|
|
|
|
|
|
|
|
|
|
|
rawDataMsg_CZ := `{ |
|
|
|
|
|
"userId": "77804162-837d-4ff9-96c0-beb8e8888f8e", |
|
|
|
|
|
"dimensionId": "00000000-0000-0000-0000-000000000000", |
|
|
|
|
|
"dimCapId": "74f90bfc-7eff-4efd-8f1e-9022626fb672", |
|
|
|
|
|
"scheduleId": "c3e70765-61be-4068-8d69-6ab5bb3f1240", |
|
|
|
|
|
"jobId": 1, |
|
|
|
|
|
"jobRepeatId": 1, |
|
|
|
|
|
"thingId": "8e3eec71-c924-47fd-ac8b-2f28c49ad4e9", |
|
|
|
|
|
"deviceId": "1dd0f0d2-e802-487e-91fc-d0d3f24ddbfc", |
|
|
|
|
|
"taskId": "1f9e5d75-a607-4c44-8188-e10c4ce49fed", |
|
|
|
|
|
"triggerTime": "2024-09-12T17:34:01.0171735+08:00", |
|
|
|
|
|
"finishTime": "2024-09-12T17:34:01.6526854+08:00", |
|
|
|
|
|
"seq": 0, |
|
|
|
|
|
"result": null, |
|
|
|
|
|
"data": { |
|
|
|
|
|
"data": { |
|
|
|
|
|
"licence": "苏I55526", |
|
|
|
|
|
"axisnum": "8", |
|
|
|
|
|
"carType": "7", |
|
|
|
|
|
"cmsLength": "764", |
|
|
|
|
|
"crossRoad": "nil", |
|
|
|
|
|
"direction": "4", |
|
|
|
|
|
"grossWeight": "433", |
|
|
|
|
|
"limitWeight": "345", |
|
|
|
|
|
"limtTotalWeight": "575", |
|
|
|
|
|
"overload": 1, |
|
|
|
|
|
"serialNum": "nil", |
|
|
|
|
|
"height": "nil", |
|
|
|
|
|
"lane": 1, |
|
|
|
|
|
"speed": "20", |
|
|
|
|
|
"temp": "-25", |
|
|
|
|
|
"totalBase": "792", |
|
|
|
|
|
"axieSpeed": "100", |
|
|
|
|
|
"width": "nil", |
|
|
|
|
|
"weightK": 1, |
|
|
|
|
|
"axieWeight": "[\"43\",\"31\",\"35\",\"7\",\"20\",\"37\",\"24\",\"41\",\"0\",\"0\"]" |
|
|
|
|
|
}, |
|
|
|
|
|
"result": { |
|
|
|
|
|
"code": 0, |
|
|
|
|
|
"detail": null, |
|
|
|
|
|
"msg": null |
|
|
|
|
|
}, |
|
|
|
|
|
"type": 0 |
|
|
|
|
|
} |
|
|
|
|
|
}` |
|
|
|
|
|
|
|
|
|
|
|
rawDataMsg_CZ2 := `{ |
|
|
|
|
|
"userId": "77804162-837d-4ff9-96c0-beb8e8888f8e", |
|
|
|
|
|
"dimensionId": "00000000-0000-0000-0000-000000000000", |
|
|
|
|
|
"dimCapId": "74f90bfc-7eff-4efd-8f1e-9022626fb672", |
|
|
|
|
|
"scheduleId": "c3e70765-61be-4068-8d69-6ab5bb3f1240", |
|
|
|
|
|
"jobId": 1, |
|
|
|
|
|
"jobRepeatId": 1, |
|
|
|
|
|
"thingId": "8e3eec71-c924-47fd-ac8b-2f28c49ad4e9", |
|
|
|
|
|
"deviceId": "1dd0f0d2-e802-487e-91fc-d0d3f24ddbfc", |
|
|
|
|
|
"taskId": "1f9e5d75-a607-4c44-8188-e10c4ce49fed", |
|
|
|
|
|
"triggerTime": "2024-09-12T18:30:01.0171735+08:00", |
|
|
|
|
|
"finishTime": "2024-09-12T18:30:01.6526854+08:00", |
|
|
|
|
|
"seq": 0, |
|
|
|
|
|
"result": null, |
|
|
|
|
|
"data": { |
|
|
|
|
|
"data": { |
|
|
|
|
|
"licence": "苏I55526", |
|
|
|
|
|
"axisnum": "8", |
|
|
|
|
|
"carType": "7", |
|
|
|
|
|
"cmsLength": "764", |
|
|
|
|
|
"crossRoad": "nil", |
|
|
|
|
|
"direction": "5", |
|
|
|
|
|
"grossWeight": "433", |
|
|
|
|
|
"limitWeight": "345", |
|
|
|
|
|
"limtTotalWeight": "575", |
|
|
|
|
|
"overload": 1, |
|
|
|
|
|
"serialNum": "nil", |
|
|
|
|
|
"height": "nil", |
|
|
|
|
|
"lane": 2, |
|
|
|
|
|
"speed": "20", |
|
|
|
|
|
"temp": "-25", |
|
|
|
|
|
"totalBase": "792", |
|
|
|
|
|
"axieSpeed": "100", |
|
|
|
|
|
"width": "nil", |
|
|
|
|
|
"weightK": 1, |
|
|
|
|
|
"axieWeight": "[\"43\",\"31\",\"35\",\"7\",\"20\",\"37\",\"24\",\"41\",\"0\",\"0\"]" |
|
|
|
|
|
}, |
|
|
|
|
|
"result": { |
|
|
|
|
|
"code": 0, |
|
|
|
|
|
"detail": null, |
|
|
|
|
|
"msg": null |
|
|
|
|
|
}, |
|
|
|
|
|
"type": 0 |
|
|
|
|
|
} |
|
|
|
|
|
}` |
|
|
|
|
|
rawData := &common_models.IotaData{} |
|
|
|
|
|
err := json.Unmarshal([]byte(rawDataMsg_CZ), rawData) |
|
|
|
|
|
if err != nil { |
|
|
|
|
|
log.Panicf("测试异常%s", err.Error()) |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
nodeWorker := app.NewEtWorker() |
|
|
|
|
|
nodeStageManage := stages.NewStageManager() |
|
|
|
|
|
nodeStageManage.AddSource(nodeWorker.LoadCh()) |
|
|
|
|
|
sinkRawHandler := et_sink.NewSinkRawHandler() |
|
|
|
|
|
nodeStageManage.AddStages(sinkRawHandler.GetStage()) |
|
|
|
|
|
infoHandler := et_Info.NewInfoHandler() |
|
|
|
|
|
nodeStageManage.AddStages(infoHandler.GetStage()) |
|
|
|
|
|
calcHandler := et_calc.NewCalcHandler() |
|
|
|
|
|
nodeStageManage.AddStages(calcHandler.GetStage()) |
|
|
|
|
|
cacheHandler := et_cache.NewCacheHandler() |
|
|
|
|
|
nodeStageManage.AddStages(cacheHandler.GetStage()) |
|
|
|
|
|
sinkThemeHandler := et_sink.NewSinkThemeHandler() |
|
|
|
|
|
nodeStageManage.AddStages(sinkThemeHandler.GetStage()) |
|
|
|
|
|
publishHandler := et_push.NewPushHandler() |
|
|
|
|
|
nodeStageManage.AddStages(publishHandler.GetStage()) |
|
|
|
|
|
|
|
|
|
|
|
nodeStageManage.Run() |
|
|
|
|
|
|
|
|
|
|
|
log.Println("测试开始") |
|
|
|
|
|
nodeWorker.ConsumerProcess(rawData) |
|
|
|
|
|
time.Sleep(time.Second * 2) |
|
|
|
|
|
err = json.Unmarshal([]byte(rawDataMsg_CZ2), rawData) |
|
|
|
|
|
nodeWorker.ConsumerProcess(rawData) |
|
|
|
|
|
time.Sleep(time.Second * 200) |
|
|
|
|
|
log.Println("测试结束") |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
func TestNodeHandler_Formula303(t *testing.T) { |
|
|
func TestNodeHandler_Formula303(t *testing.T) { |
|
|
rawDataMsg_YB := `{ |
|
|
rawDataMsg_YB := `{ |
|
@ -2599,7 +2726,7 @@ func TestStageMode(t *testing.T) { |
|
|
|
|
|
|
|
|
stage1 := stages.NewStage("加") |
|
|
stage1 := stages.NewStage("加") |
|
|
stageManager.AddStages(*stage1) |
|
|
stageManager.AddStages(*stage1) |
|
|
out := make(chan *common_models.ProcessData) |
|
|
out := make(chan *common_models.ProcessData, 1) |
|
|
|
|
|
|
|
|
stageManager.AddOut(out) |
|
|
stageManager.AddOut(out) |
|
|
|
|
|
|
|
|