2017-08-04 02:32:31 +00:00
|
|
|
package data_sender
|
2017-08-03 10:08:34 +00:00
|
|
|
|
|
|
|
import (
|
2017-08-04 02:32:31 +00:00
|
|
|
"git.loafle.net/overflow/overflow_probe/agent_api/observer"
|
2017-08-03 10:08:34 +00:00
|
|
|
"strconv"
|
|
|
|
"testing"
|
|
|
|
"time"
|
|
|
|
)
|
|
|
|
|
|
|
|
type Result struct {
|
|
|
|
Data []byte
|
|
|
|
}
|
|
|
|
|
|
|
|
func TestTotal(t *testing.T) {
|
|
|
|
|
|
|
|
time.Sleep(time.Second * 5)
|
|
|
|
|
|
|
|
observer.Notify("CONFIGMANAGER_LOADED", nil)
|
|
|
|
|
|
|
|
time.Sleep(time.Second * 5)
|
|
|
|
|
|
|
|
for i := 0; i < 20; i++ {
|
2017-08-04 03:08:17 +00:00
|
|
|
//testNotify(strconv.Itoa(i))
|
2017-08-03 10:08:34 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
time.Sleep(time.Second * 12)
|
|
|
|
for i := 20; i < 30; i++ {
|
2017-08-04 03:08:17 +00:00
|
|
|
//testNotify(strconv.Itoa(i))
|
2017-08-03 10:08:34 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
time.Sleep(time.Second * 100)
|
|
|
|
}
|
|
|
|
|
2017-08-04 03:02:50 +00:00
|
|
|
//func TestSend(t *testing.T) {
|
|
|
|
//
|
|
|
|
// ds := &DataSender{}
|
|
|
|
// ds.start()
|
|
|
|
//
|
|
|
|
// for i := 0; i < 20; i++ {
|
|
|
|
// testNotify(strconv.Itoa(i))
|
|
|
|
// }
|
|
|
|
//
|
|
|
|
// time.Sleep(time.Second * 12)
|
|
|
|
// for i := 20; i < 30; i++ {
|
|
|
|
// testNotify(strconv.Itoa(i))
|
|
|
|
// }
|
|
|
|
//
|
|
|
|
// time.Sleep(time.Second * 100)
|
|
|
|
//}
|
|
|
|
//
|
|
|
|
//func testNotify(val string) {
|
|
|
|
//
|
|
|
|
// result := make(map[string]string)
|
|
|
|
// result["a"] = val
|
|
|
|
// result["b"] = val
|
|
|
|
// result["c"] = val
|
|
|
|
//
|
|
|
|
// cd := &Data{
|
|
|
|
// SensorId: "insanity",
|
|
|
|
// Data: result,
|
|
|
|
// }
|
|
|
|
//
|
|
|
|
// observer.Notify(messages.QUEUE_DATA, cd)
|
|
|
|
//}
|