overflow_probe/event_sender/event_sender_test.go

51 lines
930 B
Go
Raw Normal View History

2017-08-04 02:32:31 +00:00
package event_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"
//"git.loafle.net/overflow/overflow_probe/agent_api/observer/messages"
2017-08-03 10:08:34 +00:00
"log"
"strconv"
"testing"
"time"
)
func TestEventSender_Start(t *testing.T) {
//observer.Notify("CONFIGMANAGER_LOADED", nil)
c := make(chan bool, 1)
err := Start(c)
<-c
if err != nil {
log.Println("err: ", err)
}
time.Sleep(time.Second * 5)
testNotify()
time.Sleep(time.Second * 5)
}
func testNotify() {
//time.Sleep(time.Second * 5)
//es := GetInstance()
for i := 0; i < 20; i++ {
result := make(map[string]string)
result["ab"] = "123 ( " + strconv.Itoa(i) + ")"
result["cd"] = "456 ( " + strconv.Itoa(i) + ")"
result["ef"] = "789 ( " + strconv.Itoa(i) + ")"
cd := &Data{
SensorId: "insanity",
Data: result,
}
AddEventData(cd)
//observer.Notify(messages.QUEUE_EVENT, cd)
}
log.Println("New data Notify")
}