github.com/turingchain2020/turingchain@v1.1.21/client/mock_execs_test.go (about) 1 // Copyright Turing Corp. 2018 All Rights Reserved. 2 // Use of this source code is governed by a BSD-style 3 // license that can be found in the LICENSE file. 4 5 package client_test 6 7 import ( 8 "github.com/turingchain2020/turingchain/queue" 9 "github.com/turingchain2020/turingchain/types" 10 ) 11 12 type mockExecs struct { 13 } 14 15 func (m *mockExecs) SetQueueClient(q queue.Queue) { 16 go func() { 17 topic := "execs" 18 client := q.Client() 19 client.Sub(topic) 20 for msg := range client.Recv() { 21 switch msg.Ty { 22 case types.EventBlockChainQuery: 23 msg.Reply(client.NewMessage(topic, types.EventBlockChainQuery, &types.Reply{})) 24 default: 25 msg.ReplyErr("Do not support", types.ErrNotSupport) 26 } 27 } 28 }() 29 } 30 31 func (m *mockExecs) Close() { 32 }