package main import ( "encoding/json" "et_Info" "et_cache" "et_calc" "et_push" "et_sink" "gitea.anxinyun.cn/container/common_models" "log" "node/app" "node/stages" "testing" "time" ) func TestNodeHandler_WSD(t *testing.T) { rawDataMsg_WSD := `{ "userId": "77804162-837d-4ff9-96c0-beb8e8888f8e", "thingId": "5da9aa1b-05b7-4943-be57-dedb34f7a1bd", "dimensionId": "76c75371-bb9a-4f71-a25d-58adf7938296", "dimCapId": "f8e00449-7dad-4ca8-a4eb-0284784efa8f", "capId": "d2add1b3-b21c-420b-82a4-e0c55ee3a019", "deviceId": "ed0f1d94-49a9-415b-9336-f965a2b0a985", "scheduleId": "8c83fb77-48f3-493b-9311-1b6b7b4fa7a7", "taskId": "0e1c7d3d-257d-4763-a335-198aef0fc625", "jobId": 2, "jobRepeatId": 1, "triggerTime": "2024-07-06T18:01:48.001+08:00", "realTime": "2024-07-06T18:01:48.001+08:00", "finishTime": "2024-07-06T18:01:48.001+08:00", "seq": 0, "released": false, "data": { "type": 1, "data": { "humidy": 60.12, "Temp": 30.2 }, "result": { "code": 0, "msg": "", "detail": null, "errTimes": 1, "dropped": false } } }` rawData := &common_models.IotaData{} err := json.Unmarshal([]byte(rawDataMsg_WSD), 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()) 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 * 20) log.Println("测试结束") } func TestNodeHandler_CZ(t *testing.T) { rawDataMsg_CZ := `{ "userId": "77804162-837d-4ff9-96c0-beb8e8888f8e", "thingId": "8e3eec71-c924-47fd-ac8b-2f28c49ad4e9", "dimensionId": "a460675c-fb42-4f9e-80b9-d50b51597618", "dimCapId": "59632dd8-d616-4520-baf6-63b7b7993b78", "capId": "aacfd8a2-92a5-41f9-8884-b41a43c74280", "deviceId": "1dd0f0d2-e802-487e-91fc-d0d3f24ddbfc", "scheduleId": "83dfb3bf-0523-41b6-907f-e2a8f542050d", "taskId": "ec9410fa-a9f1-4ba2-831a-aa52331558d6", "jobId": 3, "jobRepeatId": 1, "triggerTime": "2024-08-08T00:09:32+08:00", "realTime": "0001-01-01T00:00:00Z", "finishTime": "2024-08-08T00:09:41.34+08:00", "seq": 0, "released": false, "data": { "type": 1, "data": { "axieSpeed": "71", "axieWeight": "[\"0.9\",\"0.4\",\"0\",\"0\",\"0\",\"0\",\"0\",\"0\",\"0\",\"0\"]", "axisnum": "2", "cmsLength": "3100", "crossRoad": "22", "direction": "1", "grossWeight": 6.3, "overload": "未超载", "totalBase": "0", "weightK": 1 }, "result": { "code": 0, "msg": "", "detail": null, "errTimes": 0, "dropped": false } } }` 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 * 20) 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) { rawDataMsg_YB := `{ "userId": "77804162-837d-4ff9-96c0-beb8e8888f8e", "thingId": "8e3eec71-c924-47fd-ac8b-2f28c49ad4e9", "dimensionId": "a460675c-fb42-4f9e-80b9-d50b51597618", "dimCapId": "c59552d1-69f4-4026-b69b-37d2dde33c7e", "capId": "f22498e2-cec8-482a-bc08-673e1e30298f", "deviceId": "c5eb15d8-6a3e-4a0e-8cca-59bf1d06465b", "scheduleId": "f0380c9e-24e3-43e1-8135-c1e8df9ff7c4", "taskId": "ad6a62f1-0af7-4c53-80dd-c1d7833cdf38", "jobId": 1, "jobRepeatId": 1, "triggerTime": "2024-01-16T09:40:02.921+08:00", "realTime": "0001-01-01T00:00:00Z", "finishTime": "2024-01-16T09:45:10.556600693+08:00", "seq": 0, "released": false, "data": { "type": 1, "data": { "frequency": 32906, "physicalvalue": -10, "waterlevel": -10 }, "result": { "code": 0, "msg": "", "detail": null, "errTimes": 0, "dropped": false } } }` rawData := &common_models.IotaData{} err := json.Unmarshal([]byte(rawDataMsg_YB), 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()) sinkThemeHandler := et_sink.NewSinkThemeHandler() nodeStageManage.AddStages(sinkThemeHandler.GetStage()) nodeStageManage.Run() log.Println("测试开始") nodeWorker.ConsumerProcess(rawData) time.Sleep(time.Second * 100) } func TestNodeHandler_Formula_104(t *testing.T) { rawDataMsg_YB := ` { "userId": "77804162-837d-4ff9-96c0-beb8e8888f8e", "thingId": "8e3eec71-c924-47fd-ac8b-2f28c49ad4e9", "dimensionId": "f65e5990-540d-40ff-9056-af775e5e4c56", "dimCapId": "aaab627b-5a58-454b-a83f-e236a63930bb", "capId": "35ec137a-ea04-4c81-bbaf-23ddae650c0e", "deviceId": "9c94a305-dd18-4809-8fc6-4191c699e726", "scheduleId": "c5559fbd-eaf4-4fd9-b667-30cc40607ea9", "taskId": "c05ccef4-017c-48d5-a2e5-c01fac16f797", "jobId": 1, "jobRepeatId": 1, "triggerTime": "2024-03-28T00:53:27.244Z", "realTime": "2024-03-28T00:53:27.244Z", "finishTime": "2024-03-28T00:53:27.244Z", "seq": 0, "released": false, "data": { "type": 1, "data": { "pressure": 17.186, "temperature": 23.25 }, "result": { "code": 0, "msg": "", "detail": null, "errTimes": 0, "dropped": false } } }` rawData := &common_models.IotaData{} err := json.Unmarshal([]byte(rawDataMsg_YB), 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()) sinkThemeHandler := et_sink.NewSinkThemeHandler() nodeStageManage.AddStages(sinkThemeHandler.GetStage()) nodeStageManage.Run() log.Println("测试开始") nodeWorker.ConsumerProcess(rawData) time.Sleep(time.Second * 10) log.Println("测试结束") } func TestNodeHandler_vib(t *testing.T) { rawDataMsg_vib := ` { "userId": "77804162-837d-4ff9-96c0-beb8e8888f8e", "thingId": "8e3eec71-c924-47fd-ac8b-2f28c49ad4e9", "dimensionId": "a460675c-fb42-4f9e-80b9-d50b51597618", "dimCapId": "ef658aa7-32dc-43a5-8d6f-f73299bbae9b", "capId": "f22498e2-cec8-482a-bc08-673e1e30298f", "deviceId": "283ed38f-29d2-45ce-b133-8e71c38b0ee5", "scheduleId": "476fae85-0b60-454f-a41b-ad49c356dc5c", "taskId": "6f5acbd4-138a-43cc-96b7-b99335ef8964", "jobId": 2, "jobRepeatId": 1, "triggerTime": "2024-07-10T15:00:59+08:00", "realTime": "0001-01-01T00:00:00Z", "finishTime": "2024-07-10T15:00:59+08:00", "seq": 0, "released": false, "data": { "type": 1, "data": { "_data_type": "vib", "filterFreq": 8, "gainAmplifier": 1, "physicalvalue": [ 0.138672, 0.11777359999999999, 0.0951168, 0.0277344, -0.1117184, 0.1152344, -0.0349608, -0.023828, -0.1884768, -0.1126952, 0.18437520000000002, 0, -0.047656, -0.0974608, -0.1531248, -0.1310544, 0.1433592, 0.070508, -0.0810544, -0.0332032, -0.0757816, -0.11406240000000001, -0.08984400000000001, -0.07832, -0.05410160000000001, 0.00918, 0.0218752, 0.1371096, 0.0128904, 0.05312480000000001, 0.0937504, 0.1 ], "sampleFreq": 16, "triggerType": 4, "version": 1 }, "result": { "code": 0, "msg": "", "detail": null, "errTimes": 0, "dropped": false } } }` rawData := &common_models.IotaData{} err := json.Unmarshal([]byte(rawDataMsg_vib), 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()) sinkThemeHandler := et_sink.NewSinkThemeHandler() nodeStageManage.AddStages(sinkThemeHandler.GetStage()) nodeStageManage.Run() log.Println("测试开始") nodeWorker.ConsumerProcess(rawData) time.Sleep(time.Second * 100) log.Println("测试结束") } // 对标安心云的振动数据 判断主题是否一致 func TestNodeHandler_vib2(t *testing.T) { rawDataMsg_vib := ` { "userId": "77804162-837d-4ff9-96c0-beb8e8888f8e", "thingId": "8e3eec71-c924-47fd-ac8b-2f28c49ad4e9", "dimensionId": "a460675c-fb42-4f9e-80b9-d50b51597618", "dimCapId": "ef658aa7-32dc-43a5-8d6f-f73299bbae9b", "capId": "f22498e2-cec8-482a-bc08-673e1e30298f", "deviceId": "283ed38f-29d2-45ce-b133-8e71c38b0ee5", "scheduleId": "476fae85-0b60-454f-a41b-ad49c356dc5c", "taskId": "6f5acbd4-138a-43cc-96b7-b99335ef8964", "jobId": 2, "jobRepeatId": 1, "triggerTime": "2024-04-10T19:16:59+08:00", "realTime": "0001-01-01T00:00:00Z", "finishTime": "2024-04-10T19:23:29.886332576+08:00", "seq": 0, "released": false, "data": { "type": 1, "data": { "_data_type": "vib", "filterFreq": 128, "gainAmplifier": 0, "physicalvalue": [ -7.83457, -7.843946, -7.860351, -7.864355, -7.862305, -7.864844, -7.859961, -7.861817, -7.87539, -7.861914, -7.860938, -7.886133, -7.89375, -7.896191, -7.890332, -7.885938, -7.879687, -7.90791, -7.925098, -7.942578, -7.951367, -7.959668, -7.932813, -7.918457, -7.902344, -7.880664, -7.838574, -7.786426, -7.782519, -7.760547, -7.766309, -7.764062, -7.742578, -7.722558, -7.72334, -7.70625, -7.680664, -7.6625, -7.649023, -7.641406, -7.662793, -7.669434, -7.692871, -7.714746, -7.731446, -7.728711, -7.743652, -7.769629, -7.789844, -7.794238, -7.812695, -7.817676, -7.826172, -7.843359, -7.866016, -7.848145, -7.85039, -7.860351, -7.864355, -7.868457, -7.889062, -7.884668, -7.888086, -7.895019, -7.785645, -7.795898, -7.806348, -7.808203, -7.816797, -7.800977, -7.808496, -7.79795, -7.752149, -7.740918, -7.732813, -7.722754, -7.72168, -7.723926, -7.719824, -7.71377, -7.684863, -7.661426, -7.665332, -7.656446, -7.641894, -7.635547, -7.644141, -7.660547, -7.720019, -7.738086, -7.786914, -7.860938, -7.882715, -7.879981, -7.883984, -7.898047, -7.900977, -7.87832, -7.837793, -7.841894, -7.823828, -7.792676, -7.804883, -7.808106, -7.819336, -7.835254, -7.826172, -7.821875, -7.823242, -7.787988, -7.762207, -7.751562, -7.726855, -7.692676, -7.670313, -7.640039, -7.63711, -7.639453, -7.667285, -7.65039, -7.654492, -7.638672, -7.638965, -7.638379, -7.638183, -7.655566, -6.717871, -6.424805, -6.234863, -6.225977, -6.332715, -6.519824, -6.869726, -7.208886, -7.446875, -7.719238, -7.799023, -7.801758, -7.813086, -7.78457, -7.781641, -7.783106, -7.8, -7.826367, -7.820508, -7.849023, -7.870898, -7.877832, -7.880664, -7.88623, -7.871094, -7.883106, -7.874902, -7.854004, -7.857519, -7.869141, -7.872461, -7.901758, -7.9125, -7.905176, -7.898926, -7.867578, -7.842676, -7.813477, -7.805957, -7.763379, -7.742676, -7.723438, -7.708886, -7.707226, -7.680859, -7.664746, -7.67207, -7.678614, -7.662598, -7.665722, -7.691406, -7.688574, -7.691309, -7.716504, -7.764355, -7.766406, -7.79082, -7.796484, -7.816309, -7.866016, -7.924023, -8.006446, -8.039844, -8.067676, -8.079004, -8.092481, -8.079004, -8.066211, -8.045801, -8.002442, -7.961133, -7.948047, -7.944238, -7.944922, -7.957129, -7.990722, -8.000977, -8.004102, -7.719824, -7.71377, -7.684863, -7.661426, -7.665332, -7.656446, -7.641894, -7.635547, -7.644141, -7.660547, -7.720019, -7.738086, -7.786914, -7.860938, -7.882715, -7.879981, -7.883984, -7.898047, -7.900977, -7.87832, -7.837793, -7.841894, -7.823828, -7.792676, -7.804883, -7.808106, -7.819336, -7.835254, -7.826172, -7.821875, -7.823242, -7.787988, -7.762207, -7.751562, -7.726855, -7.692676, -7.670313, -7.640039, -7.63711, -7.639453, -7.667285, -7.65039, -7.654492, -7.638672, -7.638965, -7.638379, -7.638183, -7.655566, -7.985645, -7.972754, -7.941114, -7.89541, -7.856348, -7.822851, -7.772266, -7.712988, -7.700586, -7.678516, -7.697656, -7.680371, -7.694824, -7.689844, -7.68711, -7.689355, -7.691406, -7.69707, -7.706152, -7.718652, -7.713086, -7.715332, -7.731348, -7.745313, -7.787793, -7.816406, -7.84209, -7.88457, -7.892969, -7.901758, -7.922363, -7.934766, -7.922266, -7.926172, -7.895313, -7.872266, -7.86123, -7.841406, -7.829297, -7.847461, -7.84043, -7.832129, -7.815722, -7.798633, -7.764746, -7.748047, -7.686817, -7.669726, -7.661718, -7.630176, -7.618946, -7.607422, -7.61709, -7.647851, -7.674317, -7.693066, -7.732031, -7.733008, -7.744141, -7.771778, -7.795313, -7.806054, -7.797461, -7.766114, -7.742187, -7.72539, -7.703125, -7.727734, -7.724902, -7.728027, -7.748633, -7.78125, -7.827149, -7.888574, -7.915918, -7.956152, -7.965332, -7.957422, -7.935742, -7.924902, -7.883398, -7.836914, -7.787402, -7.744238, -7.745606, -7.718946, -7.703809, -7.709668, -7.725879, -7.717676, -7.70625, -7.703222, -7.697168, -7.671289, -7.660645, -7.645508, -7.624317, -7.624218, -7.609668, -7.616699, -7.630078, -7.619434, -7.628125, -7.63584, -7.680469, -7.699414, -7.732031, -7.731543, -7.73457, -7.748633, -7.738672, -7.758594, -7.765918, -7.763672, -7.77373, -7.813672, -7.821973, -7.885058, -7.89541, -7.92207, -7.958301, -7.946484, -7.929394, -7.92461, -7.893457, -7.868946, -7.861914, -7.81709, -7.794629, -7.748438, -7.728906, -7.739258, -7.722754, -7.716797, -7.69209, -7.654004, -7.615234, -7.595996, -7.574707, -7.568262, -7.522656, -7.493554, -7.477734, -7.466016, -7.4625, -7.503125, -7.532715, -7.515722, -7.552832, -7.578516, -7.616992, -7.633008, -7.657519, -7.708106, -7.716016, -7.752149, -7.781054, -7.801367, -7.782519, -7.791114, -7.804883, -7.844434, -7.845215, -7.845215, -7.846094, -7.82207, -7.808789, -7.832617, -7.831641, -7.802734, -7.79043, -7.770117, -7.772168, -7.785351, -7.803222, -7.790722, -7.831934, -7.836426, -7.831446, -7.853125, -7.877442, -7.86084, -7.840234, -7.797558, -7.779981, -7.766309, -7.731054, -7.713379, -7.72705, -7.740332, -7.719922, -7.74043, -7.783691, -7.826074, -7.784375, -7.771973, -7.770703, -7.777734, -7.728418, -7.694043, -7.723438, -7.738282, -7.740039, -7.741894, -7.79082, -7.792578, -7.820703, -7.818359, -7.862598, -7.875977, -7.851465, -7.846191, -7.813574, -7.805274, -7.79834, -7.782617, -7.750195, -7.751855, -7.724317, -7.702539, -7.724414, -7.708398, -7.711426, -7.724414, -7.681641, -7.655762, -7.628418, -7.601074, -7.592871, -7.581738, -7.566602, -7.566602, -7.525195, -7.527442, -7.566309, -7.576074, -7.627734, -7.648047, -7.699414, -7.74209, -7.766211, -7.807031, -7.831446, -7.836426, -7.827149, -7.825098, -7.805957, -7.82207, -7.802149, -7.81455, -7.852637, -7.855469, -7.870508, -7.859375, -7.832519, -7.795215, -7.748145, -7.719629, -7.693359, -7.680176, -7.658203, -7.653027, -7.658203, -7.672656, -7.683301, -7.7125, -7.700488, -7.64375, -7.628125, -7.603711, -7.597558, -7.608984, -7.613183, -7.625098, -7.661133, -7.669238, -7.725, -7.766797, -7.811914, -7.813183, -7.824317, -7.827442, -7.820019, -7.812207, -7.813574, -7.833106, -7.843359, -7.834082, -7.83711, -7.853809, -7.851758, -7.875195, -7.883789, -7.8875, -7.912305, -7.90166, -7.91377, -7.913282, -7.91709, -7.920215, -7.9375, -7.935938, -7.935645, -7.910938, -7.849707, -7.804004, -7.755957, -7.713574, -7.667187, -7.656054, -7.631152, -7.627344, -7.647461, -7.686328, -7.717383, -7.755859, -7.769238, -7.764649, -7.770606, -7.730957, -7.673828, -7.646289, -7.635254, -7.600782, -7.622558, -7.654981, -7.702637, -7.749902, -7.798535, -7.864746, -7.931543, -7.968066, -7.999317, -8.010254, -7.981836, -7.97832, -7.991114, -7.994434, -7.969434, -7.955859, -7.929981, -7.91875, -7.894336, -7.902734, -7.918359, -7.902442, -7.897851, -7.907617, -7.928711, -7.893457, -7.877539, -7.858789, -7.852246, -7.832617, -7.780469, -7.723633, -7.690332, -7.644531, -7.594531, -7.571973, -7.531446, -7.475977, -7.416406, -7.391699, -7.417578, -7.432129, -7.449805, -7.486817, -7.564258, -7.632031, -7.703125, -7.769531, -7.838282, -7.885742, -7.932813, -7.975488, -7.998242, -8.019336, -8.016406, -8.020117, -8.04209, -8.053516, -8.005664, -7.976172, -7.921582, -7.888477, -7.854297, -7.807519, -7.743457, -7.69961, -7.642969, -7.619531, -7.620019, -7.606836, -7.601562, -7.594531, -7.589746, -7.608106, -7.604297, -7.587012, -7.584278, -7.581934, -7.52705, -7.511914, -7.509278, -7.491894, -7.503809, -7.513574, -7.556152, -7.627734, -7.670801, -7.737305, -7.815625, -7.894238, -7.926074, -8.007031, -8.014844, -8.033398, -8.025195, -8.002539, -7.983594, -7.93584, -7.904492, -7.83584, -7.771289, -7.680664, -7.620215, -7.558886, -7.550879, -7.528906, -7.513574, -7.53623, -7.553516, -7.596386, -7.666406, -7.713477, -7.770019, -7.832324, -7.836718, -7.831934, -7.828125, -7.766602, -7.718848, -7.657715, -7.574023, -7.49082, -7.379394, -7.307324, -7.281446, -7.266211, -7.297558, -7.35791, -7.422754, -7.502442, -7.635254, -7.767285, -7.918066, -8.028906, -8.151172, -8.248535, -8.263672, -8.26211, -8.231934, -8.180274, -8.067187, -7.954687, -7.814649, -7.689844, -7.568848, -7.46211, -7.417578, -7.379199, -7.400586, -7.444434, -7.510742, -7.632617, -7.744824, -7.845996, -7.946875, -8.016211, -8.048242, -8.0625, -8.03623, -7.969336, -7.864746, -7.725098, -7.566016, -7.407422, -7.276172, -7.202246, -7.154981, -7.152539, -7.173438, -7.231543, -7.372851, -7.483594, -7.652734, -7.83877, -7.97793, -8.066406, -8.113867, -8.121289, -8.083203, -8.008594, -7.898145, -7.807422, -7.685547, -7.562695, -7.468262, -7.408203, -7.429785, -7.50166, -7.61709, -7.739258, -7.850195, -7.955469, -8.04043, -8.095215, -8.099805, -8.113965, -8.04961, -7.958496, -7.810058, -7.638477, -7.47705, -7.333203, -7.241114, -7.166894, -7.170606, -7.172168, -7.221289, -7.301758, -7.440918, -7.620703, -7.826562, -7.983398, -8.136328, -8.236718, -8.258984, -8.244336, -8.185742, -8.09541, -7.982617, -7.824512, -7.620801, -7.425879, -7.25127, -7.096778, -7.01211, -6.997168, -7.009668, -7.105176, -7.258301, -7.458398, -7.731543, -8.02959, -8.299317, -8.540234, -8.712695, -8.768164, -8.731738, -8.561133, -8.290137, -7.96709, -7.600488, -7.228614, -6.88916, -6.594141, -6.39795, -6.270898, -6.303516, -6.487793, -6.754785, -7.120019, -7.525488, -7.919531, -8.315527, -8.64541, -8.86709, -9.000586, -9.005371, -8.875, -8.658691, -8.392481, -8.008789, -7.601074, -7.243262, -6.891602, -6.644824, -6.525488, -6.448047, -6.515918, -6.692774, -6.928614, -7.279687, -7.68623, -8.066406, -8.420313, -8.699805, -8.876855, -8.954394, -8.915722, -8.741406, -8.493066, -8.159961, -7.790039, -7.404981, -7.043262, -6.764062, -6.569922, -6.508789, -6.580859, -6.733984, -6.95957, -7.272363, -7.614746, -7.930762, -8.267578, -8.523828, -8.67207, -8.731738, -8.662207, -8.533203, -8.337207, -8.08789, -7.816699, -7.574023, -7.344238, -7.164453, -7.071289, -6.994824, -7.030664, -7.092871, -7.240137, -7.389746, -7.539746, -7.720508, -7.895019, -8.04043, -8.138086, -8.211426, -8.186328, -8.144043, -8.04961, -7.92373, -7.789746, -7.655274, -7.489746, -7.359082, -7.314453, -7.28125, -7.303027, -7.406543, -7.520215, -7.672168, -7.810254, -7.943164, -8.050782, -8.165918, -8.191797, -8.187988, -8.099512, -7.955469, -7.782617, -7.602637, -7.475977, -7.340039, -7.24043, -7.214942, -7.224023, -7.291894, -7.469141, -7.629981, -7.835742, -8.058301, -8.21455, -8.345313, -8.445801, -8.398828, -8.328711, -8.205469, -8.008789, -7.801855, -7.61455, -7.381152, -7.226367, -7.117676, -7.045019, -7.116016, -7.240918, -7.403222, -7.657422, -7.875683, -8.094238, -8.313183, -8.469434, -8.592774, -8.667969, -8.605274, -8.475195, -8.26582, -7.977637, -7.708008, -7.404297, -7.096191, -6.855762, -6.644726, -6.512988, -6.500293, -6.614649, -6.820215, -7.128027, -7.467285, -7.84043, -8.218066, -8.521973, -8.798438, -8.966016, -9.010351, -8.925586, -8.754199, -8.49082, -8.176465, -7.787793, -7.415039, -7.079492, -6.76416, -6.592285, -6.525, -6.561914, -6.719922, -6.978906, -7.294434, -7.661817, -8.039453, -8.346386, -8.605957, -8.723242, -8.708594, -8.584961, -8.393262, -8.095703, -7.758691, -7.426465, -7.093262, -6.823242, -6.644824, -6.56045, -6.569922, -6.697168, -6.86543, -7.104394, -7.427149, -7.736914, -8.056641, -8.337207, -8.586328, -8.762988, -8.823926, -8.784668, -8.687793, -8.496778, -8.21582, -7.92959, -7.634668, -7.346386, -7.106348, -6.931446, -6.867871, -6.876758, -6.983886, -7.121191, -7.344336, -7.572168, -7.811035, -8.043946, -8.188574, -8.268652, -8.29043, -8.221386, -8.086133, -7.93916, -7.733789, -7.519824, -7.310351, -7.129004, -7.046973, -7.010351, -7.067383, -7.170117, -7.307129, -7.507422, -7.741992, -7.951953, -8.140137, -8.272461, -8.301855, -8.266309, -8.161914, -7.982813, -7.788965, -7.567285, -7.329004, -7.140039, -7.002637, -6.917774, -6.933691, -7.035058, -7.222168, -7.451953, -7.71045, -7.961133, -8.186133, -8.366504, -8.478711, -8.511621, -8.474707, -8.351758, -8.143262, -7.887988, -7.61455, -7.348926, -7.119531, -6.941699, -6.864649, -6.875098, -6.932617, -7.054981, -7.243164, -7.516992, -7.811328, -8.10039, -8.353614, -8.54082, -8.623535, -8.604102, -8.553418, -8.434668, -8.263477, -7.99668, -7.713867, -7.416016, -7.151562, -6.961133, -6.862988, -6.840527, -6.939258, -7.081934, -7.281934, -7.557129, -7.826367, -8.118164, -8.387988, -8.583301, -8.691797, -8.732226, -8.667285, -8.522851, -8.300683, -8.032519, -7.787012, -7.506446, -7.246973, -7.073535, -6.962305, -6.936621, -6.969824, -7.099121, -7.286621, -7.510351, -7.747363, -8.013574, -8.261328, -8.476953, -8.622851, -8.673438, -8.660547, -8.555176, -8.396094, -8.185254, -7.945898, -7.661718, -7.42461, -7.210645, -7.076855, -7.048828, -7.088477, -7.206152, -7.38418, -7.588183, -7.806738, -8.075879, -8.259863, -8.417871, -8.52373, -8.538379, -8.468946, -8.318066, -8.124121, -7.892481, -7.64043, -7.400293, -7.199414, -7.060351, -7.011035, -6.995215, -7.091309, -7.238965, -7.402149, -7.606348, -7.851172, -8.044922, -8.196973, -8.326953, -8.341504, -8.340332, -8.300977, -8.195019, -8.076074, -7.92959, -7.780762, -7.63789, -7.530078, -7.438477, -7.39961, -7.463672, -7.513379, -7.631348, -7.772461, -7.910547, -8.006738, -8.11709, -8.187695, -8.202637, -8.165039, -8.071484, -7.971386, -7.850977, -7.710351, -7.571778, -7.463672, -7.397656, -7.328906, -7.319434, -7.355859, -7.425683, -7.514258, -7.608691, -7.722168, -7.847558, -7.941699, -8.001953, -8.039844, -8.045703, -7.995898, -7.947363, -7.862793, -7.795313, -7.722266, -7.65127, -7.609473, -7.596778, -7.595606, -7.63955, -7.728125, -7.802246, -7.897558, -8.000683, -8.105664, -8.202344, -8.282617, -8.323633, -8.294922, -8.240234, -8.15039, -8.010254, -7.875, -7.710351, -7.535156, -7.39961, -7.307226, -7.232226, -7.233203, -7.246875, -7.301074, -7.388672, -7.508789, -7.63711, -7.779297, -7.914355, -8.000683, -8.094141, -8.142383, -8.149218, -8.120508, -8.04209, -7.930274, -7.795019, -7.644531, -7.503711, -7.399512, -7.316114, -7.292774, -7.273438, -7.307031, -7.388672, -7.50459, -7.635645, -7.787598, -7.930469, -8.038183, -8.13711, -8.167871, -8.180762, -8.152344, -8.122168, -8.002246, -7.863282, -7.723438, -7.592676, -7.459375, -7.355859, -7.282813, -7.258301, -7.27461, -7.26416, -7.322851, -7.41289, -7.526367, -7.625098, -7.723828, -7.807715, -7.858106, -7.871191, -7.866406, -7.858106, -7.824512, -7.804492, -7.71377, -7.672461, -7.629004, -7.581348, -7.561035, -7.587793, -7.612402, -7.691309, -7.73916, -7.810742, -7.875586, -7.94082, -7.976953, -8.005274, -7.999023, -7.968652, -7.899317, -7.843359, -7.798047, -7.709961, -7.682226, -7.640625, -7.60039, -7.587207, -7.593946, -7.593652, -7.59961, -7.614062, -7.643946, -7.697461, -7.729883, -7.768262, -7.786426, -7.821484, -7.807422, -7.778711, -7.769531, -7.722168, -7.656836, -7.602832, -7.574512, -7.523535, -7.503711, -7.468066, -7.47627, -7.533203, -7.598926, -7.672656, -7.75918, -7.860645, -7.893848, -7.946484, -7.984278, -7.99961, -8.008886, -7.985058, -7.947558, -7.891602, -7.825195, -7.731934, -7.696386, -7.616504, -7.582519, -7.552442, -7.512207, -7.54082, -7.570996, -7.650782, -7.698242, -7.771778, -7.819629, -7.876953, -7.892481, -7.900098, -7.891699, -7.839258, -7.80205, -7.75166, -7.69834, -7.619141, -7.570215, -7.540722, -7.516309, -7.535351, -7.574023, -7.649805, -7.710742, -7.786817, -7.91543, -8.01455, -8.090918, -8.130176, -8.186523, -8.203516, -8.201953, -8.137305, -8.059961, -7.995215, -7.865234, -7.736621, -7.676953, -7.608496, -7.610645, -7.595703, -7.592578, -7.62334, -7.650488, -7.689355, -7.74043, -7.842285, -7.901855, -7.920019, -7.944629, -7.94541, -7.923242, -7.894043, -7.850195, -7.815527, -7.778125, -7.69209, -7.649414, -7.631446, -7.568946, -7.563867, -7.599414, -7.603906, -7.625977, -7.663672, -7.67627, -7.742774, -7.792578, -7.81377, -7.90205, -7.925, -7.94375, -7.947168, -7.959278, -7.91123, -7.909863, -7.909375, -7.912988, -7.927246, -7.91543, -7.89668, -7.898828, -7.90957, -7.903809, -7.933008, -7.973633, -7.976367, -7.966309, -7.933984, -7.9125, -7.861914, -7.787207, -7.746582, -7.709278, -7.627832, -7.573828, -7.52627, -7.496484, -7.52832, -7.52832, -7.590332, -7.698242, -7.795606, -7.845117, -7.958106, -8.000782, -8.036426, -8.096289, -8.08916, -8.075488, -8.063379, -7.978711, -7.890039, -7.861914, -7.803809, -7.752442, -7.731934, -7.716894, -7.729102, -7.780078, -7.79834, -7.836133, -7.905566, -7.916602, -7.912012, -7.963282, -7.988379, -8.001855, -8.000683, -7.959082, -7.951465, -7.903711, -7.830566, -7.804785, -7.730762, -7.638574, -7.536817, -7.45205, -7.409082, -7.40791, -7.388379, -7.45, -7.544141, -7.66582, -7.735645, -7.811328, -7.909082, -7.983398, -8.040722, -8.056054, -8.008594, -7.958691, -7.863183, -7.724218, -7.670898, -7.597558, -7.541309, -7.540332, -7.496289, -7.507324, -7.564355, -7.601172, -7.673926, -7.77295, -7.84375, -7.957519, -8.066504, -8.118164, -8.160645, -8.189649, -8.146973, -8.128809, -8.019726, -7.926953, -7.82295, -7.690527, -7.567774, -7.479883, -7.414258, -7.366309, -7.377246, -7.369531, -7.393359, -7.42793, -7.464453, -7.512598, -7.578711, -7.608398, -7.654687, -7.680957, -7.66377, -7.655957, -7.66455, -7.618359, -7.579785, -7.593554, -7.575879, -7.622168, -7.641894, -7.668457, -7.718457, -7.79082, -7.864844, -7.968946, -8.088477, -8.171484, -8.257422, -8.303906, -8.339062, -8.397461, -8.394043, -8.31084, -8.260938, -8.154004, -8.004785, -7.881543, -7.751074, -7.629004, -7.525683, -7.422168, -7.323438, -7.287695, -7.254004, -7.228027, -7.288574, -7.331348, -7.376953, -7.46084, -7.544043, -7.579687, -7.69873, -7.777539, -7.843457, -7.957031, -8.008789, -8.057324, -8.140527, -8.145313, -8.178906, -8.201465, -8.166797, -8.136133, -8.108203, -8.034375, -7.998242, -7.936914, -7.87168, -7.804004, -7.743164, -7.640625, -7.583301, -7.529981, -7.495508, -7.477832, -7.458203, -7.410547, -7.445996, -7.445215, -7.445996, -7.55, -7.532715, -7.59082, -7.628516, -7.663574, -7.714258, -7.789844, -7.765137, -7.838086, -7.866211, -7.830566, -7.89043, -7.897656, -7.87832, -7.880566, -7.848242, -7.830371, -7.808594, -7.741992, -7.719434, -7.709082, -7.703125, -7.756738, -7.800977, -7.87168, -7.888574, -7.934961, -7.96416, -8.006348, -8.044922, -8.061035, -8.074317, -8.026855, -7.970313, -7.930762, -7.946289, -7.897851, -7.89707, -7.853906, -7.798828, -7.76582, -7.72207, -7.69834, -7.712305, -7.638183, -7.575098, -7.558691, -7.536817, -7.54043, -7.556446, -7.566602, -7.586133, -7.614258, -7.650683, -7.650488, -7.666797, -7.69209, -7.658008, -7.678418, -7.694336, -7.705859, -7.739844, -7.766699, -7.787305, -7.87373, -7.916797, -7.939649, -7.963477, -7.977149, -7.982031, -7.97539, -7.952442, -7.936035, -7.897461, -7.857324, -7.791992, -7.718457, -7.688965, -7.608398, -7.579297, -7.544531, -7.514649, -7.530371, -7.541016, -7.577442, -7.634082, -7.66123, -7.708789, -7.761523, -7.761817, -7.806641, -7.798047, -7.79082, -7.824414, -7.75918, -7.730274, -7.743359, -7.702246, -7.689355, -7.752734, -7.73789, -7.783106, -7.852539, -7.864062, -7.923633, -8.023926, -8.036035, -8.040039, -8.100098, -8.001758, -7.985742, -7.994824, -7.906054, -7.87373, -7.854492, -7.749902, -7.716016, -7.672656, -7.584473, -7.613867, -7.565234, -7.528027, -7.535156, -7.524121, -7.537695, -7.5875, -7.649218, -7.73955, -7.800879, -7.837402, -7.906446, -7.93711, -7.963965, -7.983984, -7.946484, -7.902734, -7.829004, -7.737305, -7.668946, -7.629883, -7.560742, -7.459375, -7.429981, -7.384375, -7.358789, -7.373926, -7.406641, -7.450488, -7.540332, -7.542285, -7.595215, -7.695313, -7.711133, -7.756446, -7.868066, -7.933691, -8.010645, -8.139258, -8.164453, -8.293457, -8.418262, -8.462012, -8.550977, -8.639844, -8.595996, -8.56211, -8.489355, -8.312305, -8.166797, -8.004492, -7.726562, -7.555664, -7.343262, -7.108594, -7.005371, -6.872656, -6.779981, -6.806641, -6.827637, -6.888867, -7.031543, -7.104981, -7.263477, -7.464062, -7.614942, -7.846875, -8.011914, -8.153809, -8.253614, -8.312793, -8.340039, -8.370898, -8.338867, -8.267578, -8.208789, -8.108594, -8.03584, -7.985938, -7.934473, -7.912305, -7.928027, -7.93955, -7.996973, -8.086621, -8.108106, -8.195019, -8.251953, -8.213379, -8.248633, -8.184278, -8.04834, -7.920313, -7.697754, -7.466602, -7.346875, -7.189844, -7.110547, -7.09043, -7.091894, -7.175782, -7.284863, -7.405664, -7.593946, -7.780371, -7.929981, -8.054785, -8.127344, -8.20127, -8.195606, -8.172558, -8.142676, -8.063477, -7.966504, -7.837695, -7.723242, -7.646386, -7.611523, -7.596778, -7.639453, -7.671289, -7.719531, -7.779004, -7.845215, -7.937793, -8.00918, -8.090137, -8.112793, -8.168164, -8.184278, -8.195215, -8.20166, -8.194824, -8.125, -8.061621, -7.958008, -7.829394, -7.777246, -7.672461, -7.574218, -7.48955, -7.474023, -7.448828, -7.509082, -7.537793, -7.588282, -7.652344, -7.670801, -7.693359, -7.743066, -7.749317, -7.717969, -7.691114, -7.67959, -7.632031, -7.628614, -7.602832, -7.585938, -7.634473, -7.661718, -7.694922, -7.779297, -7.856348, -7.886914, -8.022851, -8.081446, -8.09375, -8.124805, -8.095606, -8.062695, -8.035938, -7.939258, -7.853125, -7.791699, -7.645996, -7.555371, -7.540332, -7.535938, -7.521484, -7.544922, -7.584961, -7.62207, -7.658886, -7.660254, -7.683594, -7.714942, -7.730469, -7.703711, -7.717285, -7.755469, -7.789453, -7.845606, -7.907813, -7.940918, -7.972656, -7.982519, -7.954687, -7.910547, -7.87461, -7.802149, -7.775782, -7.757519, -7.729687, -7.746289, -7.721484, -7.718554, -7.702637, -7.709961, -7.660156, -7.624805, -7.547266, -7.449218, -7.414258, -7.379492, -7.378809, -7.43711, -7.488477, -7.537598, -7.632031, -7.71123, -7.873047, -8.016406, -8.129004, -8.243359, -8.344922, -8.403418, -8.446484, -8.490527, -8.461718, -8.406934, -8.261621, -8.122754, -7.962695, -7.79082, -7.631836, -7.508496, -7.391699, -7.301074, -7.233008, -7.209766, -7.217383, -7.219629, -7.281836, -7.361817, -7.410742, -7.478418, -7.561426, -7.631836, -7.752246, -7.83916, -7.932129, -8.034375, -8.062207, -8.108496, -8.152344, -8.117774, -8.078711, -8.052149, -7.96709, -7.902246, -7.85205, -7.777246, -7.750488, -7.686426, -7.634473, -7.659668, -7.646582, -7.648926, -7.654394, -7.634278, -7.667676, -7.689649, -7.694629, -7.745215, -7.763477, -7.751855, -7.776172, -7.780566, -7.80127, -7.844629, -7.851758, -7.87793, -7.91582, -7.932324, -7.986426, -7.997558, -7.982617, -7.980371, -7.921386, -7.842871, -7.74707, -7.649512, -7.575586, -7.511621, -7.435645, -7.41416, -7.390332, -7.402832, -7.453418, -7.513282, -7.612793, -7.713282, -7.768848, -7.866406, -7.986523, -8.02793, -8.119141, -8.15205, -8.163477, -8.208008, -8.197754, -8.203809, -8.217871, -8.151855, -8.106152, -8.081446, -7.994434 ], "sampleFreq": 64, "triggerType": 2, "version": 2 }, "result": { "code": 0, "msg": "", "detail": null, "errTimes": 0, "dropped": false } } }` rawData := &common_models.IotaData{} err := json.Unmarshal([]byte(rawDataMsg_vib), 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()) sinkThemeHandler := et_sink.NewSinkThemeHandler() nodeStageManage.AddStages(sinkThemeHandler.GetStage()) nodeStageManage.Run() log.Println("测试开始") nodeWorker.ConsumerProcess(rawData) time.Sleep(time.Second * 100) log.Println("测试结束") //商用最终数据 //{ // "sensor_name" : "5-ZDZ1", // "factor_name" : "梁体振动", // "factor_proto_code" : "5002", // "data" : { // "pv" : 1.53, // "trms" : 0.36, // "ppv" : 2.784 //}, // "factor_proto_name" : "振动加速度", // "factor" : 25, // "collect_time" : "2024-04-16T10:56:45.000Z", // "sensor" : 44017, // "structure" : 2069, // "iota_device" : [ //"0fc481cb-4299-42b5-ac7a-be556e2e8175" //], //"create_time" : "2024-04-16T09:51:36.132Z" //} } func TestNodeHandler_Cache_window2(t *testing.T) { rawDataMsg_WSD := `{ "userId": "77804162-837d-4ff9-96c0-beb8e8888f8e", "thingId": "5da9aa1b-05b7-4943-be57-dedb34f7a1bd", "dimensionId": "76c75371-bb9a-4f71-a25d-58adf7938296", "dimCapId": "f8e00449-7dad-4ca8-a4eb-0284784efa8f", "capId": "d2add1b3-b21c-420b-82a4-e0c55ee3a019", "deviceId": "ed0f1d94-49a9-415b-9336-f965a2b0a985", "scheduleId": "8c83fb77-48f3-493b-9311-1b6b7b4fa7a7", "taskId": "0e1c7d3d-257d-4763-a335-198aef0fc625", "jobId": 2, "jobRepeatId": 1, "triggerTime": "2024-04-08T11:01:48.001+08:00", "realTime": "2024-04-08T11:01:48.001+08:00", "finishTime": "2024-04-08T11:01:48.001+08:00", "seq": 0, "released": false, "data": { "type": 1, "data": { "humidy": 17.5, "Temp": 17.8 }, "result": { "code": 0, "msg": "", "detail": null, "errTimes": 1, "dropped": false } } }` rawDataMsg_WSD2 := `{ "userId": "77804162-837d-4ff9-96c0-beb8e8888f8e", "thingId": "5da9aa1b-05b7-4943-be57-dedb34f7a1bd", "dimensionId": "76c75371-bb9a-4f71-a25d-58adf7938296", "dimCapId": "f8e00449-7dad-4ca8-a4eb-0284784efa8f", "capId": "d2add1b3-b21c-420b-82a4-e0c55ee3a019", "deviceId": "ed0f1d94-49a9-415b-9336-f965a2b0a985", "scheduleId": "8c83fb77-48f3-493b-9311-1b6b7b4fa7a7", "taskId": "0e1c7d3d-257d-4763-a335-198aef0fc625", "jobId": 2, "jobRepeatId": 1, "triggerTime": "2024-04-08T11:02:00.001+08:00", "realTime": "2024-04-08T11:02:00.001+08:00", "finishTime": "2024-04-08T11:02:00.001+08:00", "seq": 0, "released": false, "data": { "type": 1, "data": { "humidy": 20.5, "Temp": 20.8 }, "result": { "code": 0, "msg": "", "detail": null, "errTimes": 1, "dropped": false } } }` rawData := &common_models.IotaData{} err := json.Unmarshal([]byte(rawDataMsg_WSD), rawData) if err != nil { log.Panicf("测试异常%s", err.Error()) } rawData2 := &common_models.IotaData{} err2 := json.Unmarshal([]byte(rawDataMsg_WSD2), rawData2) if err2 != 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()) nodeStageManage.Run() log.Println("测试开始") nodeWorker.ConsumerProcess(rawData) time.Sleep(time.Second * 1) nodeWorker.ConsumerProcess(rawData2) time.Sleep(time.Second * 100) log.Println("测试结束") } func TestStageMode(t *testing.T) { stageManager := stages.NewStageManager() nodeWorker := app.NewEtWorker() stageManager.AddSource(nodeWorker.LoadCh()) stage1 := stages.NewStage("加") stageManager.AddStages(*stage1) out := make(chan *common_models.ProcessData, 1) stageManager.AddOut(out) stageManager.Run() } func TestNodeHandler_Cache_window6(t *testing.T) { //温湿度测点2 rawDataMsg_WSD := `{ "userId": "77804162-837d-4ff9-96c0-beb8e8888f8e", "thingId": "5da9aa1b-05b7-4943-be57-dedb34f7a1bd", "dimensionId": "76c75371-bb9a-4f71-a25d-58adf7938296", "dimCapId": "f8e00449-7dad-4ca8-a4eb-0284784efa8f", "capId": "d2add1b3-b21c-420b-82a4-e0c55ee3a019", "deviceId": "fdbc2d0f-da70-4bdd-865e-6d26b677bbaf", "scheduleId": "8c83fb77-48f3-493b-9311-1b6b7b4fa7a7", "taskId": "0e1c7d3d-257d-4763-a335-198aef0fc625", "jobId": 2, "jobRepeatId": 1, "triggerTime": "2024-04-09T12:00:01.001+08:00", "realTime": "2024-04-09T12:00:01.001+08:00", "finishTime": "2024-04-09T12:00:01.001+08:00", "seq": 0, "released": false, "data": { "type": 1, "data": { "humidy": 50, "Temp": 17.0 }, "result": { "code": 0, "msg": "", "detail": null, "errTimes": 1, "dropped": false } } }` rawData := &common_models.IotaData{} err := json.Unmarshal([]byte(rawDataMsg_WSD), rawData) rawData.Data.Data["Temp"] = 17.0 if err != nil { log.Panicf("测试异常%s", err.Error()) } rawData2 := &common_models.IotaData{} err2 := json.Unmarshal([]byte(rawDataMsg_WSD), rawData2) rawData2.Data.Data["Temp"] = 19.0 rawData2.TriggerTime = rawData.TriggerTime.Add(time.Minute) if err2 != nil { log.Panicf("测试异常%s", err.Error()) } rawData3 := &common_models.IotaData{} err3 := json.Unmarshal([]byte(rawDataMsg_WSD), rawData3) rawData3.Data.Data["Temp"] = 21.0 rawData3.TriggerTime = rawData.TriggerTime.Add(time.Minute * 2) if err3 != nil { log.Panicf("测试异常%s", err.Error()) } rawData4 := &common_models.IotaData{} err4 := json.Unmarshal([]byte(rawDataMsg_WSD), rawData4) rawData4.Data.Data["Temp"] = 23.0 rawData4.TriggerTime = rawData.TriggerTime.Add(time.Minute * 3) if err4 != nil { log.Panicf("测试异常%s", err.Error()) } rawData5 := &common_models.IotaData{} err5 := json.Unmarshal([]byte(rawDataMsg_WSD), rawData5) rawData5.Data.Data["Temp"] = 10.0 rawData5.TriggerTime = rawData.TriggerTime.Add(time.Minute * 4) if err5 != nil { log.Panicf("测试异常%s", err.Error()) } rawData6 := &common_models.IotaData{} err6 := json.Unmarshal([]byte(rawDataMsg_WSD), rawData6) rawData6.Data.Data["Temp"] = 14.0 rawData6.TriggerTime = rawData.TriggerTime.Add(time.Minute * 5) if err6 != 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()) nodeStageManage.Run() log.Println("测试开始") nodeWorker.ConsumerProcess(rawData) nodeWorker.ConsumerProcess(rawData2) nodeWorker.ConsumerProcess(rawData3) nodeWorker.ConsumerProcess(rawData4) nodeWorker.ConsumerProcess(rawData5) nodeWorker.ConsumerProcess(rawData6) time.Sleep(time.Second * 100) log.Println("测试结束") } func TestTwoData(t *testing.T) { TestNodeHandler_Formula303(t) TestNodeHandler_Cache_window6(t) }