changed parameter

This commit is contained in:
snoop 2017-04-27 20:21:49 +09:00
parent 0c46f6e24b
commit 4d29ba87f4
2 changed files with 12 additions and 6 deletions

View File

@ -10,10 +10,10 @@ type ConfigServerImpl struct {
Crawlers map[string]crawler.Crawler
}
func (s *ConfigServerImpl) Add(c context.Context, in *pb.Input) (*pb.Output, error) {
func (s *ConfigServerImpl) Add(c context.Context, in *pb.InputAdd) (*pb.Output, error) {
output := &pb.Output{}
if c, ok := s.Crawlers[in.Name.String()]; ok {
rd, err := c.Add(in.Id)
rd, err := c.Add(in.Data)
if err != nil {
// process error
}
@ -41,7 +41,7 @@ func (s *ConfigServerImpl) Init(c context.Context, inputArray *pb.InputArray) (*
for _,in := range inputArray.In {
if c, ok := s.Crawlers[in.Name.String()]; ok {
rd, err := c.Init(in.Path)
rd, err := c.Init(in.Data)
if err != nil {
// process error
}

View File

@ -11,15 +11,17 @@ import (
"testing"
"time"
"loafle.com/overflow/crawler_go/health_crawler/redis_protocol_crawler_go"
"loafle.com/overflow/crawler_go/config"
config "loafle.com/overflow/agent_api/config_manager"
"loafle.com/overflow/rpc_network_crawler_go/impl"
)
type call func() crawler.Crawler
func startRPCServerTest(cc call) {
initCrawlers()
rr := cc()
AddDelegate(pb.Crawlers_HEALTH_REDIS.String(), rr)
go start(&ConfigServerImpl{}, &DataServerImpl{},&StatusServerImpl{})
go start(&impl.ConfigServerImpl{Crawlers : g_crawlers}, &impl.DataServerImpl{Crawlers : g_crawlers},&impl.StatusServerImpl{})
}
func clientCall(t *testing.T, cl pb.Crawlers) {
@ -47,6 +49,9 @@ func clientCall(t *testing.T, cl pb.Crawlers) {
}
func TestRedisGRPC(t *testing.T) {
go startRPCServerTest(func() crawler.Crawler {
rr := redis_protocol_crawler_go.NewRedisHeahthCrawler()
//m := make(map[string]interface{}, 0)
@ -58,11 +63,12 @@ func TestRedisGRPC(t *testing.T) {
m := config.Config{}
m.Target = config.Target{}
m.Target.Connection = config.Connection{}
m.Target.Connection.Ip = "192.168.1.104"
m.Target.Connection.Ip = "192.168.1.215"
m.Target.Connection.Port = "6379"
m.Target.Connection.PortType = "tcp"
m.Target.Connection.SSL = false
rr.PutConfig("test_redis_sid", m)
return rr
})
clientCall(t, pb.Crawlers_HEALTH_REDIS)