diff --git a/proxy/sensorItemMapping/sensorItemMapping_test.go b/proxy/sensorItemMapping/sensorItemMapping_test.go index 9d6488b..4a95ae5 100644 --- a/proxy/sensorItemMapping/sensorItemMapping_test.go +++ b/proxy/sensorItemMapping/sensorItemMapping_test.go @@ -4,6 +4,9 @@ import ( "encoding/json" "git.loafle.net/overflow/overflow_proxy_service/proxy/sensor" "testing" + "fmt" + "sync" + "strconv" ) func TestSensorItemMappingService_List(t *testing.T) { @@ -15,3 +18,43 @@ func TestSensorItemMappingService_List(t *testing.T) { 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) +}