github.com/anycable/anycable-go@v1.5.1/mocks/Broker.go (about) 1 // Code generated by mockery v2.20.0. DO NOT EDIT. 2 3 package mocks 4 5 import ( 6 broker "github.com/anycable/anycable-go/broker" 7 common "github.com/anycable/anycable-go/common" 8 9 context "context" 10 11 mock "github.com/stretchr/testify/mock" 12 ) 13 14 // Broker is an autogenerated mock type for the Broker type 15 type Broker struct { 16 mock.Mock 17 } 18 19 // Announce provides a mock function with given fields: 20 func (_m *Broker) Announce() string { 21 ret := _m.Called() 22 23 var r0 string 24 if rf, ok := ret.Get(0).(func() string); ok { 25 r0 = rf() 26 } else { 27 r0 = ret.Get(0).(string) 28 } 29 30 return r0 31 } 32 33 // CommitSession provides a mock function with given fields: sid, session 34 func (_m *Broker) CommitSession(sid string, session broker.Cacheable) error { 35 ret := _m.Called(sid, session) 36 37 var r0 error 38 if rf, ok := ret.Get(0).(func(string, broker.Cacheable) error); ok { 39 r0 = rf(sid, session) 40 } else { 41 r0 = ret.Error(0) 42 } 43 44 return r0 45 } 46 47 // FinishSession provides a mock function with given fields: sid 48 func (_m *Broker) FinishSession(sid string) error { 49 ret := _m.Called(sid) 50 51 var r0 error 52 if rf, ok := ret.Get(0).(func(string) error); ok { 53 r0 = rf(sid) 54 } else { 55 r0 = ret.Error(0) 56 } 57 58 return r0 59 } 60 61 // HandleBroadcast provides a mock function with given fields: msg 62 func (_m *Broker) HandleBroadcast(msg *common.StreamMessage) { 63 _m.Called(msg) 64 } 65 66 // HandleCommand provides a mock function with given fields: msg 67 func (_m *Broker) HandleCommand(msg *common.RemoteCommandMessage) { 68 _m.Called(msg) 69 } 70 71 // HistoryFrom provides a mock function with given fields: stream, epoch, offset 72 func (_m *Broker) HistoryFrom(stream string, epoch string, offset uint64) ([]common.StreamMessage, error) { 73 ret := _m.Called(stream, epoch, offset) 74 75 var r0 []common.StreamMessage 76 var r1 error 77 if rf, ok := ret.Get(0).(func(string, string, uint64) ([]common.StreamMessage, error)); ok { 78 return rf(stream, epoch, offset) 79 } 80 if rf, ok := ret.Get(0).(func(string, string, uint64) []common.StreamMessage); ok { 81 r0 = rf(stream, epoch, offset) 82 } else { 83 if ret.Get(0) != nil { 84 r0 = ret.Get(0).([]common.StreamMessage) 85 } 86 } 87 88 if rf, ok := ret.Get(1).(func(string, string, uint64) error); ok { 89 r1 = rf(stream, epoch, offset) 90 } else { 91 r1 = ret.Error(1) 92 } 93 94 return r0, r1 95 } 96 97 // HistorySince provides a mock function with given fields: stream, ts 98 func (_m *Broker) HistorySince(stream string, ts int64) ([]common.StreamMessage, error) { 99 ret := _m.Called(stream, ts) 100 101 var r0 []common.StreamMessage 102 var r1 error 103 if rf, ok := ret.Get(0).(func(string, int64) ([]common.StreamMessage, error)); ok { 104 return rf(stream, ts) 105 } 106 if rf, ok := ret.Get(0).(func(string, int64) []common.StreamMessage); ok { 107 r0 = rf(stream, ts) 108 } else { 109 if ret.Get(0) != nil { 110 r0 = ret.Get(0).([]common.StreamMessage) 111 } 112 } 113 114 if rf, ok := ret.Get(1).(func(string, int64) error); ok { 115 r1 = rf(stream, ts) 116 } else { 117 r1 = ret.Error(1) 118 } 119 120 return r0, r1 121 } 122 123 // RestoreSession provides a mock function with given fields: from 124 func (_m *Broker) RestoreSession(from string) ([]byte, error) { 125 ret := _m.Called(from) 126 127 var r0 []byte 128 var r1 error 129 if rf, ok := ret.Get(0).(func(string) ([]byte, error)); ok { 130 return rf(from) 131 } 132 if rf, ok := ret.Get(0).(func(string) []byte); ok { 133 r0 = rf(from) 134 } else { 135 if ret.Get(0) != nil { 136 r0 = ret.Get(0).([]byte) 137 } 138 } 139 140 if rf, ok := ret.Get(1).(func(string) error); ok { 141 r1 = rf(from) 142 } else { 143 r1 = ret.Error(1) 144 } 145 146 return r0, r1 147 } 148 149 // Shutdown provides a mock function with given fields: ctx 150 func (_m *Broker) Shutdown(ctx context.Context) error { 151 ret := _m.Called(ctx) 152 153 var r0 error 154 if rf, ok := ret.Get(0).(func(context.Context) error); ok { 155 r0 = rf(ctx) 156 } else { 157 r0 = ret.Error(0) 158 } 159 160 return r0 161 } 162 163 // Start provides a mock function with given fields: done 164 func (_m *Broker) Start(done chan error) error { 165 ret := _m.Called(done) 166 167 var r0 error 168 if rf, ok := ret.Get(0).(func(chan error) error); ok { 169 r0 = rf(done) 170 } else { 171 r0 = ret.Error(0) 172 } 173 174 return r0 175 } 176 177 // Subscribe provides a mock function with given fields: stream 178 func (_m *Broker) Subscribe(stream string) string { 179 ret := _m.Called(stream) 180 181 var r0 string 182 if rf, ok := ret.Get(0).(func(string) string); ok { 183 r0 = rf(stream) 184 } else { 185 r0 = ret.Get(0).(string) 186 } 187 188 return r0 189 } 190 191 // Unsubscribe provides a mock function with given fields: stream 192 func (_m *Broker) Unsubscribe(stream string) string { 193 ret := _m.Called(stream) 194 195 var r0 string 196 if rf, ok := ret.Get(0).(func(string) string); ok { 197 r0 = rf(stream) 198 } else { 199 r0 = ret.Get(0).(string) 200 } 201 202 return r0 203 } 204 205 type mockConstructorTestingTNewBroker interface { 206 mock.TestingT 207 Cleanup(func()) 208 } 209 210 // NewBroker creates a new instance of Broker. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations. 211 func NewBroker(t mockConstructorTestingTNewBroker) *Broker { 212 mock := &Broker{} 213 mock.Mock.Test(t) 214 215 t.Cleanup(func() { mock.AssertExpectations(t) }) 216 217 return mock 218 }