mirror of
https://github.com/cgrates/cgrates.git
synced 2026-02-11 18:16:24 +05:00
added *fileLineNumber variable
This commit is contained in:
committed by
Dan Christian Bogos
parent
07390d8624
commit
ccc999642d
@@ -187,6 +187,8 @@ func testTrendSGetTrendProfiles(t *testing.T) {
|
||||
trendProfile2.TrendProfile,
|
||||
}
|
||||
var tResult []*engine.TrendProfile
|
||||
|
||||
//get all trend profiles from every tenant when no tenant is specified
|
||||
if err := trendRPC.Call(context.Background(), utils.APIerSv1GetTrendProfiles, engine.TrendProfilesAPI{}, &tResult); err != nil {
|
||||
t.Error(err)
|
||||
} else if diff := cmp.Diff(expRes, tResult, cmpopts.SortSlices(func(a, b *engine.TrendProfile) bool { return a.ID < b.ID })); diff != utils.EmptyString {
|
||||
@@ -197,6 +199,8 @@ func testTrendSGetTrendProfiles(t *testing.T) {
|
||||
trendProfile.TrendProfile,
|
||||
trendProfile2.TrendProfile,
|
||||
}
|
||||
|
||||
//get all trend profiles of a tenant when ids length is 0
|
||||
if err := trendRPC.Call(context.Background(), utils.APIerSv1GetTrendProfiles, engine.TrendProfilesAPI{Tenant: "cgrates.org"}, &tResult); err != nil {
|
||||
t.Error(err)
|
||||
} else if diff := cmp.Diff(expRes, tResult, cmpopts.SortSlices(func(a, b *engine.TrendProfile) bool { return a.ID < b.ID })); diff != utils.EmptyString {
|
||||
@@ -206,6 +210,8 @@ func testTrendSGetTrendProfiles(t *testing.T) {
|
||||
expRes = []*engine.TrendProfile{
|
||||
trendProfile2.TrendProfile,
|
||||
}
|
||||
|
||||
//get trend profiles by their ids for a tenant
|
||||
if err := trendRPC.Call(context.Background(), utils.APIerSv1GetTrendProfiles, engine.TrendProfilesAPI{Tenant: "cgrates.org", TpIDs: []string{"Trend1"}}, &tResult); err != nil {
|
||||
t.Error(err)
|
||||
} else if diff := cmp.Diff(expRes, tResult, cmpopts.SortSlices(func(a, b *engine.TrendProfile) bool { return a.ID < b.ID })); diff != utils.EmptyString {
|
||||
|
||||
@@ -395,6 +395,7 @@
|
||||
{"tag": "DialogId", "path": "*cgreq.DialogId", "type": "*variable", "value": "~*req.11"},
|
||||
{"tag": "Partial", "path": "*opts.*partial", "type": "*constant", "value": "true"},
|
||||
{"tag": "Partial", "path": "*opts.*partial", "type": "*constant", "value": "false","filters": ["*prefix:~*vars.*fileName:missed_calls"]},
|
||||
{"tag": "LineNumber", "path": "*opts.*line", "type": "*constant", "value": "1","filters": ["*string:~*vars.*fileLineNumber:1"]},
|
||||
{"tag": "Invite", "path": "*opts.invite", "type": "*constant", "value": "true", "filters":["*string:~*req.0:INVITE"]},
|
||||
{"tag": "Bye", "path": "*opts.bye", "type": "*constant", "value": "true", "filters":["*string:~*req.0:BYE"]},
|
||||
{"tag": "Order", "path": "*opts.order", "type": "*constant", "value": "0", "filters":["*string:~*req.0:INVITE"]},
|
||||
|
||||
@@ -136,6 +136,7 @@ func (rdr *CSVFileER) processFile(fName string) (err error) {
|
||||
if rdr.Config().Opts.CSV.LazyQuotes != nil {
|
||||
csvReader.LazyQuotes = *rdr.Config().Opts.CSV.LazyQuotes
|
||||
}
|
||||
|
||||
var indxAls map[string]int
|
||||
rowNr := 0 // This counts the rows in the file, not really number of CDRs
|
||||
evsPosted := 0
|
||||
@@ -165,7 +166,7 @@ func (rdr *CSVFileER) processFile(fName string) (err error) {
|
||||
continue
|
||||
}
|
||||
rowNr++ // increment the rowNr after checking if it's not the end of file
|
||||
|
||||
reqVars.Map[utils.MetaFileLineNumber] = utils.NewLeafNode(rowNr)
|
||||
agReq := agents.NewAgentRequest(
|
||||
config.NewSliceDP(record, indxAls), reqVars,
|
||||
nil, nil, nil, rdr.Config().Tenant,
|
||||
|
||||
@@ -185,6 +185,7 @@ func (rdr *FWVFileER) processFile(fName string) (err error) {
|
||||
continue
|
||||
}
|
||||
rowNr++ // increment the rowNr after checking if it's not the end of file
|
||||
reqVars.Map[utils.MetaFileLineNumber] = utils.NewLeafNode(rowNr)
|
||||
record := string(buf)
|
||||
agReq := agents.NewAgentRequest(
|
||||
config.NewFWVProvider(record),
|
||||
|
||||
@@ -162,6 +162,7 @@ func (rdr *XMLFileER) processFile(fName string) error {
|
||||
reqVars := &utils.DataNode{Type: utils.NMMapType, Map: map[string]*utils.DataNode{utils.MetaFileName: utils.NewLeafNode(fName), utils.MetaReaderID: utils.NewLeafNode(rdr.cgrCfg.ERsCfg().Readers[rdr.cfgIdx].ID)}}
|
||||
for _, xmlElmt := range xmlElmts {
|
||||
rowNr++ // increment the rowNr after checking if it's not the end of file
|
||||
reqVars.Map[utils.MetaFileLineNumber] = utils.NewLeafNode(reqVars)
|
||||
agReq := agents.NewAgentRequest(
|
||||
config.NewXMLProvider(xmlElmt, xmlRootPath), reqVars,
|
||||
nil, nil, nil, rdr.Config().Tenant,
|
||||
|
||||
@@ -825,6 +825,7 @@ const (
|
||||
MetaGroup = "*group"
|
||||
InternalRPCSet = "InternalRPCSet"
|
||||
MetaFileName = "*fileName"
|
||||
MetaFileLineNumber = "*fileLineNumber"
|
||||
MetaReaderID = "*readerID"
|
||||
MetaRadauth = "*radauth"
|
||||
UserPassword = "UserPassword"
|
||||
|
||||
Reference in New Issue
Block a user