Finished changing structs thats use Opts in APIOpts

This commit is contained in:
andronache
2021-03-23 15:24:56 +02:00
committed by Dan Christian Bogos
parent 0d36b0cecf
commit 34b50acc38
7 changed files with 23 additions and 23 deletions

View File

@@ -955,7 +955,7 @@ func testV1FIdxSetRouteProfileIndexes(t *testing.T) {
err.Error() != utils.ErrNotFound.Error() {
t.Error(err)
}
rPrf := &RouteWithOpts{
rPrf := &RouteWithAPIOpts{
RouteProfile: &engine.RouteProfile{
Tenant: tenant,
ID: "TEST_PROFILE1",
@@ -1053,7 +1053,7 @@ func testV1FIdxSetSecondRouteProfileIndexes(t *testing.T) {
err.Error() != utils.ErrNotFound.Error() {
t.Error(err)
}
rPrf := &RouteWithOpts{
rPrf := &RouteWithAPIOpts{
RouteProfile: &engine.RouteProfile{
Tenant: tenant,
ID: "TEST_PROFILE2",

View File

@@ -347,7 +347,7 @@ func testInternalReplicateITRouteProfile(t *testing.T) {
err.Error() != utils.ErrNotFound.Error() {
t.Error(err)
}
rPrf := &RouteWithOpts{
rPrf := &RouteWithAPIOpts{
RouteProfile: &engine.RouteProfile{
Tenant: "cgrates.org",
ID: "TEST_PROFILE1",

View File

@@ -64,13 +64,13 @@ func (apierSv1 *APIerSv1) GetRouteProfileIDs(args *utils.PaginatorWithTenant, sp
return nil
}
type RouteWithOpts struct {
type RouteWithAPIOpts struct {
*engine.RouteProfile
Opts map[string]interface{}
APIOpts map[string]interface{}
}
//SetRouteProfile add a new Route configuration
func (apierSv1 *APIerSv1) SetRouteProfile(args *RouteWithOpts, reply *string) error {
func (apierSv1 *APIerSv1) SetRouteProfile(args *RouteWithAPIOpts, reply *string) error {
if missing := utils.MissingStructFields(args.RouteProfile, []string{utils.ID}); len(missing) != 0 {
return utils.NewErrMandatoryIeMissing(missing...)
}
@@ -85,8 +85,8 @@ func (apierSv1 *APIerSv1) SetRouteProfile(args *RouteWithOpts, reply *string) er
return utils.APIErrorHandler(err)
}
//handle caching for SupplierProfile
if err := apierSv1.CallCache(utils.IfaceAsString(args.Opts[utils.CacheOpt]), args.Tenant, utils.CacheRouteProfiles,
args.TenantID(), &args.FilterIDs, nil, args.Opts); err != nil {
if err := apierSv1.CallCache(utils.IfaceAsString(args.APIOpts[utils.CacheOpt]), args.Tenant, utils.CacheRouteProfiles,
args.TenantID(), &args.FilterIDs, nil, args.APIOpts); err != nil {
return utils.APIErrorHandler(err)
}
*reply = utils.OK

View File

@@ -36,7 +36,7 @@ var (
routeSv1CfgPath string
routeSv1Cfg *config.CGRConfig
routeSv1Rpc *rpc.Client
routePrf *RouteWithOpts
routePrf *RouteWithAPIOpts
routeSv1ConfDIR string //run tests for specific configuration
sTestsRouteSV1 = []func(t *testing.T){
@@ -846,7 +846,7 @@ func testV1RouteGetRouteWithoutFilter(t *testing.T) {
}
func testV1RouteSetRouteProfiles(t *testing.T) {
routePrf = &RouteWithOpts{
routePrf = &RouteWithAPIOpts{
RouteProfile: &engine.RouteProfile{
Tenant: "cgrates.org",
ID: "TEST_PROFILE1",
@@ -1108,7 +1108,7 @@ func testV1RoutesOneRouteWithoutDestination(t *testing.T) {
err.Error() != utils.ErrNotFound.Error() {
t.Error(err)
}
routePrf = &RouteWithOpts{
routePrf = &RouteWithAPIOpts{
RouteProfile: &engine.RouteProfile{
Tenant: "cgrates.org",
ID: "ROUTE_DESTINATION",
@@ -1182,7 +1182,7 @@ func testV1RouteMultipleRouteSameID(t *testing.T) {
err.Error() != utils.ErrNotFound.Error() {
t.Error(err)
}
routePrf = &RouteWithOpts{
routePrf = &RouteWithAPIOpts{
RouteProfile: &engine.RouteProfile{
Tenant: "cgrates.org",
ID: "MULTIPLE_ROUTES",
@@ -1290,7 +1290,7 @@ func testV1RouteMultipleRouteSameID(t *testing.T) {
}
func testV1RouteAccountWithRatingPlan(t *testing.T) {
routePrf = &RouteWithOpts{
routePrf = &RouteWithAPIOpts{
RouteProfile: &engine.RouteProfile{
Tenant: "cgrates.org",
ID: "RouteWithAccAndRP",
@@ -1570,7 +1570,7 @@ func testV1RouteStopEngine(t *testing.T) {
}
func testV1RouteSetRouteProfilesWithoutTenant(t *testing.T) {
routePrf = &RouteWithOpts{
routePrf = &RouteWithAPIOpts{
RouteProfile: &engine.RouteProfile{
Tenant: "cgrates.org",
ID: "TEST_PROFILE10",

View File

@@ -28,7 +28,7 @@ func init() {
c := &CmdSetRoute{
name: "routes_profile_set",
rpcMethod: utils.APIerSv1SetRouteProfile,
rpcParams: &v1.RouteWithOpts{},
rpcParams: &v1.RouteWithAPIOpts{},
}
commands[c.Name()] = c
c.CommandExecuter = &CommandExecuter{c}
@@ -37,7 +37,7 @@ func init() {
type CmdSetRoute struct {
name string
rpcMethod string
rpcParams *v1.RouteWithOpts
rpcParams *v1.RouteWithAPIOpts
*CommandExecuter
}
@@ -51,9 +51,9 @@ func (self *CmdSetRoute) RpcMethod() string {
func (self *CmdSetRoute) RpcParams(reset bool) interface{} {
if reset || self.rpcParams == nil {
self.rpcParams = &v1.RouteWithOpts{
self.rpcParams = &v1.RouteWithAPIOpts{
RouteProfile: new(engine.RouteProfile),
Opts: map[string]interface{}{},
APIOpts: map[string]interface{}{},
}
}
return self.rpcParams

View File

@@ -925,7 +925,7 @@ func testFltrRplResourceProfile(t *testing.T) {
func testFltrRplRouteProfile(t *testing.T) {
rpID := "RT1"
rpPrf := &v1.RouteWithOpts{
rpPrf := &v1.RouteWithAPIOpts{
RouteProfile: &engine.RouteProfile{
Tenant: "cgrates.org",
ID: rpID,

View File

@@ -37,7 +37,7 @@ var (
splSv1CfgPath string
splSv1Cfg *config.CGRConfig
splSv1Rpc *rpc.Client
splPrf *v1.RouteWithOpts
splPrf *v1.RouteWithAPIOpts
splSv1ConfDIR string //run tests for specific configuration
sTestsSupplierSV1 = []func(t *testing.T){
@@ -133,7 +133,7 @@ func testV1SplSSetSupplierProfilesWithoutRatingPlanIDs(t *testing.T) {
err.Error() != utils.ErrNotFound.Error() {
t.Error(err)
}
splPrf = &v1.RouteWithOpts{
splPrf = &v1.RouteWithAPIOpts{
RouteProfile: &engine.RouteProfile{
Tenant: "cgrates.org",
ID: "TEST_PROFILE2",
@@ -197,7 +197,7 @@ func testV1SplSAddNewSplPrf(t *testing.T) {
t.Error(err)
}
//create a new Supplier Profile to test *reas and *reds sorting strategy
splPrf = &v1.RouteWithOpts{
splPrf = &v1.RouteWithAPIOpts{
RouteProfile: &engine.RouteProfile{
Tenant: "cgrates.org",
ID: "ROUTE_ResourceTest",
@@ -473,7 +473,7 @@ func testV1SplSAddNewSplPrf2(t *testing.T) {
t.Error(err)
}
//create a new Supplier Profile to test *reas and *reds sorting strategy
splPrf = &v1.RouteWithOpts{
splPrf = &v1.RouteWithAPIOpts{
RouteProfile: &engine.RouteProfile{
Tenant: "cgrates.org",
ID: "ROUTE_ResourceDescendent",