added read

This commit is contained in:
snoop 2017-06-26 14:59:41 +09:00
parent ae2569e9b8
commit 992ee6dd35
2 changed files with 38 additions and 18 deletions

View File

@ -64,6 +64,13 @@ func (as *ProbeService) GetList(d *domain.Domain) (string, error) {
return out, nil
}
func (as *ProbeService) GetModel() interface{} {
return &Probe{}
func (as *ProbeService) ReadByProbeKey(probeKey string) (string, error) {
out, err := utils.InvokeDBByModel("probe", "findByProbeKey", probeKey, utils.MODEL_STRING)
if err != nil {
return "", err
}
return out, nil
}

View File

@ -7,11 +7,10 @@ import (
"git.loafle.net/overflow/overflow_service/proxy/keystore"
"git.loafle.net/overflow/overflow_service/proxy/domain"
)
func TestSaveProbe(t *testing.T) {
ks := keystore.NewKeyStoreSerivce()
pks, _ := ks.CreateKey()
@ -25,19 +24,33 @@ func TestSaveProbe(t *testing.T) {
if err != nil {
t.Log(res)
}
}
//
//func TestListAgent(t *testing.T) {
// as := NewProbeService()
// m := member.Member{}
// m.Id = "1"
// if res, err := as.GetAgentList(&m); err != nil {
// t.Fatal(err)
// }else {
// t.Log(res)
// }
//
//}
func TestListProbe(t *testing.T) {
as := NewProbeService()
d := &domain.Domain{Id:"1"}
if res, err := as.GetList(d); err != nil {
t.Fatal(err)
}else {
t.Log(res)
}
}
func TestReadProbeKey(t *testing.T) {
as := NewProbeService()
res, err := as.ReadByProbeKey("61351f265a3311e798fe080027658d13")
if err != nil {
t.Fatal(err)
}
t.Log(res)
}