X-Git-Url: https://gerrit.o-ran-sc.org/r/gitweb?a=blobdiff_plain;f=reader%2FsdlInstanceMock_test.go;h=437ae33eaf88af1f16d6831c14a3d1fd2244276e;hb=refs%2Ftags%2Fcommon%2Fv1.2.7;hp=fa147d86dd1dd77aa14147adb5b2269a8729fc24;hpb=7ea1548d526b8fd834162cd13b207dc1abaea558;p=ric-plt%2Fnodeb-rnib.git diff --git a/reader/sdlInstanceMock_test.go b/reader/sdlInstanceMock_test.go index fa147d8..437ae33 100644 --- a/reader/sdlInstanceMock_test.go +++ b/reader/sdlInstanceMock_test.go @@ -24,11 +24,15 @@ import ( "github.com/stretchr/testify/assert" ) +//Deprecated: Will be removed in a future release and tests in sdlSyncStorageMock_test.go +//should be used instead. func initSdlInstanceMockTest() (sdlInstanceMockTest *MockSdlInstance) { sdlInstanceMockTest = new(MockSdlInstance) return } +//Deprecated: Will be removed in a future release and tests in sdlSyncStorageMock_test.go +//should be used instead. func TestRemoveAll(t *testing.T){ sdlInstanceMockTest := initSdlInstanceMockTest() sdlInstanceMockTest.On("RemoveAll").Return(nil) @@ -36,6 +40,8 @@ func TestRemoveAll(t *testing.T){ assert.Nil(t, err) } +//Deprecated: Will be removed in a future release and tests in sdlSyncStorageMock_test.go +//should be used instead. func TestRemove(t *testing.T){ var data []string sdlInstanceMockTest := initSdlInstanceMockTest() @@ -45,6 +51,8 @@ func TestRemove(t *testing.T){ } +//Deprecated: Will be removed in a future release and tests in sdlSyncStorageMock_test.go +//should be used instead. func TestRemoveIf(t *testing.T){ var data map[string]interface{} key := "key" @@ -56,6 +64,8 @@ func TestRemoveIf(t *testing.T){ } +//Deprecated: Will be removed in a future release and tests in sdlSyncStorageMock_test.go +//should be used instead. func TestRemoveGroup(t *testing.T){ group := "group" sdlInstanceMockTest := initSdlInstanceMockTest() @@ -65,6 +75,8 @@ func TestRemoveGroup(t *testing.T){ } +//Deprecated: Will be removed in a future release and tests in sdlSyncStorageMock_test.go +//should be used instead. func TestRemoveIfAndPublish(t *testing.T){ var data map[string]interface{} var channelsAndEvents []string @@ -77,6 +89,8 @@ func TestRemoveIfAndPublish(t *testing.T){ } +//Deprecated: Will be removed in a future release and tests in sdlSyncStorageMock_test.go +//should be used instead. func TestRemoveAndPublish(t *testing.T){ var channelsAndEvents []string var keys []string @@ -86,6 +100,8 @@ func TestRemoveAndPublish(t *testing.T){ assert.Nil(t, err) } +//Deprecated: Will be removed in a future release and tests in sdlSyncStorageMock_test.go +//should be used instead. func TestRemoveAllAndPublish(t *testing.T){ var channelsAndEvents []string sdlInstanceMockTest := initSdlInstanceMockTest() @@ -94,6 +110,8 @@ func TestRemoveAllAndPublish(t *testing.T){ assert.Nil(t, err) } +//Deprecated: Will be removed in a future release and tests in sdlSyncStorageMock_test.go +//should be used instead. func TestIsMember(t *testing.T){ var ret map[string]interface{} sdlInstanceMockTest := initSdlInstanceMockTest() @@ -103,6 +121,8 @@ func TestIsMember(t *testing.T){ assert.NotNil(t, res) } +//Deprecated: Will be removed in a future release and tests in sdlSyncStorageMock_test.go +//should be used instead. func TestClose(t *testing.T){ sdlInstanceMockTest := initSdlInstanceMockTest() sdlInstanceMockTest.On("Close").Return(nil) @@ -110,6 +130,8 @@ func TestClose(t *testing.T){ assert.Nil(t, err) } +//Deprecated: Will be removed in a future release and tests in sdlSyncStorageMock_test.go +//should be used instead. func TestSetIfNotExists(t *testing.T){ var data map[string]interface{} key := "key" @@ -119,3 +141,92 @@ func TestSetIfNotExists(t *testing.T){ assert.Nil(t, err) assert.NotNil(t, res) } + +//Deprecated: Will be removed in a future release and tests in sdlSyncStorageMock_test.go +//should be used instead. +func TestAddMember(t *testing.T){ + var ret []interface{} + sdlInstanceMockTest := initSdlInstanceMockTest() + sdlInstanceMockTest.On("AddMember", "group", []interface{}{ret}).Return(nil) + err := sdlInstanceMockTest.AddMember("group", ret) + assert.Nil(t, err) +} + +//Deprecated: Will be removed in a future release and tests in sdlSyncStorageMock_test.go +//should be used instead. +func TestRemoveMember(t *testing.T){ + var ret []interface{} + sdlInstanceMockTest := initSdlInstanceMockTest() + sdlInstanceMockTest.On("RemoveMember", "group", []interface{}{ret}).Return(nil) + err := sdlInstanceMockTest.RemoveMember("group", ret) + assert.Nil(t, err) +} + +//Deprecated: Will be removed in a future release and tests in sdlSyncStorageMock_test.go +//should be used instead. +func TestSetAndPublish(t *testing.T){ + var pairs []interface{} + var channelsAndEvents []string + sdlInstanceMockTest := initSdlInstanceMockTest() + sdlInstanceMockTest.On("SetAndPublish", channelsAndEvents, []interface{}{pairs}).Return(nil) + err := sdlInstanceMockTest.SetAndPublish(channelsAndEvents, pairs) + assert.Nil(t, err) +} + +//Deprecated: Will be removed in a future release and tests in sdlSyncStorageMock_test.go +//should be used instead. +func TestSetIfAndPublish(t *testing.T){ + var newData map[string]interface{} + var oldData map[string]interface{} + var group []string + sdlInstanceMockTest := initSdlInstanceMockTest() + sdlInstanceMockTest.On("SetIfAndPublish", group, "key", oldData, newData).Return(true, nil) + res, err := sdlInstanceMockTest.SetIfAndPublish(group, "key", oldData, newData) + assert.Nil(t, err) + assert.NotNil(t, res) +} + +//Deprecated: Will be removed in a future release and tests in sdlSyncStorageMock_test.go +//should be used instead. +func TestSet(t *testing.T){ + var pairs []interface{} + sdlInstanceMockTest := initSdlInstanceMockTest() + sdlInstanceMockTest.On("Set", []interface{}{pairs}).Return(nil) + err := sdlInstanceMockTest.Set(pairs) + assert.Nil(t, err) +} + +//Deprecated: Will be removed in a future release and tests in sdlSyncStorageMock_test.go +//should be used instead. +func TestSetIf(t *testing.T){ + var newData map[string]interface{} + var oldData map[string]interface{} + sdlInstanceMockTest := initSdlInstanceMockTest() + sdlInstanceMockTest.On("SetIf", "key", newData, oldData).Return(true, nil) + res, err := sdlInstanceMockTest.SetIf("key", newData, oldData) + assert.Nil(t, err) + assert.NotNil(t, res) +} + +//Deprecated: Will be removed in a future release and tests in sdlSyncStorageMock_test.go +//should be used instead. +func TestGetAll(t *testing.T){ + var data []string + sdlInstanceMockTest := initSdlInstanceMockTest() + sdlInstanceMockTest.On("GetAll").Return(data, nil) + res, err := sdlInstanceMockTest.GetAll() + assert.Nil(t, err) + assert.Nil(t, res) +} + +//Deprecated: Will be removed in a future release and tests in sdlSyncStorageMock_test.go +//should be used instead. +func TestSetIfNotExistsAndPublish(t *testing.T){ + var data map[string]interface{} + var channelsAndEvents []string + sdlInstanceMockTest := initSdlInstanceMockTest() + sdlInstanceMockTest.On("SetIfNotExistsAndPublish", channelsAndEvents, "key", data).Return(true, nil) + res, err := sdlInstanceMockTest.SetIfNotExistsAndPublish(channelsAndEvents, "key", data) + assert.Nil(t, err) + assert.NotNil(t, res) +}