event test

This commit is contained in:
geek 2017-04-28 11:12:20 +09:00
parent fffeb2ff41
commit 3ec98f796b

View File

@ -4,9 +4,9 @@ import (
"loafle.com/overflow/agent_api/observer" "loafle.com/overflow/agent_api/observer"
"loafle.com/overflow/agent_api/observer/messages" "loafle.com/overflow/agent_api/observer/messages"
"log" "log"
"strconv"
"testing" "testing"
"time" "time"
"strconv"
) )
func TestEventSender_Start(t *testing.T) { func TestEventSender_Start(t *testing.T) {
@ -22,18 +22,18 @@ func TestEventSender_Start(t *testing.T) {
func testNotify() { func testNotify() {
//time.Sleep(time.Second * 5) //time.Sleep(time.Second * 5)
for i := 0; i < 20; i ++{ for i := 0; i < 20; i++ {
result := make(map[string]string) result := make(map[string]string)
result["ab"] = "123 ( " + strconv.Itoa(i) + ")" result["ab"] = "123 ( " + strconv.Itoa(i) + ")"
result["cd"] = "456 ( "+ strconv.Itoa(i) + ")" result["cd"] = "456 ( " + strconv.Itoa(i) + ")"
result["ef"] = "789 ( "+ strconv.Itoa(i) + ")" result["ef"] = "789 ( " + strconv.Itoa(i) + ")"
cd := &Data{ cd := &Data{
SensorId: "insanity", SensorId: "insanity",
Data: result, Data: result,
} }
observer.Notify(messages.QUEUE_EVENT, cd) observer.Notify(messages.QUEUE_EVENT, cd)
} }
log.Println("New data Notify") log.Println("New data Notify")
} }