37 lines
574 B
Go
37 lines
574 B
Go
|
package event_sender
|
||
|
|
||
|
import (
|
||
|
"loafle.com/overflow/agent_api/observer"
|
||
|
"loafle.com/overflow/agent_api/observer/messages"
|
||
|
"log"
|
||
|
"testing"
|
||
|
"time"
|
||
|
)
|
||
|
|
||
|
func TestEventSender_Start(t *testing.T) {
|
||
|
|
||
|
es := &EventSender{}
|
||
|
es.Start()
|
||
|
testNotify()
|
||
|
|
||
|
time.Sleep(time.Second * 100)
|
||
|
|
||
|
}
|
||
|
|
||
|
func testNotify() {
|
||
|
//time.Sleep(time.Second * 5)
|
||
|
|
||
|
result := make(map[string]string)
|
||
|
result["ab"] = "123"
|
||
|
result["cd"] = "456"
|
||
|
result["ef"] = "789"
|
||
|
|
||
|
cd := &Data{
|
||
|
SensorId: "insanity",
|
||
|
Data: result,
|
||
|
}
|
||
|
|
||
|
log.Println("New data Notify")
|
||
|
observer.Notify(messages.QUEUE_EVENT, cd)
|
||
|
}
|