In case of AttributeS Replacing CGREvent with *CGRevent when inherited

This commit is contained in:
TeoV
2019-05-24 16:24:10 +03:00
committed by Dan Christian Bogos
parent 4020ade647
commit 6ebdb4bbdf
12 changed files with 74 additions and 71 deletions

View File

@@ -162,7 +162,7 @@ func testAttributeSLoadFromFolder(t *testing.T) {
func testAttributeSGetAttributeForEvent(t *testing.T) {
ev := &engine.AttrArgsProcessEvent{
Context: utils.StringPointer(utils.MetaSessionS),
CGREvent: utils.CGREvent{
CGREvent: &utils.CGREvent{
Tenant: "cgrates.org",
ID: "testAttributeSGetAttributeForEvent",
Event: map[string]interface{}{
@@ -215,7 +215,7 @@ func testAttributeSGetAttributeForEvent(t *testing.T) {
func testAttributeSGetAttributeForEventNotFound(t *testing.T) {
ev := &engine.AttrArgsProcessEvent{
Context: utils.StringPointer(utils.MetaCDRs),
CGREvent: utils.CGREvent{
CGREvent: &utils.CGREvent{
Tenant: "cgrates.org",
ID: "testAttributeSGetAttributeForEventWihMetaAnyContext",
Event: map[string]interface{}{
@@ -267,7 +267,7 @@ func testAttributeSGetAttributeForEventNotFound(t *testing.T) {
func testAttributeSGetAttributeForEventWithMetaAnyContext(t *testing.T) {
ev := &engine.AttrArgsProcessEvent{
Context: utils.StringPointer(utils.MetaCDRs),
CGREvent: utils.CGREvent{
CGREvent: &utils.CGREvent{
Tenant: "cgrates.org",
ID: "testAttributeSGetAttributeForEventWihMetaAnyContext",
Event: map[string]interface{}{
@@ -323,7 +323,7 @@ func testAttributeSGetAttributeForEventWithMetaAnyContext(t *testing.T) {
func testAttributeSProcessEvent(t *testing.T) {
ev := &engine.AttrArgsProcessEvent{
Context: utils.StringPointer(utils.MetaSessionS),
CGREvent: utils.CGREvent{
CGREvent: &utils.CGREvent{
Tenant: "cgrates.org",
ID: "testAttributeSProcessEvent",
Event: map[string]interface{}{
@@ -372,7 +372,7 @@ func testAttributeSProcessEvent(t *testing.T) {
func testAttributeSProcessEventNotFound(t *testing.T) {
ev := &engine.AttrArgsProcessEvent{
Context: utils.StringPointer(utils.MetaSessionS),
CGREvent: utils.CGREvent{
CGREvent: &utils.CGREvent{
Tenant: "cgrates.org",
ID: "testAttributeSProcessEventNotFound",
Event: map[string]interface{}{
@@ -392,7 +392,7 @@ func testAttributeSProcessEventNotFound(t *testing.T) {
func testAttributeSProcessEventMissing(t *testing.T) {
ev := &engine.AttrArgsProcessEvent{
Context: utils.StringPointer(utils.MetaSessionS),
CGREvent: utils.CGREvent{
CGREvent: &utils.CGREvent{
Tenant: "cgrates.org",
ID: "testAttributeSProcessEvent",
Event: map[string]interface{}{
@@ -413,7 +413,7 @@ func testAttributeSProcessEventMissing(t *testing.T) {
func testAttributeSProcessEventWithNoneSubstitute(t *testing.T) {
ev := &engine.AttrArgsProcessEvent{
Context: utils.StringPointer(utils.MetaSessionS),
CGREvent: utils.CGREvent{
CGREvent: &utils.CGREvent{
Tenant: "cgrates.org",
ID: "testAttributeSWithNoneSubstitute",
Event: map[string]interface{}{
@@ -479,7 +479,7 @@ func testAttributeSProcessEventWithNoneSubstitute(t *testing.T) {
func testAttributeSProcessEventWithNoneSubstitute2(t *testing.T) {
ev := &engine.AttrArgsProcessEvent{
Context: utils.StringPointer(utils.MetaSessionS),
CGREvent: utils.CGREvent{
CGREvent: &utils.CGREvent{
Tenant: "cgrates.org",
ID: "testAttributeSWithNoneSubstitute",
Event: map[string]interface{}{
@@ -557,7 +557,7 @@ func testAttributeSProcessEventWithNoneSubstitute2(t *testing.T) {
func testAttributeSProcessEventWithNoneSubstitute3(t *testing.T) {
ev := &engine.AttrArgsProcessEvent{
Context: utils.StringPointer(utils.MetaSessionS),
CGREvent: utils.CGREvent{
CGREvent: &utils.CGREvent{
Tenant: "cgrates.org",
ID: "testAttributeSWithNoneSubstitute",
Event: map[string]interface{}{
@@ -650,7 +650,7 @@ func testAttributeSProcessEventWithHeader(t *testing.T) {
attrArgs := &engine.AttrArgsProcessEvent{
ProcessRuns: utils.IntPointer(1),
Context: utils.StringPointer(utils.MetaSessionS),
CGREvent: utils.CGREvent{
CGREvent: &utils.CGREvent{
Tenant: config.CgrConfig().GeneralCfg().DefaultTenant,
ID: "HeaderEventForAttribute",
Event: map[string]interface{}{
@@ -933,7 +933,7 @@ func testAttributeSProcessEventWithSearchAndReplace(t *testing.T) {
attrArgs := &engine.AttrArgsProcessEvent{
ProcessRuns: utils.IntPointer(1),
Context: utils.StringPointer(utils.MetaSessionS),
CGREvent: utils.CGREvent{
CGREvent: &utils.CGREvent{
Tenant: config.CgrConfig().GeneralCfg().DefaultTenant,
ID: "HeaderEventForAttribute",
Event: map[string]interface{}{
@@ -1037,7 +1037,7 @@ func testAttributeSProcessWithMultipleRuns(t *testing.T) {
attrArgs := &engine.AttrArgsProcessEvent{
Context: utils.StringPointer(utils.MetaSessionS),
ProcessRuns: utils.IntPointer(4),
CGREvent: utils.CGREvent{
CGREvent: &utils.CGREvent{
Tenant: config.CgrConfig().GeneralCfg().DefaultTenant,
ID: utils.GenUUID(),
Event: map[string]interface{}{
@@ -1147,7 +1147,7 @@ func testAttributeSProcessWithMultipleRuns2(t *testing.T) {
attrArgs := &engine.AttrArgsProcessEvent{
Context: utils.StringPointer(utils.MetaSessionS),
ProcessRuns: utils.IntPointer(4),
CGREvent: utils.CGREvent{
CGREvent: &utils.CGREvent{
Tenant: config.CgrConfig().GeneralCfg().DefaultTenant,
ID: utils.GenUUID(),
Event: map[string]interface{}{

View File

@@ -26,8 +26,8 @@ import (
)
// GetChargerProfile returns a Charger Profile
func (apierV1 *ApierV1) GetChargerProfile(arg utils.TenantID, reply *engine.ChargerProfile) error {
if missing := utils.MissingStructFields(&arg, []string{"Tenant", "ID"}); len(missing) != 0 { //Params missing
func (apierV1 *ApierV1) GetChargerProfile(arg *utils.TenantID, reply *engine.ChargerProfile) error {
if missing := utils.MissingStructFields(arg, []string{"Tenant", "ID"}); len(missing) != 0 { //Params missing
return utils.NewErrMandatoryIeMissing(missing...)
}
if cpp, err := apierV1.DataManager.GetChargerProfile(arg.Tenant, arg.ID, true, true, utils.NonTransactional); err != nil {
@@ -39,8 +39,8 @@ func (apierV1 *ApierV1) GetChargerProfile(arg utils.TenantID, reply *engine.Char
}
// GetChargerProfileIDs returns list of chargerProfile IDs registered for a tenant
func (apierV1 *ApierV1) GetChargerProfileIDs(args utils.TenantArgWithPaginator, chPrfIDs *[]string) error {
if missing := utils.MissingStructFields(&args, []string{utils.Tenant}); len(missing) != 0 { //Params missing
func (apierV1 *ApierV1) GetChargerProfileIDs(args *utils.TenantArgWithPaginator, chPrfIDs *[]string) error {
if missing := utils.MissingStructFields(args, []string{utils.Tenant}); len(missing) != 0 { //Params missing
return utils.NewErrMandatoryIeMissing(missing...)
}
prfx := utils.ChargerProfilePrefix + args.Tenant + ":"
@@ -89,8 +89,8 @@ func (apierV1 *ApierV1) SetChargerProfile(arg *ChargerWithCache, reply *string)
}
//RemoveChargerProfile remove a specific Charger Profile
func (apierV1 *ApierV1) RemoveChargerProfile(arg utils.TenantIDWithCache, reply *string) error {
if missing := utils.MissingStructFields(&arg, []string{"Tenant", "ID"}); len(missing) != 0 { //Params missing
func (apierV1 *ApierV1) RemoveChargerProfile(arg *utils.TenantIDWithCache, reply *string) error {
if missing := utils.MissingStructFields(arg, []string{"Tenant", "ID"}); len(missing) != 0 { //Params missing
return utils.NewErrMandatoryIeMissing(missing...)
}
if err := apierV1.DataManager.RemoveChargerProfile(arg.Tenant,

View File

@@ -832,7 +832,7 @@ func testV1FIdxCaRemoveStatQueueProfile(t *testing.T) {
func testV1FIdxCaProcessAttributeProfileEventWithNotFound(t *testing.T) {
ev := &engine.AttrArgsProcessEvent{
Context: utils.StringPointer(utils.MetaSessionS),
CGREvent: utils.CGREvent{
CGREvent: &utils.CGREvent{
Tenant: "cgrates.org",
ID: "testAttributeSProcessEvent",
Event: map[string]interface{}{
@@ -906,7 +906,7 @@ func testV1FIdxCaSetAttributeProfile(t *testing.T) {
//matches TEST_PROFILE1
ev := &engine.AttrArgsProcessEvent{
Context: utils.StringPointer(utils.MetaSessionS),
CGREvent: utils.CGREvent{
CGREvent: &utils.CGREvent{
Tenant: "cgrates.org",
ID: "testAttributeSProcessEvent",
Event: map[string]interface{}{
@@ -926,7 +926,7 @@ func testV1FIdxCaGetAttributeProfileFromTP(t *testing.T) {
//matches ATTR_1
ev := &engine.AttrArgsProcessEvent{
Context: utils.StringPointer(utils.MetaSessionS),
CGREvent: utils.CGREvent{
CGREvent: &utils.CGREvent{
Tenant: "cgrates.org",
ID: "testAttributeSProcessEvent",
Event: map[string]interface{}{
@@ -999,7 +999,7 @@ func testV1FIdxCaUpdateAttributeProfile(t *testing.T) {
//matches TEST_PROFILE1
ev := &engine.AttrArgsProcessEvent{
Context: utils.StringPointer(utils.MetaSessionS),
CGREvent: utils.CGREvent{
CGREvent: &utils.CGREvent{
Tenant: "cgrates.org",
ID: "testAttributeSProcessEvent",
Event: map[string]interface{}{
@@ -1055,7 +1055,7 @@ func testV1FIdxCaUpdateAttributeProfileFromTP(t *testing.T) {
//matches TEST_PROFILE1
ev := &engine.AttrArgsProcessEvent{
Context: utils.StringPointer(utils.MetaSessionS),
CGREvent: utils.CGREvent{
CGREvent: &utils.CGREvent{
Tenant: "cgrates.org",
ID: "testAttributeSProcessEvent",
Event: map[string]interface{}{
@@ -1074,7 +1074,7 @@ func testV1FIdxCaRemoveAttributeProfile(t *testing.T) {
var resp string
ev := &engine.AttrArgsProcessEvent{
Context: utils.StringPointer(utils.MetaSessionS),
CGREvent: utils.CGREvent{
CGREvent: &utils.CGREvent{
Tenant: "cgrates.org",
ID: "testAttributeSProcessEvent",
Event: map[string]interface{}{
@@ -1090,7 +1090,7 @@ func testV1FIdxCaRemoveAttributeProfile(t *testing.T) {
ev2 := &engine.AttrArgsProcessEvent{
Context: utils.StringPointer(utils.MetaSessionS),
CGREvent: utils.CGREvent{
CGREvent: &utils.CGREvent{
Tenant: "cgrates.org",
ID: "testAttributeSProcessEvent",
Event: map[string]interface{}{

View File

@@ -62,7 +62,7 @@ func (dS *DispatcherService) AttributeSv1GetAttributeForEvent(args *engine.AttrA
if args.ArgDispatcher != nil {
routeID = args.ArgDispatcher.RouteID
}
return dS.Dispatch(&args.CGREvent, utils.MetaAttributes, routeID,
return dS.Dispatch(args.CGREvent, utils.MetaAttributes, routeID,
utils.AttributeSv1GetAttributeForEvent, args, reply)
}
@@ -83,6 +83,6 @@ func (dS *DispatcherService) AttributeSv1ProcessEvent(args *engine.AttrArgsProce
if args.ArgDispatcher != nil {
routeID = args.ArgDispatcher.RouteID
}
return dS.Dispatch(&args.CGREvent, utils.MetaAttributes, routeID,
return dS.Dispatch(args.CGREvent, utils.MetaAttributes, routeID,
utils.AttributeSv1ProcessEvent, args, reply)
}

View File

@@ -114,7 +114,7 @@ func testDspAttrPingFailover(t *testing.T) {
func testDspAttrGetAttrFailover(t *testing.T) {
args := &engine.AttrArgsProcessEvent{
Context: utils.StringPointer("simpleauth"),
CGREvent: utils.CGREvent{
CGREvent: &utils.CGREvent{
Tenant: "cgrates.org",
ID: "testAttributeSGetAttributeForEvent",
Event: map[string]interface{}{
@@ -223,7 +223,7 @@ func testDspAttrPing(t *testing.T) {
func testDspAttrTestMissingArgDispatcher(t *testing.T) {
args := &engine.AttrArgsProcessEvent{
Context: utils.StringPointer("simpleauth"),
CGREvent: utils.CGREvent{
CGREvent: &utils.CGREvent{
Tenant: "cgrates.org",
ID: "testAttributeSGetAttributeForEvent",
Event: map[string]interface{}{
@@ -241,7 +241,7 @@ func testDspAttrTestMissingArgDispatcher(t *testing.T) {
func testDspAttrTestMissingApiKey(t *testing.T) {
args := &engine.AttrArgsProcessEvent{
Context: utils.StringPointer("simpleauth"),
CGREvent: utils.CGREvent{
CGREvent: &utils.CGREvent{
Tenant: "cgrates.org",
ID: "testAttributeSGetAttributeForEvent",
Event: map[string]interface{}{
@@ -260,7 +260,7 @@ func testDspAttrTestMissingApiKey(t *testing.T) {
func testDspAttrTestUnknownApiKey(t *testing.T) {
args := &engine.AttrArgsProcessEvent{
Context: utils.StringPointer("simpleauth"),
CGREvent: utils.CGREvent{
CGREvent: &utils.CGREvent{
Tenant: "cgrates.org",
ID: "testAttributeSGetAttributeForEvent",
Event: map[string]interface{}{
@@ -281,7 +281,7 @@ func testDspAttrTestUnknownApiKey(t *testing.T) {
func testDspAttrTestAuthKey(t *testing.T) {
args := &engine.AttrArgsProcessEvent{
Context: utils.StringPointer("simpleauth"),
CGREvent: utils.CGREvent{
CGREvent: &utils.CGREvent{
Tenant: "cgrates.org",
ID: "testAttributeSGetAttributeForEvent",
Event: map[string]interface{}{
@@ -302,7 +302,7 @@ func testDspAttrTestAuthKey(t *testing.T) {
func testDspAttrTestAuthKey2(t *testing.T) {
args := &engine.AttrArgsProcessEvent{
Context: utils.StringPointer("simpleauth"),
CGREvent: utils.CGREvent{
CGREvent: &utils.CGREvent{
Tenant: "cgrates.org",
ID: "testAttributeSGetAttributeForEvent",
Event: map[string]interface{}{
@@ -367,7 +367,7 @@ func testDspAttrTestAuthKey2(t *testing.T) {
func testDspAttrTestAuthKey3(t *testing.T) {
args := &engine.AttrArgsProcessEvent{
Context: utils.StringPointer("simpleauth"),
CGREvent: utils.CGREvent{
CGREvent: &utils.CGREvent{
Tenant: "cgrates.org",
ID: "testAttributeSGetAttributeForEvent",
Event: map[string]interface{}{
@@ -389,7 +389,7 @@ func testDspAttrTestAuthKey3(t *testing.T) {
func testDspAttrGetAttrRoundRobin(t *testing.T) {
args := &engine.AttrArgsProcessEvent{
Context: utils.StringPointer("simpleauth"),
CGREvent: utils.CGREvent{
CGREvent: &utils.CGREvent{
Tenant: "cgrates.org",
ID: "testAttributeSGetAttributeForEvent",
Event: map[string]interface{}{
@@ -474,7 +474,7 @@ func testDspAttrGetAttrRoundRobin(t *testing.T) {
func testDspAttrGetAttrInternal(t *testing.T) {
args := &engine.AttrArgsProcessEvent{
Context: utils.StringPointer("simpleauth"),
CGREvent: utils.CGREvent{
CGREvent: &utils.CGREvent{
Tenant: "cgrates.org",
ID: "testAttributeSGetAttributeForEvent",
Event: map[string]interface{}{

View File

@@ -71,7 +71,7 @@ func (dS *DispatcherService) authorizeEvent(ev *utils.CGREvent,
if err = dS.attrS.Call(utils.AttributeSv1ProcessEvent,
&engine.AttrArgsProcessEvent{
Context: utils.StringPointer(utils.MetaAuth),
CGREvent: *ev}, reply); err != nil {
CGREvent: ev}, reply); err != nil {
if err.Error() == utils.ErrNotFound.Error() {
err = utils.ErrUnknownApiKey
}

View File

@@ -146,7 +146,7 @@ type AttrArgsProcessEvent struct {
AttributeIDs []string
Context *string // attach the event to a context
ProcessRuns *int // number of loops for ProcessEvent
utils.CGREvent
*utils.CGREvent
*utils.ArgDispatcher
}
@@ -268,6 +268,9 @@ func (alS *AttributeService) processEvent(args *AttrArgsProcessEvent) (
func (alS *AttributeService) V1GetAttributeForEvent(args *AttrArgsProcessEvent,
attrPrfl *AttributeProfile) (err error) {
if args.CGREvent == nil {
return utils.NewErrMandatoryIeMissing("CGREvent")
}
attrPrf, err := alS.attributeProfileForEvent(args)
if err != nil {
if err != utils.ErrNotFound {
@@ -281,7 +284,7 @@ func (alS *AttributeService) V1GetAttributeForEvent(args *AttrArgsProcessEvent,
func (alS *AttributeService) V1ProcessEvent(args *AttrArgsProcessEvent,
reply *AttrSProcessEventReply) (err error) {
if args.Event == nil {
if args.CGREvent == nil || args.Event == nil {
return utils.NewErrMandatoryIeMissing("Event")
}
if args.ProcessRuns == nil || *args.ProcessRuns == 0 {
@@ -300,7 +303,7 @@ func (alS *AttributeService) V1ProcessEvent(args *AttrArgsProcessEvent,
break
}
if len(evRply.AlteredFields) != 0 {
args.CGREvent = *evRply.CGREvent // for next loop
args.CGREvent = evRply.CGREvent // for next loop
}
if apiRply == nil { // first reply
apiRply = evRply

View File

@@ -34,7 +34,7 @@ var (
attrEvs = []*AttrArgsProcessEvent{
{
Context: utils.StringPointer(utils.MetaSessionS),
CGREvent: utils.CGREvent{ //matching AttributeProfile1
CGREvent: &utils.CGREvent{ //matching AttributeProfile1
Tenant: config.CgrConfig().GeneralCfg().DefaultTenant,
ID: utils.GenUUID(),
Event: map[string]interface{}{
@@ -47,7 +47,7 @@ var (
},
{
Context: utils.StringPointer(utils.MetaSessionS),
CGREvent: utils.CGREvent{ //matching AttributeProfile2
CGREvent: &utils.CGREvent{ //matching AttributeProfile2
Tenant: config.CgrConfig().GeneralCfg().DefaultTenant,
ID: utils.GenUUID(),
Event: map[string]interface{}{
@@ -57,7 +57,7 @@ var (
},
{
Context: utils.StringPointer(utils.MetaSessionS),
CGREvent: utils.CGREvent{ //matching AttributeProfilePrefix
CGREvent: &utils.CGREvent{ //matching AttributeProfilePrefix
Tenant: config.CgrConfig().GeneralCfg().DefaultTenant,
ID: utils.GenUUID(),
Event: map[string]interface{}{
@@ -67,7 +67,7 @@ var (
},
{
Context: utils.StringPointer(utils.MetaSessionS),
CGREvent: utils.CGREvent{ //matching AttributeProfilePrefix
CGREvent: &utils.CGREvent{ //matching AttributeProfilePrefix
Tenant: config.CgrConfig().GeneralCfg().DefaultTenant,
ID: utils.GenUUID(),
Event: map[string]interface{}{
@@ -274,7 +274,7 @@ func TestAttributeProcessEvent(t *testing.T) {
eRply := &AttrSProcessEventReply{
MatchedProfiles: []string{"AttributeProfile1"},
AlteredFields: []string{"Account"},
CGREvent: &attrEvs[0].CGREvent,
CGREvent: attrEvs[0].CGREvent,
}
atrp, err := attrService.processEvent(attrEvs[0])
if err != nil {
@@ -298,7 +298,7 @@ func TestAttributeProcessEventWithIDs(t *testing.T) {
eRply := &AttrSProcessEventReply{
MatchedProfiles: []string{"AttributeIDMatch"},
AlteredFields: []string{"Account"},
CGREvent: &attrEvs[3].CGREvent,
CGREvent: attrEvs[3].CGREvent,
}
if atrp, err := attrService.processEvent(attrEvs[3]); err != nil {
} else if !reflect.DeepEqual(eRply, atrp) {
@@ -527,7 +527,7 @@ func TestAttributeProcessWithMultipleRuns1(t *testing.T) {
attrArgs := &AttrArgsProcessEvent{
Context: utils.StringPointer(utils.MetaSessionS),
ProcessRuns: utils.IntPointer(4),
CGREvent: utils.CGREvent{
CGREvent: &utils.CGREvent{
Tenant: config.CgrConfig().GeneralCfg().DefaultTenant,
ID: utils.GenUUID(),
Event: map[string]interface{}{
@@ -635,7 +635,7 @@ func TestAttributeProcessWithMultipleRuns2(t *testing.T) {
attrArgs := &AttrArgsProcessEvent{
Context: utils.StringPointer(utils.MetaSessionS),
ProcessRuns: utils.IntPointer(4),
CGREvent: utils.CGREvent{
CGREvent: &utils.CGREvent{
Tenant: config.CgrConfig().GeneralCfg().DefaultTenant,
ID: utils.GenUUID(),
Event: map[string]interface{}{
@@ -742,7 +742,7 @@ func TestAttributeProcessWithMultipleRuns3(t *testing.T) {
attrArgs := &AttrArgsProcessEvent{
Context: utils.StringPointer(utils.MetaSessionS),
ProcessRuns: utils.IntPointer(2),
CGREvent: utils.CGREvent{
CGREvent: &utils.CGREvent{
Tenant: config.CgrConfig().GeneralCfg().DefaultTenant,
ID: utils.GenUUID(),
Event: map[string]interface{}{
@@ -830,7 +830,7 @@ func TestAttributeProcessWithMultipleRuns4(t *testing.T) {
attrArgs := &AttrArgsProcessEvent{
Context: utils.StringPointer(utils.MetaSessionS),
ProcessRuns: utils.IntPointer(4),
CGREvent: utils.CGREvent{
CGREvent: &utils.CGREvent{
Tenant: config.CgrConfig().GeneralCfg().DefaultTenant,
ID: utils.GenUUID(),
Event: map[string]interface{}{
@@ -940,7 +940,7 @@ func TestAttributeMultipleProcessWithBlocker(t *testing.T) {
attrArgs := &AttrArgsProcessEvent{
Context: utils.StringPointer(utils.MetaSessionS),
ProcessRuns: utils.IntPointer(4),
CGREvent: utils.CGREvent{
CGREvent: &utils.CGREvent{
Tenant: config.CgrConfig().GeneralCfg().DefaultTenant,
ID: utils.GenUUID(),
Event: map[string]interface{}{
@@ -1049,7 +1049,7 @@ func TestAttributeMultipleProcessWithBlocker2(t *testing.T) {
attrArgs := &AttrArgsProcessEvent{
Context: utils.StringPointer(utils.MetaSessionS),
ProcessRuns: utils.IntPointer(4),
CGREvent: utils.CGREvent{
CGREvent: &utils.CGREvent{
Tenant: config.CgrConfig().GeneralCfg().DefaultTenant,
ID: utils.GenUUID(),
Event: map[string]interface{}{
@@ -1119,7 +1119,7 @@ func TestAttributeProcessValue(t *testing.T) {
attrArgs := &AttrArgsProcessEvent{
Context: utils.StringPointer(utils.MetaSessionS),
ProcessRuns: utils.IntPointer(1),
CGREvent: utils.CGREvent{
CGREvent: &utils.CGREvent{
Tenant: config.CgrConfig().GeneralCfg().DefaultTenant,
ID: utils.GenUUID(),
Event: map[string]interface{}{
@@ -1198,7 +1198,7 @@ func TestAttributeAttributeFilterIDs(t *testing.T) {
attrArgs := &AttrArgsProcessEvent{
Context: utils.StringPointer(utils.MetaSessionS),
ProcessRuns: utils.IntPointer(1),
CGREvent: utils.CGREvent{
CGREvent: &utils.CGREvent{
Tenant: config.CgrConfig().GeneralCfg().DefaultTenant,
ID: utils.GenUUID(),
Event: map[string]interface{}{
@@ -1269,7 +1269,7 @@ func TestAttributeProcessEventConstant(t *testing.T) {
attrArgs := &AttrArgsProcessEvent{
Context: utils.StringPointer(utils.MetaSessionS),
ProcessRuns: utils.IntPointer(1),
CGREvent: utils.CGREvent{
CGREvent: &utils.CGREvent{
Tenant: config.CgrConfig().GeneralCfg().DefaultTenant,
ID: utils.GenUUID(),
Event: map[string]interface{}{
@@ -1345,7 +1345,7 @@ func TestAttributeProcessEventVariable(t *testing.T) {
attrArgs := &AttrArgsProcessEvent{
Context: utils.StringPointer(utils.MetaSessionS),
ProcessRuns: utils.IntPointer(1),
CGREvent: utils.CGREvent{
CGREvent: &utils.CGREvent{
Tenant: config.CgrConfig().GeneralCfg().DefaultTenant,
ID: utils.GenUUID(),
Event: map[string]interface{}{
@@ -1428,7 +1428,7 @@ func TestAttributeProcessEventComposed(t *testing.T) {
attrArgs := &AttrArgsProcessEvent{
Context: utils.StringPointer(utils.MetaSessionS),
ProcessRuns: utils.IntPointer(1),
CGREvent: utils.CGREvent{
CGREvent: &utils.CGREvent{
Tenant: config.CgrConfig().GeneralCfg().DefaultTenant,
ID: utils.GenUUID(),
Event: map[string]interface{}{
@@ -1501,7 +1501,7 @@ func TestAttributeProcessEventSum(t *testing.T) {
attrArgs := &AttrArgsProcessEvent{
Context: utils.StringPointer(utils.MetaSessionS),
ProcessRuns: utils.IntPointer(1),
CGREvent: utils.CGREvent{
CGREvent: &utils.CGREvent{
Tenant: config.CgrConfig().GeneralCfg().DefaultTenant,
ID: utils.GenUUID(),
Event: map[string]interface{}{
@@ -1576,7 +1576,7 @@ func TestAttributeProcessEventUsageDifference(t *testing.T) {
attrArgs := &AttrArgsProcessEvent{
Context: utils.StringPointer(utils.MetaSessionS),
ProcessRuns: utils.IntPointer(1),
CGREvent: utils.CGREvent{
CGREvent: &utils.CGREvent{
Tenant: config.CgrConfig().GeneralCfg().DefaultTenant,
ID: utils.GenUUID(),
Event: map[string]interface{}{
@@ -1653,7 +1653,7 @@ func TestAttributeProcessEventValueExponent(t *testing.T) {
attrArgs := &AttrArgsProcessEvent{
Context: utils.StringPointer(utils.MetaSessionS),
ProcessRuns: utils.IntPointer(1),
CGREvent: utils.CGREvent{
CGREvent: &utils.CGREvent{
Tenant: config.CgrConfig().GeneralCfg().DefaultTenant,
ID: utils.GenUUID(),
Event: map[string]interface{}{
@@ -1740,7 +1740,7 @@ func BenchmarkAttributeProcessEventConstant(b *testing.B) {
attrArgs := &AttrArgsProcessEvent{
Context: utils.StringPointer(utils.MetaSessionS),
ProcessRuns: utils.IntPointer(1),
CGREvent: utils.CGREvent{
CGREvent: &utils.CGREvent{
Tenant: config.CgrConfig().GeneralCfg().DefaultTenant,
ID: utils.GenUUID(),
Event: map[string]interface{}{
@@ -1803,7 +1803,7 @@ func BenchmarkAttributeProcessEventVariable(b *testing.B) {
attrArgs := &AttrArgsProcessEvent{
Context: utils.StringPointer(utils.MetaSessionS),
ProcessRuns: utils.IntPointer(1),
CGREvent: utils.CGREvent{
CGREvent: &utils.CGREvent{
Tenant: config.CgrConfig().GeneralCfg().DefaultTenant,
ID: utils.GenUUID(),
Event: map[string]interface{}{

View File

@@ -327,13 +327,13 @@ func (cdrS *CDRServer) attrSProcessEvent(cgrEv *utils.CGREventWithArgDispatcher)
var rplyEv AttrSProcessEventReply
attrArgs := &AttrArgsProcessEvent{
Context: utils.StringPointer(utils.MetaCDRs),
CGREvent: *cgrEv.CGREvent}
CGREvent: cgrEv.CGREvent}
if cgrEv.ArgDispatcher != nil {
attrArgs.ArgDispatcher = cgrEv.ArgDispatcher
}
if err = cdrS.attrS.Call(utils.AttributeSv1ProcessEvent,
attrArgs, &rplyEv); err == nil && len(rplyEv.AlteredFields) != 0 {
*cgrEv.CGREvent = *rplyEv.CGREvent
cgrEv.CGREvent = rplyEv.CGREvent
if tntIface, has := cgrEv.CGREvent.Event[utils.MetaTenant]; has {
// special case when we want to overwrite the tenant
cgrEv.CGREvent.Tenant = tntIface.(string)

View File

@@ -132,7 +132,7 @@ func (cS *ChargerService) processEvent(cgrEv *utils.CGREventWithArgDispatcher) (
AttributeIDs: cP.AttributeIDs,
Context: utils.StringPointer(utils.MetaChargers),
ProcessRuns: nil,
CGREvent: *clonedEv.CGREvent,
CGREvent: clonedEv.CGREvent,
ArgDispatcher: clonedEv.ArgDispatcher,
}
var evReply AttrSProcessEventReply

View File

@@ -496,7 +496,7 @@ func (spS *SupplierService) V1GetSuppliers(args *ArgsGetSuppliers, reply *Sorted
if spS.attributeS != nil {
attrArgs := &AttrArgsProcessEvent{
Context: utils.StringPointer(utils.MetaSuppliers),
CGREvent: args.CGREvent,
CGREvent: &args.CGREvent,
ArgDispatcher: args.ArgDispatcher,
}
var rplyEv AttrSProcessEventReply

View File

@@ -1781,7 +1781,7 @@ func (sS *SessionS) BiRPCv1AuthorizeEvent(clnt rpcclient.RpcClientConnection,
}
attrArgs := &engine.AttrArgsProcessEvent{
Context: utils.StringPointer(utils.MetaSessionS),
CGREvent: args.CGREvent,
CGREvent: &args.CGREvent,
ArgDispatcher: args.ArgDispatcher,
}
var rplyEv engine.AttrSProcessEventReply
@@ -2038,7 +2038,7 @@ func (sS *SessionS) BiRPCv1InitiateSession(clnt rpcclient.RpcClientConnection,
}
attrArgs := &engine.AttrArgsProcessEvent{
Context: utils.StringPointer(utils.MetaSessionS),
CGREvent: args.CGREvent,
CGREvent: &args.CGREvent,
ArgDispatcher: args.ArgDispatcher,
}
var rplyEv engine.AttrSProcessEventReply
@@ -2266,7 +2266,7 @@ func (sS *SessionS) BiRPCv1UpdateSession(clnt rpcclient.RpcClientConnection,
}
attrArgs := &engine.AttrArgsProcessEvent{
Context: utils.StringPointer(utils.MetaSessionS),
CGREvent: args.CGREvent,
CGREvent: &args.CGREvent,
ArgDispatcher: args.ArgDispatcher,
}
var rplyEv engine.AttrSProcessEventReply
@@ -2666,7 +2666,7 @@ func (sS *SessionS) BiRPCv1ProcessEvent(clnt rpcclient.RpcClientConnection,
}
attrArgs := &engine.AttrArgsProcessEvent{
Context: utils.StringPointer(utils.MetaSessionS),
CGREvent: args.CGREvent,
CGREvent: &args.CGREvent,
ArgDispatcher: args.ArgDispatcher,
}
var rplyEv engine.AttrSProcessEventReply