Removed IDs from Count APIs

This commit is contained in:
porosnicuadrian
2021-05-27 16:01:54 +03:00
committed by Dan Christian Bogos
parent 9daba04d77
commit b232fac008
5 changed files with 28 additions and 28 deletions

View File

@@ -67,9 +67,9 @@ func (apierSv1 *APIerSv1) GetAttributeProfileIDs(args *utils.PaginatorWithTenant
return nil
}
// GetAttributeProfileIDsCount sets in reply var the total number of AttributeProfileIDs registered for a tenant
// GetAttributeProfileCount sets in reply var the total number of AttributeProfileIDs registered for a tenant
// returns ErrNotFound in case of 0 AttributeProfileIDs
func (apierSv1 *APIerSv1) GetAttributeProfileIDsCount(args *utils.TenantWithAPIOpts, reply *int) (err error) {
func (apierSv1 *APIerSv1) GetAttributeProfileCount(args *utils.TenantWithAPIOpts, reply *int) (err error) {
tnt := args.Tenant
if tnt == utils.EmptyString {
tnt = apierSv1.Config.GeneralCfg().DefaultTenant

View File

@@ -1281,13 +1281,13 @@ func testAttributeSProcessWithMultipleRuns2(t *testing.T) {
func testAttributeSGetAttributeProfileIDsCount(t *testing.T) {
var reply int
if err := attrSRPC.Call(utils.APIerSv1GetAttributeProfileIDsCount,
if err := attrSRPC.Call(utils.APIerSv1GetAttributeProfileCount,
&utils.TenantWithAPIOpts{}, &reply); err != nil {
t.Error(err)
} else if reply != 7 {
t.Errorf("Expecting: 7, received: %+v", reply)
}
if err := attrSRPC.Call(utils.APIerSv1GetAttributeProfileIDsCount,
if err := attrSRPC.Call(utils.APIerSv1GetAttributeProfileCount,
&utils.TenantWithAPIOpts{Tenant: "cgrates.org"}, &reply); err != nil {
t.Error(err)
} else if reply != 7 {
@@ -1306,7 +1306,7 @@ func testAttributeSGetAttributeProfileIDsCount(t *testing.T) {
} else if resp != utils.OK {
t.Error("Unexpected reply returned", resp)
}
if err := attrSRPC.Call(utils.APIerSv1GetAttributeProfileIDsCount,
if err := attrSRPC.Call(utils.APIerSv1GetAttributeProfileCount,
&utils.TenantWithAPIOpts{Tenant: "cgrates.org"}, &reply); err != nil {
t.Error(err)
} else if reply != 6 {
@@ -1324,7 +1324,7 @@ func testAttributeSGetAttributeProfileIDsCount(t *testing.T) {
} else if resp != utils.OK {
t.Error("Unexpected reply returned", resp)
}
if err := attrSRPC.Call(utils.APIerSv1GetAttributeProfileIDsCount,
if err := attrSRPC.Call(utils.APIerSv1GetAttributeProfileCount,
&utils.TenantWithAPIOpts{Tenant: "cgrates.org"}, &reply); err != nil {
t.Error(err)
} else if reply != 5 {
@@ -1342,7 +1342,7 @@ func testAttributeSGetAttributeProfileIDsCount(t *testing.T) {
} else if resp != utils.OK {
t.Error("Unexpected reply returned", resp)
}
if err := attrSRPC.Call(utils.APIerSv1GetAttributeProfileIDsCount,
if err := attrSRPC.Call(utils.APIerSv1GetAttributeProfileCount,
&utils.TenantWithAPIOpts{Tenant: "cgrates.org"}, &reply); err != nil {
t.Error(err)
} else if reply != 4 {
@@ -1360,7 +1360,7 @@ func testAttributeSGetAttributeProfileIDsCount(t *testing.T) {
} else if resp != utils.OK {
t.Error("Unexpected reply returned", resp)
}
if err := attrSRPC.Call(utils.APIerSv1GetAttributeProfileIDsCount,
if err := attrSRPC.Call(utils.APIerSv1GetAttributeProfileCount,
&utils.TenantWithAPIOpts{Tenant: "cgrates.org"}, &reply); err != nil {
t.Error(err)
} else if reply != 3 {
@@ -1378,7 +1378,7 @@ func testAttributeSGetAttributeProfileIDsCount(t *testing.T) {
} else if resp != utils.OK {
t.Error("Unexpected reply returned", resp)
}
if err := attrSRPC.Call(utils.APIerSv1GetAttributeProfileIDsCount,
if err := attrSRPC.Call(utils.APIerSv1GetAttributeProfileCount,
&utils.TenantWithAPIOpts{Tenant: "cgrates.org"}, &reply); err != nil {
t.Error(err)
} else if reply != 2 {
@@ -1397,7 +1397,7 @@ func testAttributeSGetAttributeProfileIDsCount(t *testing.T) {
} else if resp != utils.OK {
t.Error("Unexpected reply returned", resp)
}
if err := attrSRPC.Call(utils.APIerSv1GetAttributeProfileIDsCount,
if err := attrSRPC.Call(utils.APIerSv1GetAttributeProfileCount,
&utils.TenantWithAPIOpts{Tenant: "cgrates.org"}, &reply); err != nil {
t.Error(err)
} else if reply != 1 {
@@ -1416,7 +1416,7 @@ func testAttributeSGetAttributeProfileIDsCount(t *testing.T) {
} else if resp != utils.OK {
t.Error("Unexpected reply returned", resp)
}
if err := attrSRPC.Call(utils.APIerSv1GetAttributeProfileIDsCount,
if err := attrSRPC.Call(utils.APIerSv1GetAttributeProfileCount,
&utils.TenantWithAPIOpts{Tenant: "cgrates.org"}, &reply); err == nil || err.Error() != utils.ErrNotFound.Error() {
t.Error(err)
}

View File

@@ -104,9 +104,9 @@ func (apierSv1 *APIerSv1) GetThresholdProfileIDs(args *utils.PaginatorWithTenant
return nil
}
// GetThresholdProfileIDsCount sets in reply var the total number of ThresholdProfileIDs registered for the received tenant
// GetThresholdProfileCount sets in reply var the total number of ThresholdProfileIDs registered for the received tenant
// returns ErrNotFound in case of 0 ThresholdProfileIDs
func (apierSv1 *APIerSv1) GetThresholdProfileIDsCount(args *utils.TenantWithAPIOpts, reply *int) (err error) {
func (apierSv1 *APIerSv1) GetThresholdProfileCount(args *utils.TenantWithAPIOpts, reply *int) (err error) {
tnt := args.Tenant
if tnt == utils.EmptyString {
tnt = apierSv1.Config.GeneralCfg().DefaultTenant
@@ -158,7 +158,7 @@ func (apierSv1 *APIerSv1) RemoveThresholdProfile(args *utils.TenantIDWithAPIOpts
if tnt == utils.EmptyString {
tnt = apierSv1.Config.GeneralCfg().DefaultTenant
}
if err := apierSv1.DataManager.RemoveThresholdProfile(tnt, args.ID, true); err != nil {
if err := apierSv1.DataManager.RemoveThresholdProfile(tnt, args.ID, true); err != nil {
return utils.APIErrorHandler(err)
}
//handle caching for ThresholdProfile

View File

@@ -823,14 +823,14 @@ func testV1TSRemThresholdProfileWithoutTenant(t *testing.T) {
func testv1TSGetThresholdProfileIDsCount(t *testing.T) {
var reply int
if err := tSv1Rpc.Call(utils.APIerSv1GetThresholdProfileIDsCount,
if err := tSv1Rpc.Call(utils.APIerSv1GetThresholdProfileCount,
&utils.TenantWithAPIOpts{},
&reply); err != nil {
t.Error(err)
} else if reply != 7 {
t.Errorf("Expected 7, received %+v", reply)
}
if err := tSv1Rpc.Call(utils.APIerSv1GetThresholdProfileIDsCount,
if err := tSv1Rpc.Call(utils.APIerSv1GetThresholdProfileCount,
&utils.TenantWithAPIOpts{Tenant: "cgrates.org"},
&reply); err != nil {
t.Error(err)

View File

@@ -1430,7 +1430,7 @@ const (
APIerSv1GetSharedGroup = "APIerSv1.GetSharedGroup"
APIerSv1RemoveActionTrigger = "APIerSv1.RemoveActionTrigger"
APIerSv1GetAccount = "APIerSv1.GetAccount"
APIerSv1GetAttributeProfileIDsCount = "APIerSv1.GetAttributeProfileIDsCount"
APIerSv1GetAttributeProfileCount = "APIerSv1.GetAttributeProfileCount"
APIerSv1GetMaxUsage = "APIerSv1.GetMaxUsage"
APIerSv1GetTiming = "APIerSv1.GetTiming"
APIerSv1SetTiming = "APIerSv1.SetTiming"
@@ -1548,17 +1548,17 @@ const (
// ThresholdS APIs
const (
ThresholdSv1ProcessEvent = "ThresholdSv1.ProcessEvent"
ThresholdSv1GetThreshold = "ThresholdSv1.GetThreshold"
ThresholdSv1ResetThreshold = "ThresholdSv1.ResetThreshold"
ThresholdSv1GetThresholdIDs = "ThresholdSv1.GetThresholdIDs"
ThresholdSv1Ping = "ThresholdSv1.Ping"
ThresholdSv1GetThresholdsForEvent = "ThresholdSv1.GetThresholdsForEvent"
APIerSv1GetThresholdProfileIDs = "APIerSv1.GetThresholdProfileIDs"
APIerSv1GetThresholdProfileIDsCount = "APIerSv1.GetThresholdProfileIDsCount"
APIerSv1GetThresholdProfile = "APIerSv1.GetThresholdProfile"
APIerSv1RemoveThresholdProfile = "APIerSv1.RemoveThresholdProfile"
APIerSv1SetThresholdProfile = "APIerSv1.SetThresholdProfile"
ThresholdSv1ProcessEvent = "ThresholdSv1.ProcessEvent"
ThresholdSv1GetThreshold = "ThresholdSv1.GetThreshold"
ThresholdSv1ResetThreshold = "ThresholdSv1.ResetThreshold"
ThresholdSv1GetThresholdIDs = "ThresholdSv1.GetThresholdIDs"
ThresholdSv1Ping = "ThresholdSv1.Ping"
ThresholdSv1GetThresholdsForEvent = "ThresholdSv1.GetThresholdsForEvent"
APIerSv1GetThresholdProfileIDs = "APIerSv1.GetThresholdProfileIDs"
APIerSv1GetThresholdProfileCount = "APIerSv1.GetThresholdProfileCount"
APIerSv1GetThresholdProfile = "APIerSv1.GetThresholdProfile"
APIerSv1RemoveThresholdProfile = "APIerSv1.RemoveThresholdProfile"
APIerSv1SetThresholdProfile = "APIerSv1.SetThresholdProfile"
)
// StatS APIs