event_sender_go/event_sender_test.go
2017-05-16 15:52:20 +09:00

51 lines
895 B
Go

package event_sender_go
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)
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")
}