-
Notifications
You must be signed in to change notification settings - Fork 7
/
Copy pathfakes_test.go
131 lines (92 loc) · 2.26 KB
/
fakes_test.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
package streams_test
import (
"context"
"sync"
"time"
"github.com/msales/streams/v6"
)
type fakeSource struct {
Key interface{}
Value interface{}
}
func (s *fakeSource) Consume() (streams.Message, error) {
return streams.NewMessage(s.Key, s.Value), nil
}
func (s *fakeSource) Commit(interface{}) error {
return nil
}
func (s *fakeSource) Close() error {
return nil
}
type fakeCommitter struct{}
func (*fakeCommitter) WithPipe(streams.Pipe) {}
func (*fakeCommitter) Process(streams.Message) error {
return nil
}
func (*fakeCommitter) Commit() error {
return nil
}
func (*fakeCommitter) Close() error {
return nil
}
type fakeMetadata struct{}
func (m *fakeMetadata) WithOrigin(streams.MetadataOrigin) {
}
func (m *fakeMetadata) Merge(v streams.Metadata, s streams.MetadataStrategy) streams.Metadata {
return m
}
type fakeMetastore struct {
Metadata map[streams.Processor]streams.Metaitems
}
func (ms *fakeMetastore) Pull(p streams.Processor) (streams.Metaitems, error) {
return ms.Metadata[p], nil
}
func (ms *fakeMetastore) PullAll() (map[streams.Processor]streams.Metaitems, error) {
return ms.Metadata, nil
}
func (ms *fakeMetastore) Mark(streams.Processor, streams.Source, streams.Metadata) error {
return nil
}
type fakePump struct {
sync.Mutex
}
func (*fakePump) Accept(streams.Message) error {
return nil
}
func (*fakePump) Stop() {
}
func (*fakePump) Close() error {
return nil
}
type fakeNode struct {
Proc streams.Processor
}
func (*fakeNode) Name() string {
return ""
}
func (*fakeNode) AddChild(n streams.Node) {}
func (*fakeNode) Children() []streams.Node {
return []streams.Node{}
}
func (n *fakeNode) Processor() streams.Processor {
return n.Proc
}
type fakeSupervisor struct{}
func (*fakeSupervisor) WithContext(context.Context) {}
func (*fakeSupervisor) WithMonitor(streams.Monitor) {}
func (*fakeSupervisor) WithPumps(map[streams.Node]streams.Pump) {}
func (*fakeSupervisor) Start() error {
return nil
}
func (*fakeSupervisor) Commit(streams.Processor) error {
return nil
}
func (*fakeSupervisor) Close() error {
return nil
}
type fakeMonitor struct{}
func (*fakeMonitor) Processed(name string, l time.Duration, bp float64) {}
func (*fakeMonitor) Committed(l time.Duration) {}
func (*fakeMonitor) Close() error {
return nil
}