test
This commit is contained in:
snoop 2017-06-21 11:50:14 +09:00
parent 973877454a
commit 76b6082f1c
2 changed files with 33 additions and 1 deletions

View File

@ -21,6 +21,8 @@ import (
"git.loafle.net/overflow/overflow_proxy_service/proxy/sensorItemMapping"
"log"
"git.loafle.net/overflow/overflow_proxy_service/proxy/agent"
//"google.golang.org/grpc/metadata"
)
var g_services map[string]interface{}
@ -62,7 +64,7 @@ type ServiceImpl struct {
func (s *ServiceImpl) ExecServices(c context.Context, in *pb.ServiceInput) (*pb.ServiceOutput, error) {
// Check Service Name
serviceName, ok := g_services[in.ServiceName]
//metadata.FromContext(c)
log.Println("Service Name : " + in.ServiceName + " MethodName : " + in.MethodName)
if !ok {

View File

@ -12,6 +12,9 @@ import (
"bytes"
"io/ioutil"
"log"
"google.golang.org/grpc"
pb "git.loafle.net/overflow/overflow_api_service/grpc"
"golang.org/x/net/context"
)
func startRpcServerTest() <- chan error{
@ -86,4 +89,31 @@ func TestRpcServer(t *testing.T) {
log.Println( status)
os.Exit(1)
}
}
func TestRPC(t *testing.T) {
conn, err := grpc.Dial(":9090", grpc.WithInsecure());
if err != nil {
t.Log(err)
}
client := pb.NewOverflowGatewayClient(conn)
si := pb.ServiceInput{}
si.MethodName = "create"
si.ServiceName = "member"
si.Param = make(map[string]string)
si.Param["1"] = "2222"
so, err := client.ExecServices(context.Background(), &si)
t.Log(so.ResultStr)
}