github.com/kchristidis/fabric@v1.0.4-0.20171028114726-837acd08cde1/gossip/state/mocks/gossip.go (about)

     1  /*
     2  Copyright IBM Corp. 2017 All Rights Reserved.
     3  
     4  Licensed under the Apache License, Version 2.0 (the "License");
     5  you may not use this file except in compliance with the License.
     6  You may obtain a copy of the License at
     7  
     8  		 http://www.apache.org/licenses/LICENSE-2.0
     9  
    10  Unless required by applicable law or agreed to in writing, software
    11  distributed under the License is distributed on an "AS IS" BASIS,
    12  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    13  See the License for the specific language governing permissions and
    14  limitations under the License.
    15  */
    16  
    17  package mocks
    18  
    19  import (
    20  	"github.com/hyperledger/fabric/gossip/api"
    21  	"github.com/hyperledger/fabric/gossip/comm"
    22  	"github.com/hyperledger/fabric/gossip/common"
    23  	"github.com/hyperledger/fabric/gossip/discovery"
    24  	proto "github.com/hyperledger/fabric/protos/gossip"
    25  	"github.com/stretchr/testify/mock"
    26  )
    27  
    28  type GossipMock struct {
    29  	mock.Mock
    30  }
    31  
    32  func (*GossipMock) SuspectPeers(s api.PeerSuspector) {
    33  	panic("implement me")
    34  }
    35  
    36  func (g *GossipMock) Send(msg *proto.GossipMessage, peers ...*comm.RemotePeer) {
    37  	g.Called(msg, peers)
    38  }
    39  
    40  func (*GossipMock) Peers() []discovery.NetworkMember {
    41  	panic("implement me")
    42  }
    43  
    44  func (g *GossipMock) PeersOfChannel(chainID common.ChainID) []discovery.NetworkMember {
    45  	args := g.Called(chainID)
    46  	return args.Get(0).([]discovery.NetworkMember)
    47  }
    48  
    49  func (*GossipMock) UpdateMetadata(metadata []byte) {
    50  	panic("implement me")
    51  }
    52  
    53  func (*GossipMock) UpdateChannelMetadata(metadata []byte, chainID common.ChainID) {
    54  
    55  }
    56  
    57  func (*GossipMock) Gossip(msg *proto.GossipMessage) {
    58  	panic("implement me")
    59  }
    60  
    61  func (g *GossipMock) Accept(acceptor common.MessageAcceptor, passThrough bool) (<-chan *proto.GossipMessage, <-chan proto.ReceivedMessage) {
    62  	args := g.Called(acceptor, passThrough)
    63  	if args.Get(0) == nil {
    64  		return nil, args.Get(1).(chan proto.ReceivedMessage)
    65  	}
    66  	return args.Get(0).(<-chan *proto.GossipMessage), nil
    67  }
    68  
    69  func (g *GossipMock) JoinChan(joinMsg api.JoinChannelMessage, chainID common.ChainID) {
    70  }
    71  
    72  func (*GossipMock) Stop() {
    73  }