Fix Consistency problem between Rem and Remove* APIs

This commit is contained in:
TeoV
2019-04-11 14:14:43 +03:00
committed by Dan Christian Bogos
parent c3813ca3e0
commit aab1650916
48 changed files with 109 additions and 109 deletions

View File

@@ -82,7 +82,7 @@ func (self *ApierV1) GetAccountActionPlan(attrs AttrAcntAction, reply *[]*Accoun
return nil
}
type AttrRemActionTiming struct {
type AttrRemoveActionTiming struct {
ActionPlanId string // Id identifying the ActionTimings profile
ActionTimingId string // Internal CGR id identifying particular ActionTiming, *all for all user related ActionTimings to be canceled
Tenant string // Tenant the account belongs to
@@ -91,7 +91,7 @@ type AttrRemActionTiming struct {
}
// Removes an ActionTimings or parts of it depending on filters being set
func (self *ApierV1) RemActionTiming(attrs AttrRemActionTiming, reply *string) (err error) {
func (self *ApierV1) RemoveActionTiming(attrs AttrRemoveActionTiming, reply *string) (err error) {
if missing := utils.MissingStructFields(&attrs, []string{"ActionPlanId"}); len(missing) != 0 { // Only mandatory ActionPlanId
return utils.NewErrMandatoryIeMissing(missing...)
}

View File

@@ -166,10 +166,10 @@ func TestApierTPTiming(t *testing.T) {
t.Errorf("Calling ApierV1.GetTPTiming expected: %v, received: %v", tmAlways, rplyTmAlways2)
}
// Test remove
if err := rater.Call("ApierV1.RemTPTiming", AttrGetTPTiming{tmAlways2.TPid, tmAlways2.ID}, &reply); err != nil {
t.Error("Calling ApierV1.RemTPTiming, got error: ", err.Error())
if err := rater.Call("ApierV1.RemoveTPTiming", AttrGetTPTiming{tmAlways2.TPid, tmAlways2.ID}, &reply); err != nil {
t.Error("Calling ApierV1.RemoveTPTiming, got error: ", err.Error())
} else if reply != "OK" {
t.Error("Calling ApierV1.RemTPTiming received: ", reply)
t.Error("Calling ApierV1.RemoveTPTiming received: ", reply)
}
// Test getIds
var rplyTmIds []string
@@ -217,10 +217,10 @@ func TestApierTPDestination(t *testing.T) {
t.Errorf("Calling ApierV1.GetTPDestination expected: %v, received: %v", dstDe2, rplyDstDe2)
}
// Test remove
if err := rater.Call("ApierV1.RemTPDestination", AttrGetTPDestination{dstDe2.TPid, dstDe2.ID}, &reply); err != nil {
t.Error("Calling ApierV1.RemTPTiming, got error: ", err.Error())
if err := rater.Call("ApierV1.RemoveTPDestination", AttrGetTPDestination{dstDe2.TPid, dstDe2.ID}, &reply); err != nil {
t.Error("Calling ApierV1.RemoveTPTiming, got error: ", err.Error())
} else if reply != "OK" {
t.Error("Calling ApierV1.RemTPTiming received: ", reply)
t.Error("Calling ApierV1.RemoveTPTiming received: ", reply)
}
// Test getIds
var rplyDstIds []string
@@ -268,10 +268,10 @@ func TestApierTPRate(t *testing.T) {
t.Errorf("Calling ApierV1.GetTPRate expected: %+v, received: %+v", rt2, rplyRt2)
}
// Test remove
if err := rater.Call("ApierV1.RemTPRate", AttrGetTPRate{rt2.TPid, rt2.ID}, &reply); err != nil {
t.Error("Calling ApierV1.RemTPRate, got error: ", err.Error())
if err := rater.Call("ApierV1.RemoveTPRate", AttrGetTPRate{rt2.TPid, rt2.ID}, &reply); err != nil {
t.Error("Calling ApierV1.RemoveTPRate, got error: ", err.Error())
} else if reply != "OK" {
t.Error("Calling ApierV1.RemTPRate received: ", reply)
t.Error("Calling ApierV1.RemoveTPRate received: ", reply)
}
// Test getIds
var rplyRtIds []string
@@ -322,10 +322,10 @@ func TestApierTPDestinationRate(t *testing.T) {
t.Errorf("Calling ApierV1.GetTPDestinationRate expected: %v, received: %v", dr2, rplyDr2)
}
// Test remove
if err := rater.Call("ApierV1.RemTPDestinationRate", AttrGetTPDestinationRate{dr2.TPid, dr2.ID, utils.Paginator{}}, &reply); err != nil {
t.Error("Calling ApierV1.RemTPRate, got error: ", err.Error())
if err := rater.Call("ApierV1.RemoveTPDestinationRate", 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.RemTPRate received: ", reply)
t.Error("Calling ApierV1.RemoveTPRate received: ", reply)
}
// Test getIds
var rplyDrIds []string
@@ -373,10 +373,10 @@ func TestApierTPRatingPlan(t *testing.T) {
t.Errorf("Calling ApierV1.GetTPRatingPlan expected: %v, received: %v", rpTst, rplyRpTst)
}
// Test remove
if err := rater.Call("ApierV1.RemTPRatingPlan", AttrGetTPRatingPlan{TPid: rpTst.TPid, ID: rpTst.ID}, &reply); err != nil {
t.Error("Calling ApierV1.RemTPRatingPlan, got error: ", err.Error())
if err := rater.Call("ApierV1.RemoveTPRatingPlan", 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.RemTPRatingPlan received: ", reply)
t.Error("Calling ApierV1.RemoveTPRatingPlan received: ", reply)
}
// Test getIds
var rplyRpIds []string
@@ -426,10 +426,10 @@ func TestApierTPRatingProfile(t *testing.T) {
t.Errorf("Calling ApierV1.GetTPRatingProfiles expected: %v, received: %v", rpfTst, rplyRpf)
}
// Test remove
if err := rater.Call("ApierV1.RemTPRatingProfile", AttrGetTPRatingProfile{TPid: rpfTst.TPid, RatingProfileId: rpfTst.GetRatingProfilesId()}, &reply); err != nil {
t.Error("Calling ApierV1.RemTPRatingProfile, got error: ", err.Error())
if err := rater.Call("ApierV1.RemoveTPRatingProfile", AttrGetTPRatingProfile{TPid: rpfTst.TPid, RatingProfileId: rpfTst.GetRatingProfilesId()}, &reply); err != nil {
t.Error("Calling ApierV1.RemoveTPRatingProfile, got error: ", err.Error())
} else if reply != "OK" {
t.Error("Calling ApierV1.RemTPRatingProfile received: ", reply)
t.Error("Calling ApierV1.RemoveTPRatingProfile received: ", reply)
}
// Test getLoadIds
var rplyRpIds []string
@@ -485,10 +485,10 @@ func TestApierTPActions(t *testing.T) {
t.Errorf("Calling ApierV1.GetTPActions expected: %v, received: %v", actTst, rplyActs)
}
// Test remove
if err := rater.Call("ApierV1.RemTPActions", AttrGetTPActions{TPid: actTst.TPid, ID: actTst.ID}, &reply); err != nil {
t.Error("Calling ApierV1.RemTPActions, got error: ", err.Error())
if err := rater.Call("ApierV1.RemoveTPActions", 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.RemTPActions received: ", reply)
t.Error("Calling ApierV1.RemoveTPActions received: ", reply)
}
// Test getIds
var rplyIds []string
@@ -535,10 +535,10 @@ func TestApierTPActionPlan(t *testing.T) {
t.Errorf("Calling ApierV1.GetTPActionPlan expected: %v, received: %v", atTst, rplyActs)
}
// Test remove
if err := rater.Call("ApierV1.RemTPActionPlan", AttrGetTPActionPlan{TPid: atTst.TPid, ID: atTst.ID}, &reply); err != nil {
t.Error("Calling ApierV1.RemTPActionPlan, got error: ", err.Error())
if err := rater.Call("ApierV1.RemoveTPActionPlan", AttrGetTPActionPlan{TPid: atTst.TPid, ID: atTst.ID}, &reply); err != nil {
t.Error("Calling ApierV1.RemoveTPActionPlan, got error: ", err.Error())
} else if reply != "OK" {
t.Error("Calling ApierV1.RemTPActionPlan received: ", reply)
t.Error("Calling ApierV1.RemoveTPActionPlan received: ", reply)
}
// Test getIds
var rplyIds []string
@@ -591,10 +591,10 @@ func TestApierTPActionTriggers(t *testing.T) {
t.Errorf("Calling ApierV1.GetTPActionTriggers expected: %+v, received: %+v", atTst.ActionTriggers[0], rplyActs.ActionTriggers[0])
}
// Test remove
if err := rater.Call("ApierV1.RemTPActionTriggers", AttrGetTPActionTriggers{TPid: atTst.TPid, ID: atTst.ID}, &reply); err != nil {
t.Error("Calling ApierV1.RemTPActionTriggers, got error: ", err.Error())
if err := rater.Call("ApierV1.RemoveTPActionTriggers", AttrGetTPActionTriggers{TPid: atTst.TPid, ID: atTst.ID}, &reply); err != nil {
t.Error("Calling ApierV1.RemoveTPActionTriggers, got error: ", err.Error())
} else if reply != "OK" {
t.Error("Calling ApierV1.RemTPActionTriggers received: ", reply)
t.Error("Calling ApierV1.RemoveTPActionTriggers received: ", reply)
}
// Test getIds
var rplyIds []string
@@ -649,10 +649,10 @@ func TestApierTPAccountActions(t *testing.T) {
t.Errorf("Calling ApierV1.GetTPAccountActions expected: %v, received: %v", aaTst, rplyaa)
}
// Test remove
if err := rater.Call("ApierV1.RemTPAccountActions", AttrGetTPAccountActions{TPid: aaTst.TPid, AccountActionsId: aaTst.GetId()}, &reply); err != nil {
t.Error("Calling ApierV1.RemTPAccountActions, got error: ", err.Error())
if err := rater.Call("ApierV1.RemoveTPAccountActions", AttrGetTPAccountActions{TPid: aaTst.TPid, AccountActionsId: aaTst.GetId()}, &reply); err != nil {
t.Error("Calling ApierV1.RemoveTPAccountActions, got error: ", err.Error())
} else if reply != "OK" {
t.Error("Calling ApierV1.RemTPAccountActions received: ", reply)
t.Error("Calling ApierV1.RemoveTPAccountActions received: ", reply)
}
// Test getLoadIds
var rplyRpIds []string
@@ -1176,9 +1176,9 @@ func TestApierITGetScheduledActionsForAccount(t *testing.T) {
// Test here RemoveActionTiming
func TestApierRemUniqueIDActionTiming(t *testing.T) {
var rmReply string
rmReq := AttrRemActionTiming{ActionPlanId: "ATMS_1", Tenant: "cgrates.org", Account: "dan4"}
if err := rater.Call("ApierV1.RemActionTiming", rmReq, &rmReply); err != nil {
t.Error("Got error on ApierV1.RemActionTiming: ", err.Error())
rmReq := AttrRemoveActionTiming{ActionPlanId: "ATMS_1", Tenant: "cgrates.org", Account: "dan4"}
if err := rater.Call("ApierV1.RemoveActionTiming", rmReq, &rmReply); err != nil {
t.Error("Got error on ApierV1.RemoveActionTiming: ", err.Error())
} else if rmReply != OK {
t.Error("Unexpected answer received", rmReply)
}

View File

@@ -666,13 +666,13 @@ func testV1FIdxRemoveStatQueueProfile(t *testing.T) {
if result != utils.OK {
t.Errorf("Error: %+v", result)
}
if err := tFIdxRpc.Call("ApierV1.RemStatQueueProfile",
if err := tFIdxRpc.Call("ApierV1.RemoveStatQueueProfile",
&utils.TenantID{Tenant: tenant, ID: "TEST_PROFILE1"}, &result); err != nil {
t.Error(err)
} else if result != utils.OK {
t.Error("Unexpected reply returned", result)
}
if err := tFIdxRpc.Call("ApierV1.RemStatQueueProfile",
if err := tFIdxRpc.Call("ApierV1.RemoveStatQueueProfile",
&utils.TenantID{Tenant: tenant, ID: "TEST_PROFILE2"}, &result); err != nil {
t.Error(err)
} else if result != utils.OK {

View File

@@ -791,7 +791,7 @@ func testV1FIdxCaRemoveStatQueueProfile(t *testing.T) {
}
var result string
//Remove threshold profile that was set form api
if err := tFIdxCaRpc.Call("ApierV1.RemStatQueueProfile",
if err := tFIdxCaRpc.Call("ApierV1.RemoveStatQueueProfile",
&utils.TenantID{Tenant: "cgrates.org", ID: "TEST_PROFILE1"}, &result); err != nil {
t.Error(err)
} else if result != utils.OK {
@@ -805,7 +805,7 @@ func testV1FIdxCaRemoveStatQueueProfile(t *testing.T) {
t.Error(err)
}
//Remove threshold profile that was set form tariffplan
if err := tFIdxCaRpc.Call("ApierV1.RemStatQueueProfile",
if err := tFIdxCaRpc.Call("ApierV1.RemoveStatQueueProfile",
&utils.TenantID{Tenant: "cgrates.org", ID: "Stats1"}, &result); err != nil {
t.Error(err)
} else if result != utils.OK {

View File

@@ -110,7 +110,7 @@ func (apierV1 *ApierV1) SetStatQueueProfile(arg *StatQueueWithCache, reply *stri
}
// Remove a specific stat configuration
func (apierV1 *ApierV1) RemStatQueueProfile(args *utils.TenantIDWithCache, reply *string) error {
func (apierV1 *ApierV1) RemoveStatQueueProfile(args *utils.TenantIDWithCache, reply *string) error {
if missing := utils.MissingStructFields(args, []string{"Tenant", "ID"}); len(missing) != 0 { //Params missing
return utils.NewErrMandatoryIeMissing(missing...)
}

View File

@@ -402,7 +402,7 @@ func testV1STSUpdateStatQueueProfile(t *testing.T) {
func testV1STSRemoveStatQueueProfile(t *testing.T) {
var resp string
if err := stsV1Rpc.Call("ApierV1.RemStatQueueProfile",
if err := stsV1Rpc.Call("ApierV1.RemoveStatQueueProfile",
&utils.TenantID{Tenant: "cgrates.org", ID: "TEST_PROFILE1"}, &resp); err != nil {
t.Error(err)
} else if resp != utils.OK {
@@ -413,7 +413,7 @@ func testV1STSRemoveStatQueueProfile(t *testing.T) {
&utils.TenantID{Tenant: "cgrates.org", ID: "TEST_PROFILE1"}, &sqp); err == nil || err.Error() != utils.ErrNotFound.Error() {
t.Error(err)
}
if err := stsV1Rpc.Call("ApierV1.RemStatQueueProfile",
if err := stsV1Rpc.Call("ApierV1.RemoveStatQueueProfile",
&utils.TenantID{Tenant: "cgrates.org", ID: "TEST_PROFILE1"}, &resp); err.Error() != utils.ErrNotFound.Error() {
t.Errorf("Expected error: %v recived: %v", utils.ErrNotFound, err)
}

View File

@@ -126,7 +126,7 @@ func (self *ApierV1) GetTPAccountActionIds(attrs AttrGetTPAccountActionIds, repl
}
// Removes specific AccountActions on Tariff plan
func (self *ApierV1) RemTPAccountActions(attrs AttrGetTPAccountActions, reply *string) error {
func (self *ApierV1) RemoveTPAccountActions(attrs AttrGetTPAccountActions, reply *string) error {
if missing := utils.MissingStructFields(&attrs, []string{"TPid", "LoadId", "Tenant", "Account"}); len(missing) != 0 { //Params missing
return utils.NewErrMandatoryIeMissing(missing...)
}

View File

@@ -213,7 +213,7 @@ func testTPAccActionsGetTPAccActionAfterUpdate(t *testing.T) {
func testTPAccActionsRemTPAccAction(t *testing.T) {
var resp string
if err := tpAccActionsRPC.Call("ApierV1.RemTPAccountActions",
if err := tpAccActionsRPC.Call("ApierV1.RemoveTPAccountActions",
&AttrGetTPAccountActions{TPid: "TPAcc", AccountActionsId: tpAccActionID}, &resp); err != nil {
t.Error(err)
} else if resp != utils.OK {

View File

@@ -85,7 +85,7 @@ func (self *ApierV1) GetTPActionPlanIds(attrs AttrGetTPActionPlanIds, reply *[]s
}
// Removes specific ActionPlan on Tariff plan
func (self *ApierV1) RemTPActionPlan(attrs AttrGetTPActionPlan, reply *string) error {
func (self *ApierV1) RemoveTPActionPlan(attrs AttrGetTPActionPlan, reply *string) error {
if missing := utils.MissingStructFields(&attrs, []string{"TPid", "ID"}); len(missing) != 0 { //Params missing
return utils.NewErrMandatoryIeMissing(missing...)
}

View File

@@ -224,7 +224,7 @@ func testTPAccPlansGetTPAccPlanAfterUpdate(t *testing.T) {
func testTPAccPlansRemTPAccPlan(t *testing.T) {
var resp string
if err := tpAccPlansRPC.Call("ApierV1.RemTPActionPlan",
if err := tpAccPlansRPC.Call("ApierV1.RemoveTPActionPlan",
&AttrGetTPActionPlan{TPid: "TPAcc", ID: "ID"}, &resp); err != nil {
t.Error(err)
} else if resp != utils.OK {

View File

@@ -77,7 +77,7 @@ func (self *ApierV1) GetTPActionIds(attrs AttrGetTPActionIds, reply *[]string) e
}
// Removes specific Actions on Tariff plan
func (self *ApierV1) RemTPActions(attrs AttrGetTPActions, reply *string) error {
func (self *ApierV1) RemoveTPActions(attrs AttrGetTPActions, reply *string) error {
if missing := utils.MissingStructFields(&attrs, []string{"TPid", "ID"}); len(missing) != 0 { //Params missing
return utils.NewErrMandatoryIeMissing(missing...)
}

View File

@@ -293,7 +293,7 @@ func testTPActionsGetTPActionAfterUpdate(t *testing.T) {
func testTPActionsRemTPAction(t *testing.T) {
var resp string
if err := tpActionRPC.Call("ApierV1.RemTPActions",
if err := tpActionRPC.Call("ApierV1.RemoveTPActions",
&AttrGetTPActions{TPid: "TPAcc", ID: "ID"}, &resp); err != nil {
t.Error(err)
} else if resp != utils.OK {

View File

@@ -77,7 +77,7 @@ func (self *ApierV1) GetTPActionTriggerIds(attrs AttrGetTPActionTriggerIds, repl
}
// Removes specific ActionTriggers on Tariff plan
func (self *ApierV1) RemTPActionTriggers(attrs AttrGetTPActionTriggers, reply *string) error {
func (self *ApierV1) RemoveTPActionTriggers(attrs AttrGetTPActionTriggers, reply *string) error {
if missing := utils.MissingStructFields(&attrs, []string{"TPid", "ID"}); len(missing) != 0 { //Params missing
return utils.NewErrMandatoryIeMissing(missing...)
}

View File

@@ -54,7 +54,7 @@ var sTestsTPActionTriggers = []func(t *testing.T){
testTPActionTriggersGetTPActionTriggersIds,
testTPActionTriggersUpdateTPActionTriggers,
testTPActionTriggersGetTPActionTriggersAfterUpdate,
testTPActionTriggersRemTPActionTriggers,
testTPActionTriggersRemoveTPActionTriggers,
testTPActionTriggersGetTPActionTriggersAfterRemove,
testTPActionTriggersKillEngine,
}
@@ -312,9 +312,9 @@ func testTPActionTriggersGetTPActionTriggersAfterUpdate(t *testing.T) {
}
func testTPActionTriggersRemTPActionTriggers(t *testing.T) {
func testTPActionTriggersRemoveTPActionTriggers(t *testing.T) {
var resp string
if err := tpActionTriggerRPC.Call("ApierV1.RemTPActionTriggers",
if err := tpActionTriggerRPC.Call("ApierV1.RemoveTPActionTriggers",
&AttrGetTPActionTriggers{TPid: "TPAct", ID: "ID"}, &resp); err != nil {
t.Error(err)
} else if resp != utils.OK {

View File

@@ -71,7 +71,7 @@ func (self *ApierV1) GetTPAttributeProfileIds(attrs *AttrGetTPAttributeProfileId
}
// Removes specific AttributeProfile on Tariff plan
func (self *ApierV1) RemTPAttributeProfile(attrs *utils.TPTntID, reply *string) error {
func (self *ApierV1) RemoveTPAttributeProfile(attrs *utils.TPTntID, reply *string) error {
if missing := utils.MissingStructFields(attrs, []string{"TPid", "Tenant", "ID"}); len(missing) != 0 { //Params missing
return utils.NewErrMandatoryIeMissing(missing...)
}

View File

@@ -236,7 +236,7 @@ func testTPAlsPrfGetTPAlsPrfAfterUpdate(t *testing.T) {
func testTPAlsPrfRemTPAlsPrf(t *testing.T) {
var resp string
if err := tpAlsPrfRPC.Call("ApierV1.RemTPAttributeProfile",
if err := tpAlsPrfRPC.Call("ApierV1.RemoveTPAttributeProfile",
&utils.TPTntID{TPid: "TP1", Tenant: "cgrates.org", ID: "Attr1"},
&resp); err != nil {
t.Error(err)

View File

@@ -73,7 +73,7 @@ func (self *ApierV1) GetTPChargerIDs(attrs *AttrGetTPChargerIds, reply *[]string
}
// Removes specific ChargerProfile on Tariff plan
func (self *ApierV1) RemTPCharger(attrs *utils.TPTntID, reply *string) error {
func (self *ApierV1) RemoveTPCharger(attrs *utils.TPTntID, reply *string) error {
if missing := utils.MissingStructFields(attrs, []string{"TPid", "Tenant", "ID"}); len(missing) != 0 { //Params missing
return utils.NewErrMandatoryIeMissing(missing...)
}

View File

@@ -192,7 +192,7 @@ func testTPChrgsGetTPChrgsAfterUpdate(t *testing.T) {
func testTPChrgsRemTPChrgs(t *testing.T) {
var resp string
if err := tpChrgsRPC.Call("ApierV1.RemTPCharger",
if err := tpChrgsRPC.Call("ApierV1.RemoveTPCharger",
&utils.TPTntID{TPid: "TP1", Tenant: "cgrates.org", ID: "Chrgs"},
&resp); err != nil {
t.Error(err)

View File

@@ -80,7 +80,7 @@ func (self *ApierV1) GetTPDestinationRateIds(attrs AttrGetTPRateIds, reply *[]st
}
// Removes specific DestinationRate on Tariff plan
func (self *ApierV1) RemTPDestinationRate(attrs AttrGetTPDestinationRate, reply *string) error {
func (self *ApierV1) RemoveTPDestinationRate(attrs AttrGetTPDestinationRate, reply *string) error {
if missing := utils.MissingStructFields(&attrs, []string{"TPid", "ID"}); len(missing) != 0 { //Params missing
return utils.NewErrMandatoryIeMissing(missing...)
}

View File

@@ -183,7 +183,7 @@ func testTPDstRateGetTPDstRateAfterUpdate(t *testing.T) {
func testTPDstRateRemTPDstRate(t *testing.T) {
var resp string
if err := tpDstRateRPC.Call("ApierV1.RemTPDestinationRate",
if err := tpDstRateRPC.Call("ApierV1.RemoveTPDestinationRate",
&AttrGetTPDestinationRate{TPid: "TP1", ID: "DR_FREESWITCH_USERS"}, &resp); err != nil {
t.Error(err)
} else if resp != utils.OK {

View File

@@ -77,7 +77,7 @@ func (self *ApierV1) GetTPDestinationIDs(attrs AttrGetTPDestinationIds, reply *[
}
// Removes specific Destination on Tariff plan
func (self *ApierV1) RemTPDestination(attrs AttrGetTPDestination, reply *string) error {
func (self *ApierV1) RemoveTPDestination(attrs AttrGetTPDestination, reply *string) error {
if missing := utils.MissingStructFields(&attrs, []string{"TPid", "ID"}); len(missing) != 0 { //Params missing
return utils.NewErrMandatoryIeMissing(missing...)
}

View File

@@ -53,7 +53,7 @@ var sTestsTPDestinations = []func(t *testing.T){
testTPDestinationsGetTPDestinationIds,
testTPDestinationsUpdateTPDestination,
testTPDestinationsGetTPDestinationAfterUpdate,
testTPDestinationsRemTPDestination,
testTPDestinationsRemoveTPDestination,
testTPDestinationsGetTPDestinationAfterRemove,
testTPDestinationsKillEngine,
}
@@ -196,9 +196,9 @@ func testTPDestinationsGetTPDestinationAfterUpdate(t *testing.T) {
}
func testTPDestinationsRemTPDestination(t *testing.T) {
func testTPDestinationsRemoveTPDestination(t *testing.T) {
var resp string
if err := tpDestinationRPC.Call("ApierV1.RemTPDestination",
if err := tpDestinationRPC.Call("ApierV1.RemoveTPDestination",
&AttrGetTPDestination{TPid: "TPD", ID: "GERMANY"}, &resp); err != nil {
t.Error(err)
} else if resp != utils.OK {

View File

@@ -72,8 +72,8 @@ func (self *ApierV1) GetTPDispatcherProfileIDs(attrs *AttrGetTPDispatcherIds, re
return nil
}
//RemTPCharger removes specific DispatcherProfile on Tariff plan
func (self *ApierV1) RemTPDispatcherProfile(attrs *utils.TPTntID, reply *string) error {
//RemoveTPCharger removes specific DispatcherProfile on Tariff plan
func (self *ApierV1) RemoveTPDispatcherProfile(attrs *utils.TPTntID, reply *string) error {
if missing := utils.MissingStructFields(attrs, []string{"TPid", "Tenant", "ID"}); len(missing) != 0 { //Params missing
return utils.NewErrMandatoryIeMissing(missing...)
}
@@ -131,8 +131,8 @@ func (self *ApierV1) GetTPDispatcherHostIDs(attrs *AttrGetTPDispatcherIds, reply
return nil
}
//RemTPDispatcherHost removes specific DispatcherHost on Tariff plan
func (self *ApierV1) RemTPDispatcherHost(attrs *utils.TPTntID, reply *string) error {
//RemoveTPDispatcherHost removes specific DispatcherHost on Tariff plan
func (self *ApierV1) RemoveTPDispatcherHost(attrs *utils.TPTntID, reply *string) error {
if missing := utils.MissingStructFields(attrs, []string{"TPid", "Tenant", "ID"}); len(missing) != 0 { //Params missing
return utils.NewErrMandatoryIeMissing(missing...)
}

View File

@@ -194,7 +194,7 @@ func testTPDispatcherGetTPDispatcherAfterUpdate(t *testing.T) {
func testTPDispatcherRemTPDispatcher(t *testing.T) {
var resp string
if err := tpDispatcherRPC.Call("ApierV1.RemTPDispatcherProfile",
if err := tpDispatcherRPC.Call("ApierV1.RemoveTPDispatcherProfile",
&utils.TPTntID{TPid: "TP1", Tenant: "cgrates.org", ID: "Dsp1"}, &resp); err != nil {
t.Error(err)
} else if resp != utils.OK {

View File

@@ -73,7 +73,7 @@ func (self *ApierV1) GetTPFilterProfileIds(attrs *AttrGetTPFilterProfileIds, rep
}
// Removes specific FilterProfile on Tariff plan
func (self *ApierV1) RemTPFilterProfile(attrs *utils.TPTntID, reply *string) error {
func (self *ApierV1) RemoveTPFilterProfile(attrs *utils.TPTntID, reply *string) error {
if missing := utils.MissingStructFields(attrs, []string{"TPid", "Tenant", "ID"}); len(missing) != 0 { //Params missing
return utils.NewErrMandatoryIeMissing(missing...)
}

View File

@@ -221,7 +221,7 @@ func testTPFilterGetTPFilterAfterUpdate(t *testing.T) {
func testTPFilterRemTPFilter(t *testing.T) {
var resp string
if err := tpFilterRPC.Call("ApierV1.RemTPFilterProfile",
if err := tpFilterRPC.Call("ApierV1.RemoveTPFilterProfile",
&utils.TPTntID{TPid: "TP1", Tenant: "cgrates.org", ID: "Filter"}, &resp); err != nil {
t.Error(err)
} else if resp != utils.OK {

View File

@@ -79,7 +79,7 @@ func (self *ApierV1) GetTPRateIds(attrs AttrGetTPRateIds, reply *[]string) error
}
// Removes specific Rate on Tariff plan
func (self *ApierV1) RemTPRate(attrs AttrGetTPRate, reply *string) error {
func (self *ApierV1) RemoveTPRate(attrs AttrGetTPRate, reply *string) error {
if missing := utils.MissingStructFields(&attrs, []string{"TPid", "ID"}); len(missing) != 0 { //Params missing
return utils.NewErrMandatoryIeMissing(missing...)
}

View File

@@ -53,7 +53,7 @@ var sTestsTPRates = []func(t *testing.T){
testTPRatesGetTPRateIds,
testTPRatesUpdateTPRate,
testTPRatesGetTPRateAfterUpdate,
testTPRatesRemTPRate,
testTPRatesRemoveTPRate,
testTPRatesGetTPRateAfterRemove,
testTPRatesKillEngine,
}
@@ -219,9 +219,9 @@ func testTPRatesGetTPRateAfterUpdate(t *testing.T) {
}
func testTPRatesRemTPRate(t *testing.T) {
func testTPRatesRemoveTPRate(t *testing.T) {
var resp string
if err := tpRateRPC.Call("ApierV1.RemTPRate",
if err := tpRateRPC.Call("ApierV1.RemoveTPRate",
&AttrGetTPRate{TPid: "TPidTpRate", ID: "RT_FS_USERS"}, &resp); err != nil {
t.Error(err)
} else if resp != utils.OK {

View File

@@ -80,7 +80,7 @@ func (self *ApierV1) GetTPRatingPlanIds(attrs AttrGetTPRatingPlanIds, reply *[]s
}
// Removes specific RatingPlan on Tariff plan
func (self *ApierV1) RemTPRatingPlan(attrs AttrGetTPRatingPlan, reply *string) error {
func (self *ApierV1) RemoveTPRatingPlan(attrs AttrGetTPRatingPlan, reply *string) error {
if missing := utils.MissingStructFields(&attrs, []string{"TPid", "ID"}); len(missing) != 0 { //Params missing
return utils.NewErrMandatoryIeMissing(missing...)
}

View File

@@ -53,7 +53,7 @@ var sTestsTPRatingPlans = []func(t *testing.T){
testTPRatingPlansGetTPRatingPlanIds,
testTPRatingPlansUpdateTPRatingPlan,
testTPRatingPlansGetTPRatingPlanAfterUpdate,
testTPRatingPlansRemTPRatingPlan,
testTPRatingPlansRemoveTPRatingPlan,
testTPRatingPlansGetTPRatingPlanAfterRemove,
testTPRatingPlansKillEngine,
}
@@ -218,9 +218,9 @@ func testTPRatingPlansGetTPRatingPlanAfterUpdate(t *testing.T) {
}
}
func testTPRatingPlansRemTPRatingPlan(t *testing.T) {
func testTPRatingPlansRemoveTPRatingPlan(t *testing.T) {
var resp string
if err := tpRatingPlanRPC.Call("ApierV1.RemTPRatingPlan",
if err := tpRatingPlanRPC.Call("ApierV1.RemoveTPRatingPlan",
&AttrGetTPRatingPlan{TPid: "TPRP1", ID: "Plan1"}, &resp); err != nil {
t.Error(err)
} else if resp != utils.OK {

View File

@@ -133,7 +133,7 @@ func (self *ApierV1) GetTPRatingProfileIds(attrs AttrGetTPRatingProfileIds, repl
}
// Removes specific RatingProfiles on Tariff plan
func (self *ApierV1) RemTPRatingProfile(attrs AttrGetTPRatingProfile, reply *string) error {
func (self *ApierV1) RemoveTPRatingProfile(attrs AttrGetTPRatingProfile, reply *string) error {
if missing := utils.MissingStructFields(&attrs, []string{"TPid", "RatingProfileId"}); len(missing) != 0 { //Params missing
return utils.NewErrMandatoryIeMissing(missing...)
}

View File

@@ -56,7 +56,7 @@ var sTestsTPRatingProfiles = []func(t *testing.T){
testTPRatingProfilesUpdateTPRatingProfile,
testTPRatingProfilesGetTPRatingProfileAfterUpdate,
testTPRatingProfilesGetTPRatingProfileIds,
testTPRatingProfilesRemTPRatingProfile,
testTPRatingProfilesRemoveTPRatingProfile,
testTPRatingProfilesGetTPRatingProfileAfterRemove,
testTPRatingProfilesKillEngine,
}
@@ -268,9 +268,9 @@ func testTPRatingProfilesGetTPRatingProfileIds(t *testing.T) {
}
}
func testTPRatingProfilesRemTPRatingProfile(t *testing.T) {
func testTPRatingProfilesRemoveTPRatingProfile(t *testing.T) {
var resp string
if err := tpRatingProfileRPC.Call("ApierV1.RemTPRatingProfile",
if err := tpRatingProfileRPC.Call("ApierV1.RemoveTPRatingProfile",
&AttrGetTPRatingProfile{TPid: "TPRProf1", RatingProfileId: tpRatingProfile.GetRatingProfilesId()}, &resp); err != nil {
t.Error(err)
} else if resp != utils.OK {

View File

@@ -72,7 +72,7 @@ func (self *ApierV1) GetTPResourceIDs(attrs *AttrGetTPResourceIds, reply *[]stri
}
// Removes specific Resource on Tariff plan
func (self *ApierV1) RemTPResource(attrs *utils.TPTntID, reply *string) error {
func (self *ApierV1) RemoveTPResource(attrs *utils.TPTntID, reply *string) error {
if missing := utils.MissingStructFields(attrs, []string{"TPid", "Tenant", "ID"}); len(missing) != 0 { //Params missing
return utils.NewErrMandatoryIeMissing(missing...)
}

View File

@@ -53,7 +53,7 @@ var sTestsTPResources = []func(t *testing.T){
testTPResGetTPResourceAfterSet,
testTPResUpdateTPResource,
testTPResGetTPResourceAfterUpdate,
testTPResRemTPResource,
testTPResRemoveTPResource,
testTPResGetTPResourceAfterRemove,
testTPResKillEngine,
}
@@ -187,9 +187,9 @@ func testTPResGetTPResourceAfterUpdate(t *testing.T) {
}
}
func testTPResRemTPResource(t *testing.T) {
func testTPResRemoveTPResource(t *testing.T) {
var resp string
if err := tpResRPC.Call("ApierV1.RemTPResource", &utils.TPTntID{TPid: "TPR1", Tenant: "cgrates.org", ID: "ResGroup1"},
if err := tpResRPC.Call("ApierV1.RemoveTPResource", &utils.TPTntID{TPid: "TPR1", Tenant: "cgrates.org", ID: "ResGroup1"},
&resp); err != nil {
t.Error(err)
} else if resp != utils.OK {

View File

@@ -77,7 +77,7 @@ func (self *ApierV1) GetTPSharedGroupIds(attrs AttrGetTPSharedGroupIds, reply *[
}
// Removes specific SharedGroups on Tariff plan
func (self *ApierV1) RemTPSharedGroups(attrs AttrGetTPSharedGroups, reply *string) error {
func (self *ApierV1) RemoveTPSharedGroups(attrs AttrGetTPSharedGroups, reply *string) error {
if missing := utils.MissingStructFields(&attrs, []string{"TPid", "ID"}); len(missing) != 0 { //Params missing
return utils.NewErrMandatoryIeMissing(missing...)
}

View File

@@ -53,7 +53,7 @@ var sTestsTPSharedGroups = []func(t *testing.T){
testTPSharedGroupsGetTPSharedGroupIds,
testTPSharedGroupsUpdateTPShareGroups,
testTpSharedGroupsGetTPSharedGroupsAfterUpdate,
testTPSharedGroupsRemTPSharedGroups,
testTPSharedGroupsRemoveTPSharedGroups,
testTPSharedGroupsGetTPSharedGroupsAfterRemove,
testTPSharedGroupsKillEngine,
}
@@ -214,9 +214,9 @@ func testTpSharedGroupsGetTPSharedGroupsAfterUpdate(t *testing.T) {
}
}
func testTPSharedGroupsRemTPSharedGroups(t *testing.T) {
func testTPSharedGroupsRemoveTPSharedGroups(t *testing.T) {
var resp string
if err := tpSharedGroupRPC.Call("ApierV1.RemTPSharedGroups", &AttrGetTPSharedGroups{TPid: tpSharedGroups.TPid, ID: tpSharedGroups.ID}, &resp); err != nil {
if err := tpSharedGroupRPC.Call("ApierV1.RemoveTPSharedGroups", &AttrGetTPSharedGroups{TPid: tpSharedGroups.TPid, ID: tpSharedGroups.ID}, &resp); err != nil {
t.Error(err)
} else if resp != utils.OK {
t.Error("Unexpected reply returned", resp)

View File

@@ -74,7 +74,7 @@ func (self *ApierV1) GetTPStatIDs(attrs *AttrGetTPStatIds, reply *[]string) erro
}
// Removes specific Stat on Tariff plan
func (self *ApierV1) RemTPStat(attrs *utils.TPTntID, reply *string) error {
func (self *ApierV1) RemoveTPStat(attrs *utils.TPTntID, reply *string) error {
if missing := utils.MissingStructFields(attrs, []string{"TPid", "Tenant", "ID"}); len(missing) != 0 { //Params missing
return utils.NewErrMandatoryIeMissing(missing...)
}

View File

@@ -54,7 +54,7 @@ var sTestsTPStats = []func(t *testing.T){
testTPStatsGetTPStatAfterSet,
testTPStatsUpdateTPStat,
testTPStatsGetTPStatAfterUpdate,
testTPStatsRemTPStat,
testTPStatsRemoveTPStat,
testTPStatsGetTPStatAfterRemove,
testTPStatsKillEngine,
}
@@ -204,9 +204,9 @@ func testTPStatsGetTPStatAfterUpdate(t *testing.T) {
}
}
func testTPStatsRemTPStat(t *testing.T) {
func testTPStatsRemoveTPStat(t *testing.T) {
var resp string
if err := tpStatRPC.Call("ApierV1.RemTPStat",
if err := tpStatRPC.Call("ApierV1.RemoveTPStat",
&utils.TPTntID{TPid: "TPS1", Tenant: "cgrates.org", ID: "Stat1"}, &resp); err != nil {
t.Error(err)
} else if resp != utils.OK {

View File

@@ -73,7 +73,7 @@ func (self *ApierV1) GetTPSupplierProfileIDs(attrs *AttrGetTPSupplierProfileIDs,
}
// Removes specific SupplierProfile on Tariff plan
func (self *ApierV1) RemTPSupplierProfile(attrs *utils.TPTntID, reply *string) error {
func (self *ApierV1) RemoveTPSupplierProfile(attrs *utils.TPTntID, reply *string) error {
if missing := utils.MissingStructFields(attrs, []string{"TPid", "Tenant", "ID"}); len(missing) != 0 { //Params missing
return utils.NewErrMandatoryIeMissing(missing...)
}

View File

@@ -235,7 +235,7 @@ func testTPSplPrfGetTPSplPrfAfterUpdate(t *testing.T) {
func testTPSplPrfRemTPSplPrf(t *testing.T) {
var resp string
if err := tpSplPrfRPC.Call("ApierV1.RemTPSupplierProfile",
if err := tpSplPrfRPC.Call("ApierV1.RemoveTPSupplierProfile",
&utils.TPTntID{TPid: "TP1", Tenant: "cgrates.org", ID: "SUPL_1"},
&resp); err != nil {
t.Error(err)

View File

@@ -73,7 +73,7 @@ func (self *ApierV1) GetTPThresholdIDs(attrs *AttrGetTPThresholdIds, reply *[]st
}
// Removes specific Threshold on Tariff plan
func (self *ApierV1) RemTPThreshold(attrs *utils.TPTntID, reply *string) error {
func (self *ApierV1) RemoveTPThreshold(attrs *utils.TPTntID, reply *string) error {
if missing := utils.MissingStructFields(attrs, []string{"TPid", "Tenant", "ID"}); len(missing) != 0 { //Params missing
return utils.NewErrMandatoryIeMissing(missing...)
}

View File

@@ -201,7 +201,7 @@ func testTPThreholdGetTPThreholdAfterUpdate(t *testing.T) {
func testTPThreholdRemTPThrehold(t *testing.T) {
var resp string
if err := tpThresholdRPC.Call("ApierV1.RemTPThreshold",
if err := tpThresholdRPC.Call("ApierV1.RemoveTPThreshold",
&utils.TPTntID{TPid: "TH1", Tenant: "cgrates.org", ID: "Threshold"}, &resp); err != nil {
t.Error(err)
} else if resp != utils.OK {

View File

@@ -77,7 +77,7 @@ func (self *ApierV1) GetTPTimingIds(attrs AttrGetTPTimingIds, reply *[]string) e
}
// Removes specific Timing on Tariff plan
func (self *ApierV1) RemTPTiming(attrs AttrGetTPTiming, reply *string) error {
func (self *ApierV1) RemoveTPTiming(attrs AttrGetTPTiming, reply *string) error {
if missing := utils.MissingStructFields(&attrs, []string{"TPid", "ID"}); len(missing) != 0 { //Params missing
return utils.NewErrMandatoryIeMissing(missing...)
}

View File

@@ -53,7 +53,7 @@ var sTestsTPTiming = []func(t *testing.T){
testTPTimingsGetTPTimingIds,
testTPTimingsUpdateTPTiming,
testTPTimingsGetTPTimingAfterUpdate,
testTPTimingsRemTPTiming,
testTPTimingsRemoveTPTiming,
testTPTimingsGetTPTimingAfterRemove,
testTPTimingsKillEngine,
}
@@ -183,9 +183,9 @@ func testTPTimingsGetTPTimingAfterUpdate(t *testing.T) {
}
}
func testTPTimingsRemTPTiming(t *testing.T) {
func testTPTimingsRemoveTPTiming(t *testing.T) {
var resp string
if err := tpTimingRPC.Call("ApierV1.RemTPTiming", &AttrGetTPTiming{TPid: tpTiming.TPid, ID: tpTiming.ID}, &resp); err != nil {
if err := tpTimingRPC.Call("ApierV1.RemoveTPTiming", &AttrGetTPTiming{TPid: tpTiming.TPid, ID: tpTiming.ID}, &resp); err != nil {
t.Error(err)
} else if resp != utils.OK {
t.Error("Unexpected reply returned", resp)

View File

@@ -197,10 +197,10 @@ func testTPitTimings(t *testing.T) {
t.Errorf("Calling ApierV1.GetTPTimingIds expected: %v, received: %v", expectedTmIDs, rplyTmIDs)
}
// Test remove
if err := tpRPC.Call("ApierV2.RemTPTiming", v1.AttrGetTPTiming{tmDummyRemove.TPid, tmDummyRemove.ID}, &reply); err != nil {
t.Error("Calling ApierV2.RemTPTiming, got error: ", err.Error())
if err := tpRPC.Call("ApierV2.RemoveTPTiming", 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.RemTPTiming received: ", reply)
t.Error("Calling ApierV2.RemoveTPTiming received: ", reply)
}
// Test getIds
rplyTmIDs = []string{}
@@ -242,7 +242,7 @@ func testTPitDestinations(t *testing.T) {
t.Errorf("Calling ApierV2.GetTPDestination expected: %v, received: %v", dstDEMobile, rplyDst)
}
// Test remove
if err := tpRPC.Call("ApierV2.RemTPDestination", AttrGetTPDestination{testTPid, dstDUMMY.ID}, &reply); err != nil {
if err := tpRPC.Call("ApierV2.RemoveTPDestination", AttrGetTPDestination{testTPid, dstDUMMY.ID}, &reply); err != nil {
t.Error(err)
} else if reply != utils.OK {
t.Error("Received: ", reply)

View File

@@ -54,7 +54,7 @@ func (self *ApierV2) GetTPDestination(attrs AttrGetTPDestination, reply *utils.T
return nil
}
func (self *ApierV2) RemTPDestination(attrs AttrGetTPDestination, reply *string) error {
func (self *ApierV2) RemoveTPDestination(attrs AttrGetTPDestination, reply *string) error {
if missing := utils.MissingStructFields(&attrs, []string{"TPid", "Tag"}); len(missing) != 0 { //Params missing
return utils.NewErrMandatoryIeMissing(missing...)
}

View File

@@ -23,7 +23,7 @@ import "github.com/cgrates/cgrates/utils"
func init() {
c := &CmdRemoveStatQueue{
name: "statqueue_remove",
rpcMethod: "ApierV1.RemStatQueueProfile",
rpcMethod: "ApierV1.RemoveStatQueueProfile",
rpcParams: &utils.TenantIDWithCache{},
}
commands[c.Name()] = c

View File

@@ -327,8 +327,8 @@ func TestA1itConcurrentAPs(t *testing.T) {
}(acnt)
go func(acnt string) {
var reply string
if err := a1rpc.Call("ApierV1.RemActionTiming",
v1.AttrRemActionTiming{Tenant: "cgrates.org", Account: acnt, ActionPlanId: "PACKAGE_1"}, &reply); err != nil {
if err := a1rpc.Call("ApierV1.RemoveActionTiming",
v1.AttrRemoveActionTiming{Tenant: "cgrates.org", Account: acnt, ActionPlanId: "PACKAGE_1"}, &reply); err != nil {
t.Error(err)
}
wg.Done()