This commit is contained in:
geek 2017-05-16 15:29:43 +09:00
parent 624e73c186
commit 0df5921614
2 changed files with 13 additions and 6 deletions

View File

@ -3,7 +3,7 @@ package event_sender_go
import (
"context"
"google.golang.org/grpc"
"loafle.com/overflow/agent_api/observer/messages"
//"loafle.com/overflow/agent_api/observer/messages"
pb "loafle.com/overflow/crawler_go/grpc"
q "loafle.com/overflow/queue_go"
"log"
@ -76,6 +76,7 @@ func Start(ch chan bool) (err error) {
func Stop() (err error) {
es := GetInstance()
es.stop()
return nil
}
func AddEventData(event interface{}) {
es := GetInstance()

View File

@ -1,8 +1,8 @@
package event_sender_go
import (
"loafle.com/overflow/agent_api/observer"
"loafle.com/overflow/agent_api/observer/messages"
//"loafle.com/overflow/agent_api/observer"
//"loafle.com/overflow/agent_api/observer/messages"
"log"
"strconv"
"testing"
@ -11,8 +11,13 @@ import (
func TestEventSender_Start(t *testing.T) {
observer.Notify("CONFIGMANAGER_LOADED", nil)
//observer.Notify("CONFIGMANAGER_LOADED", nil)
c := make(chan bool)
err := Start(c)
if err != nil {
log.Println("err: ", err)
}
time.Sleep(time.Second * 5)
testNotify()
@ -23,6 +28,7 @@ func TestEventSender_Start(t *testing.T) {
func testNotify() {
//time.Sleep(time.Second * 5)
//es := GetInstance()
for i := 0; i < 20; i++ {
result := make(map[string]string)
@ -34,8 +40,8 @@ func testNotify() {
SensorId: "insanity",
Data: result,
}
observer.Notify(messages.QUEUE_EVENT, cd)
AddEventData(cd)
//observer.Notify(messages.QUEUE_EVENT, cd)
}
log.Println("New data Notify")
}