[RICPLT-1832] - update versions in go mod
[ric-plt/nodeb-rnib.git] / reader / sdlInstanceMock.go
1 //
2 // Copyright 2019 AT&T Intellectual Property
3 // Copyright 2019 Nokia
4 //
5 // Licensed under the Apache License, Version 2.0 (the "License");
6 // you may not use this file except in compliance with the License.
7 // You may obtain a copy of the License at
8 //
9 //      http://www.apache.org/licenses/LICENSE-2.0
10 //
11 // Unless required by applicable law or agreed to in writing, software
12 // distributed under the License is distributed on an "AS IS" BASIS,
13 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 // See the License for the specific language governing permissions and
15 // limitations under the License.
16
17 package reader
18
19 import "github.com/stretchr/testify/mock"
20
21 type MockSdlInstance struct {
22         mock.Mock
23 }
24
25 func (m *MockSdlInstance) SubscribeChannel(cb func(string, ...string), channels ...string) error {
26         a := m.Called(cb, channels)
27         return a.Error(0)
28 }
29
30 func (m *MockSdlInstance) UnsubscribeChannel(channels ...string) error {
31         a := m.Called(channels)
32         return a.Error(0)
33 }
34
35 func (m *MockSdlInstance) SetAndPublish(channelsAndEvents []string, pairs ...interface{}) error {
36         a := m.Called(channelsAndEvents, pairs)
37         return a.Error(0)
38 }
39
40 func (m *MockSdlInstance) SetIfAndPublish(channelsAndEvents []string, key string, oldData, newData interface{}) (bool, error) {
41         a := m.Called(channelsAndEvents, key, oldData, newData)
42         return a.Bool(0), a.Error(1)
43 }
44
45 func (m *MockSdlInstance) SetIfNotExistsAndPublish(channelsAndEvents []string, key string, data interface{}) (bool, error) {
46         a := m.Called(channelsAndEvents, key, data)
47         return a.Bool(0), a.Error(1)
48 }
49
50 func (m *MockSdlInstance) RemoveAndPublish(channelsAndEvents []string, keys []string) error {
51         a := m.Called(channelsAndEvents, keys)
52         return a.Error(0)
53 }
54
55 func (m *MockSdlInstance) RemoveIfAndPublish(channelsAndEvents []string, key string, data interface{}) (bool, error) {
56         a := m.Called(channelsAndEvents, key, data)
57         return a.Bool(0), a.Error(1)
58 }
59
60 func (m *MockSdlInstance) RemoveAllAndPublish(channelsAndEvents []string) error {
61         a := m.Called(channelsAndEvents)
62         return a.Error(0)
63 }
64
65 func (m *MockSdlInstance) Set(pairs ...interface{}) error {
66         a := m.Called(pairs)
67         return a.Error(0)
68 }
69
70 func (m *MockSdlInstance) Get(keys []string) (map[string]interface{}, error) {
71         a := m.Called(keys)
72         return a.Get(0).(map[string]interface{}), a.Error(1)
73 }
74
75 func (m *MockSdlInstance) GetAll() ([]string, error) {
76         a := m.Called()
77         return a.Get(0).([]string), a.Error(1)
78 }
79
80 func (m *MockSdlInstance) Close() error {
81         a := m.Called()
82         return a.Error(0)
83 }
84
85 func (m *MockSdlInstance) Remove(keys []string) error {
86         a := m.Called(keys)
87         return a.Error(0)
88 }
89
90 func (m *MockSdlInstance) RemoveAll() error {
91         a := m.Called()
92         return a.Error(0)
93 }
94
95 func (m *MockSdlInstance) SetIf(key string, oldData, newData interface{}) (bool, error) {
96         a := m.Called(key, oldData, newData)
97         return a.Bool(0), a.Error(1)
98 }
99
100 func (m *MockSdlInstance) SetIfNotExists(key string, data interface{}) (bool, error) {
101         a := m.Called(key, data)
102         return a.Bool(0), a.Error(1)
103 }
104 func (m *MockSdlInstance) RemoveIf(key string, data interface{}) (bool, error) {
105         a := m.Called(key, data)
106         return a.Bool(0), a.Error(1)
107 }
108
109 func (m *MockSdlInstance) AddMember(group string, member ...interface{}) error{
110         a := m.Called(group, member)
111         return a.Error(0)
112 }
113
114 func (m *MockSdlInstance) RemoveMember(group string, member ...interface{}) error {
115         a := m.Called(group, member)
116         return a.Error(0)
117 }
118 func (m *MockSdlInstance) RemoveGroup(group string) error {
119         a := m.Called(group)
120         return a.Error(0)
121 }
122 func (m *MockSdlInstance) GetMembers(group string) ([]string, error) {
123         a := m.Called(group)
124         return a.Get(0).([]string), a.Error(1)
125 }
126 func (m *MockSdlInstance) IsMember(group string, member interface{}) (bool, error){
127         a := m.Called(group, member)
128         return a.Bool(0), a.Error(1)
129 }
130 func (m *MockSdlInstance) GroupSize(group string) (int64, error){
131         a := m.Called(group,)
132         return int64(a.Int(0)), a.Error(1)
133 }