-
Notifications
You must be signed in to change notification settings - Fork 205
/
test_queue.go
68 lines (57 loc) · 2.64 KB
/
test_queue.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
package rmq
import "time"
type TestQueue struct {
name string
LastDeliveries []string
}
func NewTestQueue(name string) *TestQueue {
queue := &TestQueue{name: name}
queue.Reset()
return queue
}
func (queue *TestQueue) String() string {
return queue.name
}
func (queue *TestQueue) Publish(payload ...string) error {
queue.LastDeliveries = append(queue.LastDeliveries, payload...)
return nil
}
func (queue *TestQueue) PublishBytes(payload ...[]byte) error {
stringifiedBytes := make([]string, len(payload))
for i, b := range payload {
stringifiedBytes[i] = string(b)
}
return queue.Publish(stringifiedBytes...)
}
func (queue *TestQueue) Remove(payload string, count int64, removeFromRejected bool) error {
panic(errorNotSupported)
}
func (queue *TestQueue) RemoveBytes(payload []byte, count int64, removeFromRejected bool) error {
return queue.Remove(string(payload), count, removeFromRejected)
}
func (*TestQueue) SetPushQueue(Queue) { panic(errorNotSupported) }
func (*TestQueue) StartConsuming(int64, time.Duration) error { panic(errorNotSupported) }
func (*TestQueue) StopConsuming() <-chan struct{} { panic(errorNotSupported) }
func (*TestQueue) AddConsumer(string, Consumer) (string, error) { panic(errorNotSupported) }
func (*TestQueue) AddConsumerFunc(string, ConsumerFunc) (string, error) { panic(errorNotSupported) }
func (*TestQueue) AddBatchConsumer(string, int64, time.Duration, BatchConsumer) (string, error) {
panic(errorNotSupported)
}
func (*TestQueue) AddBatchConsumerFunc(string, int64, time.Duration, BatchConsumerFunc) (string, error) {
panic(errorNotSupported)
}
func (*TestQueue) ReturnUnacked(int64) (int64, error) { panic(errorNotSupported) }
func (*TestQueue) ReturnRejected(int64) (int64, error) { panic(errorNotSupported) }
func (*TestQueue) PurgeReady() (int64, error) { panic(errorNotSupported) }
func (*TestQueue) PurgeRejected() (int64, error) { panic(errorNotSupported) }
func (*TestQueue) Destroy() (int64, int64, error) { panic(errorNotSupported) }
func (*TestQueue) Drain(count int64) ([]string, error) { panic(errorNotSupported) }
func (*TestQueue) closeInStaleConnection() error { panic(errorNotSupported) }
func (*TestQueue) readyCount() (int64, error) { panic(errorNotSupported) }
func (*TestQueue) unackedCount() (int64, error) { panic(errorNotSupported) }
func (*TestQueue) rejectedCount() (int64, error) { panic(errorNotSupported) }
func (*TestQueue) getConsumers() ([]string, error) { panic(errorNotSupported) }
// test helper
func (queue *TestQueue) Reset() {
queue.LastDeliveries = []string{}
}