2 // Copyright 2021 AT&T Intellectual Property
3 // Copyright 2021 Nokia
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
9 // http://www.apache.org/licenses/LICENSE-2.0
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.
17 // This source code is part of the near-RT RIC (RAN Intelligent Controller)
18 // platform project (RICP).
22 import "github.com/stretchr/testify/mock"
24 type MockSdlSyncStorage struct {
28 func (m *MockSdlSyncStorage) SubscribeChannel(ns string, cb func(string, ...string), channels ...string) error {
29 a := m.Called(ns, cb, channels)
33 func (m *MockSdlSyncStorage) UnsubscribeChannel(ns string, channels ...string) error {
34 a := m.Called(ns, channels)
38 func (m *MockSdlSyncStorage) SetAndPublish(ns string, channelsAndEvents []string, pairs ...interface{}) error {
39 a := m.Called(ns, channelsAndEvents, pairs)
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)
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)
53 func (m *MockSdlSyncStorage) RemoveAndPublish(ns string, channelsAndEvents []string, keys []string) error {
54 a := m.Called(ns, channelsAndEvents, keys)
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)
63 func (m *MockSdlSyncStorage) RemoveAllAndPublish(ns string, channelsAndEvents []string) error {
64 a := m.Called(ns, channelsAndEvents)
68 func (m *MockSdlSyncStorage) Set(ns string, pairs ...interface{}) error {
69 a := m.Called(ns, pairs)
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)
78 func (m *MockSdlSyncStorage) GetAll(ns string) ([]string, error) {
80 return a.Get(0).([]string), a.Error(1)
83 func (m *MockSdlSyncStorage) ListKeys(ns string, pattern string) ([]string, error) {
84 a := m.Called(ns, pattern)
85 return a.Get(0).([]string), a.Error(1)
88 func (m *MockSdlSyncStorage) Close() error {
93 func (m *MockSdlSyncStorage) Remove(ns string, keys []string) error {
94 a := m.Called(ns, keys)
98 func (m *MockSdlSyncStorage) RemoveAll(ns string) error {
103 func (m *MockSdlSyncStorage) SetIf(ns string, key string, oldData, newData interface{}) (bool, error) {
104 a := m.Called(ns, key, oldData, newData)
105 return a.Bool(0), a.Error(1)
108 func (m *MockSdlSyncStorage) SetIfNotExists(ns string, key string, data interface{}) (bool, error) {
109 a := m.Called(ns, key, data)
110 return a.Bool(0), a.Error(1)
112 func (m *MockSdlSyncStorage) RemoveIf(ns string, key string, data interface{}) (bool, error) {
113 a := m.Called(ns, key, data)
114 return a.Bool(0), a.Error(1)
117 func (m *MockSdlSyncStorage) AddMember(ns string, group string, member ...interface{}) error {
118 a := m.Called(ns, group, member)
122 func (m *MockSdlSyncStorage) RemoveMember(ns string, group string, member ...interface{}) error {
123 a := m.Called(ns, group, member)
126 func (m *MockSdlSyncStorage) RemoveGroup(ns string, group string) error {
127 a := m.Called(ns, group)
130 func (m *MockSdlSyncStorage) GetMembers(ns string, group string) ([]string, error) {
131 a := m.Called(ns, group)
132 return a.Get(0).([]string), a.Error(1)
134 func (m *MockSdlSyncStorage) IsMember(ns string, group string, member interface{}) (bool, error) {
135 a := m.Called(ns, group, member)
136 return a.Bool(0), a.Error(1)
138 func (m *MockSdlSyncStorage) GroupSize(ns string, group string) (int64, error) {
139 a := m.Called(ns, group)
140 return int64(a.Int(0)), a.Error(1)