|
@@ -26,6 +26,10 @@ type tester struct {
|
|
|
handServ *mock_hand_serve.MockHandlerServe
|
|
handServ *mock_hand_serve.MockHandlerServe
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+const (
|
|
|
|
|
+ test_uuid = "test_uuid"
|
|
|
|
|
+)
|
|
|
|
|
+
|
|
|
var (
|
|
var (
|
|
|
qNameSub = defs.NewTopic("topic_sub")
|
|
qNameSub = defs.NewTopic("topic_sub")
|
|
|
qNameServ = defs.NewTopic("topic_serv")
|
|
qNameServ = defs.NewTopic("topic_serv")
|
|
@@ -64,7 +68,7 @@ func (sf *tester) unsubGood2() {
|
|
|
}
|
|
}
|
|
|
req := &msg_unsub.UnsubReq{
|
|
req := &msg_unsub.UnsubReq{
|
|
|
Name_: sf.handSub.Name_,
|
|
Name_: sf.handSub.Name_,
|
|
|
- Uuid_: "test_uuid",
|
|
|
|
|
|
|
+ Uuid_: test_uuid,
|
|
|
}
|
|
}
|
|
|
binReq, _ := json.MarshalIndent(req, "", " ")
|
|
binReq, _ := json.MarshalIndent(req, "", " ")
|
|
|
body := strings.NewReader(string(binReq))
|
|
body := strings.NewReader(string(binReq))
|
|
@@ -135,7 +139,7 @@ func (sf *tester) unsubGood1() {
|
|
|
}
|
|
}
|
|
|
req := &msg_unsub.UnsubReq{
|
|
req := &msg_unsub.UnsubReq{
|
|
|
Name_: sf.handSub.Name_,
|
|
Name_: sf.handSub.Name_,
|
|
|
- Uuid_: "test_uuid",
|
|
|
|
|
|
|
+ Uuid_: test_uuid,
|
|
|
}
|
|
}
|
|
|
resp := Bus_.processUnsubRequest(req)
|
|
resp := Bus_.processUnsubRequest(req)
|
|
|
if resp.Status_ != "ok" {
|
|
if resp.Status_ != "ok" {
|
|
@@ -154,7 +158,7 @@ func (sf *tester) unsubBad2() {
|
|
|
}
|
|
}
|
|
|
req := &msg_unsub.UnsubReq{
|
|
req := &msg_unsub.UnsubReq{
|
|
|
Name_: sf.handSub.Name_,
|
|
Name_: sf.handSub.Name_,
|
|
|
- Uuid_: "test_uuid",
|
|
|
|
|
|
|
+ Uuid_: test_uuid,
|
|
|
}
|
|
}
|
|
|
resp := Bus_.processUnsubRequest(req)
|
|
resp := Bus_.processUnsubRequest(req)
|
|
|
if resp.Status_ == "ok" {
|
|
if resp.Status_ == "ok" {
|
|
@@ -188,7 +192,7 @@ func (sf *tester) pubGood2() {
|
|
|
sf.t.Log("pubGood2")
|
|
sf.t.Log("pubGood2")
|
|
|
req := &msg_pub.PublishReq{
|
|
req := &msg_pub.PublishReq{
|
|
|
Topic_: qNameSub,
|
|
Topic_: qNameSub,
|
|
|
- Uuid_: "test_uuid",
|
|
|
|
|
|
|
+ Uuid_: test_uuid,
|
|
|
BinMsg_: []byte("http_pub"),
|
|
BinMsg_: []byte("http_pub"),
|
|
|
}
|
|
}
|
|
|
binReq, _ := json.MarshalIndent(req, "", " ")
|
|
binReq, _ := json.MarshalIndent(req, "", " ")
|
|
@@ -254,7 +258,7 @@ func (sf *tester) pubBad2() {
|
|
|
|
|
|
|
|
req := &msg_pub.PublishReq{
|
|
req := &msg_pub.PublishReq{
|
|
|
Topic_: qNameSub,
|
|
Topic_: qNameSub,
|
|
|
- Uuid_: "test_uuid",
|
|
|
|
|
|
|
+ Uuid_: test_uuid,
|
|
|
BinMsg_: []byte("test_pub"),
|
|
BinMsg_: []byte("test_pub"),
|
|
|
}
|
|
}
|
|
|
resp := Bus_.processPublish(req)
|
|
resp := Bus_.processPublish(req)
|
|
@@ -272,7 +276,7 @@ func (sf *tester) pubGood1() {
|
|
|
}
|
|
}
|
|
|
req := &msg_pub.PublishReq{
|
|
req := &msg_pub.PublishReq{
|
|
|
Topic_: qNameSub,
|
|
Topic_: qNameSub,
|
|
|
- Uuid_: "test_uuid",
|
|
|
|
|
|
|
+ Uuid_: test_uuid,
|
|
|
BinMsg_: []byte("test_pub"),
|
|
BinMsg_: []byte("test_pub"),
|
|
|
}
|
|
}
|
|
|
_ = Bus_.processPublish(req)
|
|
_ = Bus_.processPublish(req)
|
|
@@ -316,7 +320,7 @@ func (sf *tester) subGood2() {
|
|
|
sf.t.Log("subGood2")
|
|
sf.t.Log("subGood2")
|
|
|
req := &msg_sub.SubscribeReq{
|
|
req := &msg_sub.SubscribeReq{
|
|
|
Topic_: qNameServ,
|
|
Topic_: qNameServ,
|
|
|
- Uuid_: "test_uuid",
|
|
|
|
|
|
|
+ Uuid_: test_uuid,
|
|
|
WebHook_: "http://localhost:18200/bus/pub/",
|
|
WebHook_: "http://localhost:18200/bus/pub/",
|
|
|
}
|
|
}
|
|
|
binReq, _ := json.MarshalIndent(req, "", " ")
|
|
binReq, _ := json.MarshalIndent(req, "", " ")
|
|
@@ -354,7 +358,7 @@ func (sf *tester) subBad3() {
|
|
|
sf.t.Log("subBad3")
|
|
sf.t.Log("subBad3")
|
|
|
req := &msg_sub.SubscribeReq{
|
|
req := &msg_sub.SubscribeReq{
|
|
|
Topic_: qNameServ,
|
|
Topic_: qNameServ,
|
|
|
- Uuid_: "test_uuid",
|
|
|
|
|
|
|
+ Uuid_: test_uuid,
|
|
|
WebHook_: "http://localhost:18200/bus/pub/",
|
|
WebHook_: "http://localhost:18200/bus/pub/",
|
|
|
}
|
|
}
|
|
|
defer func() {
|
|
defer func() {
|
|
@@ -376,7 +380,7 @@ func (sf *tester) subGood1() {
|
|
|
sf.t.Log("subGood1")
|
|
sf.t.Log("subGood1")
|
|
|
req := &msg_sub.SubscribeReq{
|
|
req := &msg_sub.SubscribeReq{
|
|
|
Topic_: qNameServ,
|
|
Topic_: qNameServ,
|
|
|
- Uuid_: "test_uuid",
|
|
|
|
|
|
|
+ Uuid_: test_uuid,
|
|
|
WebHook_: "http://localhost:18200/bus/",
|
|
WebHook_: "http://localhost:18200/bus/",
|
|
|
}
|
|
}
|
|
|
defer func() {
|
|
defer func() {
|
|
@@ -447,7 +451,7 @@ func (sf *tester) reqBad4() {
|
|
|
defer sf.handServ.IsBad_.Reset()
|
|
defer sf.handServ.IsBad_.Reset()
|
|
|
req := &msg_serve.ServeReq{
|
|
req := &msg_serve.ServeReq{
|
|
|
Topic_: sf.handServ.Topic_,
|
|
Topic_: sf.handServ.Topic_,
|
|
|
- Uuid_: "test_uuid",
|
|
|
|
|
|
|
+ Uuid_: test_uuid,
|
|
|
BinReq_: []byte("test_msg"),
|
|
BinReq_: []byte("test_msg"),
|
|
|
}
|
|
}
|
|
|
binReq, _ := json.MarshalIndent(req, "", " ")
|
|
binReq, _ := json.MarshalIndent(req, "", " ")
|
|
@@ -484,7 +488,7 @@ func (sf *tester) reqGood1() {
|
|
|
sf.t.Log("reqGood1")
|
|
sf.t.Log("reqGood1")
|
|
|
req := &msg_serve.ServeReq{
|
|
req := &msg_serve.ServeReq{
|
|
|
Topic_: sf.handServ.Topic_,
|
|
Topic_: sf.handServ.Topic_,
|
|
|
- Uuid_: "test_uuid",
|
|
|
|
|
|
|
+ Uuid_: test_uuid,
|
|
|
BinReq_: []byte("test_msg"),
|
|
BinReq_: []byte("test_msg"),
|
|
|
}
|
|
}
|
|
|
binReq, _ := json.MarshalIndent(req, "", " ")
|
|
binReq, _ := json.MarshalIndent(req, "", " ")
|
|
@@ -526,7 +530,7 @@ func (sf *tester) reqBad3() {
|
|
|
sf.t.Log("reqBad3")
|
|
sf.t.Log("reqBad3")
|
|
|
req := &msg_serve.ServeReq{
|
|
req := &msg_serve.ServeReq{
|
|
|
Topic_: qNameBad,
|
|
Topic_: qNameBad,
|
|
|
- Uuid_: "test_uuid",
|
|
|
|
|
|
|
+ Uuid_: test_uuid,
|
|
|
BinReq_: []byte("test_msg"),
|
|
BinReq_: []byte("test_msg"),
|
|
|
}
|
|
}
|
|
|
binReq, _ := json.MarshalIndent(req, "", " ")
|
|
binReq, _ := json.MarshalIndent(req, "", " ")
|