| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061 |
- package service
- //func TestDeviceStatistics_GetDeviceStatistics(t *testing.T) {
- // type fields struct {
- // BaseModel BaseModel
- // BaseEquipment int
- // LaboratoryEquipment int
- // UseTime float64
- // ExperimentalData int
- // }
- // type args struct {
- // ctx context.Context
- // req *BaseModel
- // }
- // base := new(DeviceStatistics)
- // arg := args{
- // ctx: context.TODO(),
- // req: &BaseModel{LaboratoryId: 1},
- // }
- // tests := []struct {
- // name string
- // fields *DeviceStatistics
- // args args
- // want *DeviceStatistics
- // wantErr bool
- // }{
- // {"读取实验数据测试1", base, arg, nil, false},
- // }
- // for _, tt := range tests {
- // t.Run(tt.name, func(t *testing.T) {
- // d := &DeviceStatistics{
- // BaseModel: tt.fields.BaseModel,
- // BaseEquipment: tt.fields.BaseEquipment,
- // LaboratoryEquipment: tt.fields.LaboratoryEquipment,
- // UseTime: tt.fields.UseTime,
- // ExperimentalData: tt.fields.ExperimentalData,
- // }
- // got, err := d.GetDeviceStatistics(tt.args.ctx, tt.args.req)
- // if (err != nil) != tt.wantErr {
- // t.Errorf("GetDeviceStatistics() error = %v, wantErr %v", err, tt.wantErr)
- // return
- // }
- // if !reflect.DeepEqual(got, tt.want) {
- // t.Errorf("GetDeviceStatistics() got = %v, want %v", got, tt.want)
- // }
- // })
- // }
- //}
- //func Test_Open(t *testing.T) {
- // var producer *nsq.Producer
- // cfg := nsq.NewConfig()
- // nsqdtcpaddr := "47.92.249.239:9150"
- // //nsqdtcpaddr := "127.0.0.1:4150"
- // producer, _ = nsq.NewProducer(nsqdtcpaddr, cfg)
- // now := gtime.Now().String()
- // //data := `{"operation_type":"1","sign_type":"1","mac":"33343538","device_type":"2","upload_time":"`+now+`","tenant":"CU7zm9WhZm","data":{"socket":"01","socket_hole":"01","uuid":"1394819d","operate":"01"}}`
- // data := `{"operation_type":"1","sign_type":"1","tenant":"vojPzh3Ct9","mac":"1181","device_type":"","upload_time":"`+now+`","uuid":"uuid","data":{"socket":"30303030","socket_hole":"01","uuid":"ab077b7b","operate":"01","last_time":""}}`
- // //data := `{"operation_type":"1","sign_type":"2","tenant":"CU7zm9WhZm","mac":"33343538","device_type":"2","ad_time":"`+now+`","data":{"socket":"01","socket_hole":"01","uuid":"ab077b7b","operate":"01"}}`
- // producer.Publish("socket02_cmd", []byte(data))
- //}
|