projects
/
platform
/
core
/
system
/
edge-orchestration.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
6f75e8c
)
Applied code review
author
jw_wonny.cha
<jw_wonny.cha@samsung.com>
Wed, 20 Mar 2019 06:18:35 +0000
(15:18 +0900)
committer
jw_wonny.cha
<jw_wonny.cha@samsung.com>
Wed, 20 Mar 2019 06:18:35 +0000
(15:18 +0900)
src/servicemgr/message_queue.go
patch
|
blob
|
history
src/servicemgr/service_agent.go
patch
|
blob
|
history
src/servicemgr/service_map.go
patch
|
blob
|
history
src/servicemgr/test/mq_test.go
patch
|
blob
|
history
src/servicemgr/test/service_id_test.go
patch
|
blob
|
history
diff --git
a/src/servicemgr/message_queue.go
b/src/servicemgr/message_queue.go
index
71a9306
..
2adb3cb
100644
(file)
--- a/
src/servicemgr/message_queue.go
+++ b/
src/servicemgr/message_queue.go
@@
-8,8
+8,8
@@
import (
z4 "github.com/alecthomas/gozmq"
)
z4 "github.com/alecthomas/gozmq"
)
-// Push is zmq push function
-func Push(serviceID uint64, msgChan chan MsgFormat, ctlChan chan bool) error {
+// Push
IpcZmq
is zmq push function
+func Push
IpcZmq
(serviceID uint64, msgChan chan MsgFormat, ctlChan chan bool) error {
ctx, err := z4.NewContext()
if err != nil {
log.Println(err.Error())
ctx, err := z4.NewContext()
if err != nil {
log.Println(err.Error())
@@
-47,8
+47,8
@@
func Push(serviceID uint64, msgChan chan MsgFormat, ctlChan chan bool) error {
}
}
}
}
-// Pull is zmq pull function
-func Pull(serviceID uint64, outputMsg chan MsgFormat, ctlChan chan bool) error {
+// Pull
IpcZmq
is zmq pull function
+func Pull
IpcZmq
(serviceID uint64, outputMsg chan MsgFormat, ctlChan chan bool) error {
ctx, err := z4.NewContext()
if err != nil {
log.Println(err.Error())
ctx, err := z4.NewContext()
if err != nil {
log.Println(err.Error())
diff --git
a/src/servicemgr/service_agent.go
b/src/servicemgr/service_agent.go
index
680d42c
..
415f7f6
100644
(file)
--- a/
src/servicemgr/service_agent.go
+++ b/
src/servicemgr/service_agent.go
@@
-27,7
+27,7
@@
func Create(serviceParam ServiceParam) []byte {
id, msgChan, ctlChan := CreateServiceMap(cmd, serviceParam.ServiceName, serviceParam.AppName)
log.Println("id : ", id)
id, msgChan, ctlChan := CreateServiceMap(cmd, serviceParam.ServiceName, serviceParam.AppName)
log.Println("id : ", id)
- go Push(id, msgChan, ctlChan)
+ go Push
IpcZmq
(id, msgChan, ctlChan)
serviceInfo := ServiceExecutionItem{id, makeTime()}
ret.ServiceList[index] = serviceInfo
serviceInfo := ServiceExecutionItem{id, makeTime()}
ret.ServiceList[index] = serviceInfo
diff --git
a/src/servicemgr/service_map.go
b/src/servicemgr/service_map.go
index
589cc8c
..
75c90a1
100644
(file)
--- a/
src/servicemgr/service_map.go
+++ b/
src/servicemgr/service_map.go
@@
-11,7
+11,7
@@
func CreateServiceMap(cmd *exec.Cmd, serviceName string, appName string) (uint64
msgChan := make(chan MsgFormat, IPCMsgChan)
ctlChan := make(chan bool)
msgChan := make(chan MsgFormat, IPCMsgChan)
ctlChan := make(chan bool)
- value := make(map[string]interface{}
, 5
)
+ value := make(map[string]interface{})
value[KeyAppName] = appName
value[KeyServiceName] = serviceName
value[KeyAppName] = appName
value[KeyServiceName] = serviceName
diff --git
a/src/servicemgr/test/mq_test.go
b/src/servicemgr/test/mq_test.go
index
9f10ed9
..
81e1716
100644
(file)
--- a/
src/servicemgr/test/mq_test.go
+++ b/
src/servicemgr/test/mq_test.go
@@
-15,7
+15,7
@@
func TestPushMsg(t *testing.T) {
msgChan := make(chan servicemgr.MsgFormat, servicemgr.IPCMsgChan)
ctlChan := make(chan bool, 1)
msgChan := make(chan servicemgr.MsgFormat, servicemgr.IPCMsgChan)
ctlChan := make(chan bool, 1)
- go servicemgr.Push(uint64(1), msgChan, ctlChan)
+ go servicemgr.Push
IpcZmq
(uint64(1), msgChan, ctlChan)
ctx, err := z4.NewContext()
if err != nil {
log.Println("Failed to create new context")
ctx, err := z4.NewContext()
if err != nil {
log.Println("Failed to create new context")
@@
-51,8
+51,8
@@
func TestPullMsg(t *testing.T) {
outputChan := make(chan servicemgr.MsgFormat, servicemgr.IPCMsgChan)
ctlPullChan := make(chan bool, 1)
outputChan := make(chan servicemgr.MsgFormat, servicemgr.IPCMsgChan)
ctlPullChan := make(chan bool, 1)
- go servicemgr.Pull(uint64(1), outputChan, ctlPullChan)
- go servicemgr.Push(uint64(1), msgChan, ctlPushChan)
+ go servicemgr.Pull
IpcZmq
(uint64(1), outputChan, ctlPullChan)
+ go servicemgr.Push
IpcZmq
(uint64(1), msgChan, ctlPushChan)
for index := 0; index < 20; index++ {
msgChan <- servicemgr.MsgFormat{Header: servicemgr.MsgHeader{Type: "Data"}, Body: strconv.Itoa(index)}
for index := 0; index < 20; index++ {
msgChan <- servicemgr.MsgFormat{Header: servicemgr.MsgHeader{Type: "Data"}, Body: strconv.Itoa(index)}
diff --git
a/src/servicemgr/test/service_id_test.go
b/src/servicemgr/test/service_id_test.go
index
cb5f044
..
3a05413
100644
(file)
--- a/
src/servicemgr/test/service_id_test.go
+++ b/
src/servicemgr/test/service_id_test.go
@@
-45,10
+45,15
@@
func TestReadServiceName(t *testing.T) {
servicemgr.InitServiceMap()
var cmd *exec.Cmd
servicemgr.InitServiceMap()
var cmd *exec.Cmd
- idx, _, _ := servicemgr.CreateServiceMap(cmd, serviceName, appName)
-
+ idx, _, _ := servicemgr.CreateServiceMap(cmd, serviceName
1
, appName)
+ t.Log(idx)
name, _ := servicemgr.GetServiceName(idx)
name, _ := servicemgr.GetServiceName(idx)
- AssertEqualStr(t, name, serviceName)
+ AssertEqualStr(t, serviceName1, serviceName1)
+
+ idx, _, _ = servicemgr.CreateServiceMap(cmd, serviceName2, appName)
+ t.Log(idx)
+ name, _ = servicemgr.GetServiceName(idx)
+ AssertEqualStr(t, name, serviceName2)
}
func TestRemoveServiceID(t *testing.T) {
}
func TestRemoveServiceID(t *testing.T) {