2018-04-25 09:35:38 +00:00
|
|
|
package central_api
|
2018-04-06 10:16:19 +00:00
|
|
|
|
2018-05-11 11:53:50 +00:00
|
|
|
// import (
|
|
|
|
// "io/ioutil"
|
|
|
|
// "testing"
|
2018-04-25 09:35:38 +00:00
|
|
|
|
2018-05-11 11:53:50 +00:00
|
|
|
// "golang.org/x/net/context"
|
|
|
|
// "google.golang.org/grpc"
|
|
|
|
// )
|
2018-04-06 10:16:19 +00:00
|
|
|
|
2018-05-11 11:53:50 +00:00
|
|
|
// func TestTarDis_saveAllTarget(t *testing.T) {
|
2018-04-06 10:16:19 +00:00
|
|
|
|
2018-05-11 11:53:50 +00:00
|
|
|
// contents, _ := ioutil.ReadFile("../dh.json")
|
2018-04-06 10:16:19 +00:00
|
|
|
|
2018-05-11 11:53:50 +00:00
|
|
|
// si := &ServerInput{}
|
2018-04-06 10:16:19 +00:00
|
|
|
|
2018-05-11 11:53:50 +00:00
|
|
|
// si.Target = "TargetDiscoveryService"
|
|
|
|
// si.Method = "saveAllTarget"
|
2018-04-06 10:16:19 +00:00
|
|
|
|
2018-05-11 11:53:50 +00:00
|
|
|
// si.Params = append(si.Params, string(contents))
|
|
|
|
// si.Params = append(si.Params, "{\"id\":1}")
|
2018-04-06 10:16:19 +00:00
|
|
|
|
2018-05-11 11:53:50 +00:00
|
|
|
// callRPC(t, si)
|
2018-04-06 10:16:19 +00:00
|
|
|
|
2018-05-11 11:53:50 +00:00
|
|
|
// }
|
2018-04-06 10:16:19 +00:00
|
|
|
|
2018-05-11 11:53:50 +00:00
|
|
|
// func TestRPCNP_readAllByDomain(t *testing.T) {
|
2018-04-06 10:16:19 +00:00
|
|
|
|
2018-05-11 11:53:50 +00:00
|
|
|
// si := &ServerInput{}
|
2018-04-06 10:16:19 +00:00
|
|
|
|
2018-05-11 11:53:50 +00:00
|
|
|
// si.Target = "NoAuthProbeService"
|
|
|
|
// si.Method = "readAllByDomain"
|
2018-04-06 10:16:19 +00:00
|
|
|
|
2018-05-11 11:53:50 +00:00
|
|
|
// //sp := &ServerParam{}
|
|
|
|
// //sp.IsCollection = false
|
|
|
|
// //sp.Type = "com.loafle.overflow.module.domain.model.Domain"
|
|
|
|
// //sp.Data = "{\"id\":1}"
|
|
|
|
// si.Params = append(si.Params, "{\"id\":1}")
|
2018-04-06 10:16:19 +00:00
|
|
|
|
2018-05-11 11:53:50 +00:00
|
|
|
// callRPC(t, si)
|
|
|
|
// }
|
2018-04-06 10:16:19 +00:00
|
|
|
|
2018-05-11 11:53:50 +00:00
|
|
|
// func callRPC(t *testing.T, si *ServerInput) {
|
2018-04-06 10:16:19 +00:00
|
|
|
|
2018-05-11 11:53:50 +00:00
|
|
|
// conn, err := grpc.Dial(":50006", grpc.WithInsecure())
|
2018-04-06 10:16:19 +00:00
|
|
|
|
2018-05-11 11:53:50 +00:00
|
|
|
// if err != nil {
|
|
|
|
// t.Log(err)
|
|
|
|
// }
|
2018-04-06 10:16:19 +00:00
|
|
|
|
2018-05-11 11:53:50 +00:00
|
|
|
// client := NewOverflowApiServerClient(conn)
|
2018-04-06 10:16:19 +00:00
|
|
|
|
2018-05-11 11:53:50 +00:00
|
|
|
// out, err := client.Exec(context.Background(), si)
|
|
|
|
// if err != nil {
|
|
|
|
// t.Fatal(err)
|
|
|
|
// }
|
2018-04-06 10:16:19 +00:00
|
|
|
|
2018-05-11 11:53:50 +00:00
|
|
|
// t.Log(out)
|
2018-04-06 10:16:19 +00:00
|
|
|
|
2018-05-11 11:53:50 +00:00
|
|
|
// }
|