2017-08-03 10:08:34 +00:00
|
|
|
package communicate
|
|
|
|
|
|
|
|
import (
|
|
|
|
"bytes"
|
|
|
|
"encoding/json"
|
|
|
|
|
2017-08-04 02:32:31 +00:00
|
|
|
"git.loafle.net/overflow/overflow_probe/central/client/events"
|
|
|
|
"git.loafle.net/overflow/overflow_probe/discovery/discovery/types/timestamp"
|
2017-08-03 10:08:34 +00:00
|
|
|
"net/http"
|
|
|
|
"testing"
|
|
|
|
)
|
|
|
|
|
|
|
|
func TestEventCollector(t *testing.T) {
|
|
|
|
ev := events.Event{}
|
|
|
|
|
|
|
|
ev.EventType = "install"
|
|
|
|
ev.Time = timestamp.Now()
|
|
|
|
ev.Collector_id = "1111111"
|
|
|
|
ev.Data = events.CollectorInstallEvent{Version: "2.2"}
|
|
|
|
|
|
|
|
bb, _ := json.Marshal(ev)
|
|
|
|
|
|
|
|
//com := CompressTest(CompressDataGzip, UnCompressDataGzip, bb)
|
|
|
|
|
|
|
|
http.Post("http://localhost:9090/_api/collector/event/status/install", "application/json", bytes.NewBuffer(bb))
|
|
|
|
}
|