restSubscription.SubReqOngoing = true
restSubscription.SubDelReqOngoing = false
restSubscription.xAppIdToE2Id = make(map[int64]int64)
- restSubscription.Md5sum = "856e9546f6f7b65a13a86996f2d1686a"
+ restSubscription.lastReqMd5sum = "856e9546f6f7b65b13a86956f2e16f6a"
return restSubscription
}
t.Errorf("TEST: %s", err.Error())
}
restSubsDbMock.AddRestSubIdsInDb(restSubId)
+ verifyRESTKeyCount(t, 1)
+}
+
+func verifyRESTKeyCount(t *testing.T, expectedCount int) {
+
+ count, err := mainCtrl.c.GetRESTKeyCount()
+ if err != nil {
+ t.Errorf("TEST: %s", err.Error())
+ } else {
+ assert.Equal(t, expectedCount, count)
+ }
}
func TestReadRESTSubscriptionFromSdl(t *testing.T) {
t.Log("TEST: All subscription removed from db")
}
-func (m *RestSubsDbMock) Set(pairs ...interface{}) error {
+func (m *RestSubsDbMock) Set(ns string, pairs ...interface{}) error {
var key string
var val string
m.marshalLock.Lock()
defer m.marshalLock.Unlock()
+ if ns != restSubSdlNs {
+ return fmt.Errorf("Unexpected namespace '%s' error\n", ns)
+ }
+
if sdlRestShouldReturnError == true {
return GetSdlRestError()
}
return nil
}
-func (m *RestSubsDbMock) Get(keys []string) (map[string]interface{}, error) {
+func (m *RestSubsDbMock) Get(ns string, keys []string) (map[string]interface{}, error) {
retMap := make(map[string]interface{})
+
+ if ns != restSubSdlNs {
+ return nil, fmt.Errorf("Unexpected namespace '%s' error\n", ns)
+ }
+
if len(keys) == 0 {
return nil, fmt.Errorf("Get() error: len(key) == 0\n")
}
return retMap, nil
}
-func (m *RestSubsDbMock) GetAll() ([]string, error) {
+func (m *RestSubsDbMock) GetAll(ns string) ([]string, error) {
+
+ if ns != restSubSdlNs {
+ return nil, fmt.Errorf("Unexpected namespace '%s' error\n", ns)
+ }
if sdlRestShouldReturnError == true {
return nil, GetSdlRestError()
return keys, nil
}
-func (m *RestSubsDbMock) Remove(keys []string) error {
+func (m *RestSubsDbMock) Remove(ns string, keys []string) error {
+
+ if ns != restSubSdlNs {
+ return fmt.Errorf("Unexpected namespace '%s' error\n", ns)
+ }
+
if len(keys) == 0 {
return fmt.Errorf("Remove() error: len(key) == 0\n")
}
return nil
}
-func (m *RestSubsDbMock) RemoveAll() error {
+func (m *RestSubsDbMock) RemoveAll(ns string) error {
+
+ if ns != restSubSdlNs {
+ return fmt.Errorf("Unexpected namespace '%s' error\n", ns)
+ }
for key := range m.restSubsDb {