RIC:1060: Change in PTL
[ric-plt/nodeb-rnib.git] / reader / sdlSyncStorageMock.go
1 //
2 // Copyright 2021 AT&T Intellectual Property
3 // Copyright 2021 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 //  This source code is part of the near-RT RIC (RAN Intelligent Controller)
18 //  platform project (RICP).
19
20 package reader
21
22 import "github.com/stretchr/testify/mock"
23
24 type MockSdlSyncStorage struct {
25         mock.Mock
26 }
27
28 func (m *MockSdlSyncStorage) SubscribeChannel(ns string, cb func(string, ...string), channels ...string) error {
29         a := m.Called(ns, cb, channels)
30         return a.Error(0)
31 }
32
33 func (m *MockSdlSyncStorage) UnsubscribeChannel(ns string, channels ...string) error {
34         a := m.Called(ns, channels)
35         return a.Error(0)
36 }
37
38 func (m *MockSdlSyncStorage) SetAndPublish(ns string, channelsAndEvents []string, pairs ...interface{}) error {
39         a := m.Called(ns, channelsAndEvents, pairs)
40         return a.Error(0)
41 }
42
43 func (m *MockSdlSyncStorage) SetIfAndPublish(ns string, channelsAndEvents []string, key string, oldData, newData interface{}) (bool, error) {
44         a := m.Called(ns, channelsAndEvents, key, oldData, newData)
45         return a.Bool(0), a.Error(1)
46 }
47
48 func (m *MockSdlSyncStorage) SetIfNotExistsAndPublish(ns string, channelsAndEvents []string, key string, data interface{}) (bool, error) {
49         a := m.Called(ns, channelsAndEvents, key, data)
50         return a.Bool(0), a.Error(1)
51 }
52
53 func (m *MockSdlSyncStorage) RemoveAndPublish(ns string, channelsAndEvents []string, keys []string) error {
54         a := m.Called(ns, channelsAndEvents, keys)
55         return a.Error(0)
56 }
57
58 func (m *MockSdlSyncStorage) RemoveIfAndPublish(ns string, channelsAndEvents []string, key string, data interface{}) (bool, error) {
59         a := m.Called(ns, channelsAndEvents, key, data)
60         return a.Bool(0), a.Error(1)
61 }
62
63 func (m *MockSdlSyncStorage) RemoveAllAndPublish(ns string, channelsAndEvents []string) error {
64         a := m.Called(ns, channelsAndEvents)
65         return a.Error(0)
66 }
67
68 func (m *MockSdlSyncStorage) Set(ns string, pairs ...interface{}) error {
69         a := m.Called(ns, pairs)
70         return a.Error(0)
71 }
72
73 func (m *MockSdlSyncStorage) Get(ns string, keys []string) (map[string]interface{}, error) {
74         a := m.Called(ns, keys)
75         return a.Get(0).(map[string]interface{}), a.Error(1)
76 }
77
78 func (m *MockSdlSyncStorage) GetAll(ns string) ([]string, error) {
79         a := m.Called(ns)
80         return a.Get(0).([]string), a.Error(1)
81 }
82
83 func (m *MockSdlSyncStorage) Close() error {
84         a := m.Called()
85         return a.Error(0)
86 }
87
88 func (m *MockSdlSyncStorage) Remove(ns string, keys []string) error {
89         a := m.Called(ns, keys)
90         return a.Error(0)
91 }
92
93 func (m *MockSdlSyncStorage) RemoveAll(ns string) error {
94         a := m.Called(ns)
95         return a.Error(0)
96 }
97
98 func (m *MockSdlSyncStorage) SetIf(ns string, key string, oldData, newData interface{}) (bool, error) {
99         a := m.Called(ns, key, oldData, newData)
100         return a.Bool(0), a.Error(1)
101 }
102
103 func (m *MockSdlSyncStorage) SetIfNotExists(ns string, key string, data interface{}) (bool, error) {
104         a := m.Called(ns, key, data)
105         return a.Bool(0), a.Error(1)
106 }
107 func (m *MockSdlSyncStorage) RemoveIf(ns string, key string, data interface{}) (bool, error) {
108         a := m.Called(ns, key, data)
109         return a.Bool(0), a.Error(1)
110 }
111
112 func (m *MockSdlSyncStorage) AddMember(ns string, group string, member ...interface{}) error {
113         a := m.Called(ns, group, member)
114         return a.Error(0)
115 }
116
117 func (m *MockSdlSyncStorage) RemoveMember(ns string, group string, member ...interface{}) error {
118         a := m.Called(ns, group, member)
119         return a.Error(0)
120 }
121 func (m *MockSdlSyncStorage) RemoveGroup(ns string, group string) error {
122         a := m.Called(ns, group)
123         return a.Error(0)
124 }
125 func (m *MockSdlSyncStorage) GetMembers(ns string, group string) ([]string, error) {
126         a := m.Called(ns, group)
127         return a.Get(0).([]string), a.Error(1)
128 }
129 func (m *MockSdlSyncStorage) IsMember(ns string, group string, member interface{}) (bool, error) {
130         a := m.Called(ns, group, member)
131         return a.Bool(0), a.Error(1)
132 }
133 func (m *MockSdlSyncStorage) GroupSize(ns string, group string) (int64, error) {
134         a := m.Called(ns, group)
135         return int64(a.Int(0)), a.Error(1)
136 }