blob: 437ae33eaf88af1f16d6831c14a3d1fd2244276e [file] [log] [blame]
dhirajverma7ea15482021-06-08 15:46:51 +03001//
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// This source code is part of the near-RT RIC (RAN Intelligent Controller)
18// platform project (RICP).
19
20package reader
21
22import (
23 "testing"
24 "github.com/stretchr/testify/assert"
25)
26
Timo Tietavainene9fee6f2021-09-16 15:21:47 +030027//Deprecated: Will be removed in a future release and tests in sdlSyncStorageMock_test.go
28//should be used instead.
dhirajverma7ea15482021-06-08 15:46:51 +030029func initSdlInstanceMockTest() (sdlInstanceMockTest *MockSdlInstance) {
30 sdlInstanceMockTest = new(MockSdlInstance)
31 return
32}
33
Timo Tietavainene9fee6f2021-09-16 15:21:47 +030034//Deprecated: Will be removed in a future release and tests in sdlSyncStorageMock_test.go
35//should be used instead.
dhirajverma7ea15482021-06-08 15:46:51 +030036func TestRemoveAll(t *testing.T){
37 sdlInstanceMockTest := initSdlInstanceMockTest()
38 sdlInstanceMockTest.On("RemoveAll").Return(nil)
39 err := sdlInstanceMockTest.RemoveAll()
40 assert.Nil(t, err)
41}
42
Timo Tietavainene9fee6f2021-09-16 15:21:47 +030043//Deprecated: Will be removed in a future release and tests in sdlSyncStorageMock_test.go
44//should be used instead.
dhirajverma7ea15482021-06-08 15:46:51 +030045func TestRemove(t *testing.T){
46 var data []string
47 sdlInstanceMockTest := initSdlInstanceMockTest()
48 sdlInstanceMockTest.On("Remove", []string(data)).Return(nil)
49 err := sdlInstanceMockTest.Remove(data)
50 assert.Nil(t, err)
51
52}
53
Timo Tietavainene9fee6f2021-09-16 15:21:47 +030054//Deprecated: Will be removed in a future release and tests in sdlSyncStorageMock_test.go
55//should be used instead.
dhirajverma7ea15482021-06-08 15:46:51 +030056func TestRemoveIf(t *testing.T){
57 var data map[string]interface{}
58 key := "key"
59 sdlInstanceMockTest := initSdlInstanceMockTest()
60 sdlInstanceMockTest.On("RemoveIf", key, data).Return(true,nil)
61 res, err := sdlInstanceMockTest.RemoveIf(key, data)
62 assert.Nil(t, err)
63 assert.NotNil(t, res)
64
65}
66
Timo Tietavainene9fee6f2021-09-16 15:21:47 +030067//Deprecated: Will be removed in a future release and tests in sdlSyncStorageMock_test.go
68//should be used instead.
dhirajverma7ea15482021-06-08 15:46:51 +030069func TestRemoveGroup(t *testing.T){
70 group := "group"
71 sdlInstanceMockTest := initSdlInstanceMockTest()
72 sdlInstanceMockTest.On("RemoveGroup", group).Return(nil)
73 err := sdlInstanceMockTest.RemoveGroup(group)
74 assert.Nil(t, err)
75
76}
77
Timo Tietavainene9fee6f2021-09-16 15:21:47 +030078//Deprecated: Will be removed in a future release and tests in sdlSyncStorageMock_test.go
79//should be used instead.
dhirajverma7ea15482021-06-08 15:46:51 +030080func TestRemoveIfAndPublish(t *testing.T){
81 var data map[string]interface{}
82 var channelsAndEvents []string
83 key := "key"
84 sdlInstanceMockTest := initSdlInstanceMockTest()
85 sdlInstanceMockTest.On("RemoveIfAndPublish", channelsAndEvents, key, data).Return(true,nil)
86 res, err := sdlInstanceMockTest.RemoveIfAndPublish(channelsAndEvents, key, data)
87 assert.Nil(t, err)
88 assert.NotNil(t, res)
89
90}
91
Timo Tietavainene9fee6f2021-09-16 15:21:47 +030092//Deprecated: Will be removed in a future release and tests in sdlSyncStorageMock_test.go
93//should be used instead.
dhirajverma7ea15482021-06-08 15:46:51 +030094func TestRemoveAndPublish(t *testing.T){
95 var channelsAndEvents []string
96 var keys []string
97 sdlInstanceMockTest := initSdlInstanceMockTest()
98 sdlInstanceMockTest.On("RemoveAndPublish", []string(channelsAndEvents), []string(keys)).Return(nil)
99 err := sdlInstanceMockTest.RemoveAndPublish(channelsAndEvents, keys)
100 assert.Nil(t, err)
101}
102
Timo Tietavainene9fee6f2021-09-16 15:21:47 +0300103//Deprecated: Will be removed in a future release and tests in sdlSyncStorageMock_test.go
104//should be used instead.
dhirajverma7ea15482021-06-08 15:46:51 +0300105func TestRemoveAllAndPublish(t *testing.T){
106 var channelsAndEvents []string
107 sdlInstanceMockTest := initSdlInstanceMockTest()
108 sdlInstanceMockTest.On("RemoveAllAndPublish", []string(channelsAndEvents)).Return(nil)
109 err := sdlInstanceMockTest.RemoveAllAndPublish(channelsAndEvents)
110 assert.Nil(t, err)
111}
112
Timo Tietavainene9fee6f2021-09-16 15:21:47 +0300113//Deprecated: Will be removed in a future release and tests in sdlSyncStorageMock_test.go
114//should be used instead.
dhirajverma7ea15482021-06-08 15:46:51 +0300115func 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)
120 assert.Nil(t, err)
121 assert.NotNil(t, res)
122}
123
Timo Tietavainene9fee6f2021-09-16 15:21:47 +0300124//Deprecated: Will be removed in a future release and tests in sdlSyncStorageMock_test.go
125//should be used instead.
dhirajverma7ea15482021-06-08 15:46:51 +0300126func TestClose(t *testing.T){
127 sdlInstanceMockTest := initSdlInstanceMockTest()
128 sdlInstanceMockTest.On("Close").Return(nil)
129 err := sdlInstanceMockTest.Close()
130 assert.Nil(t, err)
131}
132
Timo Tietavainene9fee6f2021-09-16 15:21:47 +0300133//Deprecated: Will be removed in a future release and tests in sdlSyncStorageMock_test.go
134//should be used instead.
dhirajverma7ea15482021-06-08 15:46:51 +0300135func TestSetIfNotExists(t *testing.T){
136 var data map[string]interface{}
137 key := "key"
138 sdlInstanceMockTest := initSdlInstanceMockTest()
139 sdlInstanceMockTest.On("SetIfNotExists", key, data).Return(true,nil)
140 res, err := sdlInstanceMockTest.SetIfNotExists(key, data)
141 assert.Nil(t, err)
142 assert.NotNil(t, res)
143}
dhirajverma54d6fb22021-06-15 09:33:25 +0300144
Timo Tietavainene9fee6f2021-09-16 15:21:47 +0300145//Deprecated: Will be removed in a future release and tests in sdlSyncStorageMock_test.go
146//should be used instead.
dhirajverma54d6fb22021-06-15 09:33:25 +0300147func 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)
152 assert.Nil(t, err)
153}
154
Timo Tietavainene9fee6f2021-09-16 15:21:47 +0300155//Deprecated: Will be removed in a future release and tests in sdlSyncStorageMock_test.go
156//should be used instead.
dhirajverma54d6fb22021-06-15 09:33:25 +0300157func 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)
162 assert.Nil(t, err)
163}
164
Timo Tietavainene9fee6f2021-09-16 15:21:47 +0300165//Deprecated: Will be removed in a future release and tests in sdlSyncStorageMock_test.go
166//should be used instead.
dhirajverma54d6fb22021-06-15 09:33:25 +0300167func 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)
173 assert.Nil(t, err)
174}
175
Timo Tietavainene9fee6f2021-09-16 15:21:47 +0300176//Deprecated: Will be removed in a future release and tests in sdlSyncStorageMock_test.go
177//should be used instead.
dhirajverma54d6fb22021-06-15 09:33:25 +0300178func TestSetIfAndPublish(t *testing.T){
179 var newData map[string]interface{}
180 var oldData map[string]interface{}
181 var group []string
182 sdlInstanceMockTest := initSdlInstanceMockTest()
183 sdlInstanceMockTest.On("SetIfAndPublish", group, "key", oldData, newData).Return(true, nil)
184 res, err := sdlInstanceMockTest.SetIfAndPublish(group, "key", oldData, newData)
185 assert.Nil(t, err)
186 assert.NotNil(t, res)
187}
188
Timo Tietavainene9fee6f2021-09-16 15:21:47 +0300189//Deprecated: Will be removed in a future release and tests in sdlSyncStorageMock_test.go
190//should be used instead.
dhirajverma54d6fb22021-06-15 09:33:25 +0300191func TestSet(t *testing.T){
192 var pairs []interface{}
193 sdlInstanceMockTest := initSdlInstanceMockTest()
194 sdlInstanceMockTest.On("Set", []interface{}{pairs}).Return(nil)
195 err := sdlInstanceMockTest.Set(pairs)
196 assert.Nil(t, err)
197}
198
Timo Tietavainene9fee6f2021-09-16 15:21:47 +0300199//Deprecated: Will be removed in a future release and tests in sdlSyncStorageMock_test.go
200//should be used instead.
dhirajverma54d6fb22021-06-15 09:33:25 +0300201func 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)
207 assert.Nil(t, err)
208 assert.NotNil(t, res)
209}
210
Timo Tietavainene9fee6f2021-09-16 15:21:47 +0300211//Deprecated: Will be removed in a future release and tests in sdlSyncStorageMock_test.go
212//should be used instead.
dhirajverma54d6fb22021-06-15 09:33:25 +0300213func TestGetAll(t *testing.T){
214 var data []string
215 sdlInstanceMockTest := initSdlInstanceMockTest()
216 sdlInstanceMockTest.On("GetAll").Return(data, nil)
217 res, err := sdlInstanceMockTest.GetAll()
218 assert.Nil(t, err)
219 assert.Nil(t, res)
220}
221
Timo Tietavainene9fee6f2021-09-16 15:21:47 +0300222//Deprecated: Will be removed in a future release and tests in sdlSyncStorageMock_test.go
223//should be used instead.
dhirajverma54d6fb22021-06-15 09:33:25 +0300224func 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)
230 assert.Nil(t, err)
231 assert.NotNil(t, res)
232}