event_sender_go/event_sender_test.go
2017-04-28 12:37:33 +09:00

42 lines
748 B
Go

package event_sender
import (
"loafle.com/overflow/agent_api/observer"
"loafle.com/overflow/agent_api/observer/messages"
"log"
"strconv"
"testing"
"time"
)
func TestEventSender_Start(t *testing.T) {
observer.Notify("CONFIGMANAGER_LOADED", nil)
time.Sleep(time.Second * 5)
testNotify()
time.Sleep(time.Second * 100)
}
func testNotify() {
//time.Sleep(time.Second * 5)
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,
}
observer.Notify(messages.QUEUE_EVENT, cd)
}
log.Println("New data Notify")
}