From 22f207441e665944c8eee1fa99ff8a12a78d5474 Mon Sep 17 00:00:00 2001 From: andronache Date: Tue, 16 Mar 2021 10:46:03 +0200 Subject: [PATCH] Replaced cache with opts in several structs --- apier/v1/accountprofiles.go | 7 +-- apier/v1/accountprofiles_it_test.go | 4 +- apier/v1/accountsv1_it_test.go | 18 +++--- apier/v1/filter_indexes_it_test.go | 57 ++++++++++--------- apier/v1/filterindexecache_it_test.go | 30 +++++----- apier/v1/filters.go | 6 -- apier/v1/filters_it_test.go | 6 +- apier/v1/full_remote_it_test.go | 4 +- apier/v1/rateprofiles.go | 8 --- apier/v1/rateprofiles_it_test.go | 10 ++-- apier/v1/remote_it_test.go | 2 +- apier/v1/replicate_it_test.go | 6 +- apier/v1/stats.go | 2 +- apier/v1/stats_it_test.go | 30 +++++----- apier/v2/attributes.go | 7 +-- apier/v2/attributes_it_test.go | 6 +- console/accounts_profile_set.go | 7 +-- console/attributes_profile_set.go | 6 +- console/stats_profile_set.go | 6 +- engine/libstats.go | 6 -- engine/z_actions_it_test.go | 2 +- general_tests/cdrs_it_test.go | 2 +- general_tests/doubleremove_it_test.go | 2 +- general_tests/filtered_replication_it_test.go | 6 +- general_tests/filters_it_test.go | 14 ++--- general_tests/sessions_concur_test.go | 2 +- utils/coreutils.go | 7 --- 27 files changed, 116 insertions(+), 147 deletions(-) diff --git a/apier/v1/accountprofiles.go b/apier/v1/accountprofiles.go index 07e00bccb..c369cd920 100644 --- a/apier/v1/accountprofiles.go +++ b/apier/v1/accountprofiles.go @@ -87,13 +87,8 @@ func (apierSv1 *APIerSv1) GetAccountProfileIDsCount(args *utils.TenantWithOpts, return } -type APIAccountProfileWithCache struct { - *utils.APIAccountProfile - Cache *string -} - //SetAccountProfile add/update a new Account Profile -func (apierSv1 *APIerSv1) SetAccountProfile(extAp *APIAccountProfileWithCache, reply *string) error { +func (apierSv1 *APIerSv1) SetAccountProfile(extAp *utils.APIAccountProfileWithOpts, reply *string) error { if missing := utils.MissingStructFields(extAp.APIAccountProfile, []string{utils.ID}); len(missing) != 0 { return utils.NewErrMandatoryIeMissing(missing...) } diff --git a/apier/v1/accountprofiles_it_test.go b/apier/v1/accountprofiles_it_test.go index cfeba4dbf..d726b5841 100644 --- a/apier/v1/accountprofiles_it_test.go +++ b/apier/v1/accountprofiles_it_test.go @@ -37,7 +37,7 @@ var ( accPrfCfgPath string accPrfCfg *config.CGRConfig accSRPC *rpc.Client - apiAccPrf *APIAccountProfileWithCache + apiAccPrf *utils.APIAccountProfileWithOpts accPrf *utils.AccountProfile accPrfConfigDIR string //run tests for specific configuration @@ -225,7 +225,7 @@ func testAccountSPing(t *testing.T) { } func testAccountSSettAccountProfile(t *testing.T) { - apiAccPrf = &APIAccountProfileWithCache{ + apiAccPrf = &utils.APIAccountProfileWithOpts{ APIAccountProfile: &utils.APIAccountProfile{ Tenant: "cgrates.org", ID: "id_test", diff --git a/apier/v1/accountsv1_it_test.go b/apier/v1/accountsv1_it_test.go index 42ad480a0..26c6f993e 100644 --- a/apier/v1/accountsv1_it_test.go +++ b/apier/v1/accountsv1_it_test.go @@ -441,7 +441,7 @@ func testAccountSv1DebitAbstracts(t *testing.T) { } func testAccountSv1SimpleDebit(t *testing.T) { - accPrfAPI := &APIAccountProfileWithCache{ + accPrfAPI := &utils.APIAccountProfileWithOpts{ APIAccountProfile: &utils.APIAccountProfile{ Tenant: "cgrates.org", ID: "CustomAccount", @@ -512,7 +512,7 @@ func testAccountSv1SimpleDebit(t *testing.T) { } func testAccountSv1DebitMultipleAcc(t *testing.T) { - accPrfAPI := &APIAccountProfileWithCache{ + accPrfAPI := &utils.APIAccountProfileWithOpts{ APIAccountProfile: &utils.APIAccountProfile{ Tenant: "cgrates.org", ID: "CustomAccount", @@ -554,7 +554,7 @@ func testAccountSv1DebitMultipleAcc(t *testing.T) { t.Errorf("Expecting : %+v, received: %+v", convAcc, reply2) } - accPrfAPI2 := &APIAccountProfileWithCache{ + accPrfAPI2 := &utils.APIAccountProfileWithOpts{ APIAccountProfile: &utils.APIAccountProfile{ Tenant: "cgrates.org", ID: "CustomAccount2", @@ -623,7 +623,7 @@ func testAccountSv1DebitMultipleAcc(t *testing.T) { } func testAccountSv1DebitMultipleAccLimited(t *testing.T) { - accPrfAPI := &APIAccountProfileWithCache{ + accPrfAPI := &utils.APIAccountProfileWithOpts{ APIAccountProfile: &utils.APIAccountProfile{ Tenant: "cgrates.org", ID: "CustomAccount", @@ -668,7 +668,7 @@ func testAccountSv1DebitMultipleAccLimited(t *testing.T) { t.Errorf("Expecting : %+v, received: %+v", convAcc, reply2) } - accPrfAPI2 := &APIAccountProfileWithCache{ + accPrfAPI2 := &utils.APIAccountProfileWithOpts{ APIAccountProfile: &utils.APIAccountProfile{ Tenant: "cgrates.org", ID: "CustomAccount2", @@ -737,7 +737,7 @@ func testAccountSv1DebitMultipleAccLimited(t *testing.T) { } func testAccountSv1DebitWithAttributeSandRateS(t *testing.T) { - accPrfAPI := &APIAccountProfileWithCache{ + accPrfAPI := &utils.APIAccountProfileWithOpts{ APIAccountProfile: &utils.APIAccountProfile{ Tenant: "cgrates.org", ID: "ACC_WITH_ATTRIBUTES", @@ -834,7 +834,7 @@ func testAccountSv1DebitWithAttributeSandRateS(t *testing.T) { } func testAccountSv1DebitWithRateS(t *testing.T) { - accPrfAPI := &APIAccountProfileWithCache{ + accPrfAPI := &utils.APIAccountProfileWithOpts{ APIAccountProfile: &utils.APIAccountProfile{ Tenant: "cgrates.org", ID: "ACC_WITH_RATES", @@ -931,7 +931,7 @@ func testAccountSv1DebitWithRateS(t *testing.T) { } func testAccountSv1DebitWithRateS2(t *testing.T) { - accPrfAPI := &APIAccountProfileWithCache{ + accPrfAPI := &utils.APIAccountProfileWithOpts{ APIAccountProfile: &utils.APIAccountProfile{ Tenant: "cgrates.org", ID: "ACC_WITH_RATES2", @@ -1035,7 +1035,7 @@ func testAccountSv1DebitWithRateS2(t *testing.T) { } func testAccountSv1MaxConcretes(t *testing.T) { - apiAccPrf = &APIAccountProfileWithCache{ + apiAccPrf = &utils.APIAccountProfileWithOpts{ APIAccountProfile: &utils.APIAccountProfile{ Tenant: "cgrates.org", ID: "1004", diff --git a/apier/v1/filter_indexes_it_test.go b/apier/v1/filter_indexes_it_test.go index 73455c3c3..a2af246b4 100644 --- a/apier/v1/filter_indexes_it_test.go +++ b/apier/v1/filter_indexes_it_test.go @@ -182,7 +182,7 @@ func testV1FIdxRpcConn(t *testing.T) { //ThresholdProfile func testV1FIdxSetThresholdProfile(t *testing.T) { var reply *engine.ThresholdProfile - filter = &FilterWithCache{ + filter = &engine.FilterWithOpts{ Filter: &engine.Filter{ Tenant: tenant, ID: "TestFilter", @@ -277,7 +277,7 @@ func testV1FIdxComputeThresholdsIndexes(t *testing.T) { func testV1FIdxSetSecondThresholdProfile(t *testing.T) { var reply *engine.ThresholdProfile - filter = &FilterWithCache{ + filter = &engine.FilterWithOpts{ Filter: &engine.Filter{ Tenant: tenant, ID: "TestFilter2", @@ -442,7 +442,7 @@ func testV1FIdxRemoveThresholdProfile(t *testing.T) { //StatQueueProfile func testV1FIdxSetStatQueueProfileIndexes(t *testing.T) { var reply *engine.StatQueueProfile - filter = &FilterWithCache{ + filter = &engine.FilterWithOpts{ Filter: &engine.Filter{ Tenant: tenant, ID: "FLTR_1", @@ -468,7 +468,7 @@ func testV1FIdxSetStatQueueProfileIndexes(t *testing.T) { err.Error() != utils.ErrNotFound.Error() { t.Error(err) } - statConfig = &engine.StatQueueWithCache{ + statConfig = &engine.StatQueueProfileWithOpts{ StatQueueProfile: &engine.StatQueueProfile{ Tenant: tenant, ID: "TEST_PROFILE1", @@ -545,7 +545,7 @@ func testV1FIdxComputeStatQueueProfileIndexes(t *testing.T) { func testV1FIdxSetSecondStatQueueProfileIndexes(t *testing.T) { var reply *engine.StatQueueProfile - filter = &FilterWithCache{ + filter = &engine.FilterWithOpts{ Filter: &engine.Filter{ Tenant: tenant, ID: "FLTR_2", @@ -571,7 +571,7 @@ func testV1FIdxSetSecondStatQueueProfileIndexes(t *testing.T) { err.Error() != utils.ErrNotFound.Error() { t.Error(err) } - statConfig = &engine.StatQueueWithCache{ + statConfig = &engine.StatQueueProfileWithOpts{ StatQueueProfile: &engine.StatQueueProfile{ Tenant: tenant, ID: "TEST_PROFILE2", @@ -691,7 +691,7 @@ func testV1FIdxRemoveStatQueueProfile(t *testing.T) { //ResourceProfile func testV1FIdxSetResourceProfileIndexes(t *testing.T) { var reply *engine.ResourceProfile - filter = &FilterWithCache{ + filter = &engine.FilterWithOpts{ Filter: &engine.Filter{ Tenant: tenant, ID: "FLTR_RES_RCFG1", @@ -784,7 +784,7 @@ func testV1FIdxComputeResourceProfileIndexes(t *testing.T) { func testV1FIdxSetSecondResourceProfileIndexes(t *testing.T) { var reply *engine.StatQueueProfile - filter = &FilterWithCache{ + filter = &engine.FilterWithOpts{ Filter: &engine.Filter{ Tenant: tenant, ID: "FLTR_2", @@ -919,7 +919,7 @@ func testV1FIdxRemoveResourceProfile(t *testing.T) { //RouteProfile func testV1FIdxSetRouteProfileIndexes(t *testing.T) { var reply *engine.RouteProfile - filter = &FilterWithCache{ + filter = &engine.FilterWithOpts{ Filter: &engine.Filter{ Tenant: tenant, ID: "FLTR_1", @@ -1019,7 +1019,7 @@ func testV1FIdxComputeRouteProfileIndexes(t *testing.T) { func testV1FIdxSetSecondRouteProfileIndexes(t *testing.T) { var reply *engine.RouteProfile - filter = &FilterWithCache{ + filter = &engine.FilterWithOpts{ Filter: &engine.Filter{ Tenant: tenant, ID: "FLTR_2", @@ -1162,7 +1162,7 @@ func testV1FIdxRemoveRouteProfile(t *testing.T) { //AccountProfile func testV1FISetAccountProfileIndexes(t *testing.T) { var reply *utils.AccountProfile - filter = &FilterWithCache{ + filter = &engine.FilterWithOpts{ Filter: &engine.Filter{ Tenant: tenant, ID: "ACCPRF_FLTR", @@ -1190,7 +1190,7 @@ func testV1FISetAccountProfileIndexes(t *testing.T) { } //set in db an accPrf then we will get it without errors - accPrf := &APIAccountProfileWithCache{ + accPrf := &utils.APIAccountProfileWithOpts{ APIAccountProfile: &utils.APIAccountProfile{ Tenant: tenant, ID: "ACC_PRF", @@ -1284,7 +1284,7 @@ func testV1FIComputeAccountProfileIndexes(t *testing.T) { func testV1FISetSecondFilterForAccountProfile(t *testing.T) { //new filter - filter = &FilterWithCache{ + filter = &engine.FilterWithOpts{ Filter: &engine.Filter{ Tenant: tenant, ID: "ACCPRF_FLTR2", @@ -1305,7 +1305,7 @@ func testV1FISetSecondFilterForAccountProfile(t *testing.T) { } //we will overwrite this AccPrf with our new filter - accPrf := &APIAccountProfileWithCache{ + accPrf := &utils.APIAccountProfileWithOpts{ APIAccountProfile: &utils.APIAccountProfile{ Tenant: tenant, ID: "ACC_PRF", @@ -1431,7 +1431,7 @@ func testV1FIRemoveAccountProfile(t *testing.T) { //ActionProfile func testV1FISetActionProfileIndexes(t *testing.T) { //set a new filter in db - filter = &FilterWithCache{ + filter = &engine.FilterWithOpts{ Filter: &engine.Filter{ Tenant: tenant, ID: "ACTION_FLTR", @@ -1596,7 +1596,7 @@ func testV1FIComputeActionProfileIndexes(t *testing.T) { func testVF1SetSecondActionProfile(t *testing.T) { //second filter in db - filter = &FilterWithCache{ + filter = &engine.FilterWithOpts{ Filter: &engine.Filter{ Tenant: tenant, ID: "ACTION_FLTR2", @@ -1784,7 +1784,7 @@ func testV1FIRemoveActionProfile(t *testing.T) { //RateProfileRate Indexes func testV1FISetRateProfileRatesIndexes(t *testing.T) { //set a filter for our rates - filter = &FilterWithCache{ + filter = &engine.FilterWithOpts{ Filter: &engine.Filter{ Tenant: tenant, ID: "RATE_FLTR1", @@ -1967,7 +1967,7 @@ func testV1FIComputeRateProfileRatesIndexes(t *testing.T) { func testV1FISetSecondRateProfileRate(t *testing.T) { //second filter for a new rate in the same rate profile - filter = &FilterWithCache{ + filter = &engine.FilterWithOpts{ Filter: &engine.Filter{ Tenant: tenant, ID: "RTPRF_FLTR3", @@ -2118,7 +2118,7 @@ func testVF1RemoveRateProfileRates(t *testing.T) { //removing rates from db will delete the indexes from db var result string if err := tFIdxRpc.Call(utils.APIerSv1RemoveRateProfileRates, - &RemoveRPrfRates{ID: "RP1", + &RemoveRPrfRatesWithOpts{ID: "RP1", Tenant: tenant, RateIDs: []string{"RT_WEEK", "RT_YEAR"}}, &result); err != nil { t.Error(err) @@ -2182,7 +2182,7 @@ func testVF1RemoveRateProfileRates(t *testing.T) { //no we will remove the left rate and the profile if err := tFIdxRpc.Call(utils.APIerSv1RemoveRateProfileRates, - &RemoveRPrfRates{ID: "RP1", + &RemoveRPrfRatesWithOpts{ID: "RP1", Tenant: tenant, RateIDs: []string{"RT_MONTH"}}, &result); err != nil { t.Error(err) @@ -2202,7 +2202,7 @@ func testVF1RemoveRateProfileRates(t *testing.T) { //RateProfile Indexes func testV1FISetRateProfileIndexes(t *testing.T) { //set a filter for our rates - filter = &FilterWithCache{ + filter = &engine.FilterWithOpts{ Filter: &engine.Filter{ Tenant: tenant, ID: "RATEFLTR_FLTR1", @@ -2389,7 +2389,7 @@ func testV1FIComputeRateProfileIndexes(t *testing.T) { func testV1FISetSecondRateProfile(t *testing.T) { //second filter for a new rate profile - filter = &FilterWithCache{ + filter = &engine.FilterWithOpts{ Filter: &engine.Filter{ Tenant: tenant, ID: "RTPRF_FLTR6", @@ -2526,8 +2526,10 @@ func testVF1RemoveRateProfile(t *testing.T) { //removing rate profile from db will delete the indexes from db var result string if err := tFIdxRpc.Call(utils.APIerSv1RemoveRateProfile, - &utils.TenantIDWithCache{ID: "RP2", + &utils.TenantIDWithOpts{TenantID: &utils.TenantID{ + ID: "RP2", Tenant: tenant}, + }, &result); err != nil { t.Error(err) } else if result != utils.OK { @@ -2535,8 +2537,9 @@ func testVF1RemoveRateProfile(t *testing.T) { } if err := tFIdxRpc.Call(utils.APIerSv1RemoveRateProfile, - &utils.TenantIDWithCache{ID: "RP3", - Tenant: tenant}, + &utils.TenantIDWithOpts{TenantID: &utils.TenantID{ + ID: "RP3", + Tenant: tenant}}, &result); err != nil { t.Error(err) } else if result != utils.OK { @@ -2569,7 +2572,7 @@ func testVF1RemoveRateProfile(t *testing.T) { //AttributeProfile Indexes func testV1FIdxSetAttributeProfileIndexes(t *testing.T) { var reply *engine.AttributeProfile - filter = &FilterWithCache{ + filter = &engine.FilterWithOpts{ Filter: &engine.Filter{ Tenant: tenant, ID: "FLTR_1", @@ -2677,7 +2680,7 @@ func testV1FIdxComputeAttributeProfileIndexes(t *testing.T) { func testV1FIdxSetSecondAttributeProfileIndexes(t *testing.T) { var reply *engine.AttributeProfile - filter = &FilterWithCache{ + filter = &engine.FilterWithOpts{ Filter: &engine.Filter{ Tenant: tenant, ID: "FLTR_2", diff --git a/apier/v1/filterindexecache_it_test.go b/apier/v1/filterindexecache_it_test.go index 32771ddf6..f4f840683 100644 --- a/apier/v1/filterindexecache_it_test.go +++ b/apier/v1/filterindexecache_it_test.go @@ -163,7 +163,7 @@ func testV1FIdxCaProcessEventWithNotFound(t *testing.T) { } func testV1FIdxCaSetThresholdProfile(t *testing.T) { - filter = &FilterWithCache{ + filter = &engine.FilterWithOpts{ Filter: &engine.Filter{ Tenant: "cgrates.org", ID: "TestFilter", @@ -269,7 +269,7 @@ func testV1FIdxCaGetThresholdFromTP(t *testing.T) { func testV1FIdxCaUpdateThresholdProfile(t *testing.T) { var result string - filter = &FilterWithCache{ + filter = &engine.FilterWithOpts{ Filter: &engine.Filter{ Tenant: "cgrates.org", ID: "TestFilter2", @@ -361,7 +361,7 @@ func testV1FIdxCaUpdateThresholdProfile(t *testing.T) { func testV1FIdxCaUpdateThresholdProfileFromTP(t *testing.T) { var result string - filter = &FilterWithCache{ + filter = &engine.FilterWithOpts{ Filter: &engine.Filter{ Tenant: "cgrates.org", ID: "TestFilter3", @@ -557,7 +557,7 @@ func testV1FIdxCaGetStatQueuesWithNotFound(t *testing.T) { func testV1FIdxCaSetStatQueueProfile(t *testing.T) { tenant := "cgrates.org" - filter = &FilterWithCache{ + filter = &engine.FilterWithOpts{ Filter: &engine.Filter{ Tenant: tenant, ID: "FLTR_1", @@ -585,7 +585,7 @@ func testV1FIdxCaSetStatQueueProfile(t *testing.T) { } else if result != utils.OK { t.Error("Unexpected reply returned", result) } - statConfig = &engine.StatQueueWithCache{ + statConfig = &engine.StatQueueProfileWithOpts{ StatQueueProfile: &engine.StatQueueProfile{ Tenant: "cgrates.org", ID: "TEST_PROFILE1", @@ -720,7 +720,7 @@ func testV1FIdxCaGetStatQueuesFromTP(t *testing.T) { } func testV1FIdxCaUpdateStatQueueProfile(t *testing.T) { - filter = &FilterWithCache{ + filter = &engine.FilterWithOpts{ Filter: &engine.Filter{ Tenant: "cgrates.org", ID: "FLTR_2", @@ -747,7 +747,7 @@ func testV1FIdxCaUpdateStatQueueProfile(t *testing.T) { } else if result != utils.OK { t.Error("Unexpected reply returned", result) } - statConfig = &engine.StatQueueWithCache{ + statConfig = &engine.StatQueueProfileWithOpts{ StatQueueProfile: &engine.StatQueueProfile{ Tenant: "cgrates.org", ID: "TEST_PROFILE1", @@ -798,7 +798,7 @@ func testV1FIdxCaUpdateStatQueueProfile(t *testing.T) { } func testV1FIdxCaUpdateStatQueueProfileFromTP(t *testing.T) { - filter = &FilterWithCache{ + filter = &engine.FilterWithOpts{ Filter: &engine.Filter{ Tenant: "cgrates.org", ID: "FLTR_3", @@ -833,7 +833,7 @@ func testV1FIdxCaUpdateStatQueueProfileFromTP(t *testing.T) { reply.FilterIDs = []string{"FLTR_3"} reply.ActivationInterval = &utils.ActivationInterval{ActivationTime: time.Date(2014, 7, 14, 14, 25, 0, 0, time.UTC)} if err := tFIdxCaRpc.Call(utils.APIerSv1SetStatQueueProfile, - &engine.StatQueueWithCache{StatQueueProfile: &reply}, &result); err != nil { + &engine.StatQueueProfileWithOpts{StatQueueProfile: &reply}, &result); err != nil { t.Error(err) } else if result != utils.OK { t.Error("Unexpected reply returned", result) @@ -968,7 +968,7 @@ func testV1FIdxCaProcessAttributeProfileEventWithNotFound(t *testing.T) { } func testV1FIdxCaSetAttributeProfile(t *testing.T) { - filter = &FilterWithCache{ + filter = &engine.FilterWithOpts{ Filter: &engine.Filter{ Tenant: "cgrates.org", ID: "TestFilter", @@ -1061,7 +1061,7 @@ func testV1FIdxCaGetAttributeProfileFromTP(t *testing.T) { } func testV1FIdxCaUpdateAttributeProfile(t *testing.T) { - filter = &FilterWithCache{ + filter = &engine.FilterWithOpts{ Filter: &engine.Filter{ Tenant: "cgrates.org", ID: "TestFilter2", @@ -1134,7 +1134,7 @@ func testV1FIdxCaUpdateAttributeProfile(t *testing.T) { } func testV1FIdxCaUpdateAttributeProfileFromTP(t *testing.T) { - filter = &FilterWithCache{ + filter = &engine.FilterWithOpts{ Filter: &engine.Filter{ Tenant: "cgrates.org", ID: "TestFilter3", @@ -1298,7 +1298,7 @@ func testV1FIdxCaGetResourceProfileWithNotFound(t *testing.T) { } func testV1FIdxCaSetResourceProfile(t *testing.T) { - filter = &FilterWithCache{ + filter = &engine.FilterWithOpts{ Filter: &engine.Filter{ Tenant: "cgrates.org", ID: "FLTR_RES_RCFG1", @@ -1427,7 +1427,7 @@ func testV1FIdxCaGetResourceProfileFromTP(t *testing.T) { } func testV1FIdxCaUpdateResourceProfile(t *testing.T) { - filter = &FilterWithCache{ + filter = &engine.FilterWithOpts{ Filter: &engine.Filter{ Tenant: "cgrates.org", ID: "FLTR_RES_RCFG2", @@ -1503,7 +1503,7 @@ func testV1FIdxCaUpdateResourceProfile(t *testing.T) { } func testV1FIdxCaUpdateResourceProfileFromTP(t *testing.T) { - filter = &FilterWithCache{ + filter = &engine.FilterWithOpts{ Filter: &engine.Filter{ Tenant: "cgrates.org", ID: "FLTR_RES_RCFG3", diff --git a/apier/v1/filters.go b/apier/v1/filters.go index 06a5c988f..60e8cd176 100644 --- a/apier/v1/filters.go +++ b/apier/v1/filters.go @@ -25,12 +25,6 @@ import ( "github.com/cgrates/cgrates/utils" ) -type FilterWithCache struct { - *engine.Filter - Cache *string - Opts map[string]interface{} -} - //SetFilter add a new Filter func (apierSv1 *APIerSv1) SetFilter(arg *engine.FilterWithOpts, reply *string) error { if missing := utils.MissingStructFields(arg.Filter, []string{utils.ID}); len(missing) != 0 { diff --git a/apier/v1/filters_it_test.go b/apier/v1/filters_it_test.go index f4b948a5d..e6518ae40 100644 --- a/apier/v1/filters_it_test.go +++ b/apier/v1/filters_it_test.go @@ -36,7 +36,7 @@ var ( filterCfgPath string filterCfg *config.CGRConfig filterRPC *rpc.Client - filter *FilterWithCache + filter *engine.FilterWithOpts filterConfigDIR string //run tests for specific configuration sTestsFilter = []func(t *testing.T){ @@ -118,7 +118,7 @@ func testFilterGetFilterBeforeSet(t *testing.T) { } func testFilterSetFilter(t *testing.T) { - filter = &FilterWithCache{ + filter = &engine.FilterWithOpts{ Filter: &engine.Filter{ Tenant: "cgrates.org", ID: "Filter1", @@ -225,7 +225,7 @@ func testFilterKillEngine(t *testing.T) { } func testFilterSetFilterWithoutTenant(t *testing.T) { - filter = &FilterWithCache{ + filter = &engine.FilterWithOpts{ Filter: &engine.Filter{ ID: "FilterWithoutTenant", Rules: []*engine.FilterRule{ diff --git a/apier/v1/full_remote_it_test.go b/apier/v1/full_remote_it_test.go index 07b0b25b5..8d18cd309 100644 --- a/apier/v1/full_remote_it_test.go +++ b/apier/v1/full_remote_it_test.go @@ -192,7 +192,7 @@ func testFullRemoteITStatQueue(t *testing.T) { } var replySet string - stat := &engine.StatQueueWithCache{ + stat := &engine.StatQueueProfileWithOpts{ StatQueueProfile: &engine.StatQueueProfile{ Tenant: "cgrates.org", ID: "TEST_PROFILE1", @@ -730,7 +730,7 @@ func testFullRemoteITAccount(t *testing.T) { t.Fatal(err) } - apiAccPrf := &APIAccountProfileWithCache{ + apiAccPrf := &utils.APIAccountProfileWithOpts{ APIAccountProfile: &utils.APIAccountProfile{ Tenant: "cgrates.org", ID: "1001", diff --git a/apier/v1/rateprofiles.go b/apier/v1/rateprofiles.go index 95ba73a1d..2720c7fa9 100644 --- a/apier/v1/rateprofiles.go +++ b/apier/v1/rateprofiles.go @@ -142,14 +142,6 @@ func (apierSv1 *APIerSv1) SetRateProfileRates(ext *engine.APIRateProfileWithOpts return nil } -type RemoveRPrfRates struct { - Tenant string - ID string - RateIDs []string - Cache *string - Opts map[string]interface{} -} - type RemoveRPrfRatesWithOpts struct { Tenant string ID string diff --git a/apier/v1/rateprofiles_it_test.go b/apier/v1/rateprofiles_it_test.go index 4b2f03728..fe91c71db 100644 --- a/apier/v1/rateprofiles_it_test.go +++ b/apier/v1/rateprofiles_it_test.go @@ -493,7 +493,7 @@ func testV1RatePrfRemoveRateProfileRates(t *testing.T) { } if err := ratePrfRpc.Call(utils.APIerSv1RemoveRateProfileRates, - &RemoveRPrfRates{ + &RemoveRPrfRatesWithOpts{ Tenant: "cgrates.org", ID: "SpecialRate", RateIDs: []string{"RT_WEEKEND"}, @@ -557,7 +557,7 @@ func testV1RatePrfRemoveRateProfileRates(t *testing.T) { } if err := ratePrfRpc.Call(utils.APIerSv1RemoveRateProfileRates, - &RemoveRPrfRates{ + &RemoveRPrfRatesWithOpts{ Tenant: "cgrates.org", ID: "SpecialRate", }, &reply); err != nil { @@ -814,7 +814,7 @@ func testV1RatePrfGetRateProfileRatesWithoutTenant(t *testing.T) { func testV1RatePrfRemoveRateProfileRatesWithoutTenant(t *testing.T) { var reply string if err := ratePrfRpc.Call(utils.APIerSv1RemoveRateProfileRates, - &RemoveRPrfRates{ID: "SpecialRate"}, + &RemoveRPrfRatesWithOpts{ID: "SpecialRate"}, &reply); err != nil { t.Error(err) } else if reply != utils.OK { @@ -1339,7 +1339,7 @@ func testV1RateCostForEventSpecial(t *testing.T) { Increment: secDecimal, }}, } - rPrf := &RateProfileWithCache{ + rPrf := &engine.RateProfileWithOpts{ RateProfileWithOpts: &engine.RateProfileWithOpts{ RateProfile: &engine.RateProfile{ ID: "RateChristmas", @@ -1490,7 +1490,7 @@ func testV1RateCostForEventThreeRates(t *testing.T) { }, }, } - rPrf := &RateProfileWithCache{ + rPrf := &engine.RateProfileWithOpts{ RateProfileWithOpts: &engine.RateProfileWithOpts{ RateProfile: &engine.RateProfile{ ID: "RateNewYear", diff --git a/apier/v1/remote_it_test.go b/apier/v1/remote_it_test.go index f5c767c92..55c1badf3 100644 --- a/apier/v1/remote_it_test.go +++ b/apier/v1/remote_it_test.go @@ -1088,7 +1088,7 @@ func testInternalSetAccount(t *testing.T) { func testInternalReplicateStats(t *testing.T) { var reply string - statConfig = &engine.StatQueueWithCache{ + statConfig = &engine.StatQueueProfileWithOpts{ StatQueueProfile: &engine.StatQueueProfile{ Tenant: "cgrates.org", ID: "StatsToReplicate", diff --git a/apier/v1/replicate_it_test.go b/apier/v1/replicate_it_test.go index 4bcb773e8..be3f1f90e 100644 --- a/apier/v1/replicate_it_test.go +++ b/apier/v1/replicate_it_test.go @@ -423,7 +423,7 @@ func testInternalReplicateITStatQueueProfile(t *testing.T) { t.Error(err) } // set - statConfig = &engine.StatQueueWithCache{ + statConfig = &engine.StatQueueProfileWithOpts{ StatQueueProfile: &engine.StatQueueProfile{ Tenant: tenant, ID: "TEST_PROFILE1", @@ -698,7 +698,7 @@ func testInternalReplicateITFilter(t *testing.T) { t.Error(err) } //set - filter = &FilterWithCache{ + filter = &engine.FilterWithOpts{ Filter: &engine.Filter{ Tenant: "cgrates.org", ID: "Filter1", @@ -981,7 +981,7 @@ func testInternalReplicateITThresholdProfile(t *testing.T) { t.Error(err) } // set - filter = &FilterWithCache{ + filter = &engine.FilterWithOpts{ Filter: &engine.Filter{ Tenant: tenant, ID: "TestFilter", diff --git a/apier/v1/stats.go b/apier/v1/stats.go index 5cc1e838e..b2d3adec2 100644 --- a/apier/v1/stats.go +++ b/apier/v1/stats.go @@ -66,7 +66,7 @@ func (apierSv1 *APIerSv1) GetStatQueueProfileIDs(args *utils.PaginatorWithTenant } // SetStatQueueProfile alters/creates a StatQueueProfile -func (apierSv1 *APIerSv1) SetStatQueueProfile(arg *engine.StatQueueWithCache, reply *string) (err error) { +func (apierSv1 *APIerSv1) SetStatQueueProfile(arg *engine.StatQueueProfileWithOpts, reply *string) (err error) { if missing := utils.MissingStructFields(arg.StatQueueProfile, []string{utils.ID}); len(missing) != 0 { return utils.NewErrMandatoryIeMissing(missing...) } diff --git a/apier/v1/stats_it_test.go b/apier/v1/stats_it_test.go index c06026181..eb2e452bb 100644 --- a/apier/v1/stats_it_test.go +++ b/apier/v1/stats_it_test.go @@ -37,7 +37,7 @@ var ( stsV1CfgPath string stsV1Cfg *config.CGRConfig stsV1Rpc *rpc.Client - statConfig *engine.StatQueueWithCache + statConfig *engine.StatQueueProfileWithOpts stsV1ConfDIR string //run tests for specific configuration evs = []*utils.CGREvent{ @@ -424,7 +424,7 @@ func testV1STSGetStatsAfterRestart(t *testing.T) { func testV1STSSetStatQueueProfile(t *testing.T) { var result string var reply *engine.StatQueueProfile - statConfig = &engine.StatQueueWithCache{ + statConfig = &engine.StatQueueProfileWithOpts{ StatQueueProfile: &engine.StatQueueProfile{ Tenant: "cgrates.org", ID: "TEST_PROFILE1", @@ -461,7 +461,7 @@ func testV1STSSetStatQueueProfile(t *testing.T) { t.Fatal(err) } statConfig.FilterIDs = []string{"FLTR_1"} - filter = &FilterWithCache{ + filter = &engine.FilterWithOpts{ Filter: &engine.Filter{ Tenant: "cgrates.org", ID: "FLTR_1", @@ -519,7 +519,7 @@ func testV1STSGetStatQueueProfileIDs(t *testing.T) { func testV1STSUpdateStatQueueProfile(t *testing.T) { var result string - filter = &FilterWithCache{ + filter = &engine.FilterWithOpts{ Filter: &engine.Filter{ Tenant: "cgrates.org", ID: "FLTR_2", @@ -576,7 +576,7 @@ func testV1STSRemoveStatQueueProfile(t *testing.T) { } func testV1STSProcessMetricsWithFilter(t *testing.T) { - statConfig = &engine.StatQueueWithCache{ + statConfig = &engine.StatQueueProfileWithOpts{ StatQueueProfile: &engine.StatQueueProfile{ Tenant: "cgrates.org", ID: "CustomStatProfile", @@ -701,7 +701,7 @@ func testV1STSProcessMetricsWithFilter(t *testing.T) { } func testV1STSProcessStaticMetrics(t *testing.T) { - statConfig = &engine.StatQueueWithCache{ + statConfig = &engine.StatQueueProfileWithOpts{ StatQueueProfile: &engine.StatQueueProfile{ Tenant: "cgrates.org", ID: "StaticStatQueue", @@ -824,7 +824,7 @@ func testV1STSStatsPing(t *testing.T) { } func testV1STSProcessStatWithThreshold(t *testing.T) { - stTh := &engine.StatQueueWithCache{ + stTh := &engine.StatQueueProfileWithOpts{ StatQueueProfile: &engine.StatQueueProfile{ Tenant: "cgrates.org", ID: "StatWithThreshold", @@ -904,7 +904,7 @@ func testV1STSProcessStatWithThreshold(t *testing.T) { } func testV1STSProcessCDRStat(t *testing.T) { - statConfig = &engine.StatQueueWithCache{ + statConfig = &engine.StatQueueProfileWithOpts{ StatQueueProfile: &engine.StatQueueProfile{ Tenant: "cgrates.org", ID: "StatForCDR", @@ -1039,7 +1039,7 @@ func testV1STSProcessCDRStat(t *testing.T) { } func testV1STSOverWriteStats(t *testing.T) { - initStat := &engine.StatQueueWithCache{ + initStat := &engine.StatQueueProfileWithOpts{ StatQueueProfile: &engine.StatQueueProfile{ Tenant: "cgrates.org", ID: "InitStat", @@ -1089,7 +1089,7 @@ func testV1STSOverWriteStats(t *testing.T) { t.Errorf("expecting: %+v, received reply: %s", expectedMetrics, metrics) } // set the new profile with other metric and make sure the statQueue is updated - initStat2 := &engine.StatQueueWithCache{ + initStat2 := &engine.StatQueueProfileWithOpts{ StatQueueProfile: &engine.StatQueueProfile{ Tenant: "cgrates.org", ID: "InitStat", @@ -1131,7 +1131,7 @@ func testV1STSOverWriteStats(t *testing.T) { } func testV1STSProcessStatWithThreshold2(t *testing.T) { - stTh := &engine.StatQueueWithCache{ + stTh := &engine.StatQueueProfileWithOpts{ StatQueueProfile: &engine.StatQueueProfile{ Tenant: "cgrates.org", ID: "StatWithThreshold2", @@ -1253,7 +1253,7 @@ func BenchmarkSTSV1GetQueueStringMetrics(b *testing.B) { } func testV1STSGetStatQueueProfileWithoutTenant(t *testing.T) { - statConfig := &engine.StatQueueWithCache{ + statConfig := &engine.StatQueueProfileWithOpts{ StatQueueProfile: &engine.StatQueueProfile{ ID: "TEST_PROFILE10", FilterIDs: []string{"FLTR_1"}, @@ -1365,7 +1365,7 @@ func testV1STSV1GetStatQueuesForEventWithoutTenant(t *testing.T) { } func testV1STSSimulateAccountUpdate(t *testing.T) { - statConfig = &engine.StatQueueWithCache{ + statConfig = &engine.StatQueueProfileWithOpts{ StatQueueProfile: &engine.StatQueueProfile{ Tenant: "cgrates.org", ID: "StatForAccountUpdate", @@ -1486,7 +1486,7 @@ func testV1STSSimulateAccountUpdate(t *testing.T) { func testV1STSGetStatQueueWithoutExpired(t *testing.T) { var result string var reply *engine.StatQueueProfile - statConfig = &engine.StatQueueWithCache{ + statConfig = &engine.StatQueueProfileWithOpts{ StatQueueProfile: &engine.StatQueueProfile{ Tenant: "cgrates.org", ID: "Sq1Nanao", @@ -1549,7 +1549,7 @@ func testV1STSGetStatQueueWithoutExpired(t *testing.T) { func testV1STSGetStatQueueWithoutStored(t *testing.T) { var result string var reply *engine.StatQueueProfile - statConfig = &engine.StatQueueWithCache{ + statConfig = &engine.StatQueueProfileWithOpts{ StatQueueProfile: &engine.StatQueueProfile{ Tenant: "cgrates.org", ID: "Sq1NotStored", diff --git a/apier/v2/attributes.go b/apier/v2/attributes.go index 55f9b2f84..ea24af2ce 100644 --- a/apier/v2/attributes.go +++ b/apier/v2/attributes.go @@ -25,14 +25,13 @@ import ( "github.com/cgrates/cgrates/utils" ) -type AttributeWithCache struct { +type AttributeWithOpts struct { *engine.APIAttributeProfile - Cache *string - Opts map[string]interface{} + Opts map[string]interface{} } //SetAttributeProfile add/update a new Attribute Profile -func (APIerSv2 *APIerSv2) SetAttributeProfile(arg *AttributeWithCache, reply *string) error { +func (APIerSv2 *APIerSv2) SetAttributeProfile(arg *AttributeWithOpts, reply *string) error { if missing := utils.MissingStructFields(arg.APIAttributeProfile, []string{utils.ID}); len(missing) != 0 { return utils.NewErrMandatoryIeMissing(missing...) } diff --git a/apier/v2/attributes_it_test.go b/apier/v2/attributes_it_test.go index cf03ff45c..f9eae679f 100644 --- a/apier/v2/attributes_it_test.go +++ b/apier/v2/attributes_it_test.go @@ -112,7 +112,7 @@ func testAttributeSRPCConn(t *testing.T) { } func testAttributeSSetAlsPrf(t *testing.T) { - extAlsPrf := &AttributeWithCache{ + extAlsPrf := &AttributeWithOpts{ APIAttributeProfile: &engine.APIAttributeProfile{ Tenant: "cgrates.org", ID: "ExternalAttribute", @@ -170,7 +170,7 @@ func testAttributeSSetAlsPrf(t *testing.T) { } func testAttributeSUpdateAlsPrf(t *testing.T) { - extAlsPrf := &AttributeWithCache{ + extAlsPrf := &AttributeWithOpts{ APIAttributeProfile: &engine.APIAttributeProfile{ Tenant: "cgrates.org", ID: "ExternalAttribute", @@ -244,7 +244,7 @@ func testAttributeSKillEngine(t *testing.T) { } func testAttributeSSetAlsPrfWithoutTenant(t *testing.T) { - extAlsPrf := &AttributeWithCache{ + extAlsPrf := &AttributeWithOpts{ APIAttributeProfile: &engine.APIAttributeProfile{ ID: "ExternalAttribute", Contexts: []string{utils.MetaSessionS, utils.MetaCDRs}, diff --git a/console/accounts_profile_set.go b/console/accounts_profile_set.go index 5d64dba8d..42d85d3e2 100644 --- a/console/accounts_profile_set.go +++ b/console/accounts_profile_set.go @@ -19,7 +19,6 @@ along with this program. If not, see package console import ( - v1 "github.com/cgrates/cgrates/apier/v1" "github.com/cgrates/cgrates/utils" ) @@ -27,7 +26,7 @@ func init() { c := &CmdSetAccountProfile{ name: "accounts_profile_set", rpcMethod: utils.APIerSv1SetAccountProfile, - rpcParams: &v1.APIAccountProfileWithCache{}, + rpcParams: &utils.APIAccountProfileWithOpts{}, } commands[c.Name()] = c c.CommandExecuter = &CommandExecuter{c} @@ -36,7 +35,7 @@ func init() { type CmdSetAccountProfile struct { name string rpcMethod string - rpcParams *v1.APIAccountProfileWithCache + rpcParams *utils.APIAccountProfileWithOpts *CommandExecuter } @@ -50,7 +49,7 @@ func (self *CmdSetAccountProfile) RpcMethod() string { func (self *CmdSetAccountProfile) RpcParams(reset bool) interface{} { if reset || self.rpcParams == nil { - self.rpcParams = &v1.APIAccountProfileWithCache{APIAccountProfile: new(utils.APIAccountProfile)} + self.rpcParams = &utils.APIAccountProfileWithOpts{APIAccountProfile: new(utils.APIAccountProfile)} } return self.rpcParams } diff --git a/console/attributes_profile_set.go b/console/attributes_profile_set.go index 8db48c0d4..f72349cc2 100644 --- a/console/attributes_profile_set.go +++ b/console/attributes_profile_set.go @@ -28,7 +28,7 @@ func init() { c := &CmdSetAttributes{ name: "attributes_profile_set", rpcMethod: utils.APIerSv2SetAttributeProfile, - rpcParams: &v2.AttributeWithCache{}, + rpcParams: &v2.AttributeWithOpts{}, } commands[c.Name()] = c c.CommandExecuter = &CommandExecuter{c} @@ -37,7 +37,7 @@ func init() { type CmdSetAttributes struct { name string rpcMethod string - rpcParams *v2.AttributeWithCache + rpcParams *v2.AttributeWithOpts *CommandExecuter } @@ -51,7 +51,7 @@ func (self *CmdSetAttributes) RpcMethod() string { func (self *CmdSetAttributes) RpcParams(reset bool) interface{} { if reset || self.rpcParams == nil { - self.rpcParams = &v2.AttributeWithCache{APIAttributeProfile: new(engine.APIAttributeProfile)} + self.rpcParams = &v2.AttributeWithOpts{APIAttributeProfile: new(engine.APIAttributeProfile)} } return self.rpcParams } diff --git a/console/stats_profile_set.go b/console/stats_profile_set.go index 510f29821..de9aed86f 100644 --- a/console/stats_profile_set.go +++ b/console/stats_profile_set.go @@ -27,7 +27,7 @@ func init() { c := &CmdSetStatQueue{ name: "stats_profile_set", rpcMethod: utils.APIerSv1SetStatQueueProfile, - rpcParams: &engine.StatQueueWithCache{}, + rpcParams: &engine.StatQueueProfileWithOpts{}, } commands[c.Name()] = c c.CommandExecuter = &CommandExecuter{c} @@ -37,7 +37,7 @@ func init() { type CmdSetStatQueue struct { name string rpcMethod string - rpcParams *engine.StatQueueWithCache + rpcParams *engine.StatQueueProfileWithOpts *CommandExecuter } @@ -51,7 +51,7 @@ func (self *CmdSetStatQueue) RpcMethod() string { func (self *CmdSetStatQueue) RpcParams(reset bool) interface{} { if reset || self.rpcParams == nil { - self.rpcParams = &engine.StatQueueWithCache{ + self.rpcParams = &engine.StatQueueProfileWithOpts{ StatQueueProfile: new(engine.StatQueueProfile), Opts: make(map[string]interface{}), } diff --git a/engine/libstats.go b/engine/libstats.go index 42229efd1..37d4aecd9 100644 --- a/engine/libstats.go +++ b/engine/libstats.go @@ -50,12 +50,6 @@ type StatQueueProfileWithOpts struct { Opts map[string]interface{} } -type StatQueueWithCache struct { - *StatQueueProfile - Cache *string - Opts map[string]interface{} -} - func (sqp *StatQueueProfile) TenantID() string { return utils.ConcatenatedKey(sqp.Tenant, sqp.ID) } diff --git a/engine/z_actions_it_test.go b/engine/z_actions_it_test.go index 1456cd1b4..348a677ad 100644 --- a/engine/z_actions_it_test.go +++ b/engine/z_actions_it_test.go @@ -740,7 +740,7 @@ func testActionsitSetSDestinations(t *testing.T) { } // set a StatQueueProfile and simulate process event - statConfig := &StatQueueWithCache{ + statConfig := &StatQueueProfileWithOpts{ StatQueueProfile: &StatQueueProfile{ Tenant: "cgrates.org", ID: "DistinctMetricProfile", diff --git a/general_tests/cdrs_it_test.go b/general_tests/cdrs_it_test.go index 9f14332be..f0c2af7f9 100644 --- a/general_tests/cdrs_it_test.go +++ b/general_tests/cdrs_it_test.go @@ -469,7 +469,7 @@ func testV2CDRsSetStats(t *testing.T) { err.Error() != utils.ErrNotFound.Error() { t.Error(err) } - statConfig := &engine.StatQueueWithCache{ + statConfig := &engine.StatQueueProfileWithOpts{ StatQueueProfile: &engine.StatQueueProfile{ Tenant: "cgrates.org", ID: "STS_PoccessCDR", diff --git a/general_tests/doubleremove_it_test.go b/general_tests/doubleremove_it_test.go index d294b8c0a..52b6f4001 100644 --- a/general_tests/doubleremove_it_test.go +++ b/general_tests/doubleremove_it_test.go @@ -110,7 +110,7 @@ func testdoubleRemoveStatQueueProfile(t *testing.T) { t.Error(err) } // set - statConfig := &engine.StatQueueWithCache{ + statConfig := &engine.StatQueueProfileWithOpts{ StatQueueProfile: &engine.StatQueueProfile{ Tenant: doubleRemoveTenant, ID: "TEST_PROFILE1", diff --git a/general_tests/filtered_replication_it_test.go b/general_tests/filtered_replication_it_test.go index 0d652e452..e47a61e6a 100644 --- a/general_tests/filtered_replication_it_test.go +++ b/general_tests/filtered_replication_it_test.go @@ -268,7 +268,7 @@ func testFltrRplAttributeProfile(t *testing.T) { func testFltrRplFilters(t *testing.T) { fltrID := "FLTR1" - fltr := &v1.FilterWithCache{ + fltr := &engine.FilterWithOpts{ Filter: &engine.Filter{ Tenant: "cgrates.org", ID: fltrID, @@ -547,7 +547,7 @@ func testFltrRplThresholdProfile(t *testing.T) { func testFltrRplStatQueueProfile(t *testing.T) { stID := "ST1" - stPrf := &engine.StatQueueWithCache{ + stPrf := &engine.StatQueueProfileWithOpts{ StatQueueProfile: &engine.StatQueueProfile{ Tenant: "cgrates.org", ID: stID, @@ -1586,7 +1586,7 @@ func testFltrRplActionProfile(t *testing.T) { func testFltrRplAccountProfile(t *testing.T) { acID := "ATTR1" - acPrf := &v1.APIAccountProfileWithCache{ + acPrf := &utils.APIAccountProfileWithOpts{ APIAccountProfile: &utils.APIAccountProfile{ Tenant: "cgrates.org", ID: acID, diff --git a/general_tests/filters_it_test.go b/general_tests/filters_it_test.go index b66813941..c9e37c5da 100644 --- a/general_tests/filters_it_test.go +++ b/general_tests/filters_it_test.go @@ -261,7 +261,7 @@ func testV1FltrAddStats(t *testing.T) { func testV1FltrPopulateThreshold(t *testing.T) { //Add a filter of type *stats and check if acd metric is minim 10 ( greater than 10) //we expect that acd from Stat_1 to be 11 so the filter should pass (11 > 10) - filter := &v1.FilterWithCache{ + filter := &engine.FilterWithOpts{ Filter: &engine.Filter{ Tenant: "cgrates.org", ID: "FLTR_TH_Stats1", @@ -345,7 +345,7 @@ func testV1FltrGetThresholdForEvent(t *testing.T) { func testV1FltrGetThresholdForEvent2(t *testing.T) { //Add a filter of type *stats and check if acd metric is maximum 10 ( lower than 10) //we expect that acd from Stat_1 to be 11 so the filter should not pass (11 > 10) - filter := &v1.FilterWithCache{ + filter := &engine.FilterWithOpts{ Filter: &engine.Filter{ Tenant: "cgrates.org", ID: "FLTR_TH_Stats1", @@ -450,7 +450,7 @@ func testV1FltrPopulateResources(t *testing.T) { //we allocate 3 units to resource and add a filter for Usages > 2 //should match (3>2) - filter := v1.FilterWithCache{ + filter := engine.FilterWithOpts{ Filter: &engine.Filter{ Tenant: "cgrates.org", ID: "FLTR_TH_Resource", @@ -596,7 +596,7 @@ func testV1FltrPopulateResourcesAvailableUnits(t *testing.T) { //as we allocate 9 units, there should be available 14 more //our filter should match for *gt or *gte - filter := v1.FilterWithCache{ + filter := engine.FilterWithOpts{ Filter: &engine.Filter{ Tenant: "cgrates.org", ID: "FLTR_ST_Resource1", @@ -622,7 +622,7 @@ func testV1FltrPopulateResourcesAvailableUnits(t *testing.T) { } //set a statQueueProfile with that filter - statsPrf := &engine.StatQueueWithCache{ + statsPrf := &engine.StatQueueProfileWithOpts{ StatQueueProfile: &engine.StatQueueProfile{ Tenant: "cgrates.org", ID: "STATS_RES_TEST12", @@ -664,7 +664,7 @@ func testV1FltrPopulateResourcesAvailableUnits(t *testing.T) { } //set another filter that will not match - filter = v1.FilterWithCache{ + filter = engine.FilterWithOpts{ Filter: &engine.Filter{ Tenant: "cgrates.org", ID: "FLTR_ST_Resource1", @@ -712,7 +712,7 @@ func testV1FltrAccounts(t *testing.T) { // Add a filter with fieldName taken value from account 1001 // and check if *monetary balance is minim 9 ( greater than 9) // we expect that the balance to be 10 so the filter should pass (10 > 9) - filter := v1.FilterWithCache{ + filter := engine.FilterWithOpts{ Filter: &engine.Filter{ Tenant: "cgrates.org", ID: "FLTR_TH_Accounts", diff --git a/general_tests/sessions_concur_test.go b/general_tests/sessions_concur_test.go index e2b223888..79a22e165 100644 --- a/general_tests/sessions_concur_test.go +++ b/general_tests/sessions_concur_test.go @@ -125,7 +125,7 @@ func testSCncrLoadTP(t *testing.T) { *dataDir, "tariffplans", "tp1cnt")}, &loadInst); err != nil { t.Error(err) } - attrPrfl := &v2.AttributeWithCache{ + attrPrfl := &v2.AttributeWithOpts{ ExternalAttributeProfile: &engine.ExternalAttributeProfile{ Tenant: "cgrates.org", ID: "AttrConcurrentSessions", diff --git a/utils/coreutils.go b/utils/coreutils.go index 65e947a0d..ae03d6a21 100644 --- a/utils/coreutils.go +++ b/utils/coreutils.go @@ -759,13 +759,6 @@ func (tID *TenantID) TenantID() string { return ConcatenatedKey(tID.Tenant, tID.ID) } -type TenantIDWithCache struct { - Tenant string - ID string - Cache *string - Opts map[string]interface{} -} - func (tID *TenantIDWithOpts) TenantIDConcatenated() string { return ConcatenatedKey(tID.Tenant, tID.ID) }