github.com/koko1123/flow-go-1@v0.29.6/network/p2p/mock/lib_p2_p_node.go (about)

     1  // Code generated by mockery v2.13.1. DO NOT EDIT.
     2  
     3  package mockp2p
     4  
     5  import (
     6  	component "github.com/koko1123/flow-go-1/module/component"
     7  	channels "github.com/koko1123/flow-go-1/network/channels"
     8  
     9  	context "context"
    10  
    11  	host "github.com/libp2p/go-libp2p/core/host"
    12  
    13  	irrecoverable "github.com/koko1123/flow-go-1/module/irrecoverable"
    14  
    15  	kbucket "github.com/libp2p/go-libp2p-kbucket"
    16  
    17  	mock "github.com/stretchr/testify/mock"
    18  
    19  	network "github.com/libp2p/go-libp2p/core/network"
    20  
    21  	p2p "github.com/koko1123/flow-go-1/network/p2p"
    22  
    23  	peer "github.com/libp2p/go-libp2p/core/peer"
    24  
    25  	protocol "github.com/libp2p/go-libp2p/core/protocol"
    26  
    27  	routing "github.com/libp2p/go-libp2p/core/routing"
    28  
    29  	unicast "github.com/koko1123/flow-go-1/network/p2p/unicast"
    30  )
    31  
    32  // LibP2PNode is an autogenerated mock type for the LibP2PNode type
    33  type LibP2PNode struct {
    34  	mock.Mock
    35  }
    36  
    37  // AddPeer provides a mock function with given fields: ctx, peerInfo
    38  func (_m *LibP2PNode) AddPeer(ctx context.Context, peerInfo peer.AddrInfo) error {
    39  	ret := _m.Called(ctx, peerInfo)
    40  
    41  	var r0 error
    42  	if rf, ok := ret.Get(0).(func(context.Context, peer.AddrInfo) error); ok {
    43  		r0 = rf(ctx, peerInfo)
    44  	} else {
    45  		r0 = ret.Error(0)
    46  	}
    47  
    48  	return r0
    49  }
    50  
    51  // CreateStream provides a mock function with given fields: ctx, peerID
    52  func (_m *LibP2PNode) CreateStream(ctx context.Context, peerID peer.ID) (network.Stream, error) {
    53  	ret := _m.Called(ctx, peerID)
    54  
    55  	var r0 network.Stream
    56  	if rf, ok := ret.Get(0).(func(context.Context, peer.ID) network.Stream); ok {
    57  		r0 = rf(ctx, peerID)
    58  	} else {
    59  		if ret.Get(0) != nil {
    60  			r0 = ret.Get(0).(network.Stream)
    61  		}
    62  	}
    63  
    64  	var r1 error
    65  	if rf, ok := ret.Get(1).(func(context.Context, peer.ID) error); ok {
    66  		r1 = rf(ctx, peerID)
    67  	} else {
    68  		r1 = ret.Error(1)
    69  	}
    70  
    71  	return r0, r1
    72  }
    73  
    74  // Done provides a mock function with given fields:
    75  func (_m *LibP2PNode) Done() <-chan struct{} {
    76  	ret := _m.Called()
    77  
    78  	var r0 <-chan struct{}
    79  	if rf, ok := ret.Get(0).(func() <-chan struct{}); ok {
    80  		r0 = rf()
    81  	} else {
    82  		if ret.Get(0) != nil {
    83  			r0 = ret.Get(0).(<-chan struct{})
    84  		}
    85  	}
    86  
    87  	return r0
    88  }
    89  
    90  // GetIPPort provides a mock function with given fields:
    91  func (_m *LibP2PNode) GetIPPort() (string, string, error) {
    92  	ret := _m.Called()
    93  
    94  	var r0 string
    95  	if rf, ok := ret.Get(0).(func() string); ok {
    96  		r0 = rf()
    97  	} else {
    98  		r0 = ret.Get(0).(string)
    99  	}
   100  
   101  	var r1 string
   102  	if rf, ok := ret.Get(1).(func() string); ok {
   103  		r1 = rf()
   104  	} else {
   105  		r1 = ret.Get(1).(string)
   106  	}
   107  
   108  	var r2 error
   109  	if rf, ok := ret.Get(2).(func() error); ok {
   110  		r2 = rf()
   111  	} else {
   112  		r2 = ret.Error(2)
   113  	}
   114  
   115  	return r0, r1, r2
   116  }
   117  
   118  // GetPeersForProtocol provides a mock function with given fields: pid
   119  func (_m *LibP2PNode) GetPeersForProtocol(pid protocol.ID) peer.IDSlice {
   120  	ret := _m.Called(pid)
   121  
   122  	var r0 peer.IDSlice
   123  	if rf, ok := ret.Get(0).(func(protocol.ID) peer.IDSlice); ok {
   124  		r0 = rf(pid)
   125  	} else {
   126  		if ret.Get(0) != nil {
   127  			r0 = ret.Get(0).(peer.IDSlice)
   128  		}
   129  	}
   130  
   131  	return r0
   132  }
   133  
   134  // HasSubscription provides a mock function with given fields: topic
   135  func (_m *LibP2PNode) HasSubscription(topic channels.Topic) bool {
   136  	ret := _m.Called(topic)
   137  
   138  	var r0 bool
   139  	if rf, ok := ret.Get(0).(func(channels.Topic) bool); ok {
   140  		r0 = rf(topic)
   141  	} else {
   142  		r0 = ret.Get(0).(bool)
   143  	}
   144  
   145  	return r0
   146  }
   147  
   148  // Host provides a mock function with given fields:
   149  func (_m *LibP2PNode) Host() host.Host {
   150  	ret := _m.Called()
   151  
   152  	var r0 host.Host
   153  	if rf, ok := ret.Get(0).(func() host.Host); ok {
   154  		r0 = rf()
   155  	} else {
   156  		if ret.Get(0) != nil {
   157  			r0 = ret.Get(0).(host.Host)
   158  		}
   159  	}
   160  
   161  	return r0
   162  }
   163  
   164  // IsConnected provides a mock function with given fields: peerID
   165  func (_m *LibP2PNode) IsConnected(peerID peer.ID) (bool, error) {
   166  	ret := _m.Called(peerID)
   167  
   168  	var r0 bool
   169  	if rf, ok := ret.Get(0).(func(peer.ID) bool); ok {
   170  		r0 = rf(peerID)
   171  	} else {
   172  		r0 = ret.Get(0).(bool)
   173  	}
   174  
   175  	var r1 error
   176  	if rf, ok := ret.Get(1).(func(peer.ID) error); ok {
   177  		r1 = rf(peerID)
   178  	} else {
   179  		r1 = ret.Error(1)
   180  	}
   181  
   182  	return r0, r1
   183  }
   184  
   185  // ListPeers provides a mock function with given fields: topic
   186  func (_m *LibP2PNode) ListPeers(topic string) []peer.ID {
   187  	ret := _m.Called(topic)
   188  
   189  	var r0 []peer.ID
   190  	if rf, ok := ret.Get(0).(func(string) []peer.ID); ok {
   191  		r0 = rf(topic)
   192  	} else {
   193  		if ret.Get(0) != nil {
   194  			r0 = ret.Get(0).([]peer.ID)
   195  		}
   196  	}
   197  
   198  	return r0
   199  }
   200  
   201  // PeerManagerComponent provides a mock function with given fields:
   202  func (_m *LibP2PNode) PeerManagerComponent() component.Component {
   203  	ret := _m.Called()
   204  
   205  	var r0 component.Component
   206  	if rf, ok := ret.Get(0).(func() component.Component); ok {
   207  		r0 = rf()
   208  	} else {
   209  		if ret.Get(0) != nil {
   210  			r0 = ret.Get(0).(component.Component)
   211  		}
   212  	}
   213  
   214  	return r0
   215  }
   216  
   217  // Publish provides a mock function with given fields: ctx, topic, data
   218  func (_m *LibP2PNode) Publish(ctx context.Context, topic channels.Topic, data []byte) error {
   219  	ret := _m.Called(ctx, topic, data)
   220  
   221  	var r0 error
   222  	if rf, ok := ret.Get(0).(func(context.Context, channels.Topic, []byte) error); ok {
   223  		r0 = rf(ctx, topic, data)
   224  	} else {
   225  		r0 = ret.Error(0)
   226  	}
   227  
   228  	return r0
   229  }
   230  
   231  // Ready provides a mock function with given fields:
   232  func (_m *LibP2PNode) Ready() <-chan struct{} {
   233  	ret := _m.Called()
   234  
   235  	var r0 <-chan struct{}
   236  	if rf, ok := ret.Get(0).(func() <-chan struct{}); ok {
   237  		r0 = rf()
   238  	} else {
   239  		if ret.Get(0) != nil {
   240  			r0 = ret.Get(0).(<-chan struct{})
   241  		}
   242  	}
   243  
   244  	return r0
   245  }
   246  
   247  // RemovePeer provides a mock function with given fields: peerID
   248  func (_m *LibP2PNode) RemovePeer(peerID peer.ID) error {
   249  	ret := _m.Called(peerID)
   250  
   251  	var r0 error
   252  	if rf, ok := ret.Get(0).(func(peer.ID) error); ok {
   253  		r0 = rf(peerID)
   254  	} else {
   255  		r0 = ret.Error(0)
   256  	}
   257  
   258  	return r0
   259  }
   260  
   261  // RequestPeerUpdate provides a mock function with given fields:
   262  func (_m *LibP2PNode) RequestPeerUpdate() {
   263  	_m.Called()
   264  }
   265  
   266  // Routing provides a mock function with given fields:
   267  func (_m *LibP2PNode) Routing() routing.Routing {
   268  	ret := _m.Called()
   269  
   270  	var r0 routing.Routing
   271  	if rf, ok := ret.Get(0).(func() routing.Routing); ok {
   272  		r0 = rf()
   273  	} else {
   274  		if ret.Get(0) != nil {
   275  			r0 = ret.Get(0).(routing.Routing)
   276  		}
   277  	}
   278  
   279  	return r0
   280  }
   281  
   282  // RoutingTable provides a mock function with given fields:
   283  func (_m *LibP2PNode) RoutingTable() *kbucket.RoutingTable {
   284  	ret := _m.Called()
   285  
   286  	var r0 *kbucket.RoutingTable
   287  	if rf, ok := ret.Get(0).(func() *kbucket.RoutingTable); ok {
   288  		r0 = rf()
   289  	} else {
   290  		if ret.Get(0) != nil {
   291  			r0 = ret.Get(0).(*kbucket.RoutingTable)
   292  		}
   293  	}
   294  
   295  	return r0
   296  }
   297  
   298  // SetComponentManager provides a mock function with given fields: cm
   299  func (_m *LibP2PNode) SetComponentManager(cm *component.ComponentManager) {
   300  	_m.Called(cm)
   301  }
   302  
   303  // SetPubSub provides a mock function with given fields: ps
   304  func (_m *LibP2PNode) SetPubSub(ps p2p.PubSubAdapter) {
   305  	_m.Called(ps)
   306  }
   307  
   308  // SetRouting provides a mock function with given fields: r
   309  func (_m *LibP2PNode) SetRouting(r routing.Routing) {
   310  	_m.Called(r)
   311  }
   312  
   313  // Start provides a mock function with given fields: ctx
   314  func (_m *LibP2PNode) Start(ctx irrecoverable.SignalerContext) {
   315  	_m.Called(ctx)
   316  }
   317  
   318  // Stop provides a mock function with given fields:
   319  func (_m *LibP2PNode) Stop() error {
   320  	ret := _m.Called()
   321  
   322  	var r0 error
   323  	if rf, ok := ret.Get(0).(func() error); ok {
   324  		r0 = rf()
   325  	} else {
   326  		r0 = ret.Error(0)
   327  	}
   328  
   329  	return r0
   330  }
   331  
   332  // Subscribe provides a mock function with given fields: topic, topicValidator
   333  func (_m *LibP2PNode) Subscribe(topic channels.Topic, topicValidator p2p.TopicValidatorFunc) (p2p.Subscription, error) {
   334  	ret := _m.Called(topic, topicValidator)
   335  
   336  	var r0 p2p.Subscription
   337  	if rf, ok := ret.Get(0).(func(channels.Topic, p2p.TopicValidatorFunc) p2p.Subscription); ok {
   338  		r0 = rf(topic, topicValidator)
   339  	} else {
   340  		if ret.Get(0) != nil {
   341  			r0 = ret.Get(0).(p2p.Subscription)
   342  		}
   343  	}
   344  
   345  	var r1 error
   346  	if rf, ok := ret.Get(1).(func(channels.Topic, p2p.TopicValidatorFunc) error); ok {
   347  		r1 = rf(topic, topicValidator)
   348  	} else {
   349  		r1 = ret.Error(1)
   350  	}
   351  
   352  	return r0, r1
   353  }
   354  
   355  // UnSubscribe provides a mock function with given fields: topic
   356  func (_m *LibP2PNode) UnSubscribe(topic channels.Topic) error {
   357  	ret := _m.Called(topic)
   358  
   359  	var r0 error
   360  	if rf, ok := ret.Get(0).(func(channels.Topic) error); ok {
   361  		r0 = rf(topic)
   362  	} else {
   363  		r0 = ret.Error(0)
   364  	}
   365  
   366  	return r0
   367  }
   368  
   369  // WithDefaultUnicastProtocol provides a mock function with given fields: defaultHandler, preferred
   370  func (_m *LibP2PNode) WithDefaultUnicastProtocol(defaultHandler network.StreamHandler, preferred []unicast.ProtocolName) error {
   371  	ret := _m.Called(defaultHandler, preferred)
   372  
   373  	var r0 error
   374  	if rf, ok := ret.Get(0).(func(network.StreamHandler, []unicast.ProtocolName) error); ok {
   375  		r0 = rf(defaultHandler, preferred)
   376  	} else {
   377  		r0 = ret.Error(0)
   378  	}
   379  
   380  	return r0
   381  }
   382  
   383  // WithPeersProvider provides a mock function with given fields: peersProvider
   384  func (_m *LibP2PNode) WithPeersProvider(peersProvider p2p.PeersProvider) {
   385  	_m.Called(peersProvider)
   386  }
   387  
   388  type mockConstructorTestingTNewLibP2PNode interface {
   389  	mock.TestingT
   390  	Cleanup(func())
   391  }
   392  
   393  // NewLibP2PNode creates a new instance of LibP2PNode. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations.
   394  func NewLibP2PNode(t mockConstructorTestingTNewLibP2PNode) *LibP2PNode {
   395  	mock := &LibP2PNode{}
   396  	mock.Mock.Test(t)
   397  
   398  	t.Cleanup(func() { mock.AssertExpectations(t) })
   399  
   400  	return mock
   401  }