added
error case
This commit is contained in:
parent
96cda61428
commit
d1a698d5b0
@ -4,6 +4,9 @@ import (
|
|||||||
"encoding/json"
|
"encoding/json"
|
||||||
"git.loafle.net/overflow/overflow_proxy_service/proxy/sensor"
|
"git.loafle.net/overflow/overflow_proxy_service/proxy/sensor"
|
||||||
"testing"
|
"testing"
|
||||||
|
"fmt"
|
||||||
|
"sync"
|
||||||
|
"strconv"
|
||||||
)
|
)
|
||||||
|
|
||||||
func TestSensorItemMappingService_List(t *testing.T) {
|
func TestSensorItemMappingService_List(t *testing.T) {
|
||||||
@ -15,3 +18,43 @@ func TestSensorItemMappingService_List(t *testing.T) {
|
|||||||
|
|
||||||
t.Log(res)
|
t.Log(res)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
func TestSensorItemMappingService_List_GoRutine(t *testing.T) {
|
||||||
|
//s := &sensor.Sensor{}
|
||||||
|
//s.Id = json.Number("14")
|
||||||
|
|
||||||
|
sims := NewSensorItemMappingService()
|
||||||
|
|
||||||
|
il := make([]int, 0)
|
||||||
|
|
||||||
|
il = append(il, 1)
|
||||||
|
il = append(il, 2)
|
||||||
|
il = append(il, 3)
|
||||||
|
il = append(il, 13)
|
||||||
|
il = append(il, 14)
|
||||||
|
|
||||||
|
for _, ii := range il {
|
||||||
|
|
||||||
|
|
||||||
|
go func(i int) {
|
||||||
|
s := &sensor.Sensor{}
|
||||||
|
s.Id = json.Number(strconv.Itoa(ii))
|
||||||
|
res, _ := sims.List(s)
|
||||||
|
fmt.Print(res)
|
||||||
|
}(ii)
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
wg := sync.WaitGroup{}
|
||||||
|
|
||||||
|
wg.Add(1)
|
||||||
|
|
||||||
|
|
||||||
|
wg.Wait()
|
||||||
|
|
||||||
|
//res, _ := sims.List(s)
|
||||||
|
//
|
||||||
|
//t.Log(res)
|
||||||
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user