From 0df5921614817c03723829e7bf2be7cd40a1d6c0 Mon Sep 17 00:00:00 2001 From: geek Date: Tue, 16 May 2017 15:29:43 +0900 Subject: [PATCH] sd --- event_sender.go | 3 ++- event_sender_test.go | 16 +++++++++++----- 2 files changed, 13 insertions(+), 6 deletions(-) diff --git a/event_sender.go b/event_sender.go index 5c77736..b54112a 100644 --- a/event_sender.go +++ b/event_sender.go @@ -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() diff --git a/event_sender_test.go b/event_sender_test.go index 8fa0da0..4ee3d04 100644 --- a/event_sender_test.go +++ b/event_sender_test.go @@ -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") }