-
Notifications
You must be signed in to change notification settings - Fork 0
/
fake_migrator_watcher.go
380 lines (341 loc) · 14.3 KB
/
fake_migrator_watcher.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
// This file was generated by counterfeiter
package pg2mysqlfakes
import (
"sync"
"github.com/pivotal-cf/pg2mysql"
)
type FakeMigratorWatcher struct {
WillBuildSchemaStub func()
willBuildSchemaMutex sync.RWMutex
willBuildSchemaArgsForCall []struct{}
DidBuildSchemaStub func()
didBuildSchemaMutex sync.RWMutex
didBuildSchemaArgsForCall []struct{}
WillDisableConstraintsStub func()
willDisableConstraintsMutex sync.RWMutex
willDisableConstraintsArgsForCall []struct{}
DidDisableConstraintsStub func()
didDisableConstraintsMutex sync.RWMutex
didDisableConstraintsArgsForCall []struct{}
WillEnableConstraintsStub func()
willEnableConstraintsMutex sync.RWMutex
willEnableConstraintsArgsForCall []struct{}
EnableConstraintsDidFinishStub func()
enableConstraintsDidFinishMutex sync.RWMutex
enableConstraintsDidFinishArgsForCall []struct{}
EnableConstraintsDidFailWithErrorStub func(err error)
enableConstraintsDidFailWithErrorMutex sync.RWMutex
enableConstraintsDidFailWithErrorArgsForCall []struct {
err error
}
WillTruncateTableStub func(tableName string)
willTruncateTableMutex sync.RWMutex
willTruncateTableArgsForCall []struct {
tableName string
}
TruncateTableDidFinishStub func(tableName string)
truncateTableDidFinishMutex sync.RWMutex
truncateTableDidFinishArgsForCall []struct {
tableName string
}
TableMigrationDidStartStub func(tableName string)
tableMigrationDidStartMutex sync.RWMutex
tableMigrationDidStartArgsForCall []struct {
tableName string
}
TableMigrationDidFinishStub func(tableName string, recordsInserted int64)
tableMigrationDidFinishMutex sync.RWMutex
tableMigrationDidFinishArgsForCall []struct {
tableName string
recordsInserted int64
}
DidMigrateRowStub func(tableName string)
didMigrateRowMutex sync.RWMutex
didMigrateRowArgsForCall []struct {
tableName string
}
DidFailToMigrateRowWithErrorStub func(tableName string, err error)
didFailToMigrateRowWithErrorMutex sync.RWMutex
didFailToMigrateRowWithErrorArgsForCall []struct {
tableName string
err error
}
invocations map[string][][]interface{}
invocationsMutex sync.RWMutex
}
func (fake *FakeMigratorWatcher) WillBuildSchema() {
fake.willBuildSchemaMutex.Lock()
fake.willBuildSchemaArgsForCall = append(fake.willBuildSchemaArgsForCall, struct{}{})
fake.recordInvocation("WillBuildSchema", []interface{}{})
fake.willBuildSchemaMutex.Unlock()
if fake.WillBuildSchemaStub != nil {
fake.WillBuildSchemaStub()
}
}
func (fake *FakeMigratorWatcher) WillBuildSchemaCallCount() int {
fake.willBuildSchemaMutex.RLock()
defer fake.willBuildSchemaMutex.RUnlock()
return len(fake.willBuildSchemaArgsForCall)
}
func (fake *FakeMigratorWatcher) DidBuildSchema() {
fake.didBuildSchemaMutex.Lock()
fake.didBuildSchemaArgsForCall = append(fake.didBuildSchemaArgsForCall, struct{}{})
fake.recordInvocation("DidBuildSchema", []interface{}{})
fake.didBuildSchemaMutex.Unlock()
if fake.DidBuildSchemaStub != nil {
fake.DidBuildSchemaStub()
}
}
func (fake *FakeMigratorWatcher) DidBuildSchemaCallCount() int {
fake.didBuildSchemaMutex.RLock()
defer fake.didBuildSchemaMutex.RUnlock()
return len(fake.didBuildSchemaArgsForCall)
}
func (fake *FakeMigratorWatcher) WillDisableConstraints() {
fake.willDisableConstraintsMutex.Lock()
fake.willDisableConstraintsArgsForCall = append(fake.willDisableConstraintsArgsForCall, struct{}{})
fake.recordInvocation("WillDisableConstraints", []interface{}{})
fake.willDisableConstraintsMutex.Unlock()
if fake.WillDisableConstraintsStub != nil {
fake.WillDisableConstraintsStub()
}
}
func (fake *FakeMigratorWatcher) WillDisableConstraintsCallCount() int {
fake.willDisableConstraintsMutex.RLock()
defer fake.willDisableConstraintsMutex.RUnlock()
return len(fake.willDisableConstraintsArgsForCall)
}
func (fake *FakeMigratorWatcher) DidDisableConstraints() {
fake.didDisableConstraintsMutex.Lock()
fake.didDisableConstraintsArgsForCall = append(fake.didDisableConstraintsArgsForCall, struct{}{})
fake.recordInvocation("DidDisableConstraints", []interface{}{})
fake.didDisableConstraintsMutex.Unlock()
if fake.DidDisableConstraintsStub != nil {
fake.DidDisableConstraintsStub()
}
}
func (fake *FakeMigratorWatcher) DidDisableConstraintsCallCount() int {
fake.didDisableConstraintsMutex.RLock()
defer fake.didDisableConstraintsMutex.RUnlock()
return len(fake.didDisableConstraintsArgsForCall)
}
func (fake *FakeMigratorWatcher) WillEnableConstraints() {
fake.willEnableConstraintsMutex.Lock()
fake.willEnableConstraintsArgsForCall = append(fake.willEnableConstraintsArgsForCall, struct{}{})
fake.recordInvocation("WillEnableConstraints", []interface{}{})
fake.willEnableConstraintsMutex.Unlock()
if fake.WillEnableConstraintsStub != nil {
fake.WillEnableConstraintsStub()
}
}
func (fake *FakeMigratorWatcher) WillEnableConstraintsCallCount() int {
fake.willEnableConstraintsMutex.RLock()
defer fake.willEnableConstraintsMutex.RUnlock()
return len(fake.willEnableConstraintsArgsForCall)
}
func (fake *FakeMigratorWatcher) EnableConstraintsDidFinish() {
fake.enableConstraintsDidFinishMutex.Lock()
fake.enableConstraintsDidFinishArgsForCall = append(fake.enableConstraintsDidFinishArgsForCall, struct{}{})
fake.recordInvocation("EnableConstraintsDidFinish", []interface{}{})
fake.enableConstraintsDidFinishMutex.Unlock()
if fake.EnableConstraintsDidFinishStub != nil {
fake.EnableConstraintsDidFinishStub()
}
}
func (fake *FakeMigratorWatcher) EnableConstraintsDidFinishCallCount() int {
fake.enableConstraintsDidFinishMutex.RLock()
defer fake.enableConstraintsDidFinishMutex.RUnlock()
return len(fake.enableConstraintsDidFinishArgsForCall)
}
func (fake *FakeMigratorWatcher) EnableConstraintsDidFailWithError(err error) {
fake.enableConstraintsDidFailWithErrorMutex.Lock()
fake.enableConstraintsDidFailWithErrorArgsForCall = append(fake.enableConstraintsDidFailWithErrorArgsForCall, struct {
err error
}{err})
fake.recordInvocation("EnableConstraintsDidFailWithError", []interface{}{err})
fake.enableConstraintsDidFailWithErrorMutex.Unlock()
if fake.EnableConstraintsDidFailWithErrorStub != nil {
fake.EnableConstraintsDidFailWithErrorStub(err)
}
}
func (fake *FakeMigratorWatcher) EnableConstraintsDidFailWithErrorCallCount() int {
fake.enableConstraintsDidFailWithErrorMutex.RLock()
defer fake.enableConstraintsDidFailWithErrorMutex.RUnlock()
return len(fake.enableConstraintsDidFailWithErrorArgsForCall)
}
func (fake *FakeMigratorWatcher) EnableConstraintsDidFailWithErrorArgsForCall(i int) error {
fake.enableConstraintsDidFailWithErrorMutex.RLock()
defer fake.enableConstraintsDidFailWithErrorMutex.RUnlock()
return fake.enableConstraintsDidFailWithErrorArgsForCall[i].err
}
func (fake *FakeMigratorWatcher) WillTruncateTable(tableName string) {
fake.willTruncateTableMutex.Lock()
fake.willTruncateTableArgsForCall = append(fake.willTruncateTableArgsForCall, struct {
tableName string
}{tableName})
fake.recordInvocation("WillTruncateTable", []interface{}{tableName})
fake.willTruncateTableMutex.Unlock()
if fake.WillTruncateTableStub != nil {
fake.WillTruncateTableStub(tableName)
}
}
func (fake *FakeMigratorWatcher) WillTruncateTableCallCount() int {
fake.willTruncateTableMutex.RLock()
defer fake.willTruncateTableMutex.RUnlock()
return len(fake.willTruncateTableArgsForCall)
}
func (fake *FakeMigratorWatcher) WillTruncateTableArgsForCall(i int) string {
fake.willTruncateTableMutex.RLock()
defer fake.willTruncateTableMutex.RUnlock()
return fake.willTruncateTableArgsForCall[i].tableName
}
func (fake *FakeMigratorWatcher) TruncateTableDidFinish(tableName string) {
fake.truncateTableDidFinishMutex.Lock()
fake.truncateTableDidFinishArgsForCall = append(fake.truncateTableDidFinishArgsForCall, struct {
tableName string
}{tableName})
fake.recordInvocation("TruncateTableDidFinish", []interface{}{tableName})
fake.truncateTableDidFinishMutex.Unlock()
if fake.TruncateTableDidFinishStub != nil {
fake.TruncateTableDidFinishStub(tableName)
}
}
func (fake *FakeMigratorWatcher) TruncateTableDidFinishCallCount() int {
fake.truncateTableDidFinishMutex.RLock()
defer fake.truncateTableDidFinishMutex.RUnlock()
return len(fake.truncateTableDidFinishArgsForCall)
}
func (fake *FakeMigratorWatcher) TruncateTableDidFinishArgsForCall(i int) string {
fake.truncateTableDidFinishMutex.RLock()
defer fake.truncateTableDidFinishMutex.RUnlock()
return fake.truncateTableDidFinishArgsForCall[i].tableName
}
func (fake *FakeMigratorWatcher) TableMigrationDidStart(tableName string) {
fake.tableMigrationDidStartMutex.Lock()
fake.tableMigrationDidStartArgsForCall = append(fake.tableMigrationDidStartArgsForCall, struct {
tableName string
}{tableName})
fake.recordInvocation("TableMigrationDidStart", []interface{}{tableName})
fake.tableMigrationDidStartMutex.Unlock()
if fake.TableMigrationDidStartStub != nil {
fake.TableMigrationDidStartStub(tableName)
}
}
func (fake *FakeMigratorWatcher) TableMigrationDidStartCallCount() int {
fake.tableMigrationDidStartMutex.RLock()
defer fake.tableMigrationDidStartMutex.RUnlock()
return len(fake.tableMigrationDidStartArgsForCall)
}
func (fake *FakeMigratorWatcher) TableMigrationDidStartArgsForCall(i int) string {
fake.tableMigrationDidStartMutex.RLock()
defer fake.tableMigrationDidStartMutex.RUnlock()
return fake.tableMigrationDidStartArgsForCall[i].tableName
}
func (fake *FakeMigratorWatcher) TableMigrationDidFinish(tableName string, recordsInserted int64) {
fake.tableMigrationDidFinishMutex.Lock()
fake.tableMigrationDidFinishArgsForCall = append(fake.tableMigrationDidFinishArgsForCall, struct {
tableName string
recordsInserted int64
}{tableName, recordsInserted})
fake.recordInvocation("TableMigrationDidFinish", []interface{}{tableName, recordsInserted})
fake.tableMigrationDidFinishMutex.Unlock()
if fake.TableMigrationDidFinishStub != nil {
fake.TableMigrationDidFinishStub(tableName, recordsInserted)
}
}
func (fake *FakeMigratorWatcher) TableMigrationDidFinishCallCount() int {
fake.tableMigrationDidFinishMutex.RLock()
defer fake.tableMigrationDidFinishMutex.RUnlock()
return len(fake.tableMigrationDidFinishArgsForCall)
}
func (fake *FakeMigratorWatcher) TableMigrationDidFinishArgsForCall(i int) (string, int64) {
fake.tableMigrationDidFinishMutex.RLock()
defer fake.tableMigrationDidFinishMutex.RUnlock()
return fake.tableMigrationDidFinishArgsForCall[i].tableName, fake.tableMigrationDidFinishArgsForCall[i].recordsInserted
}
func (fake *FakeMigratorWatcher) DidMigrateRow(tableName string) {
fake.didMigrateRowMutex.Lock()
fake.didMigrateRowArgsForCall = append(fake.didMigrateRowArgsForCall, struct {
tableName string
}{tableName})
fake.recordInvocation("DidMigrateRow", []interface{}{tableName})
fake.didMigrateRowMutex.Unlock()
if fake.DidMigrateRowStub != nil {
fake.DidMigrateRowStub(tableName)
}
}
func (fake *FakeMigratorWatcher) DidMigrateRowCallCount() int {
fake.didMigrateRowMutex.RLock()
defer fake.didMigrateRowMutex.RUnlock()
return len(fake.didMigrateRowArgsForCall)
}
func (fake *FakeMigratorWatcher) DidMigrateRowArgsForCall(i int) string {
fake.didMigrateRowMutex.RLock()
defer fake.didMigrateRowMutex.RUnlock()
return fake.didMigrateRowArgsForCall[i].tableName
}
func (fake *FakeMigratorWatcher) DidFailToMigrateRowWithError(tableName string, err error) {
fake.didFailToMigrateRowWithErrorMutex.Lock()
fake.didFailToMigrateRowWithErrorArgsForCall = append(fake.didFailToMigrateRowWithErrorArgsForCall, struct {
tableName string
err error
}{tableName, err})
fake.recordInvocation("DidFailToMigrateRowWithError", []interface{}{tableName, err})
fake.didFailToMigrateRowWithErrorMutex.Unlock()
if fake.DidFailToMigrateRowWithErrorStub != nil {
fake.DidFailToMigrateRowWithErrorStub(tableName, err)
}
}
func (fake *FakeMigratorWatcher) DidFailToMigrateRowWithErrorCallCount() int {
fake.didFailToMigrateRowWithErrorMutex.RLock()
defer fake.didFailToMigrateRowWithErrorMutex.RUnlock()
return len(fake.didFailToMigrateRowWithErrorArgsForCall)
}
func (fake *FakeMigratorWatcher) DidFailToMigrateRowWithErrorArgsForCall(i int) (string, error) {
fake.didFailToMigrateRowWithErrorMutex.RLock()
defer fake.didFailToMigrateRowWithErrorMutex.RUnlock()
return fake.didFailToMigrateRowWithErrorArgsForCall[i].tableName, fake.didFailToMigrateRowWithErrorArgsForCall[i].err
}
func (fake *FakeMigratorWatcher) Invocations() map[string][][]interface{} {
fake.invocationsMutex.RLock()
defer fake.invocationsMutex.RUnlock()
fake.willBuildSchemaMutex.RLock()
defer fake.willBuildSchemaMutex.RUnlock()
fake.didBuildSchemaMutex.RLock()
defer fake.didBuildSchemaMutex.RUnlock()
fake.willDisableConstraintsMutex.RLock()
defer fake.willDisableConstraintsMutex.RUnlock()
fake.didDisableConstraintsMutex.RLock()
defer fake.didDisableConstraintsMutex.RUnlock()
fake.willEnableConstraintsMutex.RLock()
defer fake.willEnableConstraintsMutex.RUnlock()
fake.enableConstraintsDidFinishMutex.RLock()
defer fake.enableConstraintsDidFinishMutex.RUnlock()
fake.enableConstraintsDidFailWithErrorMutex.RLock()
defer fake.enableConstraintsDidFailWithErrorMutex.RUnlock()
fake.willTruncateTableMutex.RLock()
defer fake.willTruncateTableMutex.RUnlock()
fake.truncateTableDidFinishMutex.RLock()
defer fake.truncateTableDidFinishMutex.RUnlock()
fake.tableMigrationDidStartMutex.RLock()
defer fake.tableMigrationDidStartMutex.RUnlock()
fake.tableMigrationDidFinishMutex.RLock()
defer fake.tableMigrationDidFinishMutex.RUnlock()
fake.didMigrateRowMutex.RLock()
defer fake.didMigrateRowMutex.RUnlock()
fake.didFailToMigrateRowWithErrorMutex.RLock()
defer fake.didFailToMigrateRowWithErrorMutex.RUnlock()
return fake.invocations
}
func (fake *FakeMigratorWatcher) recordInvocation(key string, args []interface{}) {
fake.invocationsMutex.Lock()
defer fake.invocationsMutex.Unlock()
if fake.invocations == nil {
fake.invocations = map[string][][]interface{}{}
}
if fake.invocations[key] == nil {
fake.invocations[key] = [][]interface{}{}
}
fake.invocations[key] = append(fake.invocations[key], args)
}
var _ pg2mysql.MigratorWatcher = new(FakeMigratorWatcher)