开源中国 2018 年度最后一场技术盛会邀你来约~错过就要等明年啦!点此立即预约

rushmore / zbus-goGoMIT

指数
0
Watch 5 Star 16 Fork 3
加入码云
与超过 300 万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
zbus Golang server and client 展开 收起

https://zbus.io

mq_test.go 1.16 KB
一键复制 编辑 Web IDE 原始数据 按行查看 历史
rushmore 提交于 2017-08-16 19:18 . zbus-go server & client init
package main
import (
"encoding/json"
"fmt"
"testing"
)
var mq, _ = NewMessageQueue("/tmp/diskq", "hong")
func TestNewMessageQueue(t *testing.T) {
q, err := NewMessageQueue("/tmp/diskq", "hong")
if err != nil {
t.Fail()
}
defer q.Close()
}
func TestMessageQueue_Write(t *testing.T) {
msg := NewMessage()
msg.SetCmd("produce")
msg.SetBodyString("hello world")
err := mq.Write(msg)
if err != nil {
t.Fail()
}
}
func TestMessageQueue_ConsumeGroup(t *testing.T) {
g := &ConsumeGroup{}
g.GroupName = "hong"
g.Mask = &[]int32{0}[0]
fmt.Println(g.Mask)
}
func TestLoadMqTable(t *testing.T) {
table, err := LoadMqTable("/tmp/diskq")
if err != nil {
t.Fail()
}
println(table)
}
func TestMessageQueue_DeclareGroup(t *testing.T) {
group := &ConsumeGroup{}
group.GroupName = "hongx"
info, err := mq.DeclareGroup(group)
if err != nil {
t.Fail()
}
fmt.Println(info)
}
func TestMessageQueue_TopicInfo(t *testing.T) {
info := mq.TopicInfo()
data, _ := json.MarshalIndent(info, "", " ")
println(string(data))
}
func TestMessageQueue_Destroy(t *testing.T) {
mq, _ := NewMessageQueue("/tmp/tempmq", "hong2")
err := mq.Destroy()
if err != nil {
t.Fail()
}
}

评论 ( 0 )

你可以在登录后,发表评论

搜索帮助