2 // Copyright 2019 AT&T Intellectual Property
3 // Copyright 2019 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 MockSdlInstance struct {
28 func (m *MockSdlInstance) SubscribeChannel(cb func(string, ...string), channels ...string) error {
29 a := m.Called(cb, channels)
33 func (m *MockSdlInstance) UnsubscribeChannel(channels ...string) error {
34 a := m.Called(channels)
38 func (m *MockSdlInstance) SetAndPublish(channelsAndEvents []string, pairs ...interface{}) error {
39 a := m.Called(channelsAndEvents, pairs)
43 func (m *MockSdlInstance) SetIfAndPublish(channelsAndEvents []string, key string, oldData, newData interface{}) (bool, error) {
44 a := m.Called(channelsAndEvents, key, oldData, newData)
45 return a.Bool(0), a.Error(1)
48 func (m *MockSdlInstance) SetIfNotExistsAndPublish(channelsAndEvents []string, key string, data interface{}) (bool, error) {
49 a := m.Called(channelsAndEvents, key, data)
50 return a.Bool(0), a.Error(1)
53 func (m *MockSdlInstance) RemoveAndPublish(channelsAndEvents []string, keys []string) error {
54 a := m.Called(channelsAndEvents, keys)
58 func (m *MockSdlInstance) RemoveIfAndPublish(channelsAndEvents []string, key string, data interface{}) (bool, error) {
59 a := m.Called(channelsAndEvents, key, data)
60 return a.Bool(0), a.Error(1)
63 func (m *MockSdlInstance) RemoveAllAndPublish(channelsAndEvents []string) error {
64 a := m.Called(channelsAndEvents)
68 func (m *MockSdlInstance) Set(pairs ...interface{}) error {
73 func (m *MockSdlInstance) Get(keys []string) (map[string]interface{}, error) {
75 return a.Get(0).(map[string]interface{}), a.Error(1)
78 func (m *MockSdlInstance) GetAll() ([]string, error) {
80 return a.Get(0).([]string), a.Error(1)
83 func (m *MockSdlInstance) Close() error {
88 func (m *MockSdlInstance) Remove(keys []string) error {
93 func (m *MockSdlInstance) RemoveAll() error {
98 func (m *MockSdlInstance) SetIf(key string, oldData, newData interface{}) (bool, error) {
99 a := m.Called(key, oldData, newData)
100 return a.Bool(0), a.Error(1)
103 func (m *MockSdlInstance) SetIfNotExists(key string, data interface{}) (bool, error) {
104 a := m.Called(key, data)
105 return a.Bool(0), a.Error(1)
107 func (m *MockSdlInstance) RemoveIf(key string, data interface{}) (bool, error) {
108 a := m.Called(key, data)
109 return a.Bool(0), a.Error(1)
112 func (m *MockSdlInstance) AddMember(group string, member ...interface{}) error{
113 a := m.Called(group, member)
117 func (m *MockSdlInstance) RemoveMember(group string, member ...interface{}) error {
118 a := m.Called(group, member)
121 func (m *MockSdlInstance) RemoveGroup(group string) error {
125 func (m *MockSdlInstance) GetMembers(group string) ([]string, error) {
127 return a.Get(0).([]string), a.Error(1)
129 func (m *MockSdlInstance) IsMember(group string, member interface{}) (bool, error){
130 a := m.Called(group, member)
131 return a.Bool(0), a.Error(1)
133 func (m *MockSdlInstance) GroupSize(group string) (int64, error){
134 a := m.Called(group,)
135 return int64(a.Int(0)), a.Error(1)