Fixed integrations tests for RateProfile package and fields

This commit is contained in:
porosnicuadrian
2021-03-18 18:12:08 +02:00
committed by Dan Christian Bogos
parent 5d323f4671
commit 86bea089d8
14 changed files with 452 additions and 424 deletions

View File

@@ -781,16 +781,16 @@ func testAccountSv1DebitWithAttributeSandRateS(t *testing.T) {
}
//set a rate profile to be used in case of debit
apiRPrf := &engine.APIRateProfile{
apiRPrf := &utils.APIRateProfile{
Tenant: "cgrates.org",
ID: "RP_Test",
Weights: ";10",
Rates: map[string]*engine.APIRate{
Rates: map[string]*utils.APIRate{
"RT_ALWAYS": {
ID: "RT_ALWAYS",
Weights: ";0",
ActivationTimes: "* * * * *",
IntervalRates: []*engine.APIIntervalRate{
IntervalRates: []*utils.APIIntervalRate{
{
IntervalStart: "0",
RecurrentFee: utils.Float64Pointer(0.1),
@@ -803,8 +803,9 @@ func testAccountSv1DebitWithAttributeSandRateS(t *testing.T) {
}
if err := acntSRPC.Call(utils.APIerSv1SetRateProfile,
&engine.APIRateProfileWithOpts{
APIRateProfile: apiRPrf,
&APIRateProfileWithCache{
APIRateProfileWithOpts: &utils.APIRateProfileWithOpts{
APIRateProfile: apiRPrf},
}, &reply); err != nil {
t.Fatal(err)
} else if reply != utils.OK {
@@ -877,17 +878,17 @@ func testAccountSv1DebitWithRateS(t *testing.T) {
}
//set a rate profile to be used in case of debit
apiRPrf := &engine.APIRateProfile{
apiRPrf := &utils.APIRateProfile{
Tenant: "cgrates.org",
ID: "RP_Test2",
FilterIDs: []string{"*string:~*req.Account:ACC_WITH_RATES"},
Weights: ";20",
Rates: map[string]*engine.APIRate{
Rates: map[string]*utils.APIRate{
"RT_ALWAYS": {
ID: "RT_ALWAYS",
Weights: ";0",
ActivationTimes: "* * * * *",
IntervalRates: []*engine.APIIntervalRate{
IntervalRates: []*utils.APIIntervalRate{
{
IntervalStart: "0",
RecurrentFee: utils.Float64Pointer(0.5),
@@ -900,8 +901,7 @@ func testAccountSv1DebitWithRateS(t *testing.T) {
}
if err := acntSRPC.Call(utils.APIerSv1SetRateProfile,
&engine.APIRateProfileWithOpts{
APIRateProfile: apiRPrf,
}, &reply); err != nil {
t.Fatal(err)
} else if reply != utils.OK {
@@ -981,17 +981,17 @@ func testAccountSv1DebitWithRateS2(t *testing.T) {
}
//set a rate profile to be used in case of debit
apiRPrf := &engine.APIRateProfile{
apiRPrf := &utils.APIRateProfile{
Tenant: "cgrates.org",
ID: "RP_Test22",
FilterIDs: []string{"*string:~*req.Account:ACC_WITH_RATES2"},
Weights: ";20",
Rates: map[string]*engine.APIRate{
Rates: map[string]*utils.APIRate{
"RT_ALWAYS": {
ID: "RT_ALWAYS",
Weights: ";0",
ActivationTimes: "* * * * *",
IntervalRates: []*engine.APIIntervalRate{
IntervalRates: []*utils.APIIntervalRate{
{
IntervalStart: "0",
RecurrentFee: utils.Float64Pointer(0.5),
@@ -1004,8 +1004,9 @@ func testAccountSv1DebitWithRateS2(t *testing.T) {
}
if err := acntSRPC.Call(utils.APIerSv1SetRateProfile,
&engine.APIRateProfileWithOpts{
APIRateProfile: apiRPrf,
&APIRateProfileWithCache{
APIRateProfileWithOpts: &utils.APIRateProfileWithOpts{
APIRateProfile: apiRPrf},
}, &reply); err != nil {
t.Fatal(err)
} else if reply != utils.OK {

View File

@@ -173,7 +173,7 @@ func testCacheSReplicateProcessAttributes(t *testing.T) {
}
func testCacheSReplicateProcessRateProfile(t *testing.T) {
var rply *engine.RateProfileCost
var rply *utils.RateProfileCost
argsRt := &utils.ArgsCostForEvent{
CGREvent: &utils.CGREvent{
Tenant: "cgrates.org",
@@ -191,7 +191,7 @@ func testCacheSReplicateProcessRateProfile(t *testing.T) {
if err != nil {
t.Error(err)
}
rate1 := &engine.Rate{
rate1 := &utils.Rate{
ID: "RT_ALWAYS",
Weights: utils.DynamicWeights{
{
@@ -199,9 +199,9 @@ func testCacheSReplicateProcessRateProfile(t *testing.T) {
},
},
ActivationTimes: "* * * * *",
IntervalRates: []*engine.IntervalRate{
IntervalRates: []*utils.IntervalRate{
{
IntervalStart: 0,
IntervalStart: utils.NewDecimal(0, 0),
FixedFee: utils.NewDecimal(0, 0),
RecurrentFee: utils.NewDecimal(1, 2),
Unit: minDecimal,
@@ -209,14 +209,14 @@ func testCacheSReplicateProcessRateProfile(t *testing.T) {
},
},
}
exp := &engine.RateProfileCost{
exp := &utils.RateProfileCost{
ID: "RT_SPECIAL_1002",
Cost: 0.01,
RateSIntervals: []*engine.RateSInterval{{
UsageStart: 0,
Increments: []*engine.RateSIncrement{{
UsageStart: 0,
Usage: time.Minute,
RateSIntervals: []*utils.RateSInterval{{
IntervalStart: utils.NewDecimal(0, 0),
Increments: []*utils.RateSIncrement{{
IncrementStart: utils.NewDecimal(0, 0),
Usage: utils.NewDecimal(int64(time.Minute), 0),
Rate: rate1,
IntervalRateIndex: 0,
CompressFactor: 60,

View File

@@ -95,29 +95,31 @@ func testCostBenchLoadFromFolder2(b *testing.B) {
}
func testCostBenchSetRateProfile(b *testing.B) {
rPrf := &engine.APIRateProfileWithOpts{
APIRateProfile: &engine.APIRateProfile{
ID: "DefaultRate",
FilterIDs: []string{"*string:~*req.Subject:1001"},
Weights: ";10",
Rates: map[string]*engine.APIRate{
"RATE1": &engine.APIRate{
ID: "RATE1",
Weights: ";0",
ActivationTimes: "* * * * *",
IntervalRates: []*engine.APIIntervalRate{
{
IntervalStart: "0",
FixedFee: utils.Float64Pointer(0.4),
RecurrentFee: utils.Float64Pointer(0.2),
Unit: utils.Float64Pointer(60000000000),
Increment: utils.Float64Pointer(60000000000),
},
{
IntervalStart: "1m",
RecurrentFee: utils.Float64Pointer(0.1),
Unit: utils.Float64Pointer(60000000000),
Increment: utils.Float64Pointer(1000000000),
rPrf := &APIRateProfileWithCache{
APIRateProfileWithOpts: &utils.APIRateProfileWithOpts{
APIRateProfile: &utils.APIRateProfile{
ID: "DefaultRate",
FilterIDs: []string{"*string:~*req.Subject:1001"},
Weights: ";10",
Rates: map[string]*utils.APIRate{
"RATE1": &utils.APIRate{
ID: "RATE1",
Weights: ";0",
ActivationTimes: "* * * * *",
IntervalRates: []*utils.APIIntervalRate{
{
IntervalStart: "0",
FixedFee: utils.Float64Pointer(0.4),
RecurrentFee: utils.Float64Pointer(0.2),
Unit: utils.Float64Pointer(60000000000),
Increment: utils.Float64Pointer(60000000000),
},
{
IntervalStart: "1m",
RecurrentFee: utils.Float64Pointer(0.1),
Unit: utils.Float64Pointer(60000000000),
Increment: utils.Float64Pointer(1000000000),
},
},
},
},
@@ -133,11 +135,11 @@ func testCostBenchSetRateProfile(b *testing.B) {
}
func testCostBenchSetRateProfile2(b *testing.B) {
rate1 := &engine.APIRate{
rate1 := &utils.APIRate{
ID: "RATE1",
Weights: ";0",
ActivationTimes: "* * * * *",
IntervalRates: []*engine.APIIntervalRate{
IntervalRates: []*utils.APIIntervalRate{
{
IntervalStart: "0",
RecurrentFee: utils.Float64Pointer(0.2),
@@ -152,25 +154,27 @@ func testCostBenchSetRateProfile2(b *testing.B) {
},
},
}
rtChristmas := &engine.APIRate{
rtChristmas := &utils.APIRate{
ID: "RT_CHRISTMAS",
Weights: ";30",
ActivationTimes: "* * 24 12 *",
IntervalRates: []*engine.APIIntervalRate{{
IntervalRates: []*utils.APIIntervalRate{{
IntervalStart: "0",
RecurrentFee: utils.Float64Pointer(0.6),
Unit: utils.Float64Pointer(60000000000),
Increment: utils.Float64Pointer(1000000000),
}},
}
rPrf := &engine.APIRateProfileWithOpts{
APIRateProfile: &engine.APIRateProfile{
ID: "RateChristmas",
FilterIDs: []string{"*string:~*req.Subject:1010"},
Weights: ";50",
Rates: map[string]*engine.APIRate{
"RATE1": rate1,
"RATE_CHRISTMAS": rtChristmas,
rPrf := &APIRateProfileWithCache{
APIRateProfileWithOpts: &utils.APIRateProfileWithOpts{
APIRateProfile: &utils.APIRateProfile{
ID: "RateChristmas",
FilterIDs: []string{"*string:~*req.Subject:1010"},
Weights: ";50",
Rates: map[string]*utils.APIRate{
"RATE1": rate1,
"RATE_CHRISTMAS": rtChristmas,
},
},
},
}
@@ -259,7 +263,7 @@ func BenchmarkCostWithRateS(b *testing.B) {
testCostBenchStartEngine(b)
testCostBenchRPCConn(b)
testCostBenchSetRateProfile(b)
var rply *engine.RateProfileCost
var rply *utils.RateProfileCost
argsRt := &utils.ArgsCostForEvent{
CGREvent: &utils.CGREvent{
Tenant: "cgrates.org",
@@ -291,7 +295,7 @@ func BenchmarkCostDiffPeriodWithRateS(b *testing.B) {
testCostBenchStartEngine(b)
testCostBenchRPCConn(b)
testCostBenchSetRateProfile2(b)
var rply *engine.RateProfileCost
var rply *utils.RateProfileCost
argsRt := &utils.ArgsCostForEvent{
CGREvent: &utils.CGREvent{
Tenant: "cgrates.org",

View File

@@ -1810,7 +1810,7 @@ func testV1FISetRateProfileRatesIndexes(t *testing.T) {
t.Error("Unexpected reply returned", result)
}
//there are not any rates in db
var reply *engine.RateProfile
var reply *utils.RateProfile
if err := tFIdxRpc.Call(utils.APIerSv1GetRateProfile,
&utils.TenantIDWithAPIOpts{TenantID: &utils.TenantID{Tenant: tenant, ID: "RP1"}}, &reply); err == nil ||
err.Error() != utils.ErrNotFound.Error() {
@@ -1818,22 +1818,24 @@ func testV1FISetRateProfileRatesIndexes(t *testing.T) {
}
//set in db a ratePrf with double populated rates with our filter
ratePrfRates := &engine.APIRateProfileWithOpts{
APIRateProfile: &engine.APIRateProfile{
Tenant: "cgrates.org",
ID: "RP1",
FilterIDs: []string{"*string:~*req.Usage:10m"},
MaxCostStrategy: "*free",
Rates: map[string]*engine.APIRate{
"RT_WEEK": {
ID: "RT_WEEK",
FilterIDs: []string{"RATE_FLTR1", "*suffix:~*req.Account:1009"},
ActivationTimes: "* * * * 1-5",
},
"RT_MONTH": {
ID: "RT_MONTH",
FilterIDs: []string{"RATE_FLTR1"},
ActivationTimes: "* * * * *",
ratePrfRates := &APIRateProfileWithCache{
APIRateProfileWithOpts: &utils.APIRateProfileWithOpts{
APIRateProfile: &utils.APIRateProfile{
Tenant: "cgrates.org",
ID: "RP1",
FilterIDs: []string{"*string:~*req.Usage:10m"},
MaxCostStrategy: "*free",
Rates: map[string]*utils.APIRate{
"RT_WEEK": {
ID: "RT_WEEK",
FilterIDs: []string{"RATE_FLTR1", "*suffix:~*req.Account:1009"},
ActivationTimes: "* * * * 1-5",
},
"RT_MONTH": {
ID: "RT_MONTH",
FilterIDs: []string{"RATE_FLTR1"},
ActivationTimes: "* * * * *",
},
},
},
},
@@ -1996,17 +1998,19 @@ func testV1FISetSecondRateProfileRate(t *testing.T) {
}
//append a new rate in the same rate profile
ratePrfRates := &engine.APIRateProfileWithOpts{
APIRateProfile: &engine.APIRateProfile{
Tenant: "cgrates.org",
ID: "RP1",
FilterIDs: []string{"*string:~*req.Usage:10m"},
MaxCostStrategy: "*free",
Rates: map[string]*engine.APIRate{
"RT_YEAR": {
ID: "RT_YEAR",
FilterIDs: []string{"RTPRF_FLTR3"},
ActivationTimes: "* * * * *",
ratePrfRates := &APIRateProfileWithCache{
APIRateProfileWithOpts: &utils.APIRateProfileWithOpts{
APIRateProfile: &utils.APIRateProfile{
Tenant: "cgrates.org",
ID: "RP1",
FilterIDs: []string{"*string:~*req.Usage:10m"},
MaxCostStrategy: "*free",
Rates: map[string]*utils.APIRate{
"RT_YEAR": {
ID: "RT_YEAR",
FilterIDs: []string{"RTPRF_FLTR3"},
ActivationTimes: "* * * * *",
},
},
},
},
@@ -2237,24 +2241,26 @@ func testV1FISetRateProfileIndexes(t *testing.T) {
}
//there are not any rates in db
var reply *engine.RateProfile
var reply *utils.RateProfile
if err := tFIdxRpc.Call(utils.APIerSv1GetRateProfile,
&utils.TenantIDWithAPIOpts{TenantID: &utils.TenantID{Tenant: tenant, ID: "RP2"}}, &reply); err == nil ||
err.Error() != utils.ErrNotFound.Error() {
t.Error(err)
}
//set in db a ratePrf with with our filterS
ratePrfRates := &engine.APIRateProfileWithOpts{
APIRateProfile: &engine.APIRateProfile{
Tenant: "cgrates.org",
ID: "RP2",
FilterIDs: []string{"*string:~*req.Usage:10m", "RATEFLTR_FLTR1"},
MaxCostStrategy: "*free",
Rates: map[string]*engine.APIRate{
"RT_WEEK": {
ID: "RT_WEEK",
FilterIDs: []string{"*suffix:~*req.Account:1009"},
ActivationTimes: "* * * * 1-5",
ratePrfRates := &APIRateProfileWithCache{
APIRateProfileWithOpts: &utils.APIRateProfileWithOpts{
APIRateProfile: &utils.APIRateProfile{
Tenant: "cgrates.org",
ID: "RP2",
FilterIDs: []string{"*string:~*req.Usage:10m", "RATEFLTR_FLTR1"},
MaxCostStrategy: "*free",
Rates: map[string]*utils.APIRate{
"RT_WEEK": {
ID: "RT_WEEK",
FilterIDs: []string{"*suffix:~*req.Account:1009"},
ActivationTimes: "* * * * 1-5",
},
},
},
},
@@ -2419,17 +2425,19 @@ func testV1FISetSecondRateProfile(t *testing.T) {
}
//another rate profile
ratePrfRates := &engine.APIRateProfileWithOpts{
APIRateProfile: &engine.APIRateProfile{
Tenant: "cgrates.org",
ID: "RP3",
FilterIDs: []string{"RTPRF_FLTR6"},
MaxCostStrategy: "*free",
Rates: map[string]*engine.APIRate{
"RT_WEEK": {
ID: "RT_WEEK",
FilterIDs: []string{"*suffix:~*req.Account:1019"},
ActivationTimes: "* * * * 1-5",
ratePrfRates := &APIRateProfileWithCache{
APIRateProfileWithOpts: &utils.APIRateProfileWithOpts{
APIRateProfile: &utils.APIRateProfile{
Tenant: "cgrates.org",
ID: "RP3",
FilterIDs: []string{"RTPRF_FLTR6"},
MaxCostStrategy: "*free",
Rates: map[string]*utils.APIRate{
"RT_WEEK": {
ID: "RT_WEEK",
FilterIDs: []string{"*suffix:~*req.Account:1019"},
ActivationTimes: "* * * * 1-5",
},
},
},
},

View File

@@ -588,7 +588,7 @@ func testFullRemoteITDispatcher(t *testing.T) {
func testFullRemoteITRate(t *testing.T) {
// verify for not found in internal
var reply *engine.RateProfile
var reply *utils.RateProfile
if err := fullRemInternalRPC.Call(utils.APIerSv1GetRateProfile,
utils.TenantIDWithAPIOpts{TenantID: &utils.TenantID{Tenant: "cgrates.org", ID: "RP1"}},
&reply); err == nil || err.Error() != utils.ErrNotFound.Error() {
@@ -596,28 +596,30 @@ func testFullRemoteITRate(t *testing.T) {
}
var replySet string
apiRPrf := &engine.APIRateProfileWithOpts{
APIRateProfile: &engine.APIRateProfile{
Tenant: "cgrates.org",
ID: "RP1",
FilterIDs: []string{"*string:~*req.Subject:1001"},
Weights: ";0",
MaxCostStrategy: "*free",
Rates: map[string]*engine.APIRate{
"RT_WEEK": {
ID: "RT_WEEK",
Weights: ";0",
ActivationTimes: "* * * * 1-5",
},
"RT_WEEKEND": {
ID: "RT_WEEKEND",
Weights: ";10",
ActivationTimes: "* * * * 0,6",
},
"RT_CHRISTMAS": {
ID: "RT_CHRISTMAS",
Weights: ";30",
ActivationTimes: "* * 24 12 *",
apiRPrf := &APIRateProfileWithCache{
APIRateProfileWithOpts: &utils.APIRateProfileWithOpts{
APIRateProfile: &utils.APIRateProfile{
Tenant: "cgrates.org",
ID: "RP1",
FilterIDs: []string{"*string:~*req.Subject:1001"},
Weights: ";0",
MaxCostStrategy: "*free",
Rates: map[string]*utils.APIRate{
"RT_WEEK": {
ID: "RT_WEEK",
Weights: ";0",
ActivationTimes: "* * * * 1-5",
},
"RT_WEEKEND": {
ID: "RT_WEEKEND",
Weights: ";10",
ActivationTimes: "* * * * 0,6",
},
"RT_CHRISTMAS": {
ID: "RT_CHRISTMAS",
Weights: ";30",
ActivationTimes: "* * 24 12 *",
},
},
},
},

View File

@@ -125,7 +125,7 @@ func testV1RatePrfRpcConn(t *testing.T) {
}
func testV1RatePrfNotFound(t *testing.T) {
var reply *engine.RateProfile
var reply *utils.RateProfile
if err := ratePrfRpc.Call(utils.APIerSv1GetRateProfile,
utils.TenantIDWithAPIOpts{TenantID: &utils.TenantID{Tenant: "cgrates.org", ID: "RP1"}},
&reply); err == nil || err.Error() != utils.ErrNotFound.Error() {
@@ -143,7 +143,7 @@ func testV1RatePrfFromFolder(t *testing.T) {
}
func testV1RatePrfVerifyRateProfile(t *testing.T) {
var reply *engine.RateProfile
var reply *utils.RateProfile
if err := ratePrfRpc.Call(utils.APIerSv1GetRateProfile,
utils.TenantIDWithAPIOpts{TenantID: &utils.TenantID{Tenant: "cgrates.org", ID: "RP1"}}, &reply); err != nil {
t.Fatal(err)
@@ -156,7 +156,7 @@ func testV1RatePrfVerifyRateProfile(t *testing.T) {
if err != nil {
t.Error(err)
}
rPrf := &engine.RateProfile{
rPrf := &utils.RateProfile{
Tenant: "cgrates.org",
ID: "RP1",
FilterIDs: []string{"*string:~*req.Subject:1001"},
@@ -168,7 +168,7 @@ func testV1RatePrfVerifyRateProfile(t *testing.T) {
MinCost: utils.NewDecimal(1, 1),
MaxCost: utils.NewDecimal(6, 1),
MaxCostStrategy: "*free",
Rates: map[string]*engine.Rate{
Rates: map[string]*utils.Rate{
"RT_WEEK": {
ID: "RT_WEEK",
Weights: utils.DynamicWeights{
@@ -177,15 +177,15 @@ func testV1RatePrfVerifyRateProfile(t *testing.T) {
},
},
ActivationTimes: "* * * * 1-5",
IntervalRates: []*engine.IntervalRate{
IntervalRates: []*utils.IntervalRate{
{
IntervalStart: 0,
IntervalStart: utils.NewDecimal(0, 0),
RecurrentFee: utils.NewDecimal(12, 2),
Unit: minDecimal,
Increment: minDecimal,
},
{
IntervalStart: time.Minute,
IntervalStart: utils.NewDecimal(int64(time.Minute), 0),
RecurrentFee: utils.NewDecimal(6, 2),
Unit: minDecimal,
Increment: secDecimal,
@@ -200,9 +200,9 @@ func testV1RatePrfVerifyRateProfile(t *testing.T) {
},
},
ActivationTimes: "* * * * 0,6",
IntervalRates: []*engine.IntervalRate{
IntervalRates: []*utils.IntervalRate{
{
IntervalStart: 0,
IntervalStart: utils.NewDecimal(0, 0),
RecurrentFee: utils.NewDecimal(6, 2),
Unit: minDecimal,
Increment: secDecimal,
@@ -217,9 +217,9 @@ func testV1RatePrfVerifyRateProfile(t *testing.T) {
},
},
ActivationTimes: "* * 24 12 *",
IntervalRates: []*engine.IntervalRate{
IntervalRates: []*utils.IntervalRate{
{
IntervalStart: 0,
IntervalStart: utils.NewDecimal(0, 0),
RecurrentFee: utils.NewDecimal(6, 2),
Unit: minDecimal,
Increment: secDecimal,
@@ -245,7 +245,7 @@ func testV1RatePrfRemoveRateProfile(t *testing.T) {
}
func testV1RatePrfSetRateProfileRates(t *testing.T) {
rPrf := &engine.RateProfile{
rPrf := &utils.RateProfile{
Tenant: "cgrates.org",
ID: "RP1",
FilterIDs: []string{"*wrong:inline"},
@@ -255,7 +255,7 @@ func testV1RatePrfSetRateProfileRates(t *testing.T) {
},
},
MaxCostStrategy: "*free",
Rates: map[string]*engine.Rate{
Rates: map[string]*utils.Rate{
"RT_WEEK": {
ID: "RT_WEEK",
Weights: utils.DynamicWeights{
@@ -264,9 +264,9 @@ func testV1RatePrfSetRateProfileRates(t *testing.T) {
},
},
ActivationTimes: "* * * * 1-5",
IntervalRates: []*engine.IntervalRate{
IntervalRates: []*utils.IntervalRate{
{
IntervalStart: 0,
IntervalStart: utils.NewDecimal(0, 0),
},
},
},
@@ -275,18 +275,18 @@ func testV1RatePrfSetRateProfileRates(t *testing.T) {
if err := rPrf.Compile(); err != nil {
t.Fatal(err)
}
apiRPrf := &engine.APIRateProfile{
apiRPrf := &utils.APIRateProfile{
Tenant: "cgrates.org",
ID: "RP1",
FilterIDs: []string{"*wrong:inline"},
Weights: ";0",
MaxCostStrategy: "*free",
Rates: map[string]*engine.APIRate{
Rates: map[string]*utils.APIRate{
"RT_WEEK": {
ID: "RT_WEEK",
Weights: ";0",
ActivationTimes: "* * * * 1-5",
IntervalRates: []*engine.APIIntervalRate{
IntervalRates: []*utils.APIIntervalRate{
{
IntervalStart: "0",
},
@@ -297,30 +297,32 @@ func testV1RatePrfSetRateProfileRates(t *testing.T) {
var reply string
expErr := "SERVER_ERROR: broken reference to filter: *wrong:inline for item with ID: cgrates.org:RP1"
if err := ratePrfRpc.Call(utils.APIerSv1SetRateProfile,
&engine.APIRateProfileWithOpts{
APIRateProfile: apiRPrf,
&APIRateProfileWithCache{
APIRateProfileWithOpts: &utils.APIRateProfileWithOpts{
APIRateProfile: apiRPrf},
}, &reply); err == nil || err.Error() != expErr {
t.Fatalf("Expected error: %q, received: %v", expErr, err)
}
apiRPrf.FilterIDs = []string{"*string:~*req.Subject:1001"}
if err := ratePrfRpc.Call(utils.APIerSv1SetRateProfile,
&engine.APIRateProfileWithOpts{
APIRateProfile: apiRPrf,
&APIRateProfileWithCache{
APIRateProfileWithOpts: &utils.APIRateProfileWithOpts{
APIRateProfile: apiRPrf},
}, &reply); err != nil {
t.Fatal(err)
} else if reply != utils.OK {
t.Errorf("Expecting: %+v, received: %+v", utils.OK, reply)
}
apiRPrfRates := &engine.APIRateProfile{
apiRPrfRates := &utils.APIRateProfile{
Tenant: "cgrates.org",
ID: "RP1",
Rates: map[string]*engine.APIRate{
Rates: map[string]*utils.APIRate{
"RT_WEEK": {
ID: "RT_WEEK",
Weights: ";0",
ActivationTimes: "* * * * 1-5",
IntervalRates: []*engine.APIIntervalRate{
IntervalRates: []*utils.APIIntervalRate{
{
IntervalStart: "0",
},
@@ -333,7 +335,7 @@ func testV1RatePrfSetRateProfileRates(t *testing.T) {
ID: "RT_WEEKEND",
Weights: ";10",
ActivationTimes: "* * * * 0,6",
IntervalRates: []*engine.APIIntervalRate{
IntervalRates: []*utils.APIIntervalRate{
{
IntervalStart: "0",
},
@@ -343,7 +345,7 @@ func testV1RatePrfSetRateProfileRates(t *testing.T) {
ID: "RT_CHRISTMAS",
Weights: ";30",
ActivationTimes: "* * 24 12 *",
IntervalRates: []*engine.APIIntervalRate{
IntervalRates: []*utils.APIIntervalRate{
{
IntervalStart: "0",
},
@@ -355,23 +357,25 @@ func testV1RatePrfSetRateProfileRates(t *testing.T) {
apiRPrfRates.Rates["RT_WEEK"].FilterIDs = []string{"*wrong:inline"}
expErr = "SERVER_ERROR: broken reference to filter: *wrong:inline for rate with ID: RT_WEEK"
if err := ratePrfRpc.Call(utils.APIerSv1SetRateProfileRates,
&engine.APIRateProfileWithOpts{
APIRateProfile: apiRPrfRates,
&APIRateProfileWithCache{
APIRateProfileWithOpts: &utils.APIRateProfileWithOpts{
APIRateProfile: apiRPrfRates},
}, &reply); err == nil || err.Error() != expErr {
t.Fatalf("Expected error: %q, received: %v", expErr, err)
}
apiRPrfRates.Rates["RT_WEEK"].FilterIDs = nil
if err := ratePrfRpc.Call(utils.APIerSv1SetRateProfileRates,
&engine.APIRateProfileWithOpts{
APIRateProfile: apiRPrfRates,
&APIRateProfileWithCache{
APIRateProfileWithOpts: &utils.APIRateProfileWithOpts{
APIRateProfile: apiRPrfRates},
}, &reply); err != nil {
t.Fatal(err)
} else if reply != utils.OK {
t.Errorf("Expecting: %+v, received: %+v", utils.OK, reply)
}
rPrfUpdated := &engine.RateProfile{
rPrfUpdated := &utils.RateProfile{
Tenant: "cgrates.org",
ID: "RP1",
FilterIDs: []string{"*string:~*req.Subject:1001"},
@@ -381,7 +385,7 @@ func testV1RatePrfSetRateProfileRates(t *testing.T) {
},
},
MaxCostStrategy: "*free",
Rates: map[string]*engine.Rate{
Rates: map[string]*utils.Rate{
"RT_WEEK": {
ID: "RT_WEEK",
Weights: utils.DynamicWeights{
@@ -390,12 +394,12 @@ func testV1RatePrfSetRateProfileRates(t *testing.T) {
},
},
ActivationTimes: "* * * * 1-5",
IntervalRates: []*engine.IntervalRate{
IntervalRates: []*utils.IntervalRate{
{
IntervalStart: 0,
IntervalStart: utils.NewDecimal(0, 0),
},
{
IntervalStart: time.Minute,
IntervalStart: utils.NewDecimal(int64(time.Minute), 0),
},
},
},
@@ -407,9 +411,9 @@ func testV1RatePrfSetRateProfileRates(t *testing.T) {
},
},
ActivationTimes: "* * * * 0,6",
IntervalRates: []*engine.IntervalRate{
IntervalRates: []*utils.IntervalRate{
{
IntervalStart: 0,
IntervalStart: utils.NewDecimal(0, 0),
},
},
},
@@ -421,15 +425,15 @@ func testV1RatePrfSetRateProfileRates(t *testing.T) {
},
},
ActivationTimes: "* * 24 12 *",
IntervalRates: []*engine.IntervalRate{
IntervalRates: []*utils.IntervalRate{
{
IntervalStart: 0,
IntervalStart: utils.NewDecimal(0, 0),
},
},
},
},
}
var rply *engine.RateProfile
var rply *utils.RateProfile
if err := ratePrfRpc.Call(utils.APIerSv1GetRateProfile,
utils.TenantIDWithAPIOpts{TenantID: &utils.TenantID{Tenant: "cgrates.org", ID: "RP1"}}, &rply); err != nil {
t.Fatal(err)
@@ -440,18 +444,18 @@ func testV1RatePrfSetRateProfileRates(t *testing.T) {
}
func testV1RatePrfRemoveRateProfileRates(t *testing.T) {
apiRPrf := &engine.APIRateProfile{
apiRPrf := &utils.APIRateProfile{
Tenant: "cgrates.org",
ID: "SpecialRate",
FilterIDs: []string{"*string:~*req.Subject:1001"},
Weights: ";0",
MaxCostStrategy: "*free",
Rates: map[string]*engine.APIRate{
Rates: map[string]*utils.APIRate{
"RT_WEEK": {
ID: "RT_WEEK",
Weights: ";0",
ActivationTimes: "* * * * 1-5",
IntervalRates: []*engine.APIIntervalRate{
IntervalRates: []*utils.APIIntervalRate{
{
IntervalStart: "0",
},
@@ -464,7 +468,7 @@ func testV1RatePrfRemoveRateProfileRates(t *testing.T) {
ID: "RT_WEEKEND",
Weights: ";10",
ActivationTimes: "* * * * 0,6",
IntervalRates: []*engine.APIIntervalRate{
IntervalRates: []*utils.APIIntervalRate{
{
IntervalStart: "0",
},
@@ -474,7 +478,7 @@ func testV1RatePrfRemoveRateProfileRates(t *testing.T) {
ID: "RT_CHRISTMAS",
Weights: ";30",
ActivationTimes: "* * 24 12 *",
IntervalRates: []*engine.APIIntervalRate{
IntervalRates: []*utils.APIIntervalRate{
{
IntervalStart: "0",
},
@@ -484,8 +488,9 @@ func testV1RatePrfRemoveRateProfileRates(t *testing.T) {
}
var reply string
if err := ratePrfRpc.Call(utils.APIerSv1SetRateProfile,
&engine.APIRateProfileWithOpts{
APIRateProfile: apiRPrf,
&APIRateProfileWithCache{
APIRateProfileWithOpts: &utils.APIRateProfileWithOpts{
APIRateProfile: apiRPrf},
}, &reply); err != nil {
t.Fatal(err)
} else if reply != utils.OK {
@@ -503,7 +508,7 @@ func testV1RatePrfRemoveRateProfileRates(t *testing.T) {
t.Errorf("Expecting: %+v, received: %+v", utils.OK, reply)
}
rPrfUpdated := &engine.RateProfile{
rPrfUpdated := &utils.RateProfile{
Tenant: "cgrates.org",
ID: "SpecialRate",
FilterIDs: []string{"*string:~*req.Subject:1001"},
@@ -513,7 +518,7 @@ func testV1RatePrfRemoveRateProfileRates(t *testing.T) {
},
},
MaxCostStrategy: "*free",
Rates: map[string]*engine.Rate{
Rates: map[string]*utils.Rate{
"RT_WEEK": {
ID: "RT_WEEK",
Weights: utils.DynamicWeights{
@@ -522,12 +527,12 @@ func testV1RatePrfRemoveRateProfileRates(t *testing.T) {
},
},
ActivationTimes: "* * * * 1-5",
IntervalRates: []*engine.IntervalRate{
IntervalRates: []*utils.IntervalRate{
{
IntervalStart: 0,
IntervalStart: utils.NewDecimal(0, 0),
},
{
IntervalStart: time.Minute,
IntervalStart: utils.NewDecimal(int64(time.Minute), 0),
},
},
},
@@ -539,15 +544,15 @@ func testV1RatePrfRemoveRateProfileRates(t *testing.T) {
},
},
ActivationTimes: "* * 24 12 *",
IntervalRates: []*engine.IntervalRate{
IntervalRates: []*utils.IntervalRate{
{
IntervalStart: 0,
IntervalStart: utils.NewDecimal(0, 0),
},
},
},
},
}
var rply *engine.RateProfile
var rply *utils.RateProfile
if err := ratePrfRpc.Call(utils.APIerSv1GetRateProfile,
utils.TenantIDWithAPIOpts{TenantID: &utils.TenantID{Tenant: "cgrates.org", ID: "SpecialRate"}}, &rply); err != nil {
t.Fatal(err)
@@ -566,7 +571,7 @@ func testV1RatePrfRemoveRateProfileRates(t *testing.T) {
t.Errorf("Expecting: %+v, received: %+v", utils.OK, reply)
}
rPrfUpdated2 := &engine.RateProfile{
rPrfUpdated2 := &utils.RateProfile{
Tenant: "cgrates.org",
ID: "SpecialRate",
FilterIDs: []string{"*string:~*req.Subject:1001"},
@@ -576,9 +581,9 @@ func testV1RatePrfRemoveRateProfileRates(t *testing.T) {
},
},
MaxCostStrategy: "*free",
Rates: map[string]*engine.Rate{},
Rates: map[string]*utils.Rate{},
}
var rply2 *engine.RateProfile
var rply2 *utils.RateProfile
if err := ratePrfRpc.Call(utils.APIerSv1GetRateProfile,
utils.TenantIDWithAPIOpts{TenantID: &utils.TenantID{Tenant: "cgrates.org", ID: "SpecialRate"}}, &rply2); err != nil {
t.Fatal(err)
@@ -604,7 +609,7 @@ func testV1RatePrfStopEngine(t *testing.T) {
}
func testV1RateGetRemoveRateProfileWithoutTenant(t *testing.T) {
rateProfile := &engine.RateProfile{
rateProfile := &utils.RateProfile{
ID: "RPWithoutTenant",
FilterIDs: []string{"*string:~*req.Subject:1001"},
Weights: utils.DynamicWeights{
@@ -613,7 +618,7 @@ func testV1RateGetRemoveRateProfileWithoutTenant(t *testing.T) {
},
},
MaxCostStrategy: "*free",
Rates: map[string]*engine.Rate{
Rates: map[string]*utils.Rate{
"RT_WEEK": {
ID: "RT_WEEK",
Weights: utils.DynamicWeights{
@@ -622,9 +627,9 @@ func testV1RateGetRemoveRateProfileWithoutTenant(t *testing.T) {
},
},
ActivationTimes: "* * * * 1-5",
IntervalRates: []*engine.IntervalRate{
IntervalRates: []*utils.IntervalRate{
{
IntervalStart: 0,
IntervalStart: utils.NewDecimal(0, 0),
},
},
},
@@ -633,20 +638,22 @@ func testV1RateGetRemoveRateProfileWithoutTenant(t *testing.T) {
if *encoding == utils.MetaGOB {
rateProfile.Rates["RT_WEEK"].FilterIDs = nil
}
apiRPrf := &engine.APIRateProfileWithOpts{
APIRateProfile: &engine.APIRateProfile{
ID: "RPWithoutTenant",
FilterIDs: []string{"*string:~*req.Subject:1001"},
Weights: ";0",
MaxCostStrategy: "*free",
Rates: map[string]*engine.APIRate{
"RT_WEEK": {
ID: "RT_WEEK",
Weights: ";0",
ActivationTimes: "* * * * 1-5",
IntervalRates: []*engine.APIIntervalRate{
{
IntervalStart: "0",
apiRPrf := &APIRateProfileWithCache{
APIRateProfileWithOpts: &utils.APIRateProfileWithOpts{
APIRateProfile: &utils.APIRateProfile{
ID: "RPWithoutTenant",
FilterIDs: []string{"*string:~*req.Subject:1001"},
Weights: ";0",
MaxCostStrategy: "*free",
Rates: map[string]*utils.APIRate{
"RT_WEEK": {
ID: "RT_WEEK",
Weights: ";0",
ActivationTimes: "* * * * 1-5",
IntervalRates: []*utils.APIIntervalRate{
{
IntervalStart: "0",
},
},
},
},
@@ -659,7 +666,7 @@ func testV1RateGetRemoveRateProfileWithoutTenant(t *testing.T) {
} else if reply != utils.OK {
t.Error("Unexpected reply returned", reply)
}
var result *engine.RateProfile
var result *utils.RateProfile
rateProfile.Tenant = "cgrates.org"
if err := ratePrfRpc.Call(utils.APIerSv1GetRateProfile,
&utils.TenantIDWithAPIOpts{TenantID: &utils.TenantID{ID: "RPWithoutTenant"}},
@@ -679,7 +686,7 @@ func testV1RatePrfRemoveRateProfileWithoutTenant(t *testing.T) {
} else if reply != utils.OK {
t.Error("Unexpected reply returned", reply)
}
var result *engine.RateProfile
var result *utils.RateProfile
if err := ratePrfRpc.Call(utils.APIerSv1GetRateProfile,
&utils.TenantIDWithAPIOpts{TenantID: &utils.TenantID{ID: "RPWithoutTenant"}},
&result); err == nil || err.Error() != utils.ErrNotFound.Error() {
@@ -725,7 +732,7 @@ func testV1RatePrfGetRateProfileIDsCount(t *testing.T) {
}
func testV1RatePrfGetRateProfileRatesWithoutTenant(t *testing.T) {
rPrf := &engine.RateProfile{
rPrf := &utils.RateProfile{
ID: "SpecialRate",
FilterIDs: []string{"*string:~*req.Subject:1001"},
Weights: utils.DynamicWeights{
@@ -734,7 +741,7 @@ func testV1RatePrfGetRateProfileRatesWithoutTenant(t *testing.T) {
},
},
MaxCostStrategy: "*free",
Rates: map[string]*engine.Rate{
Rates: map[string]*utils.Rate{
"RT_WEEK": {
ID: "RT_WEEK",
Weights: utils.DynamicWeights{
@@ -764,27 +771,29 @@ func testV1RatePrfGetRateProfileRatesWithoutTenant(t *testing.T) {
},
},
}
apiRPrf := &engine.APIRateProfileWithOpts{
APIRateProfile: &engine.APIRateProfile{
ID: "SpecialRate",
FilterIDs: []string{"*string:~*req.Subject:1001"},
Weights: ";0",
MaxCostStrategy: "*free",
Rates: map[string]*engine.APIRate{
"RT_WEEK": {
ID: "RT_WEEK",
Weights: ";0",
ActivationTimes: "* * * * 1-5",
},
"RT_WEEKEND": {
ID: "RT_WEEKEND",
Weights: ";10",
ActivationTimes: "* * * * 0,6",
},
"RT_CHRISTMAS": {
ID: "RT_CHRISTMAS",
Weights: ";30",
ActivationTimes: "* * 24 12 *",
apiRPrf := &APIRateProfileWithCache{
APIRateProfileWithOpts: &utils.APIRateProfileWithOpts{
APIRateProfile: &utils.APIRateProfile{
ID: "SpecialRate",
FilterIDs: []string{"*string:~*req.Subject:1001"},
Weights: ";0",
MaxCostStrategy: "*free",
Rates: map[string]*utils.APIRate{
"RT_WEEK": {
ID: "RT_WEEK",
Weights: ";0",
ActivationTimes: "* * * * 1-5",
},
"RT_WEEKEND": {
ID: "RT_WEEKEND",
Weights: ";10",
ActivationTimes: "* * * * 0,6",
},
"RT_CHRISTMAS": {
ID: "RT_CHRISTMAS",
Weights: ";30",
ActivationTimes: "* * 24 12 *",
},
},
},
},
@@ -801,7 +810,7 @@ func testV1RatePrfGetRateProfileRatesWithoutTenant(t *testing.T) {
t.Error("Unexpected reply returned", reply)
}
rPrf.Tenant = "cgrates.org"
var rply *engine.RateProfile
var rply *utils.RateProfile
if err := ratePrfRpc.Call(utils.APIerSv1GetRateProfile,
utils.TenantIDWithAPIOpts{TenantID: &utils.TenantID{ID: "SpecialRate"}},
&rply); err != nil {
@@ -831,7 +840,7 @@ func testV1RateCostForEventWithDefault(t *testing.T) {
if err != nil {
t.Error(err)
}
rate1 := &engine.Rate{
rate1 := &utils.Rate{
ID: "RATE1",
Weights: utils.DynamicWeights{
{
@@ -839,43 +848,45 @@ func testV1RateCostForEventWithDefault(t *testing.T) {
},
},
ActivationTimes: "* * * * *",
IntervalRates: []*engine.IntervalRate{
IntervalRates: []*utils.IntervalRate{
{
IntervalStart: 0,
IntervalStart: utils.NewDecimal(0, 0),
RecurrentFee: utils.NewDecimal(12, 2),
Unit: minDecimal,
Increment: minDecimal,
},
{
IntervalStart: time.Minute,
IntervalStart: utils.NewDecimal(int64(time.Minute), 0),
RecurrentFee: utils.NewDecimal(6, 2),
Unit: minDecimal,
Increment: secDecimal,
},
},
}
rPrf := &engine.APIRateProfileWithOpts{
APIRateProfile: &engine.APIRateProfile{
ID: "DefaultRate",
FilterIDs: []string{"*string:~*req.Subject:1001"},
Weights: ";10",
Rates: map[string]*engine.APIRate{
"RATE1": &engine.APIRate{
ID: "RATE1",
Weights: ";0",
ActivationTimes: "* * * * *",
IntervalRates: []*engine.APIIntervalRate{
{
IntervalStart: "0",
RecurrentFee: utils.Float64Pointer(0.12),
Unit: utils.Float64Pointer(60000000000),
Increment: utils.Float64Pointer(60000000000),
},
{
IntervalStart: "1m",
RecurrentFee: utils.Float64Pointer(0.06),
Unit: utils.Float64Pointer(60000000000),
Increment: utils.Float64Pointer(1000000000),
rPrf := &APIRateProfileWithCache{
APIRateProfileWithOpts: &utils.APIRateProfileWithOpts{
APIRateProfile: &utils.APIRateProfile{
ID: "DefaultRate",
FilterIDs: []string{"*string:~*req.Subject:1001"},
Weights: ";10",
Rates: map[string]*utils.APIRate{
"RATE1": &utils.APIRate{
ID: "RATE1",
Weights: ";0",
ActivationTimes: "* * * * *",
IntervalRates: []*utils.APIIntervalRate{
{
IntervalStart: "0",
RecurrentFee: utils.Float64Pointer(0.12),
Unit: utils.Float64Pointer(60000000000),
Increment: utils.Float64Pointer(60000000000),
},
{
IntervalStart: "1m",
RecurrentFee: utils.Float64Pointer(0.06),
Unit: utils.Float64Pointer(60000000000),
Increment: utils.Float64Pointer(1000000000),
},
},
},
},
@@ -889,7 +900,7 @@ func testV1RateCostForEventWithDefault(t *testing.T) {
t.Error("Unexpected reply returned", reply)
}
var rply *engine.RateProfileCost
var rply *utils.RateProfileCost
argsRt := &utils.ArgsCostForEvent{
CGREvent: &utils.CGREvent{
Tenant: "cgrates.org",
@@ -899,14 +910,14 @@ func testV1RateCostForEventWithDefault(t *testing.T) {
},
},
}
exp := &engine.RateProfileCost{
exp := &utils.RateProfileCost{
ID: "DefaultRate",
Cost: 0.12,
RateSIntervals: []*engine.RateSInterval{{
UsageStart: 0,
Increments: []*engine.RateSIncrement{{
UsageStart: 0,
Usage: time.Minute,
RateSIntervals: []*utils.RateSInterval{{
IntervalStart: utils.NewDecimal(0, 0),
Increments: []*utils.RateSIncrement{{
IncrementStart: utils.NewDecimal(0, 0),
Usage: utils.NewDecimal(int64(time.Minute), 0),
Rate: rate1,
IntervalRateIndex: 0,
CompressFactor: 1,
@@ -930,7 +941,7 @@ func testV1RateCostForEventWithUsage(t *testing.T) {
if err != nil {
t.Error(err)
}
var rply *engine.RateProfileCost
var rply *utils.RateProfileCost
argsRt := &utils.ArgsCostForEvent{
CGREvent: &utils.CGREvent{
Tenant: "cgrates.org",
@@ -943,7 +954,7 @@ func testV1RateCostForEventWithUsage(t *testing.T) {
},
},
}
rate1 := &engine.Rate{
rate1 := &utils.Rate{
ID: "RATE1",
Weights: utils.DynamicWeights{
{
@@ -951,38 +962,38 @@ func testV1RateCostForEventWithUsage(t *testing.T) {
},
},
ActivationTimes: "* * * * *",
IntervalRates: []*engine.IntervalRate{
IntervalRates: []*utils.IntervalRate{
{
IntervalStart: 0,
IntervalStart: utils.NewDecimal(0, 0),
RecurrentFee: utils.NewDecimal(12, 2),
Unit: minDecimal,
Increment: minDecimal,
},
{
IntervalStart: time.Minute,
IntervalStart: utils.NewDecimal(int64(time.Minute), 0),
RecurrentFee: utils.NewDecimal(6, 2),
Unit: minDecimal,
Increment: secDecimal,
},
},
}
exp := &engine.RateProfileCost{
exp := &utils.RateProfileCost{
ID: "DefaultRate",
Cost: 0.19,
RateSIntervals: []*engine.RateSInterval{
RateSIntervals: []*utils.RateSInterval{
{
UsageStart: 0,
Increments: []*engine.RateSIncrement{
IntervalStart: utils.NewDecimal(0, 0),
Increments: []*utils.RateSIncrement{
{
UsageStart: 0,
Usage: time.Minute,
IncrementStart: utils.NewDecimal(0, 0),
Usage: utils.NewDecimal(int64(time.Minute), 0),
Rate: rate1,
IntervalRateIndex: 0,
CompressFactor: 1,
},
{
UsageStart: time.Minute,
Usage: time.Minute + 10*time.Second,
IncrementStart: utils.NewDecimal(int64(time.Minute), 0),
Usage: utils.NewDecimal(int64(time.Minute+10*time.Second), 0),
Rate: rate1,
IntervalRateIndex: 1,
CompressFactor: 70,
@@ -1011,23 +1022,23 @@ func testV1RateCostForEventWithUsage(t *testing.T) {
},
},
}
exp2 := &engine.RateProfileCost{
exp2 := &utils.RateProfileCost{
ID: "DefaultRate",
Cost: 15.075,
RateSIntervals: []*engine.RateSInterval{
RateSIntervals: []*utils.RateSInterval{
{
UsageStart: 0,
Increments: []*engine.RateSIncrement{
IntervalStart: utils.NewDecimal(0, 0),
Increments: []*utils.RateSIncrement{
{
UsageStart: 0,
Usage: time.Minute,
IncrementStart: utils.NewDecimal(0, 0),
Usage: utils.NewDecimal(int64(time.Minute), 0),
Rate: rate1,
IntervalRateIndex: 0,
CompressFactor: 1,
},
{
UsageStart: time.Minute,
Usage: 4*time.Hour + 9*time.Minute + 15*time.Second,
IncrementStart: utils.NewDecimal(int64(time.Minute), 0),
Usage: utils.NewDecimal(int64(4*time.Hour+9*time.Minute+15*time.Second), 0),
Rate: rate1,
IntervalRateIndex: 1,
CompressFactor: 14955,
@@ -1045,7 +1056,7 @@ func testV1RateCostForEventWithUsage(t *testing.T) {
}
func testV1RateCostForEventWithWrongUsage(t *testing.T) {
var rply *engine.RateProfileCost
var rply *utils.RateProfileCost
argsRt := &utils.ArgsCostForEvent{
CGREvent: &utils.CGREvent{
Tenant: "cgrates.org",
@@ -1059,7 +1070,7 @@ func testV1RateCostForEventWithWrongUsage(t *testing.T) {
},
}
if err := ratePrfRpc.Call(utils.RateSv1CostForEvent, &argsRt, &rply); err == nil ||
err.Error() != "SERVER_ERROR: time: invalid duration \"wrongUsage\"" {
err.Error() != "SERVER_ERROR: can't convert <wrongUsage> to decimal" {
t.Errorf("Expected %+v \n, received %+v", "SERVER_ERROR: time: invalid duration \"wrongUsage\"", err)
}
}
@@ -1073,7 +1084,7 @@ func testV1RateCostForEventWithStartTime(t *testing.T) {
if err != nil {
t.Error(err)
}
rate1 := &engine.Rate{
rate1 := &utils.Rate{
ID: "RATE1",
Weights: utils.DynamicWeights{
{
@@ -1081,15 +1092,15 @@ func testV1RateCostForEventWithStartTime(t *testing.T) {
},
},
ActivationTimes: "* * * * *",
IntervalRates: []*engine.IntervalRate{
IntervalRates: []*utils.IntervalRate{
{
IntervalStart: 0,
IntervalStart: utils.NewDecimal(0, 0),
RecurrentFee: utils.NewDecimal(12, 2),
Unit: minDecimal,
Increment: minDecimal,
},
{
IntervalStart: time.Minute,
IntervalStart: utils.NewDecimal(int64(time.Minute), 0),
RecurrentFee: utils.NewDecimal(6, 2),
Unit: minDecimal,
Increment: secDecimal,
@@ -1097,7 +1108,7 @@ func testV1RateCostForEventWithStartTime(t *testing.T) {
},
}
var rply *engine.RateProfileCost
var rply *utils.RateProfileCost
argsRt := &utils.ArgsCostForEvent{
CGREvent: &utils.CGREvent{
Tenant: "cgrates.org",
@@ -1110,16 +1121,16 @@ func testV1RateCostForEventWithStartTime(t *testing.T) {
},
},
}
exp := &engine.RateProfileCost{
exp := &utils.RateProfileCost{
ID: "DefaultRate",
Cost: 0.12,
RateSIntervals: []*engine.RateSInterval{
RateSIntervals: []*utils.RateSInterval{
{
UsageStart: 0,
Increments: []*engine.RateSIncrement{
IntervalStart: utils.NewDecimal(0, 0),
Increments: []*utils.RateSIncrement{
{
UsageStart: 0,
Usage: time.Minute,
IncrementStart: utils.NewDecimal(0, 0),
Usage: utils.NewDecimal(int64(time.Minute), 0),
Rate: rate1,
IntervalRateIndex: 0,
CompressFactor: 1,
@@ -1155,7 +1166,7 @@ func testV1RateCostForEventWithStartTime(t *testing.T) {
}
func testV1RateCostForEventWithWrongStartTime(t *testing.T) {
var rply *engine.RateProfileCost
var rply *utils.RateProfileCost
argsRt := &utils.ArgsCostForEvent{
CGREvent: &utils.CGREvent{
Tenant: "cgrates.org",
@@ -1183,7 +1194,7 @@ func testV1RateCostForEventWithOpts(t *testing.T) {
if err != nil {
t.Error(err)
}
var rply *engine.RateProfileCost
var rply *utils.RateProfileCost
argsRt := &utils.ArgsCostForEvent{
CGREvent: &utils.CGREvent{
Tenant: "cgrates.org",
@@ -1197,7 +1208,7 @@ func testV1RateCostForEventWithOpts(t *testing.T) {
},
},
}
rate1 := &engine.Rate{
rate1 := &utils.Rate{
ID: "RATE1",
Weights: utils.DynamicWeights{
{
@@ -1205,38 +1216,38 @@ func testV1RateCostForEventWithOpts(t *testing.T) {
},
},
ActivationTimes: "* * * * *",
IntervalRates: []*engine.IntervalRate{
IntervalRates: []*utils.IntervalRate{
{
IntervalStart: 0,
IntervalStart: utils.NewDecimal(0, 0),
RecurrentFee: utils.NewDecimal(12, 2),
Unit: minDecimal,
Increment: minDecimal,
},
{
IntervalStart: time.Minute,
IntervalStart: utils.NewDecimal(int64(time.Minute), 0),
RecurrentFee: utils.NewDecimal(6, 2),
Unit: minDecimal,
Increment: secDecimal,
},
},
}
exp := &engine.RateProfileCost{
exp := &utils.RateProfileCost{
ID: "DefaultRate",
Cost: 0.19,
RateSIntervals: []*engine.RateSInterval{
RateSIntervals: []*utils.RateSInterval{
{
UsageStart: 0,
Increments: []*engine.RateSIncrement{
IntervalStart: utils.NewDecimal(0, 0),
Increments: []*utils.RateSIncrement{
{
UsageStart: 0,
Usage: time.Minute,
IncrementStart: utils.NewDecimal(0, 0),
Usage: utils.NewDecimal(int64(time.Minute), 0),
Rate: rate1,
IntervalRateIndex: 0,
CompressFactor: 1,
},
{
UsageStart: time.Minute,
Usage: time.Minute + 10*time.Second,
IncrementStart: utils.NewDecimal(int64(time.Minute), 0),
Usage: utils.NewDecimal(int64(time.Minute+10*time.Second), 0),
Rate: rate1,
IntervalRateIndex: 1,
CompressFactor: 70,
@@ -1266,23 +1277,23 @@ func testV1RateCostForEventWithOpts(t *testing.T) {
},
},
}
exp2 := &engine.RateProfileCost{
exp2 := &utils.RateProfileCost{
ID: "DefaultRate",
Cost: 15.075,
RateSIntervals: []*engine.RateSInterval{
RateSIntervals: []*utils.RateSInterval{
{
UsageStart: 0,
Increments: []*engine.RateSIncrement{
IntervalStart: utils.NewDecimal(0, 0),
Increments: []*utils.RateSIncrement{
{
UsageStart: 0,
Usage: time.Minute,
IncrementStart: utils.NewDecimal(0, 0),
Usage: utils.NewDecimal(int64(time.Minute), 0),
Rate: rate1,
IntervalRateIndex: 0,
CompressFactor: 1,
},
{
UsageStart: time.Minute,
Usage: 4*time.Hour + 9*time.Minute + 15*time.Second,
IncrementStart: utils.NewDecimal(int64(time.Minute), 0),
Usage: utils.NewDecimal(int64(4*time.Hour+9*time.Minute+15*time.Second), 0),
Rate: rate1,
IntervalRateIndex: 1,
CompressFactor: 14955,

View File

@@ -664,14 +664,14 @@ func testInternalRemoteITGetDispatcherHost(t *testing.T) {
}
func testInternalRemoteITGetRateProfile(t *testing.T) {
var rcv *engine.RateProfile
var rcv *utils.RateProfile
if err := internalRPC.Call(utils.APIerSv1GetRateProfile,
&utils.TenantIDWithAPIOpts{TenantID: &utils.TenantID{Tenant: "cgrates.org", ID: "RP1"}},
&rcv); err == nil || err.Error() != utils.ErrNotFound.Error() {
t.Error(err)
}
rPrf := &engine.RateProfile{
rPrf := &utils.RateProfile{
Tenant: "cgrates.org",
ID: "RP1",
FilterIDs: []string{"*string:~*req.Subject:1001"},
@@ -681,7 +681,7 @@ func testInternalRemoteITGetRateProfile(t *testing.T) {
},
},
MaxCostStrategy: "*free",
Rates: map[string]*engine.Rate{
Rates: map[string]*utils.Rate{
"RT_WEEK": {
ID: "RT_WEEK",
Weights: utils.DynamicWeights{
@@ -711,28 +711,30 @@ func testInternalRemoteITGetRateProfile(t *testing.T) {
},
},
}
apiRPrf := &engine.APIRateProfileWithOpts{
APIRateProfile: &engine.APIRateProfile{
Tenant: "cgrates.org",
ID: "RP1",
FilterIDs: []string{"*string:~*req.Subject:1001"},
Weights: ";0",
MaxCostStrategy: "*free",
Rates: map[string]*engine.APIRate{
"RT_WEEK": {
ID: "RT_WEEK",
Weights: ";0",
ActivationTimes: "* * * * 1-5",
},
"RT_WEEKEND": {
ID: "RT_WEEKEND",
Weights: ";10",
ActivationTimes: "* * * * 0,6",
},
"RT_CHRISTMAS": {
ID: "RT_CHRISTMAS",
Weights: ";30",
ActivationTimes: "* * 24 12 *",
apiRPrf := &APIRateProfileWithCache{
APIRateProfileWithOpts: &utils.APIRateProfileWithOpts{
APIRateProfile: &utils.APIRateProfile{
Tenant: "cgrates.org",
ID: "RP1",
FilterIDs: []string{"*string:~*req.Subject:1001"},
Weights: ";0",
MaxCostStrategy: "*free",
Rates: map[string]*utils.APIRate{
"RT_WEEK": {
ID: "RT_WEEK",
Weights: ";0",
ActivationTimes: "* * * * 1-5",
},
"RT_WEEKEND": {
ID: "RT_WEEKEND",
Weights: ";10",
ActivationTimes: "* * * * 0,6",
},
"RT_CHRISTMAS": {
ID: "RT_CHRISTMAS",
Weights: ";30",
ActivationTimes: "* * 24 12 *",
},
},
},
},
@@ -745,7 +747,7 @@ func testInternalRemoteITGetRateProfile(t *testing.T) {
t.Errorf("Expecting : %+v, received: %+v", utils.OK, reply)
}
var rPfrg *engine.RateProfile
var rPfrg *utils.RateProfile
if err := internalRPC.Call(utils.APIerSv1GetRateProfile,
&utils.TenantIDWithAPIOpts{TenantID: &utils.TenantID{Tenant: "cgrates.org", ID: "RP1"}},
&rPfrg); err != nil {

View File

@@ -1337,7 +1337,7 @@ func testInternalReplicateITThreshold(t *testing.T) {
func testInternalReplicateITRateProfile(t *testing.T) {
//set
rPrf := &engine.RateProfile{
rPrf := &utils.RateProfile{
Tenant: "cgrates.org",
ID: "RP1",
FilterIDs: []string{"*string:~*req.Subject:1001"},
@@ -1347,7 +1347,7 @@ func testInternalReplicateITRateProfile(t *testing.T) {
},
},
MaxCostStrategy: "*free",
Rates: map[string]*engine.Rate{
Rates: map[string]*utils.Rate{
"RT_WEEK": {
ID: "RT_WEEK",
Weights: utils.DynamicWeights{
@@ -1378,13 +1378,13 @@ func testInternalReplicateITRateProfile(t *testing.T) {
},
}
apiRPrf := &engine.APIRateProfile{
apiRPrf := &utils.APIRateProfile{
Tenant: "cgrates.org",
ID: "RP1",
FilterIDs: []string{"*string:~*req.Subject:1001"},
Weights: ";0",
MaxCostStrategy: "*free",
Rates: map[string]*engine.APIRate{
Rates: map[string]*utils.APIRate{
"RT_WEEK": {
ID: "RT_WEEK",
Weights: ";0",
@@ -1409,7 +1409,7 @@ func testInternalReplicateITRateProfile(t *testing.T) {
t.Error("Unexpected reply returned", result)
}
// check
var reply *engine.RateProfile
var reply *utils.RateProfile
if err := engineOneRPC.Call(utils.APIerSv1GetRateProfile,
utils.TenantIDWithAPIOpts{TenantID: &utils.TenantID{Tenant: rPrf.Tenant, ID: rPrf.ID}}, &reply); err != nil {
t.Fatal(err)

View File

@@ -25,8 +25,6 @@ import (
"testing"
"time"
"github.com/cgrates/cgrates/engine"
"github.com/cgrates/cgrates/utils"
)
@@ -83,17 +81,17 @@ func testDspRPrfPing(t *testing.T) {
}
func testDspRPrfCostForEvent(t *testing.T) {
rPrf := &engine.APIRateProfile{
rPrf := &utils.APIRateProfile{
ID: "DefaultRate",
Tenant: "cgrates.org",
FilterIDs: []string{"*string:~*req.Subject:1001"},
Weights: ";10",
Rates: map[string]*engine.APIRate{
Rates: map[string]*utils.APIRate{
"RT_WEEK": {
ID: "RT_WEEK",
Weights: ";0",
ActivationTimes: "* * * * *",
IntervalRates: []*engine.APIIntervalRate{
IntervalRates: []*utils.APIIntervalRate{
{
IntervalStart: "0",
RecurrentFee: utils.Float64Pointer(0.12),
@@ -110,7 +108,7 @@ func testDspRPrfCostForEvent(t *testing.T) {
} else if reply != utils.OK {
t.Errorf("Expected OK, received %+v", reply)
}
var rply *engine.RateProfile
var rply *utils.RateProfile
if err := allEngine.RPC.Call(utils.APIerSv1GetRateProfile, &utils.TenantID{
Tenant: "cgrates.org",
ID: "DefaultRate",
@@ -121,14 +119,14 @@ func testDspRPrfCostForEvent(t *testing.T) {
if err != nil {
t.Fatal(err)
}
exp := &engine.RateProfileCost{
exp := &utils.RateProfileCost{
ID: "DefaultRate",
Cost: 0.12,
RateSIntervals: []*engine.RateSInterval{{
UsageStart: 0,
Increments: []*engine.RateSIncrement{{
UsageStart: 0,
Usage: time.Minute,
RateSIntervals: []*utils.RateSInterval{{
IntervalStart: utils.NewDecimal(0, 0),
Increments: []*utils.RateSIncrement{{
IncrementStart: utils.NewDecimal(0, 0),
Usage: utils.NewDecimal(int64(time.Minute), 0),
Rate: rtWeek,
IntervalRateIndex: 0,
CompressFactor: 1,
@@ -137,7 +135,7 @@ func testDspRPrfCostForEvent(t *testing.T) {
}},
}
var rpCost *engine.RateProfileCost
var rpCost *utils.RateProfileCost
if err := dispEngine.RPC.Call(utils.RateSv1CostForEvent, &utils.ArgsCostForEvent{
CGREvent: &utils.CGREvent{
Tenant: "cgrates.org",
@@ -156,16 +154,16 @@ func testDspRPrfCostForEvent(t *testing.T) {
}
func testDspRPrfCostForEventWithoutFilters(t *testing.T) {
rPrf := &engine.APIRateProfile{
rPrf := &utils.APIRateProfile{
ID: "ID_RP",
Tenant: "cgrates.org",
Weights: ";10",
Rates: map[string]*engine.APIRate{
Rates: map[string]*utils.APIRate{
"RT_WEEK": {
ID: "RT_WEEK",
Weights: ";0",
ActivationTimes: "* * * * *",
IntervalRates: []*engine.APIIntervalRate{
IntervalRates: []*utils.APIIntervalRate{
{
IntervalStart: "0",
RecurrentFee: utils.Float64Pointer(0.25),
@@ -182,7 +180,7 @@ func testDspRPrfCostForEventWithoutFilters(t *testing.T) {
} else if reply != utils.OK {
t.Errorf("Expected OK, received %+v", reply)
}
var rply *engine.RateProfile
var rply *utils.RateProfile
if err := allEngine.RPC.Call(utils.APIerSv1GetRateProfile, &utils.TenantID{
Tenant: "cgrates.org",
ID: "ID_RP",
@@ -193,14 +191,14 @@ func testDspRPrfCostForEventWithoutFilters(t *testing.T) {
if err != nil {
t.Fatal(err)
}
exp := &engine.RateProfileCost{
exp := &utils.RateProfileCost{
ID: "ID_RP",
Cost: 0.25,
RateSIntervals: []*engine.RateSInterval{{
UsageStart: 0,
Increments: []*engine.RateSIncrement{{
UsageStart: 0,
Usage: time.Minute,
RateSIntervals: []*utils.RateSInterval{{
IntervalStart: utils.NewDecimal(0, 0),
Increments: []*utils.RateSIncrement{{
IncrementStart: utils.NewDecimal(0, 0),
Usage: utils.NewDecimal(int64(time.Minute), 0),
Rate: rtWeek,
IntervalRateIndex: 0,
CompressFactor: 60,
@@ -209,7 +207,7 @@ func testDspRPrfCostForEventWithoutFilters(t *testing.T) {
}},
}
var rpCost *engine.RateProfileCost
var rpCost *utils.RateProfileCost
if err := dispEngine.RPC.Call(utils.RateSv1CostForEvent, &utils.ArgsCostForEvent{
CGREvent: &utils.CGREvent{

View File

@@ -2185,7 +2185,7 @@ func testITTestIndexingMetaNot(t *testing.T) {
}
func testITIndexRateProfileRateIndexes(t *testing.T) {
rPrf := &RateProfile{
rPrf := &utils.RateProfile{
Tenant: "cgrates.org",
ID: "RP1",
FilterIDs: []string{"*string:~*req.Subject:1001", "*string:~*req.Subject:1002"},
@@ -2195,7 +2195,7 @@ func testITIndexRateProfileRateIndexes(t *testing.T) {
},
},
MaxCostStrategy: "*free",
Rates: map[string]*Rate{
Rates: map[string]*utils.Rate{
"FIRST_GI": {
ID: "FIRST_GI",
FilterIDs: []string{"*string:~*req.Category:call"},
@@ -2240,7 +2240,7 @@ func testITIndexRateProfileRateIndexes(t *testing.T) {
}
// update the RateProfile by adding a new Rate
rPrf = &RateProfile{ // recreate the profile because if we test on internal
rPrf = &utils.RateProfile{ // recreate the profile because if we test on internal
Tenant: "cgrates.org", // each update on the original item will update the item from DB
ID: "RP1",
FilterIDs: []string{"*string:~*req.Subject:1001", "*string:~*req.Subject:1002"},
@@ -2250,7 +2250,7 @@ func testITIndexRateProfileRateIndexes(t *testing.T) {
},
},
MaxCostStrategy: "*free",
Rates: map[string]*Rate{
Rates: map[string]*utils.Rate{
"FIRST_GI": {
ID: "FIRST_GI",
FilterIDs: []string{"*string:~*req.Category:call"},
@@ -2316,7 +2316,7 @@ func testITIndexRateProfileRateIndexes(t *testing.T) {
if err := dataManager.SetFilter(fltr, true); err != nil {
t.Error(err)
}
rPrf2 := &RateProfile{
rPrf2 := &utils.RateProfile{
Tenant: "cgrates.org",
ID: "RP2",
Weights: utils.DynamicWeights{
@@ -2325,7 +2325,7 @@ func testITIndexRateProfileRateIndexes(t *testing.T) {
},
},
MaxCostStrategy: "*free",
Rates: map[string]*Rate{
Rates: map[string]*utils.Rate{
"CUSTOM_RATE1": {
ID: "CUSTOM_RATE1",
FilterIDs: []string{"*string:~*req.Subject:1001", "FLTR"},
@@ -2442,12 +2442,12 @@ func testITIndexRateProfileIndexes(t *testing.T) {
if err := dataManager.SetFilter(fltr1, true); err != nil {
t.Error(err)
}
rPrf1 := &RateProfile{
rPrf1 := &utils.RateProfile{
Tenant: "cgrates.org",
ID: "RP1",
FilterIDs: []string{"*string:~*req.Subject:1004|1005", "FLTR"},
MaxCostStrategy: "*free",
Rates: map[string]*Rate{
Rates: map[string]*utils.Rate{
"CUSTOM1_RATE1": {
ID: "CUSTOM1_RATE1",
FilterIDs: []string{"*string:~*req.Subject:1001"},
@@ -2460,12 +2460,12 @@ func testITIndexRateProfileIndexes(t *testing.T) {
},
},
}
rPrf2 := &RateProfile{
rPrf2 := &utils.RateProfile{
Tenant: "cgrates.org",
ID: "RP2",
FilterIDs: []string{"*string:~*req.ToR:*sms|*voice", "*string:~*req.Subject:1004"},
MaxCostStrategy: "*free",
Rates: map[string]*Rate{
Rates: map[string]*utils.Rate{
"CUSTOM2_RATE1": {
ID: "CUSTOM2_RATE1",
FilterIDs: []string{"*string:~*req.Subject:1009"},

View File

@@ -2158,7 +2158,7 @@ func testOnStorITDispatcherProfile(t *testing.T) {
}
func testOnStorITRateProfile(t *testing.T) {
rPrf := &RateProfile{
rPrf := &utils.RateProfile{
Tenant: "cgrates.org",
ID: "RP1",
FilterIDs: []string{"*string:~*req.Subject:1001", "*string:~*req.Subject:1002"},
@@ -2168,7 +2168,7 @@ func testOnStorITRateProfile(t *testing.T) {
},
},
MaxCostStrategy: "*free",
Rates: map[string]*Rate{
Rates: map[string]*utils.Rate{
"FIRST_GI": {
ID: "FIRST_GI",
FilterIDs: []string{"*gi:~*req.Usage:0"},

View File

@@ -365,7 +365,7 @@ func testExpVerifyRoutes(t *testing.T) {
}
func testExpVerifyRateProfiles(t *testing.T) {
var reply *engine.RateProfile
var reply *utils.RateProfile
minDecimal, err := utils.NewDecimalFromUsage("1m")
if err != nil {
t.Error(err)
@@ -375,7 +375,7 @@ func testExpVerifyRateProfiles(t *testing.T) {
t.Error(err)
}
splPrf := &engine.RateProfile{
splPrf := &utils.RateProfile{
Tenant: "cgrates.org",
ID: "RT_SPECIAL_1002",
FilterIDs: []string{"*string:~*req.Account:1002"},
@@ -388,7 +388,7 @@ func testExpVerifyRateProfiles(t *testing.T) {
MinCost: utils.NewDecimal(0, 0),
MaxCost: utils.NewDecimal(0, 0),
MaxCostStrategy: utils.MetaMaxCostFree,
Rates: map[string]*engine.Rate{
Rates: map[string]*utils.Rate{
"RT_ALWAYS": {
ID: "RT_ALWAYS",
FilterIDs: nil,
@@ -399,9 +399,9 @@ func testExpVerifyRateProfiles(t *testing.T) {
},
},
Blocker: false,
IntervalRates: []*engine.IntervalRate{
IntervalRates: []*utils.IntervalRate{
{
IntervalStart: 0 * time.Second,
IntervalStart: utils.NewDecimal(int64(0*time.Second), 0),
RecurrentFee: utils.NewDecimal(1, 2),
Unit: minDecimal,
Increment: secDecimal,

View File

@@ -1342,28 +1342,30 @@ func testFltrRplDispatcherHost(t *testing.T) {
func testFltrRplRateProfile(t *testing.T) {
rpID := "RP1"
rpPrf := &engine.APIRateProfileWithOpts{
APIRateProfile: &engine.APIRateProfile{
Tenant: "cgrates.org",
ID: rpID,
FilterIDs: []string{"*string:~*req.Account:dan"},
Weights: ";0",
MaxCostStrategy: "*free",
Rates: map[string]*engine.APIRate{
"RT_WEEK": {
ID: "RT_WEEK",
Weights: ";0",
ActivationTimes: "* * * * 1-5",
IntervalRates: []*engine.APIIntervalRate{
{
IntervalStart: "0",
rpPrf := &v1.APIRateProfileWithCache{
APIRateProfileWithOpts: &utils.APIRateProfileWithOpts{
APIRateProfile: &utils.APIRateProfile{
Tenant: "cgrates.org",
ID: rpID,
FilterIDs: []string{"*string:~*req.Account:dan"},
Weights: ";0",
MaxCostStrategy: "*free",
Rates: map[string]*utils.APIRate{
"RT_WEEK": {
ID: "RT_WEEK",
Weights: ";0",
ActivationTimes: "* * * * 1-5",
IntervalRates: []*utils.APIIntervalRate{
{
IntervalStart: "0",
},
},
},
},
},
},
}
expPrf := &engine.RateProfile{
expPrf := &utils.RateProfile{
Tenant: "cgrates.org",
ID: rpID,
FilterIDs: []string{"*string:~*req.Account:dan"},
@@ -1373,7 +1375,7 @@ func testFltrRplRateProfile(t *testing.T) {
},
},
MaxCostStrategy: "*free",
Rates: map[string]*engine.Rate{
Rates: map[string]*utils.Rate{
"RT_WEEK": {
ID: "RT_WEEK",
Weights: utils.DynamicWeights{
@@ -1382,16 +1384,16 @@ func testFltrRplRateProfile(t *testing.T) {
},
},
ActivationTimes: "* * * * 1-5",
IntervalRates: []*engine.IntervalRate{
IntervalRates: []*utils.IntervalRate{
{
IntervalStart: 0,
IntervalStart: utils.NewDecimal(0, 0),
},
},
},
},
}
var result string
var replyPrfl *engine.RateProfile
var replyPrfl *utils.RateProfile
var rplyIDs []string
// empty
if err := fltrRplEngine1RPC.Call(utils.APIerSv1GetRateProfileIDs, &utils.PaginatorWithTenant{}, &rplyIDs); err == nil ||

View File

@@ -185,7 +185,7 @@ func testRatePrfITMigrateAndMove(t *testing.T) {
if err != nil {
t.Error(err)
}
rPrf := &engine.RateProfile{
rPrf := &utils.RateProfile{
Tenant: "cgrates.org",
ID: "RP1",
FilterIDs: []string{"*string:~*req.Subject:1001"},
@@ -197,7 +197,7 @@ func testRatePrfITMigrateAndMove(t *testing.T) {
MinCost: utils.NewDecimal(1, 1),
MaxCost: utils.NewDecimal(6, 1),
MaxCostStrategy: "*free",
Rates: map[string]*engine.Rate{
Rates: map[string]*utils.Rate{
"FIRST_GI": {
ID: "FIRST_GI",
FilterIDs: []string{"*gi:~*req.Usage:0"},
@@ -206,7 +206,7 @@ func testRatePrfITMigrateAndMove(t *testing.T) {
Weight: 0,
},
},
IntervalRates: []*engine.IntervalRate{
IntervalRates: []*utils.IntervalRate{
{
RecurrentFee: utils.NewDecimal(12, 2),
Unit: minDec,
@@ -223,7 +223,7 @@ func testRatePrfITMigrateAndMove(t *testing.T) {
Weight: 10,
},
},
IntervalRates: []*engine.IntervalRate{
IntervalRates: []*utils.IntervalRate{
{
RecurrentFee: utils.NewDecimal(6, 2),
Unit: minDec,