VOL-1334 : Fixed concurrency issues
- Semaphores were added at the different layers of the model
- Made the proxy interfaces more robust
- Eliminated problems while retrieving latest data in concurrent mode
Change-Id: I7854105d7effa10e5cb704f5d9917569ab184f84
diff --git a/db/model/child_type_test.go b/db/model/child_type_test.go
index 4659805..1fd81bc 100644
--- a/db/model/child_type_test.go
+++ b/db/model/child_type_test.go
@@ -24,10 +24,10 @@
*/
func Test_ChildType_01_CacheIsEmpty(t *testing.T) {
- if GetInstance().ChildrenFieldsCache != nil || len(GetInstance().ChildrenFieldsCache) > 0 {
- t.Errorf("GetInstance().ChildrenFieldsCache should be empty: %+v\n", GetInstance().ChildrenFieldsCache)
+ if getChildTypeCache().Cache != nil || len(getChildTypeCache().Cache) > 0 {
+ t.Errorf("getChildTypeCache().Cache should be empty: %+v\n", getChildTypeCache().Cache)
}
- t.Logf("GetInstance().ChildrenFieldsCache is empty - %+v\n", GetInstance().ChildrenFieldsCache)
+ t.Logf("getChildTypeCache().Cache is empty - %+v\n", getChildTypeCache().Cache)
}
/*
@@ -54,17 +54,17 @@
*/
func Test_ChildType_03_CacheHasOneEntry(t *testing.T) {
- if GetInstance().ChildrenFieldsCache == nil || len(GetInstance().ChildrenFieldsCache) != 1 {
- t.Errorf("GetInstance().ChildrenFieldsCache should have one entry: %+v\n", GetInstance().ChildrenFieldsCache)
+ if getChildTypeCache().Cache == nil || len(getChildTypeCache().Cache) != 1 {
+ t.Errorf("getChildTypeCache().Cache should have one entry: %+v\n", getChildTypeCache().Cache)
}
- t.Logf("GetInstance().ChildrenFieldsCache has one entry: %+v\n", GetInstance().ChildrenFieldsCache)
+ t.Logf("getChildTypeCache().Cache has one entry: %+v\n", getChildTypeCache().Cache)
}
/*
*/
-func Test_ChildType_04_ChildrenFieldsCache_Keys(t *testing.T) {
- for k := range GetInstance().ChildrenFieldsCache {
- t.Logf("GetInstance().ChildrenFieldsCache Key:%+v\n", k)
+func Test_ChildType_04_Cache_Keys(t *testing.T) {
+ for k := range getChildTypeCache().Cache {
+ t.Logf("getChildTypeCache().Cache Key:%+v\n", k)
}
}