if err != nil {
t.Errorf("TEST: %s", err.Error())
}
+ verifyE2KeyCount(t, 1)
+}
+
+func verifyE2KeyCount(t *testing.T, expectedCount int) {
+
+ count, err := mainCtrl.c.GetE2KeyCount()
+ if err != nil {
+ t.Errorf("TEST: %s", err.Error())
+ } else {
+ assert.Equal(t, expectedCount, count)
+ }
}
func TestReadSubscriptionFromSdl(t *testing.T) {
t.Log("TEST: All subscription removed from db")
}
-func (m *Mock) Set(pairs ...interface{}) error {
+func (m *Mock) Set(ns string, pairs ...interface{}) error {
var key string
var val string
m.marshalLock.Lock()
defer m.marshalLock.Unlock()
+ if ns != e2SubSdlNs {
+ return fmt.Errorf("Unexpected namespace '%s' error\n", ns)
+ }
+
if sdlShouldReturnError == true {
return GetSdlError()
}
return nil
}
-func (m *Mock) Get(keys []string) (map[string]interface{}, error) {
+func (m *Mock) Get(ns string, keys []string) (map[string]interface{}, error) {
retMap := make(map[string]interface{})
+
+ if ns != e2SubSdlNs {
+ 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 *Mock) GetAll() ([]string, error) {
+func (m *Mock) GetAll(ns string) ([]string, error) {
+
+ if ns != e2SubSdlNs {
+ return nil, fmt.Errorf("Unexpected namespace '%s' error\n", ns)
+ }
if sdlShouldReturnError == true {
return nil, GetSdlError()
return keys, nil
}
-func (m *Mock) Remove(keys []string) error {
+func (m *Mock) Remove(ns string, keys []string) error {
+
+ if ns != e2SubSdlNs {
+ 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 *Mock) RemoveAll() error {
+func (m *Mock) RemoveAll(ns string) error {
+
+ if ns != e2SubSdlNs {
+ return fmt.Errorf("Unexpected namespace '%s' error\n", ns)
+ }
for key := range m.e2SubsDb {
subId64, err := strconv.ParseUint(key, 10, 64)