diff --git a/apier/v1/apier_it_test.go b/apier/v1/apier_it_test.go index 30b785afe..93636e0e8 100644 --- a/apier/v1/apier_it_test.go +++ b/apier/v1/apier_it_test.go @@ -310,20 +310,20 @@ func TestApierTPDestinationRate(t *testing.T) { *dr2 = *dr dr2.ID = utils.TEST_SQL for _, d := range []*utils.TPDestinationRate{dr, dr2, drDe} { - if err := rater.Call("ApierV1.SetTPDestinationRate", d, &reply); err != nil { + if err := rater.Call(utils.ApierV1SetTPDestinationRate, d, &reply); err != nil { t.Error("Got error on ApierV1.SetTPDestinationRate: ", err.Error()) } else if reply != "OK" { t.Error("Unexpected reply received when calling ApierV1.SetTPDestinationRate: ", reply) } } // Check second set - if err := rater.Call("ApierV1.SetTPDestinationRate", dr2, &reply); err != nil { + if err := rater.Call(utils.ApierV1SetTPDestinationRate, dr2, &reply); err != nil { t.Error("Got error on second ApierV1.SetTPDestinationRate: ", err.Error()) } else if reply != "OK" { t.Error("Calling ApierV1.SetTPDestinationRate got reply: ", reply) } // Check missing params - if err := rater.Call("ApierV1.SetTPDestinationRate", new(utils.TPDestinationRate), &reply); err == nil { + if err := rater.Call(utils.ApierV1SetTPDestinationRate, new(utils.TPDestinationRate), &reply); err == nil { t.Error("Calling ApierV1.SetTPDestination, expected error, received: ", reply) } else if err.Error() != "MANDATORY_IE_MISSING: [TPid ID DestinationRates]" { t.Error("Calling ApierV1.SetTPDestinationRate got unexpected error: ", err.Error()) @@ -336,7 +336,7 @@ func TestApierTPDestinationRate(t *testing.T) { t.Errorf("Calling ApierV1.GetTPDestinationRate expected: %v, received: %v", dr2, rplyDr2) } // Test remove - if err := rater.Call("ApierV1.RemoveTPDestinationRate", AttrGetTPDestinationRate{dr2.TPid, dr2.ID, utils.Paginator{}}, &reply); err != nil { + if err := rater.Call(utils.ApierV1RemoveTPDestinationRate, AttrGetTPDestinationRate{dr2.TPid, dr2.ID, utils.Paginator{}}, &reply); err != nil { t.Error("Calling ApierV1.RemoveTPRate, got error: ", err.Error()) } else if reply != "OK" { t.Error("Calling ApierV1.RemoveTPRate received: ", reply) @@ -344,7 +344,7 @@ func TestApierTPDestinationRate(t *testing.T) { // Test getIds var rplyDrIds []string expectedDrIds := []string{"DR_FREESWITCH_USERS"} - if err := rater.Call("ApierV1.GetTPDestinationRateIds", AttrTPDestinationRateIds{dr.TPid, utils.PaginatorWithSearch{}}, &rplyDrIds); err != nil { + if err := rater.Call(utils.ApierV1GetTPDestinationRateIds, AttrTPDestinationRateIds{dr.TPid, utils.PaginatorWithSearch{}}, &rplyDrIds); err != nil { t.Error("Calling ApierV1.GetTPDestinationRateIds, got error: ", err.Error()) } else if !reflect.DeepEqual(expectedDrIds, rplyDrIds) { t.Errorf("Calling ApierV1.GetTPDestinationRateIds expected: %v, received: %v", expectedDrIds, rplyDrIds) @@ -361,33 +361,33 @@ func TestApierTPRatingPlan(t *testing.T) { *rpTst = *rp rpTst.ID = utils.TEST_SQL for _, rpl := range []*utils.TPRatingPlan{rp, rpTst} { - if err := rater.Call("ApierV1.SetTPRatingPlan", rpl, &reply); err != nil { + if err := rater.Call(utils.ApierV1SetTPRatingPlan, rpl, &reply); err != nil { t.Error("Got error on ApierV1.SetTPRatingPlan: ", err.Error()) } else if reply != "OK" { t.Error("Unexpected reply received when calling ApierV1.SetTPRatingPlan: ", reply) } } // Check second set - if err := rater.Call("ApierV1.SetTPRatingPlan", rpTst, &reply); err != nil { + if err := rater.Call(utils.ApierV1SetTPRatingPlan, rpTst, &reply); err != nil { t.Error("Got error on second ApierV1.SetTPRatingPlan: ", err.Error()) } else if reply != "OK" { t.Error("Calling ApierV1.SetTPRatingPlan got reply: ", reply) } // Check missing params - if err := rater.Call("ApierV1.SetTPRatingPlan", new(utils.TPRatingPlan), &reply); err == nil { + if err := rater.Call(utils.ApierV1SetTPRatingPlan, new(utils.TPRatingPlan), &reply); err == nil { t.Error("Calling ApierV1.SetTPRatingPlan, expected error, received: ", reply) } else if err.Error() != "MANDATORY_IE_MISSING: [TPid ID RatingPlanBindings]" { t.Error("Calling ApierV1.SetTPRatingPlan got unexpected error: ", err.Error()) } // Test get var rplyRpTst *utils.TPRatingPlan - if err := rater.Call("ApierV1.GetTPRatingPlan", AttrGetTPRatingPlan{TPid: rpTst.TPid, ID: rpTst.ID}, &rplyRpTst); err != nil { + if err := rater.Call(utils.ApierV1GetTPRatingPlan, AttrGetTPRatingPlan{TPid: rpTst.TPid, ID: rpTst.ID}, &rplyRpTst); err != nil { t.Error("Calling ApierV1.GetTPRatingPlan, got error: ", err.Error()) } else if !reflect.DeepEqual(rpTst, rplyRpTst) { t.Errorf("Calling ApierV1.GetTPRatingPlan expected: %v, received: %v", rpTst, rplyRpTst) } // Test remove - if err := rater.Call("ApierV1.RemoveTPRatingPlan", AttrGetTPRatingPlan{TPid: rpTst.TPid, ID: rpTst.ID}, &reply); err != nil { + if err := rater.Call(utils.ApierV1RemoveTPRatingPlan, AttrGetTPRatingPlan{TPid: rpTst.TPid, ID: rpTst.ID}, &reply); err != nil { t.Error("Calling ApierV1.RemoveTPRatingPlan, got error: ", err.Error()) } else if reply != "OK" { t.Error("Calling ApierV1.RemoveTPRatingPlan received: ", reply) @@ -395,7 +395,7 @@ func TestApierTPRatingPlan(t *testing.T) { // Test getIds var rplyRpIds []string expectedRpIds := []string{"RETAIL1"} - if err := rater.Call("ApierV1.GetTPRatingPlanIds", AttrGetTPRatingPlanIds{rp.TPid, utils.PaginatorWithSearch{}}, &rplyRpIds); err != nil { + if err := rater.Call(utils.ApierV1GetTPRatingPlanIds, AttrGetTPRatingPlanIds{rp.TPid, utils.PaginatorWithSearch{}}, &rplyRpIds); err != nil { t.Error("Calling ApierV1.GetTPRatingPlanIds, got error: ", err.Error()) } else if !reflect.DeepEqual(expectedRpIds, rplyRpIds) { t.Errorf("Calling ApierV1.GetTPRatingPlanIds expected: %v, received: %v", expectedRpIds, rplyRpIds) @@ -414,33 +414,33 @@ func TestApierTPRatingProfile(t *testing.T) { *rpfTst = *rpf rpfTst.Subject = utils.TEST_SQL for _, rp := range []*utils.TPRatingProfile{rpf, rpfTst} { - if err := rater.Call("ApierV1.SetTPRatingProfile", rp, &reply); err != nil { + if err := rater.Call(utils.ApierV1SetTPRatingProfile, rp, &reply); err != nil { t.Error("Got error on ApierV1.SetTPRatingProfile: ", err.Error()) } else if reply != "OK" { t.Error("Unexpected reply received when calling ApierV1.SetTPRatingProfile: ", reply) } } // Check second set - if err := rater.Call("ApierV1.SetTPRatingProfile", rpfTst, &reply); err != nil { + if err := rater.Call(utils.ApierV1SetTPRatingProfile, rpfTst, &reply); err != nil { t.Error("Got error on second ApierV1.SetTPRatingProfile: ", err.Error()) } else if reply != "OK" { t.Error("Calling ApierV1.SetTPRatingProfile got reply: ", reply) } // Check missing params - if err := rater.Call("ApierV1.SetTPRatingProfile", new(utils.TPRatingProfile), &reply); err == nil { + if err := rater.Call(utils.ApierV1SetTPRatingProfile, new(utils.TPRatingProfile), &reply); err == nil { t.Error("Calling ApierV1.SetTPRatingProfile, expected error, received: ", reply) } else if err.Error() != "MANDATORY_IE_MISSING: [TPid LoadId Tenant Category Subject RatingPlanActivations]" { t.Error("Calling ApierV1.SetTPRatingProfile got unexpected error: ", err.Error()) } // Test get var rplyRpf *utils.TPRatingProfile - if err := rater.Call("ApierV1.GetTPRatingProfile", AttrGetTPRatingProfile{TPid: rpfTst.TPid, RatingProfileId: rpfTst.GetId()}, &rplyRpf); err != nil { + if err := rater.Call(utils.ApierV1GetTPRatingProfile, AttrGetTPRatingProfile{TPid: rpfTst.TPid, RatingProfileId: rpfTst.GetId()}, &rplyRpf); err != nil { t.Error("Calling ApierV1.GetTPRatingProfiles, got error: ", err.Error()) } else if !reflect.DeepEqual(rpfTst, rplyRpf) { t.Errorf("Calling ApierV1.GetTPRatingProfiles expected: %v, received: %v", rpfTst, rplyRpf) } // Test remove - if err := rater.Call("ApierV1.RemoveTPRatingProfile", AttrGetTPRatingProfile{TPid: rpfTst.TPid, RatingProfileId: rpfTst.GetId()}, &reply); err != nil { + if err := rater.Call(utils.ApierV1RemoveTPRatingProfile, AttrGetTPRatingProfile{TPid: rpfTst.TPid, RatingProfileId: rpfTst.GetId()}, &reply); err != nil { t.Error("Calling ApierV1.RemoveTPRatingProfile, got error: ", err.Error()) } else if reply != "OK" { t.Error("Calling ApierV1.RemoveTPRatingProfile received: ", reply) @@ -448,7 +448,7 @@ func TestApierTPRatingProfile(t *testing.T) { // Test getLoadIds var rplyRpIds []string expectedRpIds := []string{utils.TEST_SQL} - if err := rater.Call("ApierV1.GetTPRatingProfileLoadIds", utils.AttrTPRatingProfileIds{TPid: rpf.TPid}, &rplyRpIds); err != nil { + if err := rater.Call(utils.ApierV1GetTPRatingProfileLoadIds, utils.AttrTPRatingProfileIds{TPid: rpf.TPid}, &rplyRpIds); err != nil { t.Error("Calling ApierV1.GetTPRatingProfileLoadIds, got error: ", err.Error()) } else if !reflect.DeepEqual(expectedRpIds, rplyRpIds) { t.Errorf("Calling ApierV1.GetTPRatingProfileLoadIds expected: %v, received: %v", expectedRpIds, rplyRpIds) @@ -473,20 +473,20 @@ func TestApierTPActions(t *testing.T) { *actTst = *act actTst.ID = utils.TEST_SQL for _, ac := range []*utils.TPActions{act, actWarn, actTst, actLog} { - if err := rater.Call("ApierV1.SetTPActions", ac, &reply); err != nil { + if err := rater.Call(utils.ApierV1SetTPActions, ac, &reply); err != nil { t.Error("Got error on ApierV1.SetTPActions: ", err.Error()) } else if reply != "OK" { t.Error("Unexpected reply received when calling ApierV1.SetTPActions: ", reply) } } // Check second set - if err := rater.Call("ApierV1.SetTPActions", actTst, &reply); err != nil { + if err := rater.Call(utils.ApierV1SetTPActions, actTst, &reply); err != nil { t.Error("Got error on second ApierV1.SetTPActions: ", err.Error()) } else if reply != "OK" { t.Error("Calling ApierV1.SetTPActions got reply: ", reply) } // Check missing params - if err := rater.Call("ApierV1.SetTPActions", new(utils.TPActions), &reply); err == nil { + if err := rater.Call(utils.ApierV1SetTPActions, new(utils.TPActions), &reply); err == nil { t.Error("Calling ApierV1.SetTPActions, expected error, received: ", reply) } else if err.Error() != "MANDATORY_IE_MISSING: [TPid ID Actions]" { t.Error("Calling ApierV1.SetTPActions got unexpected error: ", err.Error()) @@ -499,7 +499,7 @@ func TestApierTPActions(t *testing.T) { t.Errorf("Calling ApierV1.GetTPActions expected: %v, received: %v", actTst, rplyActs) } // Test remove - if err := rater.Call("ApierV1.RemoveTPActions", AttrGetTPActions{TPid: actTst.TPid, ID: actTst.ID}, &reply); err != nil { + if err := rater.Call(utils.ApierV1RemoveTPActions, AttrGetTPActions{TPid: actTst.TPid, ID: actTst.ID}, &reply); err != nil { t.Error("Calling ApierV1.RemoveTPActions, got error: ", err.Error()) } else if reply != "OK" { t.Error("Calling ApierV1.RemoveTPActions received: ", reply) @@ -507,7 +507,7 @@ func TestApierTPActions(t *testing.T) { // Test getIds var rplyIds []string expectedIds := []string{"LOG_BALANCE", "PREPAID_10", "WARN_VIA_HTTP"} - if err := rater.Call("ApierV1.GetTPActionIds", AttrGetTPActionIds{TPid: actTst.TPid}, &rplyIds); err != nil { + if err := rater.Call(utils.ApierV1GetTPActionIds, AttrGetTPActionIds{TPid: actTst.TPid}, &rplyIds); err != nil { t.Error("Calling ApierV1.GetTPActionIds, got error: ", err.Error()) } else if !reflect.DeepEqual(expectedIds, rplyIds) { t.Errorf("Calling ApierV1.GetTPActionIds expected: %v, received: %v", expectedIds, rplyIds) @@ -681,7 +681,7 @@ func TestApierTPAccountActions(t *testing.T) { // Test here LoadRatingPlan func TestApierLoadRatingPlan(t *testing.T) { reply := "" - if err := rater.Call("ApierV1.LoadRatingPlan", AttrLoadRatingPlan{TPid: utils.TEST_SQL, RatingPlanId: "RETAIL1"}, &reply); err != nil { + if err := rater.Call(utils.ApierV1LoadRatingPlan, AttrLoadRatingPlan{TPid: utils.TEST_SQL, RatingPlanId: "RETAIL1"}, &reply); err != nil { t.Error("Got error on ApierV1.LoadRatingPlan: ", err.Error()) } else if reply != "OK" { t.Error("Calling ApierV1.LoadRatingPlan got reply: ", reply) @@ -694,7 +694,7 @@ func TestApierLoadRatingProfile(t *testing.T) { rpf := &utils.TPRatingProfile{ TPid: utils.TEST_SQL, LoadId: utils.TEST_SQL, Tenant: "cgrates.org", Category: "call", Subject: "*any"} - if err := rater.Call("ApierV1.LoadRatingProfile", rpf, &reply); err != nil { + if err := rater.Call(utils.ApierV1LoadRatingProfile, rpf, &reply); err != nil { t.Error("Got error on ApierV1.LoadRatingProfile: ", err.Error()) } else if reply != "OK" { t.Error("Calling ApierV1.LoadRatingProfile got reply: ", reply) @@ -712,7 +712,7 @@ func TestApierLoadAccountActions(t *testing.T) { } reply := "" aa1 := &utils.TPAccountActions{TPid: utils.TEST_SQL, LoadId: utils.TEST_SQL, Tenant: "cgrates.org", Account: "1001"} - if err := rater.Call("ApierV1.LoadAccountActions", aa1, &reply); err != nil { + if err := rater.Call(utils.ApierV1LoadAccountActions, aa1, &reply); err != nil { t.Error("Got error on ApierV1.LoadAccountActions: ", err.Error()) } else if reply != "OK" { t.Error("Calling ApierV1.LoadAccountActions got reply: ", reply) @@ -745,7 +745,7 @@ func TestApierSetRatingProfile(t *testing.T) { rpa := &utils.TPRatingActivation{ActivationTime: "2012-01-01T00:00:00Z", RatingPlanId: "RETAIL1", FallbackSubjects: "dan2"} rpf := &utils.AttrSetRatingProfile{Tenant: "cgrates.org", Category: "call", Subject: "dan", RatingPlanActivations: []*utils.TPRatingActivation{rpa}} - if err := rater.Call("ApierV1.SetRatingProfile", rpf, &reply); err != nil { + if err := rater.Call(utils.ApierV1SetRatingProfile, rpf, &reply); err != nil { t.Error("Got error on ApierV1.SetRatingProfile: ", err.Error()) } else if reply != "OK" { t.Error("Calling ApierV1.SetRatingProfile got reply: ", reply) @@ -762,7 +762,7 @@ func TestApierSetRatingProfile(t *testing.T) { t.Errorf("Calling CacheSv1.GetCacheStats expected: %+v, received: %+v", expectedStats, rcvStats) } // Calling the second time should not raise EXISTS - if err := rater.Call("ApierV1.SetRatingProfile", rpf, &reply); err != nil { + if err := rater.Call(utils.ApierV1SetRatingProfile, rpf, &reply); err != nil { t.Error("Unexpected result on duplication: ", err.Error()) } // Make sure rates were loaded for account dan @@ -849,7 +849,7 @@ func TestApierReloadCache(t *testing.T) { reply := "" arc := new(utils.AttrReloadCache) // Simple test that command is executed without errors - if err := rater.Call("CacheSv1.ReloadCache", arc, &reply); err != nil { + if err := rater.Call(utils.CacheSv1ReloadCache, arc, &reply); err != nil { t.Error("Got error on CacheSv1.ReloadCache: ", err.Error()) } else if reply != "OK" { t.Error("Calling CacheSv1.ReloadCache got reply: ", reply) @@ -875,7 +875,7 @@ func TestApierGetDestination(t *testing.T) { reply := new(engine.Destination) dstId := "GERMANY_MOBILE" expectedReply := &engine.Destination{Id: dstId, Prefixes: []string{"+4915", "+4916", "+4917"}} - if err := rater.Call("ApierV1.GetDestination", dstId, reply); err != nil { + if err := rater.Call(utils.ApierV1GetDestination, dstId, reply); err != nil { t.Error("Got error on ApierV1.GetDestination: ", err.Error()) } else if !reflect.DeepEqual(expectedReply, reply) { t.Errorf("Calling ApierV1.GetDestination expected: %v, received: %v", expectedReply, reply) @@ -931,43 +931,43 @@ func TestApierRemoveRatingPlan(t *testing.T) { func TestApierAddBalance(t *testing.T) { reply := "" attrs := &AttrAddBalance{Tenant: "cgrates.org", Account: "1001", BalanceType: "*monetary", Value: 1.5} - if err := rater.Call("ApierV1.AddBalance", attrs, &reply); err != nil { + if err := rater.Call(utils.ApierV1AddBalance, attrs, &reply); err != nil { t.Error("Got error on ApierV1.AddBalance: ", err.Error()) } else if reply != "OK" { t.Errorf("Calling ApierV1.AddBalance received: %s", reply) } attrs = &AttrAddBalance{Tenant: "cgrates.org", Account: "dan", BalanceType: "*monetary", Value: 1.5} - if err := rater.Call("ApierV1.AddBalance", attrs, &reply); err != nil { + if err := rater.Call(utils.ApierV1AddBalance, attrs, &reply); err != nil { t.Error("Got error on ApierV1.AddBalance: ", err.Error()) } else if reply != "OK" { t.Errorf("Calling ApierV1.AddBalance received: %s", reply) } attrs = &AttrAddBalance{Tenant: "cgrates.org", Account: "dan2", BalanceType: "*monetary", Value: 1.5} - if err := rater.Call("ApierV1.AddBalance", attrs, &reply); err != nil { + if err := rater.Call(utils.ApierV1AddBalance, attrs, &reply); err != nil { t.Error("Got error on ApierV1.AddBalance: ", err.Error()) } else if reply != "OK" { t.Errorf("Calling ApierV1.AddBalance received: %s", reply) } attrs = &AttrAddBalance{Tenant: "cgrates.org", Account: "dan3", BalanceType: "*monetary", Value: 1.5} - if err := rater.Call("ApierV1.AddBalance", attrs, &reply); err != nil { + if err := rater.Call(utils.ApierV1AddBalance, attrs, &reply); err != nil { t.Error("Got error on ApierV1.AddBalance: ", err.Error()) } else if reply != "OK" { t.Errorf("Calling ApierV1.AddBalance received: %s", reply) } attrs = &AttrAddBalance{Tenant: "cgrates.org", Account: "dan3", BalanceType: "*monetary", Value: 2.1} - if err := rater.Call("ApierV1.AddBalance", attrs, &reply); err != nil { + if err := rater.Call(utils.ApierV1AddBalance, attrs, &reply); err != nil { t.Error("Got error on ApierV1.AddBalance: ", err.Error()) } else if reply != "OK" { t.Errorf("Calling ApierV1.AddBalance received: %s", reply) } attrs = &AttrAddBalance{Tenant: "cgrates.org", Account: "dan6", BalanceType: "*monetary", Value: 2.1} - if err := rater.Call("ApierV1.AddBalance", attrs, &reply); err != nil { + if err := rater.Call(utils.ApierV1AddBalance, attrs, &reply); err != nil { t.Error("Got error on ApierV1.AddBalance: ", err.Error()) } else if reply != "OK" { t.Errorf("Calling ApierV1.AddBalance received: %s", reply) } attrs = &AttrAddBalance{Tenant: "cgrates.org", Account: "dan6", BalanceType: "*monetary", Value: 1, Overwrite: true} - if err := rater.Call("ApierV1.AddBalance", attrs, &reply); err != nil { + if err := rater.Call(utils.ApierV1AddBalance, attrs, &reply); err != nil { t.Error("Got error on ApierV1.AddBalance: ", err.Error()) } else if reply != "OK" { t.Errorf("Calling ApierV1.AddBalance received: %s", reply) @@ -980,7 +980,7 @@ func TestApierExecuteAction(t *testing.T) { reply := "" // Add balance to a previously known account attrs := utils.AttrExecuteAction{Tenant: "cgrates.org", Account: "dan2", ActionsId: "PREPAID_10"} - if err := rater.Call("ApierV1.ExecuteAction", attrs, &reply); err != nil { + if err := rater.Call(utils.ApierV1ExecuteAction, attrs, &reply); err != nil { t.Error("Got error on ApierV1.ExecuteAction: ", err.Error()) } else if reply != "OK" { t.Errorf("Calling ApierV1.ExecuteAction received: %s", reply) @@ -988,7 +988,7 @@ func TestApierExecuteAction(t *testing.T) { reply2 := "" // Add balance to an account which does n exist attrs = utils.AttrExecuteAction{Tenant: "cgrates.org", Account: "dan2", ActionsId: "DUMMY_ACTION"} - if err := rater.Call("ApierV1.ExecuteAction", attrs, &reply2); err == nil || reply2 == "OK" { + if err := rater.Call(utils.ApierV1ExecuteAction, attrs, &reply2); err == nil || reply2 == "OK" { t.Error("Expecting error on ApierV1.ExecuteAction.", err, reply2) } } @@ -997,13 +997,13 @@ func TestApierSetActions(t *testing.T) { act1 := &V1TPAction{Identifier: utils.TOPUP_RESET, BalanceType: utils.MONETARY, Directions: utils.META_OUT, Units: 75.0, ExpiryTime: utils.UNLIMITED, Weight: 20.0} attrs1 := &V1AttrSetActions{ActionsId: "ACTS_1", Actions: []*V1TPAction{act1}} reply1 := "" - if err := rater.Call("ApierV1.SetActions", attrs1, &reply1); err != nil { + if err := rater.Call(utils.ApierV1SetActions, attrs1, &reply1); err != nil { t.Error("Got error on ApierV1.SetActions: ", err.Error()) } else if reply1 != "OK" { t.Errorf("Calling ApierV1.SetActions received: %s", reply1) } // Calling the second time should raise EXISTS - if err := rater.Call("ApierV1.SetActions", attrs1, &reply1); err == nil || err.Error() != "EXISTS" { + if err := rater.Call(utils.ApierV1SetActions, attrs1, &reply1); err == nil || err.Error() != "EXISTS" { t.Error("Unexpected result on duplication: ", err.Error()) } } @@ -1026,13 +1026,13 @@ func TestApierSetActionPlan(t *testing.T) { atm1 := &AttrActionPlan{ActionsId: "ACTS_1", MonthDays: "1", Time: "00:00:00", Weight: 20.0} atms1 := &AttrSetActionPlan{Id: "ATMS_1", ActionPlan: []*AttrActionPlan{atm1}} reply1 := "" - if err := rater.Call("ApierV1.SetActionPlan", atms1, &reply1); err != nil { + if err := rater.Call(utils.ApierV1SetActionPlan, atms1, &reply1); err != nil { t.Error("Got error on ApierV1.SetActionPlan: ", err.Error()) } else if reply1 != "OK" { t.Errorf("Calling ApierV1.SetActionPlan received: %s", reply1) } // Calling the second time should raise EXISTS - if err := rater.Call("ApierV1.SetActionPlan", atms1, &reply1); err == nil || err.Error() != "EXISTS" { + if err := rater.Call(utils.ApierV1SetActionPlan, atms1, &reply1); err == nil || err.Error() != "EXISTS" { t.Error("Unexpected result on duplication: ", err.Error()) } } @@ -1041,7 +1041,7 @@ func TestApierSetActionPlan(t *testing.T) { func TestApierAddTriggeredAction(t *testing.T) { var reply string attrs := &AttrAddBalance{Tenant: "cgrates.org", Account: "dan32", BalanceType: "*monetary", Value: 1.5} - if err := rater.Call("ApierV1.AddBalance", attrs, &reply); err != nil { + if err := rater.Call(utils.ApierV1AddBalance, attrs, &reply); err != nil { t.Error("Got error on ApierV1.AddBalance: ", err.Error()) } else if reply != "OK" { t.Errorf("Calling ApierV1.AddBalance received: %s", reply) @@ -1049,7 +1049,7 @@ func TestApierAddTriggeredAction(t *testing.T) { // Add balance to a previously known account attrsAddTrigger := &AttrAddActionTrigger{Tenant: "cgrates.org", Account: "dan32", BalanceDirection: "*out", BalanceType: "*monetary", ThresholdType: "*min_balance", ThresholdValue: 2, BalanceDestinationIds: "*any", Weight: 10, ActionsId: "WARN_VIA_HTTP"} - if err := rater.Call("ApierV1.AddTriggeredAction", attrsAddTrigger, &reply); err != nil { + if err := rater.Call(utils.ApierV1AddTriggeredAction, attrsAddTrigger, &reply); err != nil { t.Error("Got error on ApierV1.AddTriggeredAction: ", err.Error()) } else if reply != "OK" { t.Errorf("Calling ApierV1.AddTriggeredAction received: %s", reply) @@ -1059,7 +1059,7 @@ func TestApierAddTriggeredAction(t *testing.T) { *attrs2 = *attrsAddTrigger attrs2.Account = "dan10" // Does not exist so it should error when adding triggers on it // Add trigger to an account which does n exist - if err := rater.Call("ApierV1.AddTriggeredAction", attrs2, &reply2); err == nil { + if err := rater.Call(utils.ApierV1AddTriggeredAction, attrs2, &reply2); err == nil { t.Error("Expecting error on ApierV1.AddTriggeredAction.", err, reply2) } } @@ -1068,7 +1068,7 @@ func TestApierAddTriggeredAction(t *testing.T) { func TestApierGetAccountActionTriggers(t *testing.T) { var reply engine.ActionTriggers req := utils.TenantAccount{Tenant: "cgrates.org", Account: "dan32"} - if err := rater.Call("ApierV1.GetAccountActionTriggers", req, &reply); err != nil { + if err := rater.Call(utils.ApierV1GetAccountActionTriggers, req, &reply); err != nil { t.Error("Got error on ApierV1.GetAccountActionTimings: ", err.Error()) } else if len(reply) != 1 || reply[0].ActionsID != "WARN_VIA_HTTP" { t.Errorf("Unexpected action triggers received %v", reply) @@ -1079,7 +1079,7 @@ func TestApierAddTriggeredAction2(t *testing.T) { reply := "" // Add balance to a previously known account attrs := &AttrAddAccountActionTriggers{ActionTriggerIDs: &[]string{"STANDARD_TRIGGERS"}, Tenant: "cgrates.org", Account: "dan2"} - if err := rater.Call("ApierV1.AddAccountActionTriggers", attrs, &reply); err != nil { + if err := rater.Call(utils.ApierV1AddAccountActionTriggers, attrs, &reply); err != nil { t.Error("Got error on ApierV1.AddAccountActionTriggers: ", err.Error()) } else if reply != "OK" { t.Errorf("Calling ApierV1.AddAccountActionTriggers received: %s", reply) @@ -1089,7 +1089,7 @@ func TestApierAddTriggeredAction2(t *testing.T) { *attrs2 = *attrs attrs2.Account = "dan10" // Does not exist so it should error when adding triggers on it // Add trigger to an account which does n exist - if err := rater.Call("ApierV1.AddAccountActionTriggers", attrs2, &reply2); err == nil || reply2 == "OK" { + if err := rater.Call(utils.ApierV1AddAccountActionTriggers, attrs2, &reply2); err == nil || reply2 == "OK" { t.Error("Expecting error on ApierV1.AddAccountActionTriggers.", err, reply2) } } @@ -1098,7 +1098,7 @@ func TestApierAddTriggeredAction2(t *testing.T) { func TestApierGetAccountActionTriggers2(t *testing.T) { var reply engine.ActionTriggers req := utils.TenantAccount{Tenant: "cgrates.org", Account: "dan2"} - if err := rater.Call("ApierV1.GetAccountActionTriggers", req, &reply); err != nil { + if err := rater.Call(utils.ApierV1GetAccountActionTriggers, req, &reply); err != nil { t.Error("Got error on ApierV1.GetAccountActionTimings: ", err.Error()) } else if len(reply) != 1 || reply[0].ActionsID != "LOG_BALANCE" { t.Errorf("Unexpected action triggers received %v", reply) @@ -1110,7 +1110,7 @@ func TestApierSetAccountActionTriggers(t *testing.T) { // Test first get so we can steal the id which we need to remove var reply engine.ActionTriggers req := utils.TenantAccount{Tenant: "cgrates.org", Account: "dan2"} - if err := rater.Call("ApierV1.GetAccountActionTriggers", req, &reply); err != nil { + if err := rater.Call(utils.ApierV1GetAccountActionTriggers, req, &reply); err != nil { t.Error("Got error on ApierV1.GetAccountActionTimings: ", err.Error()) } else if len(reply) != 1 || reply[0].ActionsID != "LOG_BALANCE" { for _, atr := range reply { @@ -1120,17 +1120,17 @@ func TestApierSetAccountActionTriggers(t *testing.T) { } var setReply string setReq := AttrSetAccountActionTriggers{Tenant: "cgrates.org", Account: "dan2", UniqueID: reply[0].UniqueID, ActivationDate: utils.StringPointer("2016-02-05T18:00:00Z")} - if err := rater.Call("ApierV1.ResetAccountActionTriggers", setReq, &setReply); err != nil { + if err := rater.Call(utils.ApierV1ResetAccountActionTriggers, setReq, &setReply); err != nil { t.Error("Got error on ApierV1.ResetActionTiming: ", err.Error()) } else if setReply != utils.OK { t.Error("Unexpected answer received", setReply) } - if err := rater.Call("ApierV1.SetAccountActionTriggers", setReq, &setReply); err != nil { + if err := rater.Call(utils.ApierV1SetAccountActionTriggers, setReq, &setReply); err != nil { t.Error("Got error on ApierV1.RemoveActionTiming: ", err.Error()) } else if setReply != utils.OK { t.Error("Unexpected answer received", setReply) } - if err := rater.Call("ApierV1.GetAccountActionTriggers", req, &reply); err != nil { + if err := rater.Call(utils.ApierV1GetAccountActionTriggers, req, &reply); err != nil { t.Error("Got error on ApierV1.GetAccountActionTriggers: ", err.Error()) } else if len(reply) != 1 || reply[0].ActivationDate != time.Date(2016, 2, 5, 18, 0, 0, 0, time.UTC) { t.Errorf("Unexpected action triggers received %+v", reply[0]) @@ -1142,7 +1142,7 @@ func TestApierRemAccountActionTriggers(t *testing.T) { // Test first get so we can steal the id which we need to remove var reply engine.ActionTriggers req := utils.TenantAccount{Tenant: "cgrates.org", Account: "dan2"} - if err := rater.Call("ApierV1.GetAccountActionTriggers", req, &reply); err != nil { + if err := rater.Call(utils.ApierV1GetAccountActionTriggers, req, &reply); err != nil { t.Error("Got error on ApierV1.GetAccountActionTimings: ", err.Error()) } else if len(reply) != 1 || reply[0].ActionsID != "LOG_BALANCE" { for _, atr := range reply { @@ -1152,17 +1152,17 @@ func TestApierRemAccountActionTriggers(t *testing.T) { } var rmReply string rmReq := AttrRemoveAccountActionTriggers{Tenant: "cgrates.org", Account: "dan2", UniqueID: reply[0].UniqueID} - if err := rater.Call("ApierV1.ResetAccountActionTriggers", rmReq, &rmReply); err != nil { + if err := rater.Call(utils.ApierV1ResetAccountActionTriggers, rmReq, &rmReply); err != nil { t.Error("Got error on ApierV1.ResetActionTiming: ", err.Error()) } else if rmReply != utils.OK { t.Error("Unexpected answer received", rmReply) } - if err := rater.Call("ApierV1.RemoveAccountActionTriggers", rmReq, &rmReply); err != nil { + if err := rater.Call(utils.ApierV1RemoveAccountActionTriggers, rmReq, &rmReply); err != nil { t.Error("Got error on ApierV1.RemoveActionTiming: ", err.Error()) } else if rmReply != utils.OK { t.Error("Unexpected answer received", rmReply) } - if err := rater.Call("ApierV1.GetAccountActionTriggers", req, &reply); err != nil { + if err := rater.Call(utils.ApierV1GetAccountActionTriggers, req, &reply); err != nil { t.Error("Got error on ApierV1.GetAccountActionTriggers: ", err.Error()) } else if len(reply) != 0 { t.Errorf("Unexpected action triggers received %+v", reply[0]) @@ -1173,7 +1173,7 @@ func TestApierRemAccountActionTriggers(t *testing.T) { func TestApierSetAccount(t *testing.T) { reply := "" attrs := &utils.AttrSetAccount{Tenant: "cgrates.org", Account: "dan7", ActionPlanId: "ATMS_1", ReloadScheduler: true} - if err := rater.Call("ApierV1.SetAccount", attrs, &reply); err != nil { + if err := rater.Call(utils.ApierV1SetAccount, attrs, &reply); err != nil { t.Error("Got error on ApierV1.SetAccount: ", err.Error()) } else if reply != "OK" { t.Errorf("Calling ApierV1.SetAccount received: %s", reply) @@ -1183,7 +1183,7 @@ func TestApierSetAccount(t *testing.T) { *attrs2 = *attrs attrs2.ActionPlanId = "DUMMY_DATA" // Does not exist so it should error when adding triggers on it // Add account with actions timing which does not exist - if err := rater.Call("ApierV1.SetAccount", attrs2, &reply2); err == nil || reply2 == "OK" { // OK is not welcomed + if err := rater.Call(utils.ApierV1SetAccount, attrs2, &reply2); err == nil || reply2 == "OK" { // OK is not welcomed t.Error("Expecting error on ApierV1.SetAccount.", err, reply2) } } @@ -1206,7 +1206,7 @@ func TestApierGetAccountActionPlan(t *testing.T) { // Make sure we have scheduled actions func TestApierITGetScheduledActionsForAccount(t *testing.T) { var rply []*scheduler.ScheduledAction - if err := rater.Call("ApierV1.GetScheduledActions", + if err := rater.Call(utils.ApierV1GetScheduledActions, scheduler.ArgsGetScheduledActions{ Tenant: utils.StringPointer("cgrates.org"), Account: utils.StringPointer("dan7")}, &rply); err != nil { @@ -1220,7 +1220,7 @@ func TestApierITGetScheduledActionsForAccount(t *testing.T) { func TestApierRemUniqueIDActionTiming(t *testing.T) { var rmReply string rmReq := AttrRemoveActionTiming{ActionPlanId: "ATMS_1", Tenant: "cgrates.org", Account: "dan4"} - if err := rater.Call("ApierV1.RemoveActionTiming", rmReq, &rmReply); err != nil { + if err := rater.Call(utils.ApierV1RemoveActionTiming, rmReq, &rmReply); err != nil { t.Error("Got error on ApierV1.RemoveActionTiming: ", err.Error()) } else if rmReply != utils.OK { t.Error("Unexpected answer received", rmReply) @@ -1274,13 +1274,13 @@ func TestApierGetAccount(t *testing.T) { func TestApierTriggersExecute(t *testing.T) { reply := "" attrs := &utils.AttrSetAccount{Tenant: "cgrates.org", Account: "dan8", ReloadScheduler: true} - if err := rater.Call("ApierV1.SetAccount", attrs, &reply); err != nil { + if err := rater.Call(utils.ApierV1SetAccount, attrs, &reply); err != nil { t.Error("Got error on ApierV1.SetAccount: ", err.Error()) } else if reply != "OK" { t.Errorf("Calling ApierV1.SetAccount received: %s", reply) } attrAddBlnc := &AttrAddBalance{Tenant: "cgrates.org", Account: "1008", BalanceType: "*monetary", Value: 2} - if err := rater.Call("ApierV1.AddBalance", attrAddBlnc, &reply); err != nil { + if err := rater.Call(utils.ApierV1AddBalance, attrAddBlnc, &reply); err != nil { t.Error("Got error on ApierV1.AddBalance: ", err.Error()) } else if reply != "OK" { t.Errorf("Calling ApierV1.AddBalance received: %s", reply) @@ -1292,7 +1292,7 @@ func TestApierResetDataBeforeLoadFromFolder(t *testing.T) { TestApierInitDataDb(t) var reply string // Simple test that command is executed without errors - if err := rater.Call("CacheSv1.FlushCache", utils.AttrReloadCache{FlushAll: true}, &reply); err != nil { + if err := rater.Call(utils.CacheSv1FlushCache, utils.AttrReloadCache{FlushAll: true}, &reply); err != nil { t.Error(err) } else if reply != "OK" { t.Error("Reply: ", reply) @@ -1331,12 +1331,12 @@ func TestApierLoadTariffPlanFromFolder(t *testing.T) { // For now just test that they execute without errors func TestApierComputeReverse(t *testing.T) { var reply string - if err := rater.Call("ApierV1.ComputeReverseDestinations", "", &reply); err != nil { + if err := rater.Call(utils.ApierV1ComputeReverseDestinations, "", &reply); err != nil { t.Error(err) } else if reply != utils.OK { t.Error("Received: ", reply) } - if err := rater.Call("ApierV1.ComputeAccountActionPlans", "", &reply); err != nil { + if err := rater.Call(utils.ApierV1ComputeAccountActionPlans, "", &reply); err != nil { t.Error(err) } else if reply != utils.OK { t.Error("Received: ", reply) @@ -1359,7 +1359,7 @@ func TestApierResetDataAfterLoadFromFolder(t *testing.T) { } reply := "" // Simple test that command is executed without errors - if err := rater.Call("CacheSv1.LoadCache", utils.AttrReloadCache{}, &reply); err != nil { + if err := rater.Call(utils.CacheSv1LoadCache, utils.AttrReloadCache{}, &reply); err != nil { t.Error(err) } else if reply != "OK" { t.Error(reply) @@ -1589,30 +1589,30 @@ func TestApierGetCallCostLog(t *testing.T) { func TestApierITSetDestination(t *testing.T) { attrs := utils.AttrSetDestination{Id: "TEST_SET_DESTINATION", Prefixes: []string{"+4986517174963", "+4986517174960"}} var reply string - if err := rater.Call("ApierV1.SetDestination", attrs, &reply); err != nil { + if err := rater.Call(utils.ApierV1SetDestination, attrs, &reply); err != nil { t.Error("Unexpected error", err.Error()) } else if reply != utils.OK { t.Error("Unexpected reply returned", reply) } - if err := rater.Call("ApierV1.SetDestination", attrs, &reply); err == nil || err.Error() != "EXISTS" { // Second time without overwrite should generate error + if err := rater.Call(utils.ApierV1SetDestination, attrs, &reply); err == nil || err.Error() != "EXISTS" { // Second time without overwrite should generate error t.Error("Unexpected error", err.Error()) } attrs = utils.AttrSetDestination{Id: "TEST_SET_DESTINATION", Prefixes: []string{"+4986517174963", "+4986517174964"}, Overwrite: true} - if err := rater.Call("ApierV1.SetDestination", attrs, &reply); err != nil { + if err := rater.Call(utils.ApierV1SetDestination, attrs, &reply); err != nil { t.Error("Unexpected error", err.Error()) } else if reply != utils.OK { t.Error("Unexpected reply returned", reply) } eDestination := engine.Destination{Id: attrs.Id, Prefixes: attrs.Prefixes} var rcvDestination engine.Destination - if err := rater.Call("ApierV1.GetDestination", attrs.Id, &rcvDestination); err != nil { + if err := rater.Call(utils.ApierV1GetDestination, attrs.Id, &rcvDestination); err != nil { t.Error("Unexpected error", err.Error()) } else if !reflect.DeepEqual(eDestination, rcvDestination) { t.Errorf("Expecting: %+v, received: %+v", eDestination, rcvDestination) } eRcvIDs := []string{attrs.Id} var rcvIDs []string - if err := rater.Call("ApierV1.GetReverseDestination", attrs.Prefixes[0], &rcvIDs); err != nil { + if err := rater.Call(utils.ApierV1GetReverseDestination, attrs.Prefixes[0], &rcvIDs); err != nil { t.Error("Unexpected error", err.Error()) } else if !reflect.DeepEqual(eRcvIDs, rcvIDs) { t.Errorf("Expecting: %+v, received: %+v", eRcvIDs, rcvIDs) @@ -1621,7 +1621,7 @@ func TestApierITSetDestination(t *testing.T) { func TestApierITGetScheduledActions(t *testing.T) { var rply []*scheduler.ScheduledAction - if err := rater.Call("ApierV1.GetScheduledActions", scheduler.ArgsGetScheduledActions{}, &rply); err != nil { + if err := rater.Call(utils.ApierV1GetScheduledActions, scheduler.ArgsGetScheduledActions{}, &rply); err != nil { t.Error("Unexpected error: ", err) } } @@ -1630,7 +1630,7 @@ func TestApierITGetDataCost(t *testing.T) { attrs := AttrGetDataCost{Category: "data", Tenant: "cgrates.org", Subject: "1001", AnswerTime: "*now", Usage: 640113} var rply *engine.DataCost - if err := rater.Call("ApierV1.GetDataCost", attrs, &rply); err != nil { + if err := rater.Call(utils.ApierV1GetDataCost, attrs, &rply); err != nil { t.Error("Unexpected nil error received: ", err.Error()) } else if rply.Cost != 128.0240 { t.Errorf("Unexpected cost received: %f", rply.Cost) @@ -1641,7 +1641,7 @@ func TestApierITGetCost(t *testing.T) { attrs := AttrGetCost{Category: "data", Tenant: "cgrates.org", Subject: "1001", AnswerTime: "*now", Usage: "640113"} var rply *engine.EventCost - if err := rater.Call("ApierV1.GetCost", attrs, &rply); err != nil { + if err := rater.Call(utils.ApierV1GetCost, attrs, &rply); err != nil { t.Error("Unexpected nil error received: ", err.Error()) } else if *rply.Cost != 128.0240 { t.Errorf("Unexpected cost received: %f", *rply.Cost) @@ -1664,7 +1664,7 @@ func TestApierInitStorDb2(t *testing.T) { func TestApierReloadCache2(t *testing.T) { reply := "" // Simple test that command is executed without errors - if err := rater.Call("CacheSv1.FlushCache", utils.AttrReloadCache{FlushAll: true}, &reply); err != nil { + if err := rater.Call(utils.CacheSv1FlushCache, utils.AttrReloadCache{FlushAll: true}, &reply); err != nil { t.Error("Got error on CacheSv1.ReloadCache: ", err.Error()) } else if reply != utils.OK { t.Error("Calling CacheSv1.ReloadCache got reply: ", reply) @@ -1683,7 +1683,7 @@ func TestApierReloadScheduler2(t *testing.T) { func TestApierImportTPFromFolderPath(t *testing.T) { var reply string - if err := rater.Call("ApierV1.ImportTariffPlanFromFolder", + if err := rater.Call(utils.ApierV1ImportTariffPlanFromFolder, utils.AttrImportTPFromFolder{TPid: "TEST_TPID2", FolderPath: "/usr/share/cgrates/tariffplans/oldtutorial"}, &reply); err != nil { t.Error("Got error on ApierV1.ImportTarrifPlanFromFolder: ", err.Error()) @@ -1695,7 +1695,7 @@ func TestApierImportTPFromFolderPath(t *testing.T) { func TestApierLoadTariffPlanFromStorDbDryRun(t *testing.T) { var reply string - if err := rater.Call("ApierV1.LoadTariffPlanFromStorDb", + if err := rater.Call(utils.ApierV1LoadTariffPlanFromStorDb, AttrLoadTpFromStorDb{TPid: "TEST_TPID2", DryRun: true}, &reply); err != nil { t.Error("Got error on ApierV1.LoadTariffPlanFromStorDb: ", err.Error()) } else if reply != utils.OK { @@ -1716,7 +1716,7 @@ func TestApierGetCacheStats2(t *testing.T) { func TestApierLoadTariffPlanFromStorDb(t *testing.T) { var reply string - if err := rater.Call("ApierV1.LoadTariffPlanFromStorDb", + if err := rater.Call(utils.ApierV1LoadTariffPlanFromStorDb, AttrLoadTpFromStorDb{TPid: "TEST_TPID2"}, &reply); err != nil { t.Error("Got error on ApierV1.LoadTariffPlanFromStorDb: ", err.Error()) } else if reply != utils.OK { @@ -1791,7 +1791,7 @@ func TestApierReplayFailedPosts(t *testing.T) { } fileOut.Close() var reply string - if err := rater.Call("ApierV1.ReplayFailedPosts", args, &reply); err != nil { + if err := rater.Call(utils.ApierV1ReplayFailedPosts, args, &reply); err != nil { t.Error(err) } else if reply != utils.OK { t.Error("Unexpected reply: ", reply) @@ -1813,7 +1813,7 @@ func TestApierReplayFailedPosts(t *testing.T) { t.Error(err) } fileOut.Close() - if err := rater.Call("ApierV1.ReplayFailedPosts", args, &reply); err != nil { + if err := rater.Call(utils.ApierV1ReplayFailedPosts, args, &reply); err != nil { t.Error(err) } else if reply != utils.OK { t.Error("Unexpected reply: ", reply) diff --git a/apier/v1/tp_it_test.go b/apier/v1/tp_it_test.go index a40b2c648..ca13e35af 100644 --- a/apier/v1/tp_it_test.go +++ b/apier/v1/tp_it_test.go @@ -109,7 +109,7 @@ func testTPRpcConn(t *testing.T) { func testTPImportTPFromFolderPath(t *testing.T) { var reply string - if err := tpRPC.Call("ApierV1.ImportTariffPlanFromFolder", + if err := tpRPC.Call(utils.ApierV1ImportTariffPlanFromFolder, utils.AttrImportTPFromFolder{TPid: "TEST_TPID2", FolderPath: path.Join(tpDataDir, "tariffplans", "tutorial")}, &reply); err != nil { t.Error("Got error on ApierV1.ImportTarrifPlanFromFolder: ", err.Error()) @@ -132,7 +132,7 @@ func testTPExportTPToFolder(t *testing.T) { tpid := "TEST_TPID2" compress := true exportPath := "/tmp/" - if err := tpRPC.Call("ApierV1.ExportTPToFolder", &utils.AttrDirExportTP{TPid: &tpid, ExportPath: &exportPath, Compress: &compress}, &reply); err != nil { + if err := tpRPC.Call(utils.ApierV1ExportTPToFolder, &utils.AttrDirExportTP{TPid: &tpid, ExportPath: &exportPath, Compress: &compress}, &reply); err != nil { t.Error("Got error on ApierV1.ExportTPToFolder: ", err.Error()) } else if !reflect.DeepEqual(reply.ExportPath, expectedTPStas.ExportPath) { t.Errorf("Expecting : %+v, received: %+v", expectedTPStas.ExportPath, reply.ExportPath) diff --git a/apier/v1/tpactions_it_test.go b/apier/v1/tpactions_it_test.go index a2b5a3dc0..934f2cd00 100644 --- a/apier/v1/tpactions_it_test.go +++ b/apier/v1/tpactions_it_test.go @@ -182,7 +182,7 @@ func testTPActionsSetTPAction(t *testing.T) { }, } var result string - if err := tpActionRPC.Call("ApierV1.SetTPActions", tpActions, &result); err != nil { + if err := tpActionRPC.Call(utils.ApierV1SetTPActions, tpActions, &result); err != nil { t.Error(err) } else if result != utils.OK { t.Error("Unexpected reply returned", result) @@ -206,7 +206,7 @@ func testTPActionsGetTPActionAfterSet(t *testing.T) { func testTPActionsGetTPActionIds(t *testing.T) { var result []string expectedTPID := []string{"ID"} - if err := tpActionRPC.Call("ApierV1.GetTPActionIds", + if err := tpActionRPC.Call(utils.ApierV1GetTPActionIds, &AttrGetTPActionIds{TPid: "TPAcc"}, &result); err != nil { t.Error(err) } else if !reflect.DeepEqual(expectedTPID, result) { @@ -275,7 +275,7 @@ func testTPActionsUpdateTPAction(t *testing.T) { }, } var result string - if err := tpActionRPC.Call("ApierV1.SetTPActions", tpActions, &result); err != nil { + if err := tpActionRPC.Call(utils.ApierV1SetTPActions, tpActions, &result); err != nil { t.Error(err) } else if result != utils.OK { t.Error("Unexpected reply returned", result) @@ -300,7 +300,7 @@ func testTPActionsGetTPActionAfterUpdate(t *testing.T) { func testTPActionsRemTPAction(t *testing.T) { var resp string - if err := tpActionRPC.Call("ApierV1.RemoveTPActions", + if err := tpActionRPC.Call(utils.ApierV1RemoveTPActions, &AttrGetTPActions{TPid: "TPAcc", ID: "ID"}, &resp); err != nil { t.Error(err) } else if resp != utils.OK { diff --git a/apier/v1/tpdestinationrates_it_test.go b/apier/v1/tpdestinationrates_it_test.go index 3502cd8f3..b3afc73b1 100644 --- a/apier/v1/tpdestinationrates_it_test.go +++ b/apier/v1/tpdestinationrates_it_test.go @@ -145,7 +145,7 @@ func testTPDstRateSetTPDstRate(t *testing.T) { }, } var result string - if err := tpDstRateRPC.Call("ApierV1.SetTPDestinationRate", tpDstRate, &result); err != nil { + if err := tpDstRateRPC.Call(utils.ApierV1SetTPDestinationRate, tpDstRate, &result); err != nil { t.Error(err) } else if result != utils.OK { t.Error("Unexpected reply returned", result) @@ -165,7 +165,7 @@ func testTPDstRateGetTPDstRateAfterSet(t *testing.T) { func testTPDstRateGetTPDstRateIds(t *testing.T) { var result []string expectedTPID := []string{"DR_FREESWITCH_USERS"} - if err := tpDstRateRPC.Call("ApierV1.GetTPDestinationRateIds", + if err := tpDstRateRPC.Call(utils.ApierV1GetTPDestinationRateIds, &AttrTPDestinationRateIds{TPid: "TP1"}, &result); err != nil { t.Error(err) } else if !reflect.DeepEqual(expectedTPID, result) { @@ -190,7 +190,7 @@ func testTPDstRateGetTPDstRateAfterUpdate(t *testing.T) { func testTPDstRateRemTPDstRate(t *testing.T) { var resp string - if err := tpDstRateRPC.Call("ApierV1.RemoveTPDestinationRate", + if err := tpDstRateRPC.Call(utils.ApierV1RemoveTPDestinationRate, &AttrGetTPDestinationRate{TPid: "TP1", ID: "DR_FREESWITCH_USERS"}, &resp); err != nil { t.Error(err) } else if resp != utils.OK { diff --git a/apier/v1/tpratingplans_it_test.go b/apier/v1/tpratingplans_it_test.go index 652749277..4dd692a68 100644 --- a/apier/v1/tpratingplans_it_test.go +++ b/apier/v1/tpratingplans_it_test.go @@ -129,7 +129,7 @@ func testTPRatingPlansRpcConn(t *testing.T) { func testTPRatingPlansGetTPRatingPlanBeforeSet(t *testing.T) { var reply *utils.TPRatingPlan - if err := tpRatingPlanRPC.Call("ApierV1.GetTPRatingPlan", + if err := tpRatingPlanRPC.Call(utils.ApierV1GetTPRatingPlan, &AttrGetTPRatingPlan{TPid: "TPRP1", ID: "Plan1"}, &reply); err == nil || err.Error() != utils.ErrNotFound.Error() { t.Error(err) } @@ -153,7 +153,7 @@ func testTPRatingPlansSetTPRatingPlan(t *testing.T) { }, } var result string - if err := tpRatingPlanRPC.Call("ApierV1.SetTPRatingPlan", tpRatingPlan, &result); err != nil { + if err := tpRatingPlanRPC.Call(utils.ApierV1SetTPRatingPlan, tpRatingPlan, &result); err != nil { t.Error(err) } else if result != utils.OK { t.Error("Unexpected reply returned", result) @@ -162,7 +162,7 @@ func testTPRatingPlansSetTPRatingPlan(t *testing.T) { func testTPRatingPlansGetTPRatingPlanAfterSet(t *testing.T) { var respond *utils.TPRatingPlan - if err := tpRatingPlanRPC.Call("ApierV1.GetTPRatingPlan", + if err := tpRatingPlanRPC.Call(utils.ApierV1GetTPRatingPlan, &AttrGetTPRatingPlan{TPid: "TPRP1", ID: "Plan1"}, &respond); err != nil { t.Error(err) } else if !reflect.DeepEqual(tpRatingPlan.TPid, respond.TPid) { @@ -177,7 +177,7 @@ func testTPRatingPlansGetTPRatingPlanAfterSet(t *testing.T) { func testTPRatingPlansGetTPRatingPlanIds(t *testing.T) { var result []string expected := []string{"Plan1"} - if err := tpRatingPlanRPC.Call("ApierV1.GetTPRatingPlanIds", + if err := tpRatingPlanRPC.Call(utils.ApierV1GetTPRatingPlanIds, &AttrGetTPRatingPlanIds{TPid: tpRatingPlan.TPid}, &result); err != nil { t.Error(err) } else if !reflect.DeepEqual(expected, result) { @@ -204,7 +204,7 @@ func testTPRatingPlansUpdateTPRatingPlan(t *testing.T) { }, } var result string - if err := tpRatingPlanRPC.Call("ApierV1.SetTPRatingPlan", tpRatingPlan, &result); err != nil { + if err := tpRatingPlanRPC.Call(utils.ApierV1SetTPRatingPlan, tpRatingPlan, &result); err != nil { t.Error(err) } else if result != utils.OK { t.Error("Unexpected reply returned", result) @@ -213,7 +213,7 @@ func testTPRatingPlansUpdateTPRatingPlan(t *testing.T) { func testTPRatingPlansGetTPRatingPlanAfterUpdate(t *testing.T) { var respond *utils.TPRatingPlan - if err := tpRatingPlanRPC.Call("ApierV1.GetTPRatingPlan", + if err := tpRatingPlanRPC.Call(utils.ApierV1GetTPRatingPlan, &AttrGetTPRatingPlan{TPid: "TPRP1", ID: "Plan1"}, &respond); err != nil { t.Error(err) } else if !reflect.DeepEqual(tpRatingPlan.TPid, respond.TPid) { @@ -227,7 +227,7 @@ func testTPRatingPlansGetTPRatingPlanAfterUpdate(t *testing.T) { func testTPRatingPlansRemoveTPRatingPlan(t *testing.T) { var resp string - if err := tpRatingPlanRPC.Call("ApierV1.RemoveTPRatingPlan", + if err := tpRatingPlanRPC.Call(utils.ApierV1RemoveTPRatingPlan, &AttrGetTPRatingPlan{TPid: "TPRP1", ID: "Plan1"}, &resp); err != nil { t.Error(err) } else if resp != utils.OK { @@ -237,7 +237,7 @@ func testTPRatingPlansRemoveTPRatingPlan(t *testing.T) { func testTPRatingPlansGetTPRatingPlanAfterRemove(t *testing.T) { var respond *utils.TPRatingPlan - if err := tpRatingPlanRPC.Call("ApierV1.GetTPRatingPlan", + if err := tpRatingPlanRPC.Call(utils.ApierV1GetTPRatingPlan, &AttrGetTPRatingPlan{TPid: "TPRP1", ID: "Plan1"}, &respond); err == nil || err.Error() != utils.ErrNotFound.Error() { t.Error(err) } diff --git a/apier/v1/tpratingprofiles_it_test.go b/apier/v1/tpratingprofiles_it_test.go index 19db40a87..8bfda30ed 100644 --- a/apier/v1/tpratingprofiles_it_test.go +++ b/apier/v1/tpratingprofiles_it_test.go @@ -133,7 +133,7 @@ func testTPRatingProfilesRpcConn(t *testing.T) { func testTPRatingProfilesGetTPRatingProfileBeforeSet(t *testing.T) { var reply *utils.TPRatingProfile - if err := tpRatingProfileRPC.Call("ApierV1.GetTPRatingProfile", + if err := tpRatingProfileRPC.Call(utils.ApierV1GetTPRatingProfile, &AttrGetTPRatingProfile{TPid: "TPRProf1", RatingProfileId: tpRatingProfileID}, &reply); err == nil || err.Error() != utils.ErrNotFound.Error() { t.Error(err) } @@ -160,7 +160,7 @@ func testTPRatingProfilesSetTPRatingProfile(t *testing.T) { }, } var result string - if err := tpRatingProfileRPC.Call("ApierV1.SetTPRatingProfile", tpRatingProfile, &result); err != nil { + if err := tpRatingProfileRPC.Call(utils.ApierV1SetTPRatingProfile, tpRatingProfile, &result); err != nil { t.Error(err) } else if result != utils.OK { t.Error("Unexpected reply returned", result) @@ -169,7 +169,7 @@ func testTPRatingProfilesSetTPRatingProfile(t *testing.T) { func testTPRatingProfilesGetTPRatingProfileAfterSet(t *testing.T) { var respond *utils.TPRatingProfile - if err := tpRatingProfileRPC.Call("ApierV1.GetTPRatingProfile", + if err := tpRatingProfileRPC.Call(utils.ApierV1GetTPRatingProfile, &AttrGetTPRatingProfile{TPid: "TPRProf1", RatingProfileId: tpRatingProfileID}, &respond); err != nil { t.Error(err) } else if !reflect.DeepEqual(tpRatingProfile.TPid, respond.TPid) { @@ -190,7 +190,7 @@ func testTPRatingProfilesGetTPRatingProfileAfterSet(t *testing.T) { func testTPRatingProfilesGetTPRatingProfileLoadIds(t *testing.T) { var result []string expected := []string{"RPrf"} - if err := tpRatingProfileRPC.Call("ApierV1.GetTPRatingProfileLoadIds", + if err := tpRatingProfileRPC.Call(utils.ApierV1GetTPRatingProfileLoadIds, &utils.AttrTPRatingProfileIds{TPid: tpRatingProfile.TPid, Tenant: tpRatingProfile.Tenant, Category: tpRatingProfile.Category, Subject: tpRatingProfile.Subject}, &result); err != nil { t.Error(err) @@ -201,7 +201,7 @@ func testTPRatingProfilesGetTPRatingProfileLoadIds(t *testing.T) { func testTPRatingProfilesGetTPRatingProfilesByLoadId(t *testing.T) { var respond *[]*utils.TPRatingProfile - if err := tpRatingProfileRPC.Call("ApierV1.GetTPRatingProfilesByLoadId", + if err := tpRatingProfileRPC.Call(utils.ApierV1GetTPRatingProfilesByLoadId, &utils.TPRatingProfile{TPid: "TPRProf1", LoadId: "RPrf"}, &respond); err != nil { t.Error(err) } else if !reflect.DeepEqual(tpRatingProfile.TPid, (*respond)[0].TPid) { @@ -238,7 +238,7 @@ func testTPRatingProfilesUpdateTPRatingProfile(t *testing.T) { FallbackSubjects: "Retreat", }, } - if err := tpRatingProfileRPC.Call("ApierV1.SetTPRatingProfile", tpRatingProfile, &result); err != nil { + if err := tpRatingProfileRPC.Call(utils.ApierV1SetTPRatingProfile, tpRatingProfile, &result); err != nil { t.Error(err) } else if result != utils.OK { t.Error("Unexpected reply returned", result) @@ -247,7 +247,7 @@ func testTPRatingProfilesUpdateTPRatingProfile(t *testing.T) { func testTPRatingProfilesGetTPRatingProfileAfterUpdate(t *testing.T) { var respond *utils.TPRatingProfile - if err := tpRatingProfileRPC.Call("ApierV1.GetTPRatingProfile", + if err := tpRatingProfileRPC.Call(utils.ApierV1GetTPRatingProfile, &AttrGetTPRatingProfile{TPid: "TPRProf1", RatingProfileId: tpRatingProfileID}, &respond); err != nil { t.Error(err) } else if !reflect.DeepEqual(tpRatingProfile.TPid, respond.TPid) { @@ -268,7 +268,7 @@ func testTPRatingProfilesGetTPRatingProfileAfterUpdate(t *testing.T) { func testTPRatingProfilesGetTPRatingProfileIds(t *testing.T) { var respond []string expected := []string{"RPrf:Tenant1:Category:Subject"} - if err := tpRatingProfileRPC.Call("ApierV1.GetTPRatingProfileIds", + if err := tpRatingProfileRPC.Call(utils.ApierV1GetTPRatingProfileIds, &AttrGetTPRatingProfileIds{TPid: "TPRProf1"}, &respond); err != nil { t.Error(err) } else if !reflect.DeepEqual(expected, respond) { @@ -278,7 +278,7 @@ func testTPRatingProfilesGetTPRatingProfileIds(t *testing.T) { func testTPRatingProfilesRemoveTPRatingProfile(t *testing.T) { var resp string - if err := tpRatingProfileRPC.Call("ApierV1.RemoveTPRatingProfile", + if err := tpRatingProfileRPC.Call(utils.ApierV1RemoveTPRatingProfile, &AttrGetTPRatingProfile{TPid: "TPRProf1", RatingProfileId: tpRatingProfile.GetId()}, &resp); err != nil { t.Error(err) } else if resp != utils.OK { @@ -289,7 +289,7 @@ func testTPRatingProfilesRemoveTPRatingProfile(t *testing.T) { func testTPRatingProfilesGetTPRatingProfileAfterRemove(t *testing.T) { var respond *utils.TPRatingProfile - if err := tpRatingProfileRPC.Call("ApierV1.GetTPRatingProfile", + if err := tpRatingProfileRPC.Call(utils.ApierV1GetTPRatingProfile, &AttrGetTPRatingProfile{TPid: "TPRProf1", RatingProfileId: tpRatingProfileID}, &respond); err == nil || err.Error() != utils.ErrNotFound.Error() { t.Error(err) } diff --git a/apier/v1/versions_it_test.go b/apier/v1/versions_it_test.go index 5ca486f47..ea4b90e57 100644 --- a/apier/v1/versions_it_test.go +++ b/apier/v1/versions_it_test.go @@ -146,7 +146,7 @@ func testVrsSetDataDBVrs(t *testing.T) { "Attributes": 3, }, } - if err := vrsRPC.Call("ApierV1.SetDataDBVersions", args, &reply); err != nil { + if err := vrsRPC.Call(utils.ApierV1SetDataDBVersions, args, &reply); err != nil { t.Error(err) } else if reply != utils.OK { t.Errorf("Expecting: %+v, received: %+v", utils.OK, reply) @@ -167,7 +167,7 @@ func testVrsSetDataDBVrs(t *testing.T) { args = SetVersionsArg{ Versions: nil, } - if err := vrsRPC.Call("ApierV1.SetDataDBVersions", args, &reply); err != nil { + if err := vrsRPC.Call(utils.ApierV1SetDataDBVersions, args, &reply); err != nil { t.Error(err) } else if reply != utils.OK { t.Errorf("Expecting: %+v, received: %+v", utils.OK, reply) @@ -181,7 +181,7 @@ func testVrsSetStorDBVrs(t *testing.T) { "TpResources": 2, }, } - if err := vrsRPC.Call("ApierV1.SetStorDBVersions", args, &reply); err != nil { + if err := vrsRPC.Call(utils.ApierV1SetStorDBVersions, args, &reply); err != nil { t.Error(err) } else if reply != utils.OK { t.Errorf("Expecting: %+v, received: %+v", utils.OK, reply) @@ -202,7 +202,7 @@ func testVrsSetStorDBVrs(t *testing.T) { args = SetVersionsArg{ Versions: nil, } - if err := vrsRPC.Call("ApierV1.SetStorDBVersions", args, &reply); err != nil { + if err := vrsRPC.Call(utils.ApierV1SetStorDBVersions, args, &reply); err != nil { t.Error(err) } else if reply != utils.OK { t.Errorf("Expecting: %+v, received: %+v", utils.OK, reply) diff --git a/apier/v2/apierv2_it_test.go b/apier/v2/apierv2_it_test.go index e91bf35d9..764714049 100644 --- a/apier/v2/apierv2_it_test.go +++ b/apier/v2/apierv2_it_test.go @@ -131,11 +131,11 @@ func TestApierV2itSetAction(t *testing.T) { {Identifier: utils.DISABLE_ACCOUNT, Weight: 10.0}, }} var reply string - if err := apierRPC.Call("ApierV2.SetActions", attrs, &reply); err != nil { + if err := apierRPC.Call(utils.ApierV2SetActions, attrs, &reply); err != nil { t.Error(err) } var acts map[string]engine.Actions - if err := apierRPC.Call("ApierV2.GetActions", AttrGetActions{ActionIDs: []string{attrs.ActionsId}}, &acts); err != nil { + if err := apierRPC.Call(utils.ApierV2GetActions, AttrGetActions{ActionIDs: []string{attrs.ActionsId}}, &acts); err != nil { t.Error(err) } else if len(acts) != 1 { t.Errorf("Received actions: %+v", acts) @@ -153,20 +153,20 @@ func TestApierV2itSetAccountActionTriggers(t *testing.T) { ActionsID: utils.StringPointer("DISABLE_ACCOUNT"), } var reply string - if err := apierRPC.Call("ApierV2.SetAccountActionTriggers", attrs, &reply); err != nil { + if err := apierRPC.Call(utils.ApierV2SetAccountActionTriggers, attrs, &reply); err != nil { t.Error(err) } var ats engine.ActionTriggers - if err := apierRPC.Call("ApierV2.GetAccountActionTriggers", utils.TenantAccount{Tenant: "cgrates.org", Account: "dan"}, &ats); err != nil { + if err := apierRPC.Call(utils.ApierV2GetAccountActionTriggers, utils.TenantAccount{Tenant: "cgrates.org", Account: "dan"}, &ats); err != nil { t.Error(err) } else if len(ats) != 1 || ats[0].ID != *attrs.GroupID || ats[0].ThresholdValue != 50.0 { t.Errorf("Received: %+v", ats) } attrs.ThresholdValue = utils.Float64Pointer(55) // Change the threshold - if err := apierRPC.Call("ApierV2.SetAccountActionTriggers", attrs, &reply); err != nil { + if err := apierRPC.Call(utils.ApierV2SetAccountActionTriggers, attrs, &reply); err != nil { t.Error(err) } - if err := apierRPC.Call("ApierV2.GetAccountActionTriggers", utils.TenantAccount{Tenant: "cgrates.org", Account: "dan"}, &ats); err != nil { + if err := apierRPC.Call(utils.ApierV2GetAccountActionTriggers, utils.TenantAccount{Tenant: "cgrates.org", Account: "dan"}, &ats); err != nil { t.Error(err) } else if len(ats) != 1 || ats[0].ID != *attrs.GroupID || ats[0].ThresholdValue != 55.0 { t.Errorf("Received: %+v", ats) @@ -199,7 +199,7 @@ func TestApierV2itFraudMitigation(t *testing.T) { Account: "dan", Disabled: utils.BoolPointer(false), } - if err := apierRPC.Call("ApierV2.SetAccount", attrSetAcnt, &reply); err != nil { + if err := apierRPC.Call(utils.ApierV2SetAccount, attrSetAcnt, &reply); err != nil { t.Fatal(err) } if err := apierRPC.Call(utils.ApierV2GetAccount, &utils.AttrGetAccount{Tenant: "cgrates.org", Account: "dan"}, &acnt); err != nil { @@ -218,7 +218,7 @@ func TestApierV2itSetAccountWithAP(t *testing.T) { BalanceType: utils.MONETARY, Units: "5.0", Weight: 20.0}, }} var reply string - if err := apierRPC.Call("ApierV2.SetActions", argActs1, &reply); err != nil { + if err := apierRPC.Call(utils.ApierV2SetActions, argActs1, &reply); err != nil { t.Error(err) } tNow := time.Now().Add(time.Duration(time.Minute)) @@ -230,7 +230,7 @@ func TestApierV2itSetAccountWithAP(t *testing.T) { if _, err := dm.GetActionPlan(argAP1.Id, true, utils.NonTransactional); err == nil || err != utils.ErrNotFound { t.Error(err) } - if err := apierRPC.Call("ApierV1.SetActionPlan", argAP1, &reply); err != nil { + if err := apierRPC.Call(utils.ApierV1SetActionPlan, argAP1, &reply); err != nil { t.Error("Got error on ApierV1.SetActionPlan: ", err.Error()) } else if reply != utils.OK { t.Errorf("Calling ApierV1.SetActionPlan received: %s", reply) @@ -244,7 +244,7 @@ func TestApierV2itSetAccountWithAP(t *testing.T) { if _, err := dm.GetAccountActionPlans(acntID, true, utils.NonTransactional); err == nil || err != utils.ErrNotFound { t.Error(err) } - if err := apierRPC.Call("ApierV2.SetAccount", argSetAcnt1, &reply); err != nil { + if err := apierRPC.Call(utils.ApierV2SetAccount, argSetAcnt1, &reply); err != nil { t.Fatal(err) } if ap, err := dm.GetActionPlan(argAP1.Id, true, utils.NonTransactional); err != nil { @@ -265,7 +265,7 @@ func TestApierV2itSetAccountWithAP(t *testing.T) { if _, err := dm.GetActionPlan(argAP2.Id, true, utils.NonTransactional); err == nil || err != utils.ErrNotFound { t.Error(err) } - if err := apierRPC.Call("ApierV2.SetActionPlan", argAP2, &reply); err != nil { + if err := apierRPC.Call(utils.ApierV2SetActionPlan, argAP2, &reply); err != nil { t.Error("Got error on ApierV2.SetActionPlan: ", err.Error()) } else if reply != utils.OK { t.Errorf("Calling ApierV2.SetActionPlan received: %s", reply) @@ -276,7 +276,7 @@ func TestApierV2itSetAccountWithAP(t *testing.T) { Account: "TestApierV2itSetAccountWithAP1", ActionPlanIDs: &[]string{argAP2.Id}, } - if err := apierRPC.Call("ApierV2.SetAccount", argSetAcnt2, &reply); err != nil { + if err := apierRPC.Call(utils.ApierV2SetAccount, argSetAcnt2, &reply); err != nil { t.Fatal(err) } if ap, err := dm.GetActionPlan(argAP2.Id, true, utils.NonTransactional); err != nil { @@ -302,7 +302,7 @@ func TestApierV2itSetAccountWithAP(t *testing.T) { ActionPlanIDs: &[]string{argAP2.Id}, ActionPlansOverwrite: true, } - if err := apierRPC.Call("ApierV2.SetAccount", argSetAcnt2, &reply); err != nil { + if err := apierRPC.Call(utils.ApierV2SetAccount, argSetAcnt2, &reply); err != nil { t.Fatal(err) } if ap, err := dm.GetActionPlan(argAP1.Id, true, utils.NonTransactional); err != nil { @@ -338,12 +338,12 @@ func TestApierV2itSetActionWithCategory(t *testing.T) { BalanceType: utils.MONETARY, Categories: "test", Units: "5.0", Weight: 20.0}, }} - if err := apierRPC.Call("ApierV2.SetActions", argActs1, &reply); err != nil { + if err := apierRPC.Call(utils.ApierV2SetActions, argActs1, &reply); err != nil { t.Error(err) } attrsEA := &utils.AttrExecuteAction{Tenant: attrsSetAccount.Tenant, Account: attrsSetAccount.Account, ActionsId: argActs1.ActionsId} - if err := apierRPC.Call("ApierV1.ExecuteAction", attrsEA, &reply); err != nil { + if err := apierRPC.Call(utils.ApierV1ExecuteAction, attrsEA, &reply); err != nil { t.Error("Got error on ApierV1.ExecuteAction: ", err.Error()) } else if reply != utils.OK { t.Errorf("Calling ApierV1.ExecuteAction received: %s", reply) @@ -374,7 +374,7 @@ func TestApierV2itSetActionPlanWithWrongTiming(t *testing.T) { }, } - if err := apierRPC.Call("ApierV1.SetActionPlan", argAP1, &reply); err == nil || + if err := apierRPC.Call(utils.ApierV1SetActionPlan, argAP1, &reply); err == nil || err.Error() != fmt.Sprintf("UNSUPPORTED_FORMAT:%s", tNow) { t.Error("Expecting error ", err) } @@ -392,7 +392,7 @@ func TestApierV2itSetActionPlanWithWrongTiming2(t *testing.T) { }, } - if err := apierRPC.Call("ApierV1.SetActionPlan", argAP1, &reply); err == nil || + if err := apierRPC.Call(utils.ApierV1SetActionPlan, argAP1, &reply); err == nil || err.Error() != fmt.Sprintf("UNSUPPORTED_FORMAT:aa:bb:cc") { t.Error("Expecting error ", err) } diff --git a/apier/v2/attributes_it_test.go b/apier/v2/attributes_it_test.go index 2193fc5d9..1de37de40 100644 --- a/apier/v2/attributes_it_test.go +++ b/apier/v2/attributes_it_test.go @@ -129,7 +129,7 @@ func testAttributeSSetAlsPrf(t *testing.T) { }, } var result string - if err := attrSRPC.Call("ApierV2.SetAttributeProfile", extAlsPrf, &result); err != nil { + if err := attrSRPC.Call(utils.ApierV2SetAttributeProfile, extAlsPrf, &result); err != nil { t.Error(err) } else if result != utils.OK { t.Error("Unexpected reply returned", result) @@ -191,7 +191,7 @@ func testAttributeSUpdateAlsPrf(t *testing.T) { }, } var result string - if err := attrSRPC.Call("ApierV2.SetAttributeProfile", extAlsPrf, &result); err != nil { + if err := attrSRPC.Call(utils.ApierV2SetAttributeProfile, extAlsPrf, &result); err != nil { t.Error(err) } else if result != utils.OK { t.Error("Unexpected reply returned", result) diff --git a/apier/v2/cdrs_it_test.go b/apier/v2/cdrs_it_test.go index ec455ef20..654bee6d1 100644 --- a/apier/v2/cdrs_it_test.go +++ b/apier/v2/cdrs_it_test.go @@ -162,7 +162,7 @@ func testV2CDRsProcessCDR(t *testing.T) { func testV2CDRsGetCdrs(t *testing.T) { var cdrCnt int64 req := utils.AttrGetCdrs{} - if err := cdrsRpc.Call("ApierV2.CountCDRs", req, &cdrCnt); err != nil { + if err := cdrsRpc.Call(utils.ApierV2CountCDRs, req, &cdrCnt); err != nil { t.Error("Unexpected error: ", err.Error()) } else if cdrCnt != 3 { t.Error("Unexpected number of CDRs returned: ", cdrCnt) @@ -247,7 +247,7 @@ func testV2CDRsRateCDRs(t *testing.T) { Overwrite: true, } var reply string - if err := cdrsRpc.Call("ApierV1.SetRatingProfile", rpf, &reply); err != nil { + if err := cdrsRpc.Call(utils.ApierV1SetRatingProfile, rpf, &reply); err != nil { t.Error("Got error on ApierV1.SetRatingProfile: ", err.Error()) } else if reply != "OK" { t.Error("Calling ApierV1.SetRatingProfile got reply: ", reply) @@ -282,7 +282,7 @@ func testV2CDRsRateCDRs(t *testing.T) { func testV2CDRsGetCdrs2(t *testing.T) { var cdrCnt int64 req := utils.AttrGetCdrs{} - if err := cdrsRpc.Call("ApierV2.CountCDRs", req, &cdrCnt); err != nil { + if err := cdrsRpc.Call(utils.ApierV2CountCDRs, req, &cdrCnt); err != nil { t.Error("Unexpected error: ", err.Error()) } else if cdrCnt != 3 { t.Error("Unexpected number of CDRs returned: ", cdrCnt) @@ -465,7 +465,7 @@ func testV2CDRsDifferentTenants(t *testing.T) { t.Error("Unexpected reply returned", result) } var reply2 *engine.ChargerProfile - if err := cdrsRpc.Call("ApierV1.GetChargerProfile", + if err := cdrsRpc.Call(utils.ApierV1GetChargerProfile, &utils.TenantID{Tenant: "CustomTenant", ID: "CustomCharger"}, &reply2); err != nil { t.Error(err) } else if !reflect.DeepEqual(chargerProfile.ChargerProfile, reply2) { @@ -567,7 +567,7 @@ func testV2CDRsProcessCDRNoRattingPlan(t *testing.T) { func testV2CDRsGetCdrsNoRattingPlan(t *testing.T) { var cdrCnt int64 req := utils.AttrGetCdrs{} - if err := cdrsRpc.Call("ApierV2.CountCDRs", req, &cdrCnt); err != nil { + if err := cdrsRpc.Call(utils.ApierV2CountCDRs, req, &cdrCnt); err != nil { t.Error("Unexpected error: ", err.Error()) } else if cdrCnt != 11 { t.Error("Unexpected number of CDRs returned: ", cdrCnt) @@ -624,7 +624,7 @@ func testV2CDRsRateCDRsWithRatingPlan(t *testing.T) { Overwrite: true, } var reply string - if err := cdrsRpc.Call("ApierV1.SetRatingProfile", rpf, &reply); err != nil { + if err := cdrsRpc.Call(utils.ApierV1SetRatingProfile, rpf, &reply); err != nil { t.Error("Got error on ApierV1.SetRatingProfile: ", err.Error()) } else if reply != "OK" { t.Error("Calling ApierV1.SetRatingProfile got reply: ", reply) @@ -640,7 +640,7 @@ func testV2CDRsRateCDRsWithRatingPlan(t *testing.T) { RatingPlanId: "RP_TESTIT1"}}, Overwrite: true, } - if err := cdrsRpc.Call("ApierV1.SetRatingProfile", rpf, &reply); err != nil { + if err := cdrsRpc.Call(utils.ApierV1SetRatingProfile, rpf, &reply); err != nil { t.Error("Got error on ApierV1.SetRatingProfile: ", err.Error()) } else if reply != "OK" { t.Error("Calling ApierV1.SetRatingProfile got reply: ", reply) @@ -660,7 +660,7 @@ func testV2CDRsRateCDRsWithRatingPlan(t *testing.T) { func testV2CDRsGetCdrsWithRattingPlan(t *testing.T) { var cdrCnt int64 req := utils.AttrGetCdrs{} - if err := cdrsRpc.Call("ApierV2.CountCDRs", req, &cdrCnt); err != nil { + if err := cdrsRpc.Call(utils.ApierV2CountCDRs, req, &cdrCnt); err != nil { t.Error("Unexpected error: ", err.Error()) } else if cdrCnt != 11 { t.Error("Unexpected number of CDRs returned: ", cdrCnt) diff --git a/apier/v2/cdrs_offline_it_test.go b/apier/v2/cdrs_offline_it_test.go index 94249c527..fe67002a6 100644 --- a/apier/v2/cdrs_offline_it_test.go +++ b/apier/v2/cdrs_offline_it_test.go @@ -147,7 +147,7 @@ func testV2CDRsOfflineBalanceUpdate(t *testing.T) { attrsAA := &utils.AttrSetActions{ActionsId: "ACT_LOG", Actions: []*utils.TPAction{ {Identifier: utils.LOG}, }} - if err := cdrsOfflineRpc.Call("ApierV2.SetActions", attrsAA, &reply); err != nil && err.Error() != utils.ErrExists.Error() { + if err := cdrsOfflineRpc.Call(utils.ApierV2SetActions, attrsAA, &reply); err != nil && err.Error() != utils.ErrExists.Error() { t.Error("Got error on ApierV2.SetActions: ", err.Error()) } else if reply != utils.OK { t.Errorf("Calling ApierV2.SetActions received: %s", reply) @@ -223,7 +223,7 @@ func testV2CDRsOfflineExpiryBalance(t *testing.T) { &utils.TPAction{Identifier: utils.TOPUP, BalanceType: utils.MONETARY, BalanceId: "NewBalance", Units: "10", ExpiryTime: utils.UNLIMITED, BalanceWeight: "10", Weight: 20.0}, }} - if err := cdrsOfflineRpc.Call("ApierV2.SetActions", acc, &reply); err != nil && err.Error() != utils.ErrExists.Error() { + if err := cdrsOfflineRpc.Call(utils.ApierV2SetActions, acc, &reply); err != nil && err.Error() != utils.ErrExists.Error() { t.Error("Got error on ApierV2.SetActions: ", err.Error()) } else if reply != utils.OK { t.Errorf("Calling ApierV2.SetActions received: %s", reply) @@ -231,13 +231,13 @@ func testV2CDRsOfflineExpiryBalance(t *testing.T) { atm1 := &v1.AttrActionPlan{ActionsId: "ACT_TOPUP_TEST2", Time: "*asap", Weight: 20.0} atms1 := &v1.AttrSetActionPlan{Id: "AP_TEST2", ActionPlan: []*v1.AttrActionPlan{atm1}} - if err := cdrsOfflineRpc.Call("ApierV1.SetActionPlan", atms1, &reply); err != nil { + if err := cdrsOfflineRpc.Call(utils.ApierV1SetActionPlan, atms1, &reply); err != nil { t.Error("Got error on ApierV1.SetActionPlan: ", err.Error()) } else if reply != "OK" { t.Errorf("Calling ApierV1.SetActionPlan received: %s", reply) } - if err := cdrsOfflineRpc.Call("ApierV2.SetAccount", + if err := cdrsOfflineRpc.Call(utils.ApierV2SetAccount, &AttrSetAccount{Tenant: "cgrates.org", Account: "test2", ActionPlanIDs: &[]string{"AP_TEST2"}, ReloadScheduler: true}, &reply); err != nil { @@ -263,7 +263,7 @@ func testV2CDRsOfflineExpiryBalance(t *testing.T) { attrsA := &utils.AttrSetActions{ActionsId: "ACT_LOG", Actions: []*utils.TPAction{ {Identifier: utils.LOG}, }} - if err := cdrsOfflineRpc.Call("ApierV2.SetActions", attrsA, &reply); err != nil && err.Error() != utils.ErrExists.Error() { + if err := cdrsOfflineRpc.Call(utils.ApierV2SetActions, attrsA, &reply); err != nil && err.Error() != utils.ErrExists.Error() { t.Error("Got error on ApierV2.SetActions: ", err.Error()) } else if reply != utils.OK { t.Errorf("Calling ApierV2.SetActions received: %s", reply) diff --git a/apier/v2/tp_it_test.go b/apier/v2/tp_it_test.go index 8cfcbfc92..6dab48c78 100644 --- a/apier/v2/tp_it_test.go +++ b/apier/v2/tp_it_test.go @@ -175,7 +175,7 @@ func testTPitTimings(t *testing.T) { // Test set var reply string for _, tm := range []*utils.ApierTPTiming{tmPeak, tmOffPeakMorning, tmOffPeakEvening, tmOffPeakWeekend, tmDummyRemove} { - if err := tpRPC.Call("ApierV2.SetTPTiming", tm, &reply); err != nil { + if err := tpRPC.Call(utils.ApierV2SetTPTiming, tm, &reply); err != nil { t.Error("Got error on ApierV2.SetTPTiming: ", err.Error()) } else if reply != utils.OK { t.Error("Unexpected reply received when calling ApierV2.SetTPTiming: ", reply) @@ -183,7 +183,7 @@ func testTPitTimings(t *testing.T) { } // Test get var rplyTmDummy *utils.ApierTPTiming - if err := tpRPC.Call("ApierV2.GetTPTiming", v1.AttrGetTPTiming{tmDummyRemove.TPid, tmDummyRemove.ID}, &rplyTmDummy); err != nil { + if err := tpRPC.Call(utils.ApierV2GetTPTiming, v1.AttrGetTPTiming{tmDummyRemove.TPid, tmDummyRemove.ID}, &rplyTmDummy); err != nil { t.Error("Calling ApierV2.GetTPTiming, got error: ", err.Error()) } else if !reflect.DeepEqual(tmDummyRemove, rplyTmDummy) { t.Errorf("Calling ApierV2.GetTPTiming expected: %v, received: %v", tmDummyRemove, rplyTmDummy) @@ -196,7 +196,7 @@ func testTPitTimings(t *testing.T) { t.Errorf("Calling ApierV1.GetTPTimingIds expected: %v, received: %v", expectedTmIDs, rplyTmIDs) } // Test remove - if err := tpRPC.Call("ApierV2.RemoveTPTiming", v1.AttrGetTPTiming{tmDummyRemove.TPid, tmDummyRemove.ID}, &reply); err != nil { + if err := tpRPC.Call(utils.ApierV2RemoveTPTiming, v1.AttrGetTPTiming{tmDummyRemove.TPid, tmDummyRemove.ID}, &reply); err != nil { t.Error("Calling ApierV2.RemoveTPTiming, got error: ", err.Error()) } else if reply != utils.OK { t.Error("Calling ApierV2.RemoveTPTiming received: ", reply) @@ -227,7 +227,7 @@ func testTPitDestinations(t *testing.T) { dstDEMobile := &utils.TPDestination{TPid: testTPid, ID: "DST_DE_MOBILE", Prefixes: []string{"+49151", "+49161", "+49171"}} dstDUMMY := &utils.TPDestination{TPid: testTPid, ID: "DUMMY_REMOVE", Prefixes: []string{"999"}} for _, dst := range []*utils.TPDestination{dst1002, dst1003, dst1007, dstFS, dstDEMobile, dstDUMMY} { - if err := tpRPC.Call("ApierV2.SetTPDestination", dst, &reply); err != nil { + if err := tpRPC.Call(utils.ApierV2SetTPDestination, dst, &reply); err != nil { t.Error("Got error on ApierV2.SetTPDestination: ", err.Error()) } else if reply != utils.OK { t.Error("Unexpected reply received when calling ApierV2.SetTPDestination: ", reply) @@ -235,13 +235,13 @@ func testTPitDestinations(t *testing.T) { } // Test get var rplyDst *utils.TPDestination - if err := tpRPC.Call("ApierV2.GetTPDestination", AttrGetTPDestination{testTPid, dstDEMobile.ID}, &rplyDst); err != nil { + if err := tpRPC.Call(utils.ApierV2GetTPDestination, AttrGetTPDestination{testTPid, dstDEMobile.ID}, &rplyDst); err != nil { t.Error("Calling ApierV2.GetTPDestination, got error: ", err.Error()) } else if len(dstDEMobile.Prefixes) != len(rplyDst.Prefixes) { t.Errorf("Calling ApierV2.GetTPDestination expected: %v, received: %v", dstDEMobile, rplyDst) } // Test remove - if err := tpRPC.Call("ApierV2.RemoveTPDestination", AttrGetTPDestination{testTPid, dstDUMMY.ID}, &reply); err != nil { + if err := tpRPC.Call(utils.ApierV2RemoveTPDestination, AttrGetTPDestination{testTPid, dstDUMMY.ID}, &reply); err != nil { t.Error(err) } else if reply != utils.OK { t.Error("Received: ", reply) @@ -249,7 +249,7 @@ func testTPitDestinations(t *testing.T) { // Test getIds var rplyDstIds []string expectedDstIds := []string{"DST_1002", "DST_1003", "DST_1007", "DST_DE_MOBILE", "DST_FS"} - if err := tpRPC.Call("ApierV2.GetTPDestinationIDs", v1.AttrGetTPDestinationIds{TPid: testTPid}, &rplyDstIds); err != nil { + if err := tpRPC.Call(utils.ApierV2GetTPDestinationIDs, v1.AttrGetTPDestinationIds{TPid: testTPid}, &rplyDstIds); err != nil { t.Error("Calling ApierV1.GetTPDestinationIDs, got error: ", err.Error()) } else if len(expectedDstIds) != len(rplyDstIds) { t.Errorf("Calling ApierV2.GetTPDestinationIDs expected: %v, received: %v", expectedDstIds, rplyDstIds) diff --git a/cmd/cgr-engine/engine_test.go b/cmd/cgr-engine/engine_test.go index 3f95d3930..7b6a9fc6a 100644 --- a/cmd/cgr-engine/engine_test.go +++ b/cmd/cgr-engine/engine_test.go @@ -20,6 +20,7 @@ package main import ( "net/rpc" "testing" + "github.com/cgrates/cgrates/utils" ) func BenchmarkRPCGet(b *testing.B) { @@ -28,6 +29,6 @@ func BenchmarkRPCGet(b *testing.B) { b.StartTimer() var reply string for i := 0; i < b.N; i++ { - client.Call("Responder.Get", "test", &reply) + client.Call(utils.ResponderGet, "test", &reply) } } diff --git a/cmd/cgr-tester/cdr_repl/process_cdr.go b/cmd/cgr-tester/cdr_repl/process_cdr.go index 483178efb..d79f765fa 100644 --- a/cmd/cgr-tester/cdr_repl/process_cdr.go +++ b/cmd/cgr-tester/cdr_repl/process_cdr.go @@ -59,7 +59,7 @@ func main() { } var reply string for _, cdr := range cdrs { - if err := cdrsMasterRpc.Call("CdrsV2.ProcessCdr", cdr, &reply); err != nil { + if err := cdrsMasterRpc.Call(utils.CdrsV2ProcessCdr, cdr, &reply); err != nil { log.Fatal("Unexpected error: ", err.Error()) } else if reply != utils.OK { log.Fatal("Unexpected reply received: ", reply) diff --git a/console/account_remove.go b/console/account_remove.go index 88f4ddf1d..dfb7520d6 100644 --- a/console/account_remove.go +++ b/console/account_remove.go @@ -23,7 +23,7 @@ import "github.com/cgrates/cgrates/utils" func init() { c := &CmdRemoveAccount{ name: "account_remove", - rpcMethod: "ApierV1.RemoveAccount", + rpcMethod: utils.ApierV1RemoveAccount, } commands[c.Name()] = c c.CommandExecuter = &CommandExecuter{c} diff --git a/console/account_set.go b/console/account_set.go index 858674208..527d8ab33 100644 --- a/console/account_set.go +++ b/console/account_set.go @@ -18,12 +18,14 @@ along with this program. If not, see package console -import "github.com/cgrates/cgrates/apier/v2" - +import ( + "github.com/cgrates/cgrates/apier/v2" + "github.com/cgrates/cgrates/utils" +) func init() { c := &CmdAddAccount{ name: "account_set", - rpcMethod: "ApierV2.SetAccount", + rpcMethod: utils.ApierV2SetAccount, } commands[c.Name()] = c c.CommandExecuter = &CommandExecuter{c} diff --git a/console/account_trigger_add.go b/console/account_trigger_add.go index f52093c46..3176200d0 100644 --- a/console/account_trigger_add.go +++ b/console/account_trigger_add.go @@ -18,12 +18,15 @@ along with this program. If not, see package console -import "github.com/cgrates/cgrates/apier/v1" +import ( + v1 "github.com/cgrates/cgrates/apier/v1" + "github.com/cgrates/cgrates/utils" +) func init() { c := &CmdAccountAddTriggers{ name: "account_triggers_add", - rpcMethod: "ApierV1.AddAccountActionTriggers", + rpcMethod: utils.ApierV1AddAccountActionTriggers, rpcParams: &v1.AttrAddAccountActionTriggers{}, } commands[c.Name()] = c diff --git a/console/account_trigger_remove.go b/console/account_trigger_remove.go index c99ef1d9c..6e3367026 100644 --- a/console/account_trigger_remove.go +++ b/console/account_trigger_remove.go @@ -18,12 +18,15 @@ along with this program. If not, see package console -import "github.com/cgrates/cgrates/apier/v1" +import ( + v1 "github.com/cgrates/cgrates/apier/v1" + "github.com/cgrates/cgrates/utils" +) func init() { c := &CmdAccountRemoveTriggers{ name: "account_triggers_remove", - rpcMethod: "ApierV1.RemoveAccountActionTriggers", + rpcMethod: utils.ApierV1RemoveAccountActionTriggers, rpcParams: &v1.AttrRemoveAccountActionTriggers{}, } commands[c.Name()] = c diff --git a/console/account_trigger_reset.go b/console/account_trigger_reset.go index 61c3621c6..7847f0a8f 100644 --- a/console/account_trigger_reset.go +++ b/console/account_trigger_reset.go @@ -18,12 +18,14 @@ along with this program. If not, see package console -import "github.com/cgrates/cgrates/apier/v1" - +import ( + v1 "github.com/cgrates/cgrates/apier/v1" + "github.com/cgrates/cgrates/utils" +) func init() { c := &CmdAccountResetTriggers{ name: "account_triggers_reset", - rpcMethod: "ApierV1.ResetAccountActionTriggers", + rpcMethod: utils.ApierV1ResetAccountActionTriggers, rpcParams: &v1.AttrRemoveAccountActionTriggers{}, } commands[c.Name()] = c diff --git a/console/account_trigger_set.go b/console/account_trigger_set.go index 97dbdc59c..f93814e95 100644 --- a/console/account_trigger_set.go +++ b/console/account_trigger_set.go @@ -18,12 +18,14 @@ along with this program. If not, see package console -import "github.com/cgrates/cgrates/apier/v1" - +import ( + v1 "github.com/cgrates/cgrates/apier/v1" + "github.com/cgrates/cgrates/utils" +) func init() { c := &CmdAccountSetTriggers{ name: "account_triggers_set", - rpcMethod: "ApierV1.SetAccountActionTriggers", + rpcMethod: utils.ApierV1SetAccountActionTriggers, rpcParams: &v1.AttrSetAccountActionTriggers{}, } commands[c.Name()] = c diff --git a/console/accounts.go b/console/accounts.go index 127559c20..7e00070b6 100644 --- a/console/accounts.go +++ b/console/accounts.go @@ -26,7 +26,7 @@ import ( func init() { c := &CmdGetAccounts{ name: "accounts", - rpcMethod: "ApierV2.GetAccounts", + rpcMethod: utils.ApierV2GetAccounts, rpcParams: &utils.AttrGetAccounts{}, } commands[c.Name()] = c diff --git a/console/action_execute.go b/console/action_execute.go index 95fa96606..98d6845a1 100644 --- a/console/action_execute.go +++ b/console/action_execute.go @@ -25,7 +25,7 @@ import ( func init() { c := &CmdExecuteAction{ name: "action_execute", - rpcMethod: "ApierV1.ExecuteAction", + rpcMethod: utils.ApierV1ExecuteAction, rpcParams: &utils.AttrExecuteAction{}, } commands[c.Name()] = c diff --git a/console/actionplan_remove.go b/console/actionplan_remove.go index 67bb1da86..99db10c00 100644 --- a/console/actionplan_remove.go +++ b/console/actionplan_remove.go @@ -20,12 +20,13 @@ package console import ( v1 "github.com/cgrates/cgrates/apier/v1" + "github.com/cgrates/cgrates/utils" ) func init() { c := &CmdRemoveActionPlan{ name: "actionplan_remove", - rpcMethod: "ApierV1.RemoveActionPlan", + rpcMethod: utils.ApierV1RemoveActionPlan, rpcParams: &v1.AttrGetActionPlan{}, } commands[c.Name()] = c diff --git a/console/actionplan_set.go b/console/actionplan_set.go index 571df6bc5..62ebec372 100644 --- a/console/actionplan_set.go +++ b/console/actionplan_set.go @@ -18,12 +18,14 @@ along with this program. If not, see package console -import "github.com/cgrates/cgrates/apier/v1" - +import ( + "github.com/cgrates/cgrates/apier/v1" + "github.com/cgrates/cgrates/utils" +) func init() { c := &CmdSetActionPlan{ name: "actionplan_set", - rpcMethod: "ApierV1.SetActionPlan", + rpcMethod: utils.ApierV1SetActionPlan, rpcParams: &v1.AttrSetActionPlan{}, } commands[c.Name()] = c diff --git a/console/actions.go b/console/actions.go index ff2e03bd2..9cf8d8cbb 100644 --- a/console/actions.go +++ b/console/actions.go @@ -19,14 +19,15 @@ along with this program. If not, see package console import ( - "github.com/cgrates/cgrates/apier/v2" + v2 "github.com/cgrates/cgrates/apier/v2" "github.com/cgrates/cgrates/engine" + "github.com/cgrates/cgrates/utils" ) func init() { c := &CmdGetActions{ name: "actions", - rpcMethod: "ApierV2.GetActions", + rpcMethod: utils.ApierV2GetActions, } commands[c.Name()] = c c.CommandExecuter = &CommandExecuter{c} diff --git a/console/actions_remove.go b/console/actions_remove.go index dce70c114..ca9b730ac 100644 --- a/console/actions_remove.go +++ b/console/actions_remove.go @@ -18,12 +18,15 @@ along with this program. If not, see package console -import "github.com/cgrates/cgrates/apier/v1" +import ( + "github.com/cgrates/cgrates/apier/v1" + "github.com/cgrates/cgrates/utils" +) func init() { c := &CmdRemoveActions{ name: "actions_remove", - rpcMethod: "ApierV1.RemoveActions", + rpcMethod: utils.ApierV1RemoveActions, } commands[c.Name()] = c c.CommandExecuter = &CommandExecuter{c} diff --git a/console/balance_remove.go b/console/balance_remove.go index a917e8eae..5ee5565e3 100644 --- a/console/balance_remove.go +++ b/console/balance_remove.go @@ -19,14 +19,14 @@ along with this program. If not, see package console import ( - "github.com/cgrates/cgrates/apier/v1" + v1 "github.com/cgrates/cgrates/apier/v1" "github.com/cgrates/cgrates/utils" ) func init() { c := &CmdRemoveBalance{ name: "balance_remove", - rpcMethod: "ApierV1.RemoveBalances", + rpcMethod: utils.ApierV1RemoveBalances, } commands[c.Name()] = c c.CommandExecuter = &CommandExecuter{c} diff --git a/console/cdrc_config_reload.go b/console/cdrc_config_reload.go index 54ebee540..0b3d47b14 100644 --- a/console/cdrc_config_reload.go +++ b/console/cdrc_config_reload.go @@ -20,12 +20,13 @@ package console import ( "github.com/cgrates/cgrates/apier/v1" + "github.com/cgrates/cgrates/utils" ) func init() { c := &CmdCdrcConfigReload{ name: "cdrc_config_reload", - rpcMethod: "ApierV1.ReloadCdrcConfig", + rpcMethod: utils.ApierV1ReloadCdrcConfig, } commands[c.Name()] = c c.CommandExecuter = &CommandExecuter{c} diff --git a/console/cdre_config_reload.go b/console/cdre_config_reload.go index 8dc1542e1..46cce6c38 100644 --- a/console/cdre_config_reload.go +++ b/console/cdre_config_reload.go @@ -20,12 +20,14 @@ package console import ( "github.com/cgrates/cgrates/apier/v1" + "github.com/cgrates/cgrates/utils" + ) func init() { c := &CmdCdreConfigReload{ name: "cdre_config_reload", - rpcMethod: "ApierV1.ReloadCdreConfig", + rpcMethod: utils.ApierV1ReloadCdreConfig, } commands[c.Name()] = c c.CommandExecuter = &CommandExecuter{c} diff --git a/console/cost.go b/console/cost.go index 0f5939ac5..3da0df073 100644 --- a/console/cost.go +++ b/console/cost.go @@ -27,7 +27,7 @@ import ( func init() { c := &CmdGetCost{ name: "cost", - rpcMethod: "ApierV1.GetCost", + rpcMethod: utils.ApierV1GetCost, clientArgs: []string{"Tenant", "Category", "Subject", "AnswerTime", "Destination", "Usage"}, rpcParams: &v1.AttrGetCost{}, } diff --git a/console/datacost.go b/console/datacost.go index b4f55bac6..1b058e3f9 100644 --- a/console/datacost.go +++ b/console/datacost.go @@ -27,7 +27,7 @@ import ( func init() { c := &CmdGetDataCost{ name: "datacost", - rpcMethod: "ApierV1.GetDataCost", + rpcMethod: utils.ApierV1GetDataCost, clientArgs: []string{"Direction", "Category", "Tenant", "Account", "Subject", "StartTime", "Usage"}, } commands[c.Name()] = c diff --git a/console/destination_set.go b/console/destination_set.go index 5a974dca3..2b4181e06 100644 --- a/console/destination_set.go +++ b/console/destination_set.go @@ -23,7 +23,7 @@ import "github.com/cgrates/cgrates/utils" func init() { c := &CmdSetDestination{ name: "destination_set", - rpcMethod: "ApierV1.SetDestination", + rpcMethod: utils.ApierV1SetDestination, } commands[c.Name()] = c c.CommandExecuter = &CommandExecuter{c} diff --git a/console/destinations.go b/console/destinations.go index 4df115ecd..56e881798 100644 --- a/console/destinations.go +++ b/console/destinations.go @@ -19,14 +19,15 @@ along with this program. If not, see package console import ( - "github.com/cgrates/cgrates/apier/v2" + v2 "github.com/cgrates/cgrates/apier/v2" "github.com/cgrates/cgrates/engine" + "github.com/cgrates/cgrates/utils" ) func init() { c := &CmdGetDestination{ name: "destinations", - rpcMethod: "ApierV2.GetDestinations", + rpcMethod: utils.ApierV2GetDestinations, } commands[c.Name()] = c c.CommandExecuter = &CommandExecuter{c} diff --git a/console/import_tp_from_folder.go b/console/import_tp_from_folder.go index 4f0fcf47e..dcf9ab6f8 100644 --- a/console/import_tp_from_folder.go +++ b/console/import_tp_from_folder.go @@ -23,7 +23,7 @@ import "github.com/cgrates/cgrates/utils" func init() { c := &ImportTpFromFolder{ name: "import_tp_from_folder", - rpcMethod: "ApierV1.ImportTariffPlanFromFolder", + rpcMethod: utils.ApierV1ImportTariffPlanFromFolder, } commands[c.Name()] = c c.CommandExecuter = &CommandExecuter{c} diff --git a/console/load_history.go b/console/load_history.go index a91a208ef..e1dc0df10 100644 --- a/console/load_history.go +++ b/console/load_history.go @@ -23,7 +23,7 @@ import "github.com/cgrates/cgrates/utils" func init() { c := &CmdGetLoadHistory{ name: "load_history", - rpcMethod: "ApierV1.GetLoadHistory", + rpcMethod: utils.ApierV1GetLoadHistory, rpcParams: new(utils.Paginator), } commands[c.Name()] = c diff --git a/console/load_ids.go b/console/load_ids.go index 9cb1bbe2b..a22891c41 100644 --- a/console/load_ids.go +++ b/console/load_ids.go @@ -18,10 +18,12 @@ along with this program. If not, see package console +import "github.com/cgrates/cgrates/utils" + func init() { c := &CmdCacheVersions{ name: "get_load_ids", - rpcMethod: "ApierV1.GetLoadIDs", + rpcMethod: utils.ApierV1GetLoadIDs , } commands[c.Name()] = c c.CommandExecuter = &CommandExecuter{c} diff --git a/console/load_times.go b/console/load_times.go index 226ed5bf0..61f96c36e 100644 --- a/console/load_times.go +++ b/console/load_times.go @@ -20,12 +20,13 @@ package console import ( v1 "github.com/cgrates/cgrates/apier/v1" + "github.com/cgrates/cgrates/utils" ) func init() { c := &CmdLoadTimes{ name: "get_load_times", - rpcMethod: "ApierV1.GetLoadTimes", + rpcMethod: utils.ApierV1GetLoadTimes, rpcParams: &v1.LoadTimeArgs{}, } commands[c.Name()] = c diff --git a/console/load_tp_from_folder.go b/console/load_tp_from_folder.go index b4aa7e319..a73170ec6 100644 --- a/console/load_tp_from_folder.go +++ b/console/load_tp_from_folder.go @@ -23,7 +23,7 @@ import "github.com/cgrates/cgrates/utils" func init() { c := &LoadTpFromFolder{ name: "load_tp_from_folder", - rpcMethod: "ApierV1.LoadTariffPlanFromFolder", + rpcMethod: utils.ApierV1LoadTariffPlanFromFolder, } commands[c.Name()] = c c.CommandExecuter = &CommandExecuter{c} diff --git a/console/load_tp_from_stordb.go b/console/load_tp_from_stordb.go index d8e658e7f..1d60b39d1 100644 --- a/console/load_tp_from_stordb.go +++ b/console/load_tp_from_stordb.go @@ -18,12 +18,15 @@ along with this program. If not, see package console -import "github.com/cgrates/cgrates/apier/v1" +import ( + v1 "github.com/cgrates/cgrates/apier/v1" + "github.com/cgrates/cgrates/utils" +) func init() { c := &LoadTpFromStorDb{ name: "load_tp_from_stordb", - rpcMethod: "ApierV1.LoadTariffPlanFromStorDb", + rpcMethod: utils.ApierV1LoadTariffPlanFromStorDb, } commands[c.Name()] = c c.CommandExecuter = &CommandExecuter{c} diff --git a/console/scheduler_execute.go b/console/scheduler_execute.go index 5d018b188..6da026492 100644 --- a/console/scheduler_execute.go +++ b/console/scheduler_execute.go @@ -18,12 +18,14 @@ along with this program. If not, see package console -import "github.com/cgrates/cgrates/apier/v1" - +import ( + "github.com/cgrates/cgrates/apier/v1" + "github.com/cgrates/cgrates/utils" +) func init() { c := &CmdExecuteScheduledActions{ name: "scheduler_execute", - rpcMethod: "ApierV1.ExecuteScheduledActions", + rpcMethod: utils.ApierV1ExecuteScheduledActions, rpcParams: &v1.AttrsExecuteScheduledActions{}, } commands[c.Name()] = c diff --git a/console/scheduler_queue.go b/console/scheduler_queue.go index 675b59c7f..2e1d24af4 100644 --- a/console/scheduler_queue.go +++ b/console/scheduler_queue.go @@ -20,12 +20,13 @@ package console import ( "github.com/cgrates/cgrates/scheduler" + "github.com/cgrates/cgrates/utils" ) func init() { c := &CmdGetScheduledActions{ name: "scheduler_queue", - rpcMethod: "ApierV1.GetScheduledActions", + rpcMethod: utils.ApierV1GetScheduledActions, rpcParams: &scheduler.ArgsGetScheduledActions{}, } commands[c.Name()] = c diff --git a/console/sharedgroup.go b/console/sharedgroup.go index 9b17aae2d..1ee6100ea 100644 --- a/console/sharedgroup.go +++ b/console/sharedgroup.go @@ -18,12 +18,14 @@ along with this program. If not, see package console -import "github.com/cgrates/cgrates/engine" - +import ( + "github.com/cgrates/cgrates/engine" + "github.com/cgrates/cgrates/utils" +) func init() { c := &CmdGetSharedGroup{ name: "sharedgroup", - rpcMethod: "ApierV1.GetSharedGroup", + rpcMethod: utils.ApierV1GetSharedGroup, } commands[c.Name()] = c c.CommandExecuter = &CommandExecuter{c} diff --git a/console/trigger_remove.go b/console/trigger_remove.go index 217a8f7ff..181e9df8e 100644 --- a/console/trigger_remove.go +++ b/console/trigger_remove.go @@ -18,12 +18,15 @@ along with this program. If not, see package console -import "github.com/cgrates/cgrates/apier/v1" +import ( + "github.com/cgrates/cgrates/apier/v1" + "github.com/cgrates/cgrates/utils" +) func init() { c := &CmdRemoveTriggers{ name: "triggers_remove", - rpcMethod: "ApierV1.RemoveActionTrigger", + rpcMethod: utils.ApierV1RemoveActionTrigger, rpcParams: &v1.AttrRemoveActionTrigger{}, } commands[c.Name()] = c diff --git a/console/trigger_set.go b/console/trigger_set.go index 9001c9873..c304a0f77 100644 --- a/console/trigger_set.go +++ b/console/trigger_set.go @@ -18,12 +18,15 @@ along with this program. If not, see package console -import "github.com/cgrates/cgrates/apier/v1" +import ( + v1 "github.com/cgrates/cgrates/apier/v1" + "github.com/cgrates/cgrates/utils" +) func init() { c := &CmdSetTriggers{ name: "triggers_set", - rpcMethod: "ApierV1.SetActionTrigger", + rpcMethod: utils.ApierV1SetActionTrigger, rpcParams: &v1.AttrSetActionTrigger{}, } commands[c.Name()] = c diff --git a/console/triggers.go b/console/triggers.go index bcb781a19..04e98f818 100644 --- a/console/triggers.go +++ b/console/triggers.go @@ -21,12 +21,13 @@ package console import ( v1 "github.com/cgrates/cgrates/apier/v1" "github.com/cgrates/cgrates/engine" + "github.com/cgrates/cgrates/utils" ) func init() { c := &CmdGetTriggers{ name: "triggers", - rpcMethod: "ApierV1.GetActionTriggers", + rpcMethod: utils.ApierV1GetActionTriggers, rpcParams: &v1.AttrGetActionTriggers{}, } commands[c.Name()] = c diff --git a/dispatchers/dispatchers_test.go b/dispatchers/dispatchers_test.go index 46e3238d1..4d037acb1 100644 --- a/dispatchers/dispatchers_test.go +++ b/dispatchers/dispatchers_test.go @@ -33,7 +33,7 @@ func (dS *DispatcherService) DispatcherServicePing(ev *utils.CGREvent, reply *st func TestDispatcherCall1(t *testing.T) { dS := &DispatcherService{} var reply string - if err := dS.Call("DispatcherService.Ping", &utils.CGREvent{}, &reply); err != nil { + if err := dS.Call(utils.DispatcherServicePing, &utils.CGREvent{}, &reply); err != nil { t.Error(err) } else if reply != utils.Pong { t.Errorf("Expected: %s , received: %s", utils.Pong, reply) diff --git a/engine/actions2_it_test.go b/engine/actions2_it_test.go index 0b5e60490..dd5ac5e9a 100644 --- a/engine/actions2_it_test.go +++ b/engine/actions2_it_test.go @@ -173,13 +173,13 @@ func testActionsExecuteRemoveSMCos1(t *testing.T) { }, }, } - if err := actsRPC.Call("ApierV2.SetActions", attrsAA, &reply); err != nil && err.Error() != utils.ErrExists.Error() { + if err := actsRPC.Call(utils.ApierV2SetActions, attrsAA, &reply); err != nil && err.Error() != utils.ErrExists.Error() { t.Error("Got error on ApierV2.SetActions: ", err.Error()) } else if reply != utils.OK { t.Errorf("Calling ApierV2.SetActions received: %s", reply) } attrsEA := &utils.AttrExecuteAction{Tenant: "cgrates.org", ActionsId: attrsAA.ActionsId} - if err := actsRPC.Call("ApierV1.ExecuteAction", attrsEA, &reply); err != nil { + if err := actsRPC.Call(utils.ApierV1ExecuteAction, attrsEA, &reply); err != nil { t.Error("Got error on ApierV1.ExecuteAction: ", err.Error()) } else if reply != utils.OK { t.Errorf("Calling ApierV1.ExecuteAction received: %s", reply) @@ -206,13 +206,13 @@ func testActionsExecuteRemoveSMCos2(t *testing.T) { }, }, } - if err := actsRPC.Call("ApierV2.SetActions", attrsAA, &reply); err != nil && err.Error() != utils.ErrExists.Error() { + if err := actsRPC.Call(utils.ApierV2SetActions, attrsAA, &reply); err != nil && err.Error() != utils.ErrExists.Error() { t.Error("Got error on ApierV2.SetActions: ", err.Error()) } else if reply != utils.OK { t.Errorf("Calling ApierV2.SetActions received: %s", reply) } attrsEA := &utils.AttrExecuteAction{Tenant: "cgrates.org", ActionsId: attrsAA.ActionsId} - if err := actsRPC.Call("ApierV1.ExecuteAction", attrsEA, &reply); err != nil { + if err := actsRPC.Call(utils.ApierV1ExecuteAction, attrsEA, &reply); err != nil { t.Error("Got error on ApierV1.ExecuteAction: ", err.Error()) } else if reply != utils.OK { t.Errorf("Calling ApierV1.ExecuteAction received: %s", reply) @@ -235,7 +235,7 @@ func testActionsUpdateBalance(t *testing.T) { topupAction := &utils.AttrSetActions{ActionsId: "ACT_TOPUP_RST", Actions: []*utils.TPAction{ {Identifier: utils.TOPUP, BalanceId: "test", BalanceType: utils.MONETARY, Units: "5", ExpiryTime: utils.UNLIMITED, Weight: 20.0}, }} - if err := actsRPC.Call("ApierV2.SetActions", topupAction, &reply); err != nil && err.Error() != utils.ErrExists.Error() { + if err := actsRPC.Call(utils.ApierV2SetActions, topupAction, &reply); err != nil && err.Error() != utils.ErrExists.Error() { t.Error("Got error on ApierV2.SetActions: ", err.Error()) } else if reply != utils.OK { t.Errorf("Calling ApierV2.SetActions received: %s", reply) @@ -243,20 +243,20 @@ func testActionsUpdateBalance(t *testing.T) { changeBlockerAction := &utils.AttrSetActions{ActionsId: "ACT_BAL_UPDT", Actions: []*utils.TPAction{ {Identifier: utils.SET_BALANCE, BalanceId: "test", BalanceBlocker: "true"}, }} - if err := actsRPC.Call("ApierV2.SetActions", changeBlockerAction, &reply); err != nil && err.Error() != utils.ErrExists.Error() { + if err := actsRPC.Call(utils.ApierV2SetActions, changeBlockerAction, &reply); err != nil && err.Error() != utils.ErrExists.Error() { t.Error("Got error on ApierV2.SetActions: ", err.Error()) } else if reply != utils.OK { t.Errorf("Calling ApierV2.SetActions received: %s", reply) } attrsEA := &utils.AttrExecuteAction{Tenant: attrsSetAccount.Tenant, Account: attrsSetAccount.Account, ActionsId: topupAction.ActionsId} - if err := actsRPC.Call("ApierV1.ExecuteAction", attrsEA, &reply); err != nil { + if err := actsRPC.Call(utils.ApierV1ExecuteAction, attrsEA, &reply); err != nil { t.Error("Got error on ApierV1.ExecuteAction: ", err.Error()) } else if reply != utils.OK { t.Errorf("Calling ApierV1.ExecuteAction received: %s", reply) } time.Sleep(1) attrsEA2 := &utils.AttrExecuteAction{Tenant: attrsSetAccount.Tenant, Account: attrsSetAccount.Account, ActionsId: changeBlockerAction.ActionsId} - if err := actsRPC.Call("ApierV1.ExecuteAction", attrsEA2, &reply); err != nil { + if err := actsRPC.Call(utils.ApierV1ExecuteAction, attrsEA2, &reply); err != nil { t.Error("Got error on ApierV1.ExecuteAction: ", err.Error()) } else if reply != utils.OK { t.Errorf("Calling ApierV1.ExecuteAction received: %s", reply) diff --git a/engine/actions_it_test.go b/engine/actions_it_test.go index 36334f62c..cc5b57e05 100644 --- a/engine/actions_it_test.go +++ b/engine/actions_it_test.go @@ -88,13 +88,13 @@ func TestActionsitSetCdrlogDebit(t *testing.T) { {Identifier: utils.DEBIT, BalanceType: utils.MONETARY, Units: "5", ExpiryTime: utils.UNLIMITED, Weight: 20.0}, {Identifier: utils.CDRLOG}, }} - if err := actsLclRpc.Call("ApierV2.SetActions", attrsAA, &reply); err != nil && err.Error() != utils.ErrExists.Error() { + if err := actsLclRpc.Call(utils.ApierV2SetActions, attrsAA, &reply); err != nil && err.Error() != utils.ErrExists.Error() { t.Error("Got error on ApierV2.SetActions: ", err.Error()) } else if reply != utils.OK { t.Errorf("Calling ApierV2.SetActions received: %s", reply) } attrsEA := &utils.AttrExecuteAction{Tenant: attrsSetAccount.Tenant, Account: attrsSetAccount.Account, ActionsId: attrsAA.ActionsId} - if err := actsLclRpc.Call("ApierV1.ExecuteAction", attrsEA, &reply); err != nil { + if err := actsLclRpc.Call(utils.ApierV1ExecuteAction, attrsEA, &reply); err != nil { t.Error("Got error on ApierV1.ExecuteAction: ", err.Error()) } else if reply != utils.OK { t.Errorf("Calling ApierV1.ExecuteAction received: %s", reply) @@ -131,13 +131,13 @@ func TestActionsitSetCdrlogTopup(t *testing.T) { {Identifier: utils.TOPUP, BalanceType: utils.MONETARY, Units: "5", ExpiryTime: utils.UNLIMITED, Weight: 20.0}, {Identifier: utils.CDRLOG}, }} - if err := actsLclRpc.Call("ApierV2.SetActions", attrsAA, &reply); err != nil && err.Error() != utils.ErrExists.Error() { + if err := actsLclRpc.Call(utils.ApierV2SetActions, attrsAA, &reply); err != nil && err.Error() != utils.ErrExists.Error() { t.Error("Got error on ApierV2.SetActions: ", err.Error()) } else if reply != utils.OK { t.Errorf("Calling ApierV2.SetActions received: %s", reply) } attrsEA := &utils.AttrExecuteAction{Tenant: attrsSetAccount.Tenant, Account: attrsSetAccount.Account, ActionsId: attrsAA.ActionsId} - if err := actsLclRpc.Call("ApierV1.ExecuteAction", attrsEA, &reply); err != nil { + if err := actsLclRpc.Call(utils.ApierV1ExecuteAction, attrsEA, &reply); err != nil { t.Error("Got error on ApierV1.ExecuteAction: ", err.Error()) } else if reply != utils.OK { t.Errorf("Calling ApierV1.ExecuteAction received: %s", reply) @@ -170,13 +170,13 @@ func TestActionsitCdrlogEmpty(t *testing.T) { Units: "5", ExpiryTime: utils.UNLIMITED, Weight: 20.0}, {Identifier: utils.CDRLOG}, }} - if err := actsLclRpc.Call("ApierV2.SetActions", attrsAA, &reply); err != nil && err.Error() != utils.ErrExists.Error() { + if err := actsLclRpc.Call(utils.ApierV2SetActions, attrsAA, &reply); err != nil && err.Error() != utils.ErrExists.Error() { t.Error("Got error on ApierV2.SetActions: ", err.Error()) } else if reply != utils.OK { t.Errorf("Calling ApierV2.SetActions received: %s", reply) } attrsEA := &utils.AttrExecuteAction{Tenant: attrsSetAccount.Tenant, Account: attrsSetAccount.Account, ActionsId: attrsAA.ActionsId} - if err := actsLclRpc.Call("ApierV1.ExecuteAction", attrsEA, &reply); err != nil { + if err := actsLclRpc.Call(utils.ApierV1ExecuteAction, attrsEA, &reply); err != nil { t.Error("Got error on ApierV1.ExecuteAction: ", err.Error()) } else if reply != utils.OK { t.Errorf("Calling ApierV1.ExecuteAction received: %s", reply) @@ -209,13 +209,13 @@ func TestActionsitCdrlogWithParams(t *testing.T) { DestinationIds: "RET", Units: "25", ExpiryTime: utils.UNLIMITED, Weight: 20.0}, }, } - if err := actsLclRpc.Call("ApierV2.SetActions", attrsAA, &reply); err != nil && err.Error() != utils.ErrExists.Error() { + if err := actsLclRpc.Call(utils.ApierV2SetActions, attrsAA, &reply); err != nil && err.Error() != utils.ErrExists.Error() { t.Error("Got error on ApierV2.SetActions: ", err.Error()) } else if reply != utils.OK { t.Errorf("Calling ApierV2.SetActions received: %s", reply) } attrsEA := &utils.AttrExecuteAction{Tenant: attrsSetAccount.Tenant, Account: attrsSetAccount.Account, ActionsId: attrsAA.ActionsId} - if err := actsLclRpc.Call("ApierV1.ExecuteAction", attrsEA, &reply); err != nil { + if err := actsLclRpc.Call(utils.ApierV1ExecuteAction, attrsEA, &reply); err != nil { t.Error("Got error on ApierV1.ExecuteAction: ", err.Error()) } else if reply != utils.OK { t.Errorf("Calling ApierV1.ExecuteAction received: %s", reply) @@ -250,7 +250,7 @@ func TestActionsitThresholdCDrLog(t *testing.T) { {Identifier: utils.TOPUP, BalanceType: utils.MONETARY, Units: "5", ExpiryTime: utils.UNLIMITED, Weight: 20.0}, {Identifier: utils.CDRLOG}, }} - if err := actsLclRpc.Call("ApierV2.SetActions", attrsAA, &reply); err != nil && err.Error() != utils.ErrExists.Error() { + if err := actsLclRpc.Call(utils.ApierV2SetActions, attrsAA, &reply); err != nil && err.Error() != utils.ErrExists.Error() { t.Error("Got error on ApierV2.SetActions: ", err.Error()) } else if reply != utils.OK { t.Errorf("Calling ApierV2.SetActions received: %s", reply) @@ -378,7 +378,7 @@ func TestActionsitCDRAccount(t *testing.T) { {Identifier: utils.MetaCDRAccount, ExpiryTime: utils.UNLIMITED, Weight: 20.0}, }, } - if err := actsLclRpc.Call("ApierV2.SetActions", attrsAA, &reply); err != nil && err.Error() != utils.ErrExists.Error() { + if err := actsLclRpc.Call(utils.ApierV2SetActions, attrsAA, &reply); err != nil && err.Error() != utils.ErrExists.Error() { t.Error("Got error on ApierV2.SetActions: ", err.Error()) } else if reply != utils.OK { t.Errorf("Calling ApierV2.SetActions received: %s", reply) @@ -437,7 +437,7 @@ func TestActionsitCDRAccount(t *testing.T) { time.Sleep(100 * time.Millisecond) attrsEA := &utils.AttrExecuteAction{Tenant: "cgrates.org", Account: acnt, ActionsId: attrsAA.ActionsId} - if err := actsLclRpc.Call("ApierV1.ExecuteAction", attrsEA, &reply); err != nil { + if err := actsLclRpc.Call(utils.ApierV1ExecuteAction, attrsEA, &reply); err != nil { t.Error("Got error on ApierV1.ExecuteAction: ", err.Error()) } else if reply != utils.OK { t.Errorf("Calling ApierV1.ExecuteAction received: %s", reply) @@ -459,7 +459,7 @@ func TestActionsitThresholdPostEvent(t *testing.T) { attrsAA := &utils.AttrSetActions{ActionsId: "ACT_TH_POSTEVENT", Actions: []*utils.TPAction{ &utils.TPAction{Identifier: utils.MetaPostEvent, ExtraParameters: "http://127.0.0.1:12080/invalid_json"}, }} - if err := actsLclRpc.Call("ApierV2.SetActions", attrsAA, &reply); err != nil && err.Error() != utils.ErrExists.Error() { + if err := actsLclRpc.Call(utils.ApierV2SetActions, attrsAA, &reply); err != nil && err.Error() != utils.ErrExists.Error() { t.Error("Got error on ApierV2.SetActions: ", err.Error()) } else if reply != utils.OK { t.Errorf("Calling ApierV2.SetActions received: %s", reply) diff --git a/general_tests/a1_it_test.go b/general_tests/a1_it_test.go index eb38cc7e2..bc70a994b 100644 --- a/general_tests/a1_it_test.go +++ b/general_tests/a1_it_test.go @@ -333,7 +333,7 @@ func testA1itConcurrentAPs(t *testing.T) { ActionPlanIDs: &[]string{"PACKAGE_1"}, } var reply string - if err := a1rpc.Call("ApierV2.SetAccount", attrSetAcnt, &reply); err != nil { + if err := a1rpc.Call(utils.ApierV2SetAccount, attrSetAcnt, &reply); err != nil { t.Error(err) } wg.Done() @@ -362,7 +362,7 @@ func testA1itConcurrentAPs(t *testing.T) { }(acnt) go func(acnt string) { var reply string - if err := a1rpc.Call("ApierV1.RemoveActionTiming", + if err := a1rpc.Call(utils.ApierV1RemoveActionTiming, v1.AttrRemoveActionTiming{Tenant: "cgrates.org", Account: acnt, ActionPlanId: "PACKAGE_1"}, &reply); err != nil { t.Error(err) } @@ -375,7 +375,7 @@ func testA1itConcurrentAPs(t *testing.T) { ActionPlanIDs: &[]string{"PACKAGE_2"}, } var reply string - if err := a1rpc.Call("ApierV2.SetAccount", attrSetAcnt, &reply); err != nil { + if err := a1rpc.Call(utils.ApierV2SetAccount, attrSetAcnt, &reply); err != nil { t.Error(err) } wg.Done() diff --git a/general_tests/accounts_it_test.go b/general_tests/accounts_it_test.go index 4b4b6e579..7cc3e2052 100644 --- a/general_tests/accounts_it_test.go +++ b/general_tests/accounts_it_test.go @@ -143,7 +143,7 @@ func testV1AccGetAccountAfterLoad(t *testing.T) { func testV1AccRemAccount(t *testing.T) { var reply string - if err := accRpc.Call("ApierV1.RemoveAccount", + if err := accRpc.Call(utils.ApierV1RemoveAccount, &utils.AttrRemoveAccount{Tenant: "cgrates.org", Account: "1001"}, &reply); err != nil { t.Error(err) @@ -163,7 +163,7 @@ func testV1AccGetAccountAfterDelete(t *testing.T) { func testV1AccSetAccount(t *testing.T) { var reply string - if err := accRpc.Call("ApierV2.SetAccount", + if err := accRpc.Call(utils.ApierV2SetAccount, &utils.AttrSetAccount{Tenant: "cgrates.org", Account: "testacc"}, &reply); err != nil { t.Error(err) } else if reply != utils.OK { @@ -181,7 +181,7 @@ func testV1AccGetAccountAfterSet(t *testing.T) { func testV1AccRemAccountSet(t *testing.T) { var reply string - if err := accRpc.Call("ApierV1.RemoveAccount", + if err := accRpc.Call(utils.ApierV1RemoveAccount, &utils.AttrRemoveAccount{Tenant: "cgrates.org", Account: "testacc"}, &reply); err != nil { t.Error(err) @@ -203,7 +203,7 @@ func testV1AccGetAccountSetAfterDelete(t *testing.T) { Need to investigate for redis why didn't return not found func testV1AccRemAccountAfterDelete(t *testing.T) { var reply string - if err := accRpc.Call("ApierV1.RemoveAccount", + if err := accRpc.Call(utils.ApierV1RemoveAccount, &utils.AttrRemoveAccount{Tenant: "cgrates.org", Account: "testacc"}, &reply); err == nil || err.Error() != utils.NewErrServerError(utils.ErrNotFound).Error() { t.Error(err) @@ -240,7 +240,7 @@ func testV1AccSendToThreshold(t *testing.T) { {Identifier: utils.DISABLE_ACCOUNT}, {Identifier: utils.LOG}, }} - if err := accRpc.Call("ApierV2.SetActions", attrsAA, &reply); err != nil && err.Error() != utils.ErrExists.Error() { + if err := accRpc.Call(utils.ApierV2SetActions, attrsAA, &reply); err != nil && err.Error() != utils.ErrExists.Error() { t.Error("Got error on ApierV2.SetActions: ", err.Error()) } else if reply != utils.OK { t.Errorf("Calling ApierV2.SetActions received: %s", reply) diff --git a/general_tests/cdrs_it_test.go b/general_tests/cdrs_it_test.go index 22865fde7..47f6fe815 100644 --- a/general_tests/cdrs_it_test.go +++ b/general_tests/cdrs_it_test.go @@ -138,14 +138,14 @@ func testV2CDRsLoadTariffPlanFromFolder(t *testing.T) { } time.Sleep(time.Duration(*waitRater) * time.Millisecond) // Give time for scheduler to execute topups var resp string - if err := cdrsRpc.Call("ApierV1.RemoveChargerProfile", + if err := cdrsRpc.Call(utils.ApierV1RemoveChargerProfile, &utils.TenantID{Tenant: "cgrates.org", ID: "SupplierCharges"}, &resp); err != nil { t.Error(err) } else if resp != utils.OK { t.Error("Unexpected reply returned", resp) } var reply *engine.AttributeProfile - if err := cdrsRpc.Call("ApierV1.GetChargerProfile", + if err := cdrsRpc.Call(utils.ApierV1GetChargerProfile, &utils.TenantID{Tenant: "cgrates.org", ID: "SupplierCharges"}, &reply); err == nil || err.Error() != utils.ErrNotFound.Error() { t.Error(err) @@ -185,7 +185,7 @@ func testV2CDRsProcessCDR(t *testing.T) { func testV2CDRsGetCdrs(t *testing.T) { var cdrCnt int64 req := utils.AttrGetCdrs{} - if err := cdrsRpc.Call("ApierV2.CountCDRs", req, &cdrCnt); err != nil { + if err := cdrsRpc.Call(utils.ApierV2CountCDRs, req, &cdrCnt); err != nil { t.Error("Unexpected error: ", err.Error()) } else if cdrCnt != 2 { t.Error("Unexpected number of CDRs returned: ", cdrCnt) @@ -256,7 +256,7 @@ func testV2CDRsProcessCDR2(t *testing.T) { func testV2CDRsGetCdrs2(t *testing.T) { var cdrCnt int64 req := utils.AttrGetCdrs{Accounts: []string{"testV2CDRsProcessCDR2"}} - if err := cdrsRpc.Call("ApierV2.CountCDRs", req, &cdrCnt); err != nil { + if err := cdrsRpc.Call(utils.ApierV2CountCDRs, req, &cdrCnt); err != nil { t.Error("Unexpected error: ", err.Error()) } else if cdrCnt != 2 { t.Error("Unexpected number of CDRs returned: ", cdrCnt) @@ -330,7 +330,7 @@ func testV2CDRsProcessCDR3(t *testing.T) { func testV2CDRsGetCdrs3(t *testing.T) { var cdrCnt int64 req := utils.AttrGetCdrs{Accounts: []string{"testV2CDRsProcessCDR3"}} - if err := cdrsRpc.Call("ApierV2.CountCDRs", req, &cdrCnt); err != nil { + if err := cdrsRpc.Call(utils.ApierV2CountCDRs, req, &cdrCnt); err != nil { t.Error("Unexpected error: ", err.Error()) } else if cdrCnt != 1 { t.Error("Unexpected number of CDRs returned: ", cdrCnt) @@ -503,7 +503,7 @@ func testV2CDRsSetThresholdProfile(t *testing.T) { // Set Action attrsAA := &utils.AttrSetActions{ActionsId: "ACT_THD_PoccessCDR", Actions: []*utils.TPAction{{Identifier: utils.LOG}}} - if err := cdrsRpc.Call("ApierV2.SetActions", attrsAA, &actreply); err != nil && err.Error() != utils.ErrExists.Error() { + if err := cdrsRpc.Call(utils.ApierV2SetActions, attrsAA, &actreply); err != nil && err.Error() != utils.ErrExists.Error() { t.Error("Got error on ApierV2.SetActions: ", err.Error()) } else if actreply != utils.OK { t.Errorf("Calling ApierV2.SetActions received: %s", actreply) @@ -600,7 +600,7 @@ func testV2CDRsGetStats1(t *testing.T) { func testV2CDRsGetThreshold1(t *testing.T) { expected := []string{"THD_ACNT_1001", "THD_PoccessCDR"} var result []string - if err := cdrsRpc.Call("ApierV1.GetThresholdProfileIDs", + if err := cdrsRpc.Call(utils.ApierV1GetThresholdProfileIDs, utils.TenantArgWithPaginator{TenantArg: utils.TenantArg{"cgrates.org"}}, &result); err != nil { t.Error(err) } else if len(expected) != len(result) { diff --git a/general_tests/cdrs_onlexp_it_test.go b/general_tests/cdrs_onlexp_it_test.go index ba1c41368..779beec2c 100644 --- a/general_tests/cdrs_onlexp_it_test.go +++ b/general_tests/cdrs_onlexp_it_test.go @@ -597,7 +597,7 @@ func testCdrsHttpCdrReplication2(t *testing.T) { } var reply string for _, cdr := range cdrs { - if err := cdrsMasterRpc.Call("CdrsV2.ProcessCdr", cdr, &reply); err != nil { + if err := cdrsMasterRpc.Call(utils.CdrsV2ProcessCdr, cdr, &reply); err != nil { t.Error("Unexpected error: ", err.Error()) } else if reply != utils.OK { t.Error("Unexpected reply received: ", reply) diff --git a/general_tests/data_it_test.go b/general_tests/data_it_test.go index f97637108..d8675463a 100644 --- a/general_tests/data_it_test.go +++ b/general_tests/data_it_test.go @@ -164,7 +164,7 @@ func testV1DataDataDebitUsageWith10Kilo(t *testing.T) { AnswerTime: time.Date(2013, 11, 7, 7, 42, 20, 0, time.UTC).String(), } tStart := time.Now() - if err := dataRpc.Call("ApierV1.DebitUsage", + if err := dataRpc.Call(utils.ApierV1DebitUsage, engine.UsageRecordWithArgDispatcher{UsageRecord: usageRecord}, &reply); err != nil { t.Error(err) } @@ -190,7 +190,7 @@ func testV1DataGetCostWith10Kilo(t *testing.T) { Subject: "10kilo", AnswerTime: "*now", Usage: 256000000} var rply *engine.DataCost tStart := time.Now() - if err := dataRpc.Call("ApierV1.GetDataCost", attrs, &rply); err != nil { + if err := dataRpc.Call(utils.ApierV1GetDataCost, attrs, &rply); err != nil { t.Error("Unexpected nil error received: ", err.Error()) } else if rply.Cost != 25600.000000 { t.Errorf("Unexpected cost received: %f", rply.Cost) @@ -298,7 +298,7 @@ func testV1DataDataDebitUsage1G0(t *testing.T) { AnswerTime: time.Date(2013, 11, 7, 7, 42, 20, 0, time.UTC).String(), } tStart := time.Now() - if err := dataRpc.Call("ApierV1.DebitUsage", + if err := dataRpc.Call(utils.ApierV1DebitUsage, engine.UsageRecordWithArgDispatcher{UsageRecord: usageRecord}, &reply); err != nil { t.Error(err) } @@ -324,7 +324,7 @@ func testV1DataGetCost1G0(t *testing.T) { Subject: "10kilo", AnswerTime: "*now", Usage: 1000000000} var rply *engine.DataCost tStart := time.Now() - if err := dataRpc.Call("ApierV1.GetDataCost", attrs, &rply); err != nil { + if err := dataRpc.Call(utils.ApierV1GetDataCost, attrs, &rply); err != nil { t.Error("Unexpected nil error received: ", err.Error()) } else if rply.Cost != 100000.000000 { t.Errorf("Unexpected cost received: %f", rply.Cost) diff --git a/general_tests/dest_management_it_test.go b/general_tests/dest_management_it_test.go index a61aad3b2..abd3a1eb8 100644 --- a/general_tests/dest_management_it_test.go +++ b/general_tests/dest_management_it_test.go @@ -120,14 +120,14 @@ func testDestManagLoadTariffPlanFromFolderAll(t *testing.T) { func testDestManagAllDestinationLoaded(t *testing.T) { dests := make([]*engine.Destination, 0) - if err := destRPC.Call("ApierV2.GetDestinations", v2.AttrGetDestinations{DestinationIDs: []string{}}, &dests); err != nil { + if err := destRPC.Call(utils.ApierV2GetDestinations, v2.AttrGetDestinations{DestinationIDs: []string{}}, &dests); err != nil { t.Error("Got error on ApierV2.GetDestinations: ", err.Error()) } else if len(dests) != 6 { t.Errorf("Calling ApierV2.GetDestinations got reply: %v", utils.ToIJSON(dests)) } var rcvStats utils.CacheStats - if err := destRPC.Call("ApierV1.GetCacheStats", utils.AttrCacheStats{}, &rcvStats); err != nil { + if err := destRPC.Call(utils.ApierV1GetCacheStats, utils.AttrCacheStats{}, &rcvStats); err != nil { t.Error("Got error on ApierV1.GetCacheStats: ", err.Error()) } else if rcvStats.Destinations != 9 { t.Errorf("Calling ApierV1.GetCacheStats received: %+v", rcvStats) @@ -146,14 +146,14 @@ func testDestManagLoadTariffPlanFromFolderRemoveSome(t *testing.T) { func testDestManagRemoveSomeDestinationLoaded(t *testing.T) { dests := make([]*engine.Destination, 0) - if err := destRPC.Call("ApierV2.GetDestinations", v2.AttrGetDestinations{DestinationIDs: []string{}}, &dests); err != nil { + if err := destRPC.Call(utils.ApierV2GetDestinations, v2.AttrGetDestinations{DestinationIDs: []string{}}, &dests); err != nil { t.Error("Got error on ApierV2.GetDestinations: ", err.Error()) } else if len(dests) != 6 { t.Errorf("Calling ApierV2.GetDestinations got reply: %v", utils.ToIJSON(dests)) } var rcvStats utils.CacheStats - if err := destRPC.Call("ApierV1.GetCacheStats", utils.AttrCacheStats{}, &rcvStats); err != nil { + if err := destRPC.Call(utils.ApierV1GetCacheStats, utils.AttrCacheStats{}, &rcvStats); err != nil { t.Error("Got error on ApierV1.GetCacheStats: ", err.Error()) } else if rcvStats.Destinations != 9 { t.Errorf("Calling ApierV1.GetCacheStats received: %+v", rcvStats) @@ -171,14 +171,14 @@ func testDestManagLoadTariffPlanFromFolderRemoveSomeFlush(t *testing.T) { func testDestManagRemoveSomeFlushDestinationLoaded(t *testing.T) { dests := make([]*engine.Destination, 0) - if err := destRPC.Call("ApierV2.GetDestinations", v2.AttrGetDestinations{DestinationIDs: []string{}}, &dests); err != nil { + if err := destRPC.Call(utils.ApierV2GetDestinations, v2.AttrGetDestinations{DestinationIDs: []string{}}, &dests); err != nil { t.Error("Got error on ApierV2.GetDestinations: ", err.Error()) } else if len(dests) != 4 { t.Errorf("Calling ApierV2.GetDestinations got reply: %v", utils.ToIJSON(dests)) } var rcvStats utils.CacheStats - if err := destRPC.Call("ApierV1.GetCacheStats", utils.AttrCacheStats{}, &rcvStats); err != nil { + if err := destRPC.Call(utils.ApierV1GetCacheStats, utils.AttrCacheStats{}, &rcvStats); err != nil { t.Error("Got error on ApierV1.GetCacheStats: ", err.Error()) } else if rcvStats.Destinations != 5 { t.Errorf("Calling ApierV1.GetCacheStats received: %+v", rcvStats) @@ -196,14 +196,14 @@ func testDestManagLoadTariffPlanFromFolderAddBack(t *testing.T) { func testDestManagAddBackDestinationLoaded(t *testing.T) { dests := make([]*engine.Destination, 0) - if err := destRPC.Call("ApierV2.GetDestinations", v2.AttrGetDestinations{DestinationIDs: []string{}}, &dests); err != nil { + if err := destRPC.Call(utils.ApierV2GetDestinations, v2.AttrGetDestinations{DestinationIDs: []string{}}, &dests); err != nil { t.Error("Got error on ApierV2.GetDestinations: ", err.Error()) } else if len(dests) != 6 { t.Errorf("Calling ApierV2.GetDestinations got reply: %v", utils.ToIJSON(dests)) } var rcvStats utils.CacheStats - if err := destRPC.Call("ApierV1.GetCacheStats", utils.AttrCacheStats{}, &rcvStats); err != nil { + if err := destRPC.Call(utils.ApierV1GetCacheStats, utils.AttrCacheStats{}, &rcvStats); err != nil { t.Error("Got error on ApierV1.GetCacheStats: ", err.Error()) } else if rcvStats.Destinations != 9 { t.Errorf("Calling ApierV1.GetCacheStats received: %+v", rcvStats) @@ -221,14 +221,14 @@ func testDestManagLoadTariffPlanFromFolderAddOne(t *testing.T) { func testDestManagAddOneDestinationLoaded(t *testing.T) { dests := make([]*engine.Destination, 0) - if err := destRPC.Call("ApierV2.GetDestinations", v2.AttrGetDestinations{DestinationIDs: []string{}}, &dests); err != nil { + if err := destRPC.Call(utils.ApierV2GetDestinations, v2.AttrGetDestinations{DestinationIDs: []string{}}, &dests); err != nil { t.Error("Got error on ApierV2.GetDestinations: ", err.Error()) } else if len(dests) != 7 { t.Errorf("Calling ApierV2.GetDestinations got reply: %v", utils.ToIJSON(dests)) } var rcvStats utils.CacheStats - if err := destRPC.Call("ApierV1.GetCacheStats", utils.AttrCacheStats{}, &rcvStats); err != nil { + if err := destRPC.Call(utils.ApierV1GetCacheStats, utils.AttrCacheStats{}, &rcvStats); err != nil { t.Error("Got error on ApierV1.GetCacheStats: ", err.Error()) } else if rcvStats.Destinations != 10 { t.Errorf("Calling ApierV1.GetCacheStats received: %+v", rcvStats) @@ -240,7 +240,7 @@ func testDestManagCacheWithGetCache(t *testing.T) { t.Fatal(err) } var reply string - if err := destRPC.Call("ApierV1.ReloadCache", utils.AttrReloadCache{}, &reply); err != nil { + if err := destRPC.Call(utils.ApierV1ReloadCache, utils.AttrReloadCache{}, &reply); err != nil { t.Error("Got error on ApierV1.ReloadCache: ", err.Error()) } else if reply != utils.OK { t.Errorf("Calling ApierV1.ReloadCache received: %+v", reply) @@ -253,14 +253,14 @@ func testDestManagCacheWithGetCache(t *testing.T) { time.Sleep(time.Duration(*waitRater) * time.Millisecond) // Give time for scheduler to execute topups dests := make([]*engine.Destination, 0) - if err := destRPC.Call("ApierV2.GetDestinations", v2.AttrGetDestinations{DestinationIDs: []string{}}, &dests); err != nil { + if err := destRPC.Call(utils.ApierV2GetDestinations, v2.AttrGetDestinations{DestinationIDs: []string{}}, &dests); err != nil { t.Error("Got error on ApierV2.GetDestinations: ", err.Error()) } else if len(dests) != 1 { t.Errorf("Calling ApierV2.GetDestinations got reply: %v", utils.ToIJSON(dests)) } var rcvStats utils.CacheStats - if err := destRPC.Call("ApierV1.GetCacheStats", utils.AttrCacheStats{}, &rcvStats); err != nil { + if err := destRPC.Call(utils.ApierV1GetCacheStats, utils.AttrCacheStats{}, &rcvStats); err != nil { t.Error("Got error on ApierV1.GetCacheStats: ", err.Error()) } else if rcvStats.Destinations != 2 { t.Errorf("Calling ApierV1.GetCacheStats received: %+v", rcvStats) @@ -273,13 +273,13 @@ func testDestManagCacheWithGetCache(t *testing.T) { time.Sleep(time.Duration(*waitRater) * time.Millisecond) // Give time for scheduler to execute topups dests = make([]*engine.Destination, 0) - if err := destRPC.Call("ApierV2.GetDestinations", v2.AttrGetDestinations{DestinationIDs: []string{}}, &dests); err != nil { + if err := destRPC.Call(utils.ApierV2GetDestinations, v2.AttrGetDestinations{DestinationIDs: []string{}}, &dests); err != nil { t.Error("Got error on ApierV2.GetDestinations: ", err.Error()) } else if len(dests) != 1 { t.Errorf("Calling ApierV2.GetDestinations got reply: %v", utils.ToIJSON(dests)) } - if err := destRPC.Call("ApierV1.GetCacheStats", utils.AttrCacheStats{}, &rcvStats); err != nil { + if err := destRPC.Call(utils.ApierV1GetCacheStats, utils.AttrCacheStats{}, &rcvStats); err != nil { t.Error("Got error on ApierV1.GetCacheStats: ", err.Error()) } else if rcvStats.Destinations != 1 { t.Errorf("Calling ApierV1.GetCacheStats received: %+v", rcvStats) @@ -291,7 +291,7 @@ func testDestManagCacheWithGetCost(t *testing.T) { t.Fatal(err) } var reply string - if err := destRPC.Call("ApierV1.ReloadCache", utils.AttrReloadCache{}, &reply); err != nil { + if err := destRPC.Call(utils.ApierV1ReloadCache, utils.AttrReloadCache{}, &reply); err != nil { t.Error("Got error on ApierV1.ReloadCache: ", err.Error()) } else if reply != utils.OK { t.Errorf("Calling ApierV1.ReloadCache received: %+v", reply) @@ -304,7 +304,7 @@ func testDestManagCacheWithGetCost(t *testing.T) { time.Sleep(time.Duration(*waitRater) * time.Millisecond) // Give time for scheduler to execute topups dests := make([]*engine.Destination, 0) - if err := destRPC.Call("ApierV2.GetDestinations", v2.AttrGetDestinations{DestinationIDs: []string{}}, &dests); err != nil { + if err := destRPC.Call(utils.ApierV2GetDestinations, v2.AttrGetDestinations{DestinationIDs: []string{}}, &dests); err != nil { t.Error("Got error on ApierV2.GetDestinations: ", err.Error()) } else if len(dests) != 1 { t.Errorf("Calling ApierV2.GetDestinations got reply: %v", utils.ToIJSON(dests)) @@ -333,7 +333,7 @@ func testDestManagCacheWithGetCost(t *testing.T) { time.Sleep(time.Duration(*waitRater) * time.Millisecond) // Give time for scheduler to execute topups dests = make([]*engine.Destination, 0) - if err := destRPC.Call("ApierV2.GetDestinations", v2.AttrGetDestinations{DestinationIDs: []string{}}, &dests); err != nil { + if err := destRPC.Call(utils.ApierV2GetDestinations, v2.AttrGetDestinations{DestinationIDs: []string{}}, &dests); err != nil { t.Error("Got error on ApierV2.GetDestinations: ", err.Error()) } else if len(dests) != 1 { t.Errorf("Calling ApierV2.GetDestinations got reply: %v", utils.ToIJSON(dests)) diff --git a/general_tests/destination_combined_it_test.go b/general_tests/destination_combined_it_test.go index 2498ccbd3..1d9c60f6d 100644 --- a/general_tests/destination_combined_it_test.go +++ b/general_tests/destination_combined_it_test.go @@ -106,7 +106,7 @@ func testDestinationGetCostFor1002(t *testing.T) { Usage: "1m", } var rply *engine.EventCost - if err := tutorialRpc.Call("ApierV1.GetCost", attrs, &rply); err != nil { + if err := tutorialRpc.Call(utils.ApierV1GetCost, attrs, &rply); err != nil { t.Error("Unexpected nil error received: ", err.Error()) } else if *rply.Cost != 0.01 { t.Errorf("Unexpected cost received: %f", *rply.Cost) @@ -123,7 +123,7 @@ func testDestinationGetCostFor1003(t *testing.T) { Usage: "1m", } var rply *engine.EventCost - if err := tutorialRpc.Call("ApierV1.GetCost", attrs, &rply); err != nil { + if err := tutorialRpc.Call(utils.ApierV1GetCost, attrs, &rply); err != nil { t.Error("Unexpected nil error received: ", err.Error()) } else if *rply.Cost != 0.3 { t.Errorf("Unexpected cost received: %f", *rply.Cost) diff --git a/general_tests/filters_it_test.go b/general_tests/filters_it_test.go index 226a5a524..beae9f11e 100644 --- a/general_tests/filters_it_test.go +++ b/general_tests/filters_it_test.go @@ -261,7 +261,7 @@ func testV1FltrPupulateThreshold(t *testing.T) { attrsAA := &utils.AttrSetActions{ActionsId: "LOG", Actions: []*utils.TPAction{ {Identifier: utils.LOG}, }} - if err := fltrRpc.Call("ApierV2.SetActions", attrsAA, &result); err != nil && err.Error() != utils.ErrExists.Error() { + if err := fltrRpc.Call(utils.ApierV2SetActions, attrsAA, &result); err != nil && err.Error() != utils.ErrExists.Error() { t.Error("Got error on ApierV2.SetActions: ", err.Error()) } else if result != utils.OK { t.Errorf("Calling ApierV2.SetActions received: %s", result) @@ -548,7 +548,7 @@ func testV1FltrAccounts(t *testing.T) { attrsAA := &utils.AttrSetActions{ActionsId: "LOG", Actions: []*utils.TPAction{ {Identifier: utils.LOG}, }} - if err := fltrRpc.Call("ApierV2.SetActions", attrsAA, &result); err != nil && err.Error() != utils.ErrExists.Error() { + if err := fltrRpc.Call(utils.ApierV2SetActions, attrsAA, &result); err != nil && err.Error() != utils.ErrExists.Error() { t.Error("Got error on ApierV2.SetActions: ", err.Error()) } else if result != utils.OK { t.Errorf("Calling ApierV2.SetActions received: %s", result) diff --git a/general_tests/oldtutorial_it_test.go b/general_tests/oldtutorial_it_test.go index 96294bf69..3aa19f7e0 100644 --- a/general_tests/oldtutorial_it_test.go +++ b/general_tests/oldtutorial_it_test.go @@ -108,7 +108,7 @@ package general_tests // ThresholdProfiles: 7, Filters: 16, SupplierProfiles: 3, AttributeProfiles: 1, // CdrStats: 0, Users: 0} // CdrStats and Users are 0 because deprecated. To be removed // var args utils.AttrCacheStats -// if err := tutLocalRpc.Call("ApierV1.GetCacheStats", args, &rcvStats); err != nil { +// if err := tutLocalRpc.Call(utils.ApierV1GetCacheStats, 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", utils.ToJSON(expectedStats), utils.ToJSON(rcvStats)) @@ -120,7 +120,7 @@ package general_tests // var rcvKeys utils.ArgsCache // argsAPI := utils.ArgsCacheKeys{ArgsCache: utils.ArgsCache{ // DestinationIDs: &[]string{}, RatingPlanIDs: &[]string{"RP_RETAIL1", "RP_GENERIC", "NONEXISTENT"}}} -// if err := tutLocalRpc.Call("ApierV1.GetCacheKeys", argsAPI, &rcvKeys); err != nil { +// if err := tutLocalRpc.Call(utils.ApierV1GetCacheKeys, argsAPI, &rcvKeys); err != nil { // t.Error("Got error on ApierV1.GetCacheStats: ", err.Error()) // } else { // if rcvKeys.DestinationIDs == nil { @@ -145,7 +145,7 @@ package general_tests // if err != nil { // t.Fatal(err) // } -// if err := tutLocalRpc.Call("ApierV1.GetCacheStats", args, &rcvStats); err != nil { +// if err := tutLocalRpc.Call(utils.ApierV1GetCacheStats, 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) @@ -1186,7 +1186,7 @@ package general_tests // func TestTutITSetAccount(t *testing.T) { // var reply string // attrs := &v2.AttrSetAccount{Tenant: "cgrates.org", Account: "tutacnt1", ActionPlanIDs: &[]string{"PACKAGE_10"}, ActionTriggerIDs: &[]string{"STANDARD_TRIGGERS"}, ReloadScheduler: true} -// if err := tutLocalRpc.Call("ApierV2.SetAccount", attrs, &reply); err != nil { +// if err := tutLocalRpc.Call(utils.ApierV2SetAccount, attrs, &reply); err != nil { // t.Error("Got error on ApierV2.SetAccount: ", err.Error()) // } else if reply != "OK" { // t.Errorf("Calling ApierV2.SetAccount received: %s", reply) @@ -1225,7 +1225,7 @@ package general_tests // } // attrs = &v2.AttrSetAccount{Tenant: "cgrates.org", Account: "tutacnt1", ActionPlanIDs: &[]string{"PACKAGE_10"}, ActionTriggerIDs: &[]string{"STANDARD_TRIGGERS"}, AllowNegative: utils.BoolPointer(true), Disabled: utils.BoolPointer(true), ReloadScheduler: true} -// if err := tutLocalRpc.Call("ApierV2.SetAccount", attrs, &reply); err != nil { +// if err := tutLocalRpc.Call(utils.ApierV2SetAccount, attrs, &reply); err != nil { // t.Error("Got error on ApierV2.SetAccount: ", err.Error()) // } else if reply != "OK" { // t.Errorf("Calling ApierV2.SetAccount received: %s", reply) @@ -1255,7 +1255,7 @@ package general_tests // } // attrs = &v2.AttrSetAccount{Tenant: "cgrates.org", Account: "tutacnt1", ActionPlanIDs: &[]string{"PACKAGE_1001"}, ActionTriggerIDs: &[]string{"CDRST1_WARN"}, AllowNegative: utils.BoolPointer(true), Disabled: utils.BoolPointer(true), ReloadScheduler: true} -// if err := tutLocalRpc.Call("ApierV2.SetAccount", attrs, &reply); err != nil { +// if err := tutLocalRpc.Call(utils.ApierV2SetAccount, attrs, &reply); err != nil { // t.Error("Got error on ApierV2.SetAccount: ", err.Error()) // } else if reply != "OK" { // t.Errorf("Calling ApierV2.SetAccount received: %s", reply) diff --git a/general_tests/rpccaching_it_test.go b/general_tests/rpccaching_it_test.go index 966b5c18d..c5ca3a60c 100644 --- a/general_tests/rpccaching_it_test.go +++ b/general_tests/rpccaching_it_test.go @@ -135,7 +135,7 @@ func testRPCMethodsAddData(t *testing.T) { {Identifier: utils.DISABLE_ACCOUNT}, {Identifier: utils.LOG}, }} - if err := rpcRpc.Call("ApierV2.SetActions", attrsAA, &reply); err != nil && err.Error() != utils.ErrExists.Error() { + if err := rpcRpc.Call(utils.ApierV2SetActions, attrsAA, &reply); err != nil && err.Error() != utils.ErrExists.Error() { t.Error("Got error on ApierV2.SetActions: ", err.Error()) } else if reply != utils.OK { t.Errorf("Calling ApierV2.SetActions received: %s", reply) @@ -145,7 +145,7 @@ func testRPCMethodsAddData(t *testing.T) { {Identifier: utils.ENABLE_ACCOUNT}, {Identifier: utils.LOG}, }} - if err := rpcRpc.Call("ApierV2.SetActions", attrsAA2, &reply); err != nil && err.Error() != utils.ErrExists.Error() { + if err := rpcRpc.Call(utils.ApierV2SetActions, attrsAA2, &reply); err != nil && err.Error() != utils.ErrExists.Error() { t.Error("Got error on ApierV2.SetActions: ", err.Error()) } else if reply != utils.OK { t.Errorf("Calling ApierV2.SetActions received: %s", reply) diff --git a/general_tests/rpcclient_it_test.go b/general_tests/rpcclient_it_test.go index b49aca0f0..0db1ff53d 100644 --- a/general_tests/rpcclient_it_test.go +++ b/general_tests/rpcclient_it_test.go @@ -298,7 +298,7 @@ func testRPCITLclStatusBcastRALs1Up(t *testing.T) { /* func TestRPCITStatusBcastCmd(t *testing.T) { var stats utils.CacheStats - if err := rpcRAL1.Call("ApierV2.GetCacheStats", utils.AttrCacheStats{}, &stats); err != nil { + if err := rpcRAL1.Call(utils.ApierV2GetCacheStats, utils.AttrCacheStats{}, &stats); err != nil { t.Error(err) } else if stats.LastRatingLoadID != utils.NOT_AVAILABLE || stats.LastAccountingLoadID != utils.NOT_AVAILABLE { t.Errorf("Received unexpected stats: %+v", stats) @@ -311,17 +311,17 @@ func TestRPCITStatusBcastCmd(t *testing.T) { t.Errorf("Empty loadId received, loadInstance: %+v", loadInst) } var reply string - if err := rpcPoolBroadcast.Call("ApierV1.ReloadCache", utils.AttrReloadCache{}, &reply); err != nil { + if err := rpcPoolBroadcast.Call(utils.ApierV1ReloadCache, utils.AttrReloadCache{}, &reply); err != nil { t.Error("Got error on ApierV1.ReloadCache: ", err.Error()) } else if reply != utils.OK { t.Error("Calling ApierV1.ReloadCache got reply: ", reply) } - if err := rpcRAL1.Call("ApierV2.GetCacheStats", utils.AttrCacheStats{}, &stats); err != nil { + if err := rpcRAL1.Call(utils.ApierV2GetCacheStats, utils.AttrCacheStats{}, &stats); err != nil { t.Error(err) } else if stats.LastRatingLoadID != loadInst.RatingLoadID { t.Errorf("Received unexpected stats: %+v vs %+v", stats, loadInst) } - if err := rpcRAL2.Call("ApierV2.GetCacheStats", utils.AttrCacheStats{}, &stats); err != nil { + if err := rpcRAL2.Call(utils.ApierV2GetCacheStats, utils.AttrCacheStats{}, &stats); err != nil { t.Error(err) } else if stats.LastRatingLoadID != loadInst.RatingLoadID { t.Errorf("Received unexpected stats: %+v vs %+v", stats, loadInst) diff --git a/general_tests/suretax_it_test.go b/general_tests/suretax_it_test.go index 940106588..61c1e6340 100644 --- a/general_tests/suretax_it_test.go +++ b/general_tests/suretax_it_test.go @@ -121,7 +121,7 @@ func testSTICacheStats(t *testing.T) { var rcvStats *utils.CacheStats expectedStats := &utils.CacheStats{Destinations: 1, RatingPlans: 1, RatingProfiles: 1} var args utils.AttrCacheStats - if err := stiRpc.Call("ApierV2.GetCacheStats", args, &rcvStats); err != nil { + if err := stiRpc.Call(utils.ApierV2GetCacheStats, args, &rcvStats); err != nil { t.Error("Got error on ApierV2.GetCacheStats: ", err.Error()) } else if !reflect.DeepEqual(expectedStats, rcvStats) { t.Errorf("Calling ApierV2.GetCacheStats expected: %+v, received: %+v", expectedStats, rcvStats) @@ -137,7 +137,7 @@ func testSTIProcessExternalCdr(t *testing.T) { Usage: "15s", PDD: "7.0", ExtraFields: map[string]string{"CustomerNumber": "000000534", "ZipCode": ""}, } var reply string - if err := stiRpc.Call("CdrsV2.ProcessExternalCdr", cdr, &reply); err != nil { + if err := stiRpc.Call(utils.CdrsV2ProcessExternalCdr, cdr, &reply); err != nil { t.Error("Unexpected error: ", err.Error()) } else if reply != utils.OK { t.Error("Unexpected reply received: ", reply) diff --git a/general_tests/tp_it_test.go b/general_tests/tp_it_test.go index fb61581ed..7ea6aa44a 100644 --- a/general_tests/tp_it_test.go +++ b/general_tests/tp_it_test.go @@ -146,13 +146,13 @@ func testTpBalanceCounter(t *testing.T) { func testTpActionTriggers(t *testing.T) { var atrs engine.ActionTriggers - if err := tpRPC.Call("ApierV1.GetActionTriggers", v1.AttrGetActionTriggers{GroupIDs: []string{}}, &atrs); err != nil { + if err := tpRPC.Call(utils.ApierV1GetActionTriggers, v1.AttrGetActionTriggers{GroupIDs: []string{}}, &atrs); err != nil { t.Error("Got error on ApierV1.GetActionTriggers: ", err.Error()) } else if len(atrs) != 4 { t.Errorf("Calling v1.GetActionTriggers got: %v", atrs) } var reply string - if err := tpRPC.Call("ApierV1.SetActionTrigger", v1.AttrSetActionTrigger{ + if err := tpRPC.Call(utils.ApierV1SetActionTrigger, v1.AttrSetActionTrigger{ GroupID: "TestATR", UniqueID: "Unique atr id", BalanceID: utils.StringPointer("BID1"), @@ -161,12 +161,12 @@ func testTpActionTriggers(t *testing.T) { } else if reply != utils.OK { t.Errorf("Calling v1.SetActionTrigger got: %v", reply) } - if err := tpRPC.Call("ApierV1.GetActionTriggers", v1.AttrGetActionTriggers{GroupIDs: []string{}}, &atrs); err != nil { + if err := tpRPC.Call(utils.ApierV1GetActionTriggers, v1.AttrGetActionTriggers{GroupIDs: []string{}}, &atrs); err != nil { t.Error(err) } else if len(atrs) != 5 { t.Errorf("Calling v1.GetActionTriggers got: %v", atrs) } - if err := tpRPC.Call("ApierV1.GetActionTriggers", v1.AttrGetActionTriggers{GroupIDs: []string{"TestATR"}}, &atrs); err != nil { + if err := tpRPC.Call(utils.ApierV1GetActionTriggers, v1.AttrGetActionTriggers{GroupIDs: []string{"TestATR"}}, &atrs); err != nil { t.Error("Got error on ApierV1.GetActionTriggers: ", err.Error()) } else if len(atrs) != 1 { t.Errorf("Calling v1.GetActionTriggers got: %v", atrs) @@ -252,7 +252,7 @@ func testTpZeroNegativeCost(t *testing.T) { func testTpExecuteActionCgrRpc(t *testing.T) { var reply string - if err := tpRPC.Call("ApierV2.ExecuteAction", utils.AttrExecuteAction{ActionsId: "RPC"}, &reply); err != nil { + if err := tpRPC.Call(utils.ApierV2ExecuteAction, utils.AttrExecuteAction{ActionsId: "RPC"}, &reply); err != nil { t.Error("Got error on ApierV2.ExecuteAction: ", err.Error()) } else if reply != utils.OK { t.Errorf("Calling ExecuteAction got reply: %s", reply) @@ -266,7 +266,7 @@ func testTpExecuteActionCgrRpc(t *testing.T) { func testTpExecuteActionCgrRpcAcc(t *testing.T) { var reply string - if err := tpRPC.Call("ApierV2.ExecuteAction", utils.AttrExecuteAction{ + if err := tpRPC.Call(utils.ApierV2ExecuteAction, utils.AttrExecuteAction{ Tenant: "cgrates.org", Account: "1016", ActionsId: "RPC_DEST", @@ -277,7 +277,7 @@ func testTpExecuteActionCgrRpcAcc(t *testing.T) { } var dests []*engine.Destination attrs := &v2.AttrGetDestinations{DestinationIDs: []string{}} - if err := tpRPC.Call("ApierV2.GetDestinations", attrs, &dests); err != nil { + if err := tpRPC.Call(utils.ApierV2GetDestinations, attrs, &dests); err != nil { t.Error("Got error on ApierV2.GetDestinations: ", err.Error()) } } @@ -285,7 +285,7 @@ func testTpExecuteActionCgrRpcAcc(t *testing.T) { // Deprecated // func //(t *testing.T) { // var reply string -// if err := tpRPC.Call("ApierV2.ExecuteAction", utils.AttrExecuteAction{ +// if err := tpRPC.Call(utils.ApierV2ExecuteAction, utils.AttrExecuteAction{ // ActionsId: "RPC_CDRSTATS", // }, &reply); err != nil { // t.Error("Got error on ApierV2.ExecuteAction: ", err.Error()) @@ -294,14 +294,14 @@ func testTpExecuteActionCgrRpcAcc(t *testing.T) { // } // var queue engine.CDRStatsQueue // time.Sleep(20 * time.Millisecond) -// if err := tpRPC.Call("CDRStatsV1.GetQueue", "qtest", &queue); err != nil { +// if err := tpRPC.Call(utils.CDRStatsV1GetQueue, "qtest", &queue); err != nil { // t.Error("Got error on CDRStatsV1.GetQueue: ", err.Error()) // } // } func testTpCreateExecuteActionMatch(t *testing.T) { var reply string - if err := tpRPC.Call("ApierV2.SetActions", utils.AttrSetActions{ + if err := tpRPC.Call(utils.ApierV2SetActions, utils.AttrSetActions{ ActionsId: "PAYMENT_2056bd2fe137082970f97102b64e42fd", Actions: []*utils.TPAction{ { @@ -317,7 +317,7 @@ func testTpCreateExecuteActionMatch(t *testing.T) { } else if reply != utils.OK { t.Errorf("Calling ApierV2.SetActions got reply: %s", reply) } - if err := tpRPC.Call("ApierV2.ExecuteAction", utils.AttrExecuteAction{ + if err := tpRPC.Call(utils.ApierV2ExecuteAction, utils.AttrExecuteAction{ Tenant: "cgrates.org", Account: "1015", ActionsId: "PAYMENT_2056bd2fe137082970f97102b64e42fd", @@ -326,7 +326,7 @@ func testTpCreateExecuteActionMatch(t *testing.T) { } else if reply != utils.OK { t.Errorf("Calling ExecuteAction got reply: %s", reply) } - if err := tpRPC.Call("ApierV2.ExecuteAction", utils.AttrExecuteAction{ + if err := tpRPC.Call(utils.ApierV2ExecuteAction, utils.AttrExecuteAction{ Tenant: "cgrates.org", Account: "1015", ActionsId: "PAYMENT_2056bd2fe137082970f97102b64e42fd", @@ -349,7 +349,7 @@ func testTpCreateExecuteActionMatch(t *testing.T) { func testTpSetRemoveActions(t *testing.T) { var reply string - if err := tpRPC.Call("ApierV2.SetActions", utils.AttrSetActions{ + if err := tpRPC.Call(utils.ApierV2SetActions, utils.AttrSetActions{ ActionsId: "TO_BE_DELETED", Actions: []*utils.TPAction{ { @@ -366,21 +366,21 @@ func testTpSetRemoveActions(t *testing.T) { t.Errorf("Calling ApierV2.SetActions got reply: %s", reply) } actionsMap := make(map[string]engine.Actions) - if err := tpRPC.Call("ApierV2.GetActions", v2.AttrGetActions{ + if err := tpRPC.Call(utils.ApierV2GetActions, v2.AttrGetActions{ ActionIDs: []string{"PAYMENT_2056bd2fe137082970f97102b64e42fd"}, }, &actionsMap); err != nil { t.Error("Got error on ApierV2.GetActions: ", err.Error()) } else if len(actionsMap) != 1 { t.Errorf("Calling ApierV2.GetActions got reply: %s", utils.ToIJSON(actionsMap)) } - if err := tpRPC.Call("ApierV2.RemoveActions", v1.AttrRemoveActions{ + if err := tpRPC.Call(utils.ApierV2RemoveActions, v1.AttrRemoveActions{ ActionIDs: []string{"PAYMENT_2056bd2fe137082970f97102b64e42fd"}, }, &reply); err != nil { t.Error("Got error on ApierV2.RemoveActions: ", err.Error()) } else if reply != utils.OK { t.Errorf("Calling ApierV2.RemoveActions got reply: %s", reply) } - if err := tpRPC.Call("ApierV2.GetActions", v2.AttrGetActions{ + if err := tpRPC.Call(utils.ApierV2GetActions, v2.AttrGetActions{ ActionIDs: []string{"PAYMENT_2056bd2fe137082970f97102b64e42fd"}, }, &actionsMap); err == nil { t.Error("no error on ApierV2.GetActions: ", err) @@ -389,7 +389,7 @@ func testTpSetRemoveActions(t *testing.T) { func testTpRemoveActionsRefenced(t *testing.T) { actionsMap := make(map[string]engine.Actions) - if err := tpRPC.Call("ApierV2.GetActions", v2.AttrGetActions{ + if err := tpRPC.Call(utils.ApierV2GetActions, v2.AttrGetActions{ ActionIDs: []string{"TOPUP_VOICE"}, }, &actionsMap); err != nil { t.Error("Got error on ApierV2.GetActions: ", err.Error()) @@ -397,7 +397,7 @@ func testTpRemoveActionsRefenced(t *testing.T) { t.Errorf("Calling ApierV2.GetActions got reply: %s", utils.ToIJSON(actionsMap)) } var reply string - if err := tpRPC.Call("ApierV2.RemoveActions", v1.AttrRemoveActions{ + if err := tpRPC.Call(utils.ApierV2RemoveActions, v1.AttrRemoveActions{ ActionIDs: []string{"TOPUP_VOICE"}, }, &reply); err != nil { t.Error("Error on ApierV2.RemoveActions: ", err.Error()) @@ -405,7 +405,7 @@ func testTpRemoveActionsRefenced(t *testing.T) { t.Errorf("Calling ApierV2.RemoveActions got reply: %s", reply) } /* - if err := tpRPC.Call("ApierV2.GetActions", v2.AttrGetActions{ + if err := tpRPC.Call(utils.ApierV2GetActions, v2.AttrGetActions{ ActionIDs: []string{"PAYMENT_2056bd2fe137082970f97102b64e42fd"}, }, &actionsMap); err == nil { t.Error("no error on ApierV2.GetActions: ", err) @@ -422,7 +422,7 @@ func testTpApierResetAccountActionTriggers(t *testing.T) { t.Skip("Skipping test since Executed is not yet true") } var reply string - if err := tpRPC.Call("ApierV2.ResetAccountActionTriggers", v1.AttrResetAccountActionTriggers{ + if err := tpRPC.Call(utils.ApierV2ResetAccountActionTriggers, v1.AttrResetAccountActionTriggers{ Tenant: "cgrates.org", Account: "1005", GroupID: "STANDARD_TRIGGERS", diff --git a/general_tests/tut_smgeneric_it_test.go b/general_tests/tut_smgeneric_it_test.go index 4eb3ceb93..d20289e77 100644 --- a/general_tests/tut_smgeneric_it_test.go +++ b/general_tests/tut_smgeneric_it_test.go @@ -112,7 +112,7 @@ func TestTutSMGLoadTariffPlanFromFolder(t *testing.T) { // Check loaded stats func TestTutSMGCacheStats(t *testing.T) { var reply string - if err := tutSMGRpc.Call("CacheSv1.LoadCache", utils.AttrReloadCache{}, &reply); err != nil { + if err := tutSMGRpc.Call(utils.CacheSv1LoadCache, utils.AttrReloadCache{}, &reply); err != nil { t.Error(err) } else if reply != "OK" { t.Error(reply) diff --git a/general_tests/tutorial_it_test.go b/general_tests/tutorial_it_test.go index eb2e777b0..22c8894ca 100644 --- a/general_tests/tutorial_it_test.go +++ b/general_tests/tutorial_it_test.go @@ -134,7 +134,7 @@ func testTutorialGetCost(t *testing.T) { Usage: "2m10s", } var rply *engine.EventCost - if err := tutorialRpc.Call("ApierV1.GetCost", attrs, &rply); err != nil { + if err := tutorialRpc.Call(utils.ApierV1GetCost, attrs, &rply); err != nil { t.Error("Unexpected nil error received: ", err.Error()) } else if *rply.Cost != 0.716900 { t.Errorf("Unexpected cost received: %f", *rply.Cost) diff --git a/sessions/sessions_voice_it_test.go b/sessions/sessions_voice_it_test.go index dcbac5f5e..049fe907b 100644 --- a/sessions/sessions_voice_it_test.go +++ b/sessions/sessions_voice_it_test.go @@ -1292,7 +1292,7 @@ func TestSMGDataDerivedChargingNoCredit(t *testing.T) { utils.Usage: "100", } var maxUsage float64 - if err := sessionsRPC.Call("SMGenericV2.InitiateSession", smgEv, &maxUsage); err != nil { + if err := sessionsRPC.Call(utils.SMGenericV2InitiateSession, smgEv, &maxUsage); err != nil { t.Error(err) } // the second derived charging run has no credit diff --git a/utils/consts.go b/utils/consts.go index 913ba5405..f60704671 100755 --- a/utils/consts.go +++ b/utils/consts.go @@ -971,6 +971,61 @@ const ( ApierV1SetTPSharedGroups = "ApierV1.SetTPSharedGroups" ApierV1GetTPSharedGroupIds = "ApierV1.GetTPSharedGroupIds" ApierV1RemoveTPSharedGroups = "ApierV1.RemoveTPSharedGroups" + ApierV1ExportCDRs = "ApierV1.ExportCDRs" + ApierV1GetTPRatingPlan = "ApierV1.GetTPRatingPlan" + ApierV1SetTPRatingPlan = "ApierV1.SetTPRatingPlan" + ApierV1GetTPRatingPlanIds = "ApierV1.GetTPRatingPlanIds" + ApierV1RemoveTPRatingPlan = "ApierV1.RemoveTPRatingPlan" + ApierV1SetTPActions = "ApierV1.SetTPActions" + ApierV1GetTPActionIds = "ApierV1.GetTPActionIds" + ApierV1RemoveTPActions = "ApierV1.RemoveTPActions" + ApierV1SetActionPlan = "ApierV1.SetActionPlan" + ApierV1ExecuteAction = "ApierV1.ExecuteAction" + ApierV1SetTPRatingProfile = "ApierV1.SetTPRatingProfile" + ApierV1GetTPRatingProfile = "ApierV1.GetTPRatingProfile" + ApierV1RemoveTPRatingProfile = "ApierV1.RemoveTPRatingProfile" + ApierV1SetTPDestinationRate = "ApierV1.SetTPDestinationRate" + ApierV1GetTPRatingProfileLoadIds = "ApierV1.GetTPRatingProfileLoadIds" + ApierV1GetTPRatingProfilesByLoadId = "ApierV1.GetTPRatingProfilesByLoadId" + ApierV1GetTPRatingProfileIds = "ApierV1.GetTPRatingProfileIds" + ApierV1GetTPDestinationRateIds = "ApierV1.GetTPDestinationRateIds" + ApierV1RemoveTPDestinationRate = "ApierV1.RemoveTPDestinationRate" + ApierV1ImportTariffPlanFromFolder = "ApierV1.ImportTariffPlanFromFolder" + ApierV1ExportTPToFolder = "ApierV1.ExportTPToFolder" + ApierV1LoadRatingPlan = "ApierV1.LoadRatingPlan" + ApierV1LoadRatingProfile = "ApierV1.LoadRatingProfile" + ApierV1LoadAccountActions = "ApierV1.LoadAccountActions" + ApierV1SetActions = "ApierV1.SetActions" + ApierV1AddTriggeredAction = "ApierV1.AddTriggeredAction" + ApierV1GetAccountActionTriggers = "ApierV1.GetAccountActionTriggers" + ApierV1AddAccountActionTriggers = "ApierV1.AddAccountActionTriggers" + ApierV1ResetAccountActionTriggers = "ApierV1.ResetAccountActionTriggers" + ApierV1SetAccountActionTriggers = "ApierV1.SetAccountActionTriggers" + ApierV1RemoveAccountActionTriggers = "ApierV1.RemoveAccountActionTriggers" + ApierV1GetScheduledActions = "ApierV1.GetScheduledActions" + ApierV1RemoveActionTiming = "ApierV1.RemoveActionTiming" + ApierV1ComputeReverseDestinations = "ApierV1.ComputeReverseDestinations" + ApierV1ComputeAccountActionPlans = "ApierV1.ComputeAccountActionPlans" + ApierV1SetDestination = "ApierV1.SetDestination" + ApierV1GetDataCost = "ApierV1.GetDataCost" + ApierV1ReplayFailedPosts = "ApierV1.ReplayFailedPosts" + ApierV1RemoveAccount = "ApierV1.RemoveAccount" + ApierV1DebitUsage = "ApierV1.DebitUsage" + ApierV1GetCacheStats = "ApierV1.GetCacheStats" + ApierV1ReloadCache = "ApierV1.ReloadCache" + ApierV1GetActionTriggers = "ApierV1.GetActionTriggers" + ApierV1SetActionTrigger = "ApierV1.SetActionTrigger" + ApierV1RemoveActionPlan = "ApierV1.RemoveActionPlan" + ApierV1RemoveActions = "ApierV1.RemoveActions" + ApierV1RemoveBalances = "ApierV1.RemoveBalances" + ApierV1ReloadCdrcConfig = "ApierV1.ReloadCdrcConfig" + ApierV1ReloadCdreConfig = "ApierV1.ReloadCdreConfig" + ApierV1GetLoadHistory = "ApierV1.GetLoadHistory" + ApierV1GetLoadIDs = "ApierV1.GetLoadIDs" + ApierV1GetLoadTimes = "ApierV1.GetLoadTimes" + ApierV1ExecuteScheduledActions = "ApierV1.ExecuteScheduledActions" + ApierV1GetSharedGroup = "ApierV1.GetSharedGroup" + ApierV1RemoveActionTrigger = "ApierV1.RemoveActionTrigger" ) // ApierV1 TP APIs @@ -985,14 +1040,31 @@ const ( // ApierV2 APIs const ( - ApierV2 = "ApierV2" - ApierV2LoadTariffPlanFromFolder = "ApierV2.LoadTariffPlanFromFolder" - ApierV2GetCDRs = "ApierV2.GetCDRs" - ApierV2GetAccount = "ApierV2.GetAccount" - ApierV2GetAccounts = "ApierV2.GetAccounts" - ApierV2SetAccount = "ApierV2.SetAccount" - ApierV2CountCDRs = "ApierV2.CountCDRs" - ApierV2SetBalance = "ApierV2.SetBalance" + ApierV2 = "ApierV2" + ApierV2LoadTariffPlanFromFolder = "ApierV2.LoadTariffPlanFromFolder" + ApierV2GetCDRs = "ApierV2.GetCDRs" + ApierV2GetAccount = "ApierV2.GetAccount" + ApierV2GetAccounts = "ApierV2.GetAccounts" + ApierV2SetAccount = "ApierV2.SetAccount" + ApierV2CountCDRs = "ApierV2.CountCDRs" + ApierV2SetBalance = "ApierV2.SetBalance" + ApierV2SetActions = "ApierV2.SetActions" + ApierV2RemoveTPTiming = "ApierV2.RemoveTPTiming" + ApierV2GetTPDestination = "ApierV2.GetTPDestination" + ApierV2SetTPDestination = "ApierV2.SetTPDestination" + ApierV2RemoveTPDestination = "ApierV2.RemoveTPDestination" + ApierV2GetTPDestinationIDs = "ApierV2.GetTPDestinationIDs" + ApierV2GetTPTiming = "ApierV2.GetTPTiming" + ApierV2SetTPTiming = "ApierV2.SetTPTiming" + ApierV2SetAccountActionTriggers = "ApierV2.SetAccountActionTriggers" + ApierV2GetAccountActionTriggers = "ApierV2.GetAccountActionTriggers" + ApierV2SetActionPlan = "ApierV2.SetActionPlan" + ApierV2GetActions = "ApierV2.GetActions" + ApierV2GetDestinations = "ApierV2.GetDestinations" + ApierV2GetCacheStats = "ApierV2.GetCacheStats" + ApierV2ExecuteAction = "ApierV2.ExecuteAction" + ApierV2ResetAccountActionTriggers = "ApierV2.ResetAccountActionTriggers" + ApierV2RemoveActions = "ApierV2.RemoveActions" ) const ( @@ -1136,6 +1208,7 @@ const ( ResponderShutdown = "Responder.Shutdown" ResponderGetTimeout = "Responder.GetTimeout" ResponderPing = "Responder.Ping" + ResponderGet = "Responder.Get" ) // DispatcherS APIs @@ -1143,6 +1216,7 @@ const ( DispatcherSv1Ping = "DispatcherSv1.Ping" DispatcherSv1GetProfileForEvent = "DispatcherSv1.GetProfileForEvent" DispatcherSv1Apier = "DispatcherSv1.Apier" + DispatcherServicePing = "DispatcherService.Ping" ) // AnalyzerS APIs @@ -1188,17 +1262,21 @@ const ( // Cdrs APIs const ( - CDRsV1 = "CDRsV1" - CDRsV1CountCDRs = "CDRsV1.CountCDRs" - CDRsV1RateCDRs = "CDRsV1.RateCDRs" - CDRsV1GetCDRs = "CDRsV1.GetCDRs" - CDRsV1ProcessCDR = "CDRsV1.ProcessCDR" - CDRsV1ProcessExternalCDR = "CDRsV1.ProcessExternalCDR" - CDRsV1StoreSessionCost = "CDRsV1.StoreSessionCost" - CDRsV1ProcessEvent = "CDRsV1.ProcessEvent" - CDRsV1Ping = "CDRsV1.Ping" - CDRsV2 = "CDRsV2" - CDRsV2StoreSessionCost = "CDRsV2.StoreSessionCost" + CDRsV1 = "CDRsV1" + CDRsV1CountCDRs = "CDRsV1.CountCDRs" + CDRsV1RateCDRs = "CDRsV1.RateCDRs" + CDRsV1GetCDRs = "CDRsV1.GetCDRs" + CDRsV1ProcessCDR = "CDRsV1.ProcessCDR" + CDRsV1ProcessExternalCDR = "CDRsV1.ProcessExternalCDR" + CDRsV1StoreSessionCost = "CDRsV1.StoreSessionCost" + CDRsV1ProcessEvent = "CDRsV1.ProcessEvent" + CDRsV1Ping = "CDRsV1.Ping" + CDRsV2 = "CDRsV2" + CDRsV2StoreSessionCost = "CDRsV2.StoreSessionCost" + CdrsV2ProcessExternalCdr = "CdrsV2.ProcessExternalCdr" + CdrsV2ProcessCdr = "CdrsV2.ProcessCdr" + CDRStatsV1GetQueue = "CDRStatsV1.GetQueue" + SMGenericV2InitiateSession = "SMGenericV2.InitiateSession" ) // Scheduler