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).
24 "github.com/stretchr/testify/assert"
27 //Deprecated: Will be removed in a future release and tests in sdlSyncStorageMock_test.go
28 //should be used instead.
29 func initSdlInstanceMockTest() (sdlInstanceMockTest *MockSdlInstance) {
30 sdlInstanceMockTest = new(MockSdlInstance)
34 //Deprecated: Will be removed in a future release and tests in sdlSyncStorageMock_test.go
35 //should be used instead.
36 func TestRemoveAll(t *testing.T){
37 sdlInstanceMockTest := initSdlInstanceMockTest()
38 sdlInstanceMockTest.On("RemoveAll").Return(nil)
39 err := sdlInstanceMockTest.RemoveAll()
43 //Deprecated: Will be removed in a future release and tests in sdlSyncStorageMock_test.go
44 //should be used instead.
45 func TestRemove(t *testing.T){
47 sdlInstanceMockTest := initSdlInstanceMockTest()
48 sdlInstanceMockTest.On("Remove", []string(data)).Return(nil)
49 err := sdlInstanceMockTest.Remove(data)
54 //Deprecated: Will be removed in a future release and tests in sdlSyncStorageMock_test.go
55 //should be used instead.
56 func TestRemoveIf(t *testing.T){
57 var data map[string]interface{}
59 sdlInstanceMockTest := initSdlInstanceMockTest()
60 sdlInstanceMockTest.On("RemoveIf", key, data).Return(true,nil)
61 res, err := sdlInstanceMockTest.RemoveIf(key, data)
67 //Deprecated: Will be removed in a future release and tests in sdlSyncStorageMock_test.go
68 //should be used instead.
69 func TestRemoveGroup(t *testing.T){
71 sdlInstanceMockTest := initSdlInstanceMockTest()
72 sdlInstanceMockTest.On("RemoveGroup", group).Return(nil)
73 err := sdlInstanceMockTest.RemoveGroup(group)
78 //Deprecated: Will be removed in a future release and tests in sdlSyncStorageMock_test.go
79 //should be used instead.
80 func TestRemoveIfAndPublish(t *testing.T){
81 var data map[string]interface{}
82 var channelsAndEvents []string
84 sdlInstanceMockTest := initSdlInstanceMockTest()
85 sdlInstanceMockTest.On("RemoveIfAndPublish", channelsAndEvents, key, data).Return(true,nil)
86 res, err := sdlInstanceMockTest.RemoveIfAndPublish(channelsAndEvents, key, data)
92 //Deprecated: Will be removed in a future release and tests in sdlSyncStorageMock_test.go
93 //should be used instead.
94 func TestRemoveAndPublish(t *testing.T){
95 var channelsAndEvents []string
97 sdlInstanceMockTest := initSdlInstanceMockTest()
98 sdlInstanceMockTest.On("RemoveAndPublish", []string(channelsAndEvents), []string(keys)).Return(nil)
99 err := sdlInstanceMockTest.RemoveAndPublish(channelsAndEvents, keys)
103 //Deprecated: Will be removed in a future release and tests in sdlSyncStorageMock_test.go
104 //should be used instead.
105 func TestRemoveAllAndPublish(t *testing.T){
106 var channelsAndEvents []string
107 sdlInstanceMockTest := initSdlInstanceMockTest()
108 sdlInstanceMockTest.On("RemoveAllAndPublish", []string(channelsAndEvents)).Return(nil)
109 err := sdlInstanceMockTest.RemoveAllAndPublish(channelsAndEvents)
113 //Deprecated: Will be removed in a future release and tests in sdlSyncStorageMock_test.go
114 //should be used instead.
115 func TestIsMember(t *testing.T){
116 var ret map[string]interface{}
117 sdlInstanceMockTest := initSdlInstanceMockTest()
118 sdlInstanceMockTest.On("IsMember", "group", ret).Return(true,nil)
119 res, err := sdlInstanceMockTest.IsMember("group", ret)
121 assert.NotNil(t, res)
124 //Deprecated: Will be removed in a future release and tests in sdlSyncStorageMock_test.go
125 //should be used instead.
126 func TestClose(t *testing.T){
127 sdlInstanceMockTest := initSdlInstanceMockTest()
128 sdlInstanceMockTest.On("Close").Return(nil)
129 err := sdlInstanceMockTest.Close()
133 //Deprecated: Will be removed in a future release and tests in sdlSyncStorageMock_test.go
134 //should be used instead.
135 func TestSetIfNotExists(t *testing.T){
136 var data map[string]interface{}
138 sdlInstanceMockTest := initSdlInstanceMockTest()
139 sdlInstanceMockTest.On("SetIfNotExists", key, data).Return(true,nil)
140 res, err := sdlInstanceMockTest.SetIfNotExists(key, data)
142 assert.NotNil(t, res)
145 //Deprecated: Will be removed in a future release and tests in sdlSyncStorageMock_test.go
146 //should be used instead.
147 func TestAddMember(t *testing.T){
148 var ret []interface{}
149 sdlInstanceMockTest := initSdlInstanceMockTest()
150 sdlInstanceMockTest.On("AddMember", "group", []interface{}{ret}).Return(nil)
151 err := sdlInstanceMockTest.AddMember("group", ret)
155 //Deprecated: Will be removed in a future release and tests in sdlSyncStorageMock_test.go
156 //should be used instead.
157 func TestRemoveMember(t *testing.T){
158 var ret []interface{}
159 sdlInstanceMockTest := initSdlInstanceMockTest()
160 sdlInstanceMockTest.On("RemoveMember", "group", []interface{}{ret}).Return(nil)
161 err := sdlInstanceMockTest.RemoveMember("group", ret)
165 //Deprecated: Will be removed in a future release and tests in sdlSyncStorageMock_test.go
166 //should be used instead.
167 func TestSetAndPublish(t *testing.T){
168 var pairs []interface{}
169 var channelsAndEvents []string
170 sdlInstanceMockTest := initSdlInstanceMockTest()
171 sdlInstanceMockTest.On("SetAndPublish", channelsAndEvents, []interface{}{pairs}).Return(nil)
172 err := sdlInstanceMockTest.SetAndPublish(channelsAndEvents, pairs)
176 //Deprecated: Will be removed in a future release and tests in sdlSyncStorageMock_test.go
177 //should be used instead.
178 func TestSetIfAndPublish(t *testing.T){
179 var newData map[string]interface{}
180 var oldData map[string]interface{}
182 sdlInstanceMockTest := initSdlInstanceMockTest()
183 sdlInstanceMockTest.On("SetIfAndPublish", group, "key", oldData, newData).Return(true, nil)
184 res, err := sdlInstanceMockTest.SetIfAndPublish(group, "key", oldData, newData)
186 assert.NotNil(t, res)
189 //Deprecated: Will be removed in a future release and tests in sdlSyncStorageMock_test.go
190 //should be used instead.
191 func TestSet(t *testing.T){
192 var pairs []interface{}
193 sdlInstanceMockTest := initSdlInstanceMockTest()
194 sdlInstanceMockTest.On("Set", []interface{}{pairs}).Return(nil)
195 err := sdlInstanceMockTest.Set(pairs)
199 //Deprecated: Will be removed in a future release and tests in sdlSyncStorageMock_test.go
200 //should be used instead.
201 func TestSetIf(t *testing.T){
202 var newData map[string]interface{}
203 var oldData map[string]interface{}
204 sdlInstanceMockTest := initSdlInstanceMockTest()
205 sdlInstanceMockTest.On("SetIf", "key", newData, oldData).Return(true, nil)
206 res, err := sdlInstanceMockTest.SetIf("key", newData, oldData)
208 assert.NotNil(t, res)
211 //Deprecated: Will be removed in a future release and tests in sdlSyncStorageMock_test.go
212 //should be used instead.
213 func TestGetAll(t *testing.T){
215 sdlInstanceMockTest := initSdlInstanceMockTest()
216 sdlInstanceMockTest.On("GetAll").Return(data, nil)
217 res, err := sdlInstanceMockTest.GetAll()
222 //Deprecated: Will be removed in a future release and tests in sdlSyncStorageMock_test.go
223 //should be used instead.
224 func TestSetIfNotExistsAndPublish(t *testing.T){
225 var data map[string]interface{}
226 var channelsAndEvents []string
227 sdlInstanceMockTest := initSdlInstanceMockTest()
228 sdlInstanceMockTest.On("SetIfNotExistsAndPublish", channelsAndEvents, "key", data).Return(true, nil)
229 res, err := sdlInstanceMockTest.SetIfNotExistsAndPublish(channelsAndEvents, "key", data)
231 assert.NotNil(t, res)