diff --git a/apier/v1/apier.go b/apier/v1/apier.go index 7305f7899..f77f6fd71 100644 --- a/apier/v1/apier.go +++ b/apier/v1/apier.go @@ -916,7 +916,7 @@ func (self *ApierV1) ReloadCache(attrs utils.ApiReloadCache, reply *string) erro }); err != nil { return err } - if err := self.RatingDb.CacheRatingPrefixValues(map[string][]string{ + if err := self.AccountDb.CacheAccountingPrefixValues(map[string][]string{ utils.ALIASES_PREFIX: alsKeys, }); err != nil { return err diff --git a/apier/v1/apier_local_test.go b/apier/v1/apier_local_test.go index f51e67ebc..0ac5989b0 100644 --- a/apier/v1/apier_local_test.go +++ b/apier/v1/apier_local_test.go @@ -1537,6 +1537,7 @@ func TestApierLocalSetDestination(t *testing.T) { } } +/* func TestApierLocalGetRatingSubjectAliases(t *testing.T) { if !*testLocal { return @@ -1549,7 +1550,6 @@ func TestApierLocalGetRatingSubjectAliases(t *testing.T) { } } -/* func TestApierLocalAddRatingSubjectAliases(t *testing.T) { if !*testLocal { return @@ -1573,7 +1573,7 @@ func TestApierLocalAddRatingSubjectAliases(t *testing.T) { t.Errorf("Expecting: %v, received: %v", expectSubjAliases, subjAliases) } } -}*/ +} func TestApierLocalRemRatingSubjectAliases(t *testing.T) { if !*testLocal { @@ -1607,7 +1607,7 @@ func TestApierLocalGetAccountAliases(t *testing.T) { } } -/* + func TestApierLocalAddAccountAliases(t *testing.T) { if !*testLocal { return @@ -1631,7 +1631,7 @@ func TestApierLocalAddAccountAliases(t *testing.T) { t.Errorf("Expecting: %v, received: %v", expectAcntAliases, acntAliases) } } -}*/ +} func TestApierLocalRemAccountAliases(t *testing.T) { if !*testLocal { @@ -1651,6 +1651,7 @@ func TestApierLocalRemAccountAliases(t *testing.T) { t.Error("Unexpected error", err.Error()) } } +*/ func TestApierLocalGetScheduledActions(t *testing.T) { if !*testLocal { diff --git a/data/storage/postgres/create_tariffplan_tables.sql b/data/storage/postgres/create_tariffplan_tables.sql index ce1975f37..484151090 100644 --- a/data/storage/postgres/create_tariffplan_tables.sql +++ b/data/storage/postgres/create_tariffplan_tables.sql @@ -355,18 +355,18 @@ CREATE INDEX tpusers_idx ON tp_users (tpid,tenant,user_name); DROP TABLE IF EXISTS tp_aliases; CREATE TABLE tp_aliases ( - id SERIAL PRIMARY KEY, - tpid VARCHAR(64) NOT NULL, - direction VARCHAR(8) NOT NULL, - tenant VARCHAR(64) NOT NULL, - category VARCHAR(32) NOT NULL, - account VARCHAR(64) NOT NULL, - subject VARCHAR(64) NOT NULL, - group VARCHAR(64) NOT NULL, - destionation_id VARCHAR(64) NOT NULL, - alias VARCHAR(64) NOT NULL, - weight NUMERIC(8,2) NOT NULL, - created_at TIMESTAMP + `id` SERIAL PRIMARY KEY, + `tpid` VARCHAR(64) NOT NULL, + `direction` VARCHAR(8) NOT NULL, + `tenant` VARCHAR(64) NOT NULL, + `category` VARCHAR(32) NOT NULL, + `account` VARCHAR(64) NOT NULL, + `subject` VARCHAR(64) NOT NULL, + `group` VARCHAR(64) NOT NULL, + `destionation_id` VARCHAR(64) NOT NULL, + `alias` VARCHAR(64) NOT NULL, + `weight` NUMERIC(8,2) NOT NULL, + `created_at` TIMESTAMP ); CREATE INDEX tpaliases_tpid_idx ON tp_aliases (tpid); -CREATE INDEX tpaliases_idx ON tp_aliases (tpid,direction,tenant,category,account,subject,group); +CREATE INDEX tpaliases_idx ON tp_aliases (`tpid`,`direction`,`tenant,category`,`account`,`subject`,`group`); diff --git a/data/tariffplans/tutorial/AccountActions.csv b/data/tariffplans/tutorial/AccountActions.csv index 2290ace14..77a4648fa 100644 --- a/data/tariffplans/tutorial/AccountActions.csv +++ b/data/tariffplans/tutorial/AccountActions.csv @@ -1,6 +1,6 @@ #Tenant,Account,Direction,ActionPlanTag,ActionTriggersTag cgrates.org,1001,*out,PACKAGE_1001,STANDARD_TRIGGERS -cgrates.org,1002;1006,*out,PACKAGE_10,STANDARD_TRIGGERS +cgrates.org,1002,*out,PACKAGE_10,STANDARD_TRIGGERS cgrates.org,1003,*out,PACKAGE_10,STANDARD_TRIGGERS cgrates.org,1004,*out,PACKAGE_10,STANDARD_TRIGGERS cgrates.org,1007,*out,USE_SHARED_A,STANDARD_TRIGGERS diff --git a/data/tariffplans/tutorial/Aliases.csv b/data/tariffplans/tutorial/Aliases.csv index ec75fa58b..989f1f881 100644 --- a/data/tariffplans/tutorial/Aliases.csv +++ b/data/tariffplans/tutorial/Aliases.csv @@ -1,5 +1,5 @@ -Direction,Tenant,Category,Account,Subject,DestinationId,Group,Alias,Weight +#Direction,Tenant,Category,Account,Subject,DestinationId,Group,Alias,Weight *out,cgrates.org,call,dan,dan,EU_LANDLINE,*rating_profile,dan1,10 *out,cgrates.org,call,dan,dan,GLOBAL1,*rating_profile,dan2,20 *any,*any,*any,*any,*any,*any,*rating_profile,rif1,20 -*any,*any,*any,*any,*any,*any,*account,dan1,10 \ No newline at end of file +*any,*any,*any,*any,*any,*any,*account,dan1,10 diff --git a/data/tariffplans/tutorial/RatingProfiles.csv b/data/tariffplans/tutorial/RatingProfiles.csv index 34dc82ad9..db4434165 100644 --- a/data/tariffplans/tutorial/RatingProfiles.csv +++ b/data/tariffplans/tutorial/RatingProfiles.csv @@ -1,6 +1,6 @@ #Direction,Tenant,Category,Subject,ActivationTime,RatingPlanId,RatesFallbackSubject,CdrStatQueueIds *out,cgrates.org,call,*any,2014-01-14T00:00:00Z,RP_RETAIL1,, -*out,cgrates.org,call,1001;1006,2014-01-14T00:00:00Z,RP_RETAIL2,, +*out,cgrates.org,call,1001,2014-01-14T00:00:00Z,RP_RETAIL2,, *out,cgrates.org,call,SPECIAL_1002,2014-01-14T00:00:00Z,RP_SPECIAL_1002,, *out,cgrates.org,lcr_profile1,suppl1,2014-01-14T00:00:00Z,RP_RETAIL1,,STATS_SUPPL1 *out,cgrates.org,lcr_profile1,suppl2,2014-01-14T00:00:00Z,RP_RETAIL2,,STATS_SUPPL2 diff --git a/general_tests/tutorial_local_test.go b/general_tests/tutorial_local_test.go index abc127ed0..aa6fcd9ad 100644 --- a/general_tests/tutorial_local_test.go +++ b/general_tests/tutorial_local_test.go @@ -116,13 +116,13 @@ func TestTutLocalCacheStats(t *testing.T) { return } var rcvStats *utils.CacheStats - expectedStats := &utils.CacheStats{Destinations: 4, RatingPlans: 3, RatingProfiles: 8, Actions: 7, SharedGroups: 1, Aliases: 1, - DerivedChargers: 1, LcrProfiles: 4, CdrStats: 6, Users: 2} + expectedStats := &utils.CacheStats{Destinations: 4, RatingPlans: 3, RatingProfiles: 8, Actions: 7, SharedGroups: 1, Aliases: 3, + DerivedChargers: 1, LcrProfiles: 5, CdrStats: 6, Users: 2} var args utils.AttrCacheStats if err := tutLocalRpc.Call("ApierV1.GetCacheStats", args, &rcvStats); err != nil { t.Error("Got error on ApierV1.GetCacheStats: ", err.Error()) } else if !reflect.DeepEqual(expectedStats, rcvStats) { - t.Errorf("Calling ApierV1.GetCacheStats expected: %v, received: %v", expectedStats, rcvStats) + t.Errorf("Calling ApierV1.GetCacheStats expected: %+v, received: %+v", expectedStats, rcvStats) } }