mirror of
https://github.com/cgrates/cgrates.git
synced 2026-02-11 18:16:24 +05:00
Remove config default value for xml_root_path
The field will remain commented in config_defaults for reference.
This commit is contained in:
committed by
Dan Christian Bogos
parent
e7b4d565cd
commit
425c2f2e9b
@@ -311,7 +311,7 @@ const CGRATES_CFG_JSON = `
|
||||
"concurrent_requests": 1024, // maximum simultaneous requests/files to process, 0 for unlimited
|
||||
"source_path": "/var/spool/cgrates/ers/in", // read data from this path
|
||||
"processed_path": "/var/spool/cgrates/ers/out", // move processed data here
|
||||
"xml_root_path": "", // path towards one event in case of XML CDRs
|
||||
// "xml_root_path": "", // path towards one event in case of XML CDRs
|
||||
"tenant": "", // tenant used by import
|
||||
"timezone": "", // timezone for timestamps where not specified <""|UTC|Local|$IANA_TZ_DB>
|
||||
"filters": [], // limit parsing based on the filters
|
||||
|
||||
@@ -1719,7 +1719,6 @@ func TestDfEventReaderCfg(t *testing.T) {
|
||||
Concurrent_requests: utils.IntPointer(1024),
|
||||
Source_path: utils.StringPointer("/var/spool/cgrates/ers/in"),
|
||||
Processed_path: utils.StringPointer("/var/spool/cgrates/ers/out"),
|
||||
Xml_root_path: utils.StringPointer(utils.EmptyString),
|
||||
Tenant: utils.StringPointer(utils.EmptyString),
|
||||
Timezone: utils.StringPointer(utils.EmptyString),
|
||||
Filters: &[]string{},
|
||||
|
||||
@@ -249,9 +249,23 @@ func (er *EventReaderCfg) Clone() (cln *EventReaderCfg) {
|
||||
}
|
||||
|
||||
func (er *EventReaderCfg) AsMapInterface(separator string) map[string]any {
|
||||
xmlRootPath := make([]string, len(er.XmlRootPath))
|
||||
for i, item := range er.XmlRootPath {
|
||||
xmlRootPath[i] = item
|
||||
rdrMap := map[string]any{
|
||||
utils.IDCfg: er.ID,
|
||||
utils.TypeCfg: er.Type,
|
||||
utils.RowLengthCfg: er.RowLength,
|
||||
utils.FieldSepCfg: er.FieldSep,
|
||||
utils.ConcurrentReqsCfg: er.ConcurrentReqs,
|
||||
utils.SourcePathCfg: er.SourcePath,
|
||||
utils.ProcessedPathCfg: er.ProcessedPath,
|
||||
utils.TimezoneCfg: er.Timezone,
|
||||
utils.FiltersCfg: er.Filters,
|
||||
utils.FailedCallsPrefixCfg: er.FailedCallsPrefix,
|
||||
utils.PartialCacheExpiryActionCfg: er.PartialCacheExpiryAction,
|
||||
}
|
||||
if len(er.XmlRootPath) != 0 {
|
||||
xmlRootPath := make([]string, len(er.XmlRootPath))
|
||||
copy(xmlRootPath, er.XmlRootPath)
|
||||
rdrMap[utils.XmlRootPathCfg] = xmlRootPath
|
||||
}
|
||||
var tenant string
|
||||
if er.Tenant != nil {
|
||||
@@ -261,7 +275,7 @@ func (er *EventReaderCfg) AsMapInterface(separator string) map[string]any {
|
||||
}
|
||||
tenant = strings.Join(values, separator)
|
||||
}
|
||||
|
||||
rdrMap[utils.TenantCfg] = tenant
|
||||
flags := make(map[string][]any, len(er.Flags))
|
||||
for key, val := range er.Flags {
|
||||
buf := make([]any, len(val))
|
||||
@@ -270,14 +284,17 @@ func (er *EventReaderCfg) AsMapInterface(separator string) map[string]any {
|
||||
}
|
||||
flags[key] = buf
|
||||
}
|
||||
rdrMap[utils.FlagsCfg] = flags
|
||||
fields := make([]map[string]any, len(er.Fields))
|
||||
for i, item := range er.Fields {
|
||||
fields[i] = item.AsMapInterface(separator)
|
||||
}
|
||||
rdrMap[utils.FieldsCfg] = fields
|
||||
cacheDumpFields := make([]map[string]any, len(er.CacheDumpFields))
|
||||
for i, item := range er.CacheDumpFields {
|
||||
cacheDumpFields[i] = item.AsMapInterface(separator)
|
||||
}
|
||||
rdrMap[utils.CacheDumpFieldsCfg] = cacheDumpFields
|
||||
var runDelay string
|
||||
if er.RunDelay > 0 {
|
||||
runDelay = er.RunDelay.String()
|
||||
@@ -286,30 +303,11 @@ func (er *EventReaderCfg) AsMapInterface(separator string) map[string]any {
|
||||
} else {
|
||||
runDelay = "-1"
|
||||
}
|
||||
|
||||
rdrMap[utils.RunDelayCfg] = runDelay
|
||||
var partialRecordCache string = "0"
|
||||
if er.PartialRecordCache != 0 {
|
||||
partialRecordCache = er.PartialRecordCache.String()
|
||||
}
|
||||
|
||||
return map[string]any{
|
||||
utils.IDCfg: er.ID,
|
||||
utils.TypeCfg: er.Type,
|
||||
utils.RowLengthCfg: er.RowLength,
|
||||
utils.FieldSepCfg: er.FieldSep,
|
||||
utils.RunDelayCfg: runDelay,
|
||||
utils.ConcurrentReqsCfg: er.ConcurrentReqs,
|
||||
utils.SourcePathCfg: er.SourcePath,
|
||||
utils.ProcessedPathCfg: er.ProcessedPath,
|
||||
utils.XmlRootPathCfg: xmlRootPath,
|
||||
utils.TenantCfg: tenant,
|
||||
utils.TimezoneCfg: er.Timezone,
|
||||
utils.FiltersCfg: er.Filters,
|
||||
utils.FlagsCfg: flags,
|
||||
utils.FailedCallsPrefixCfg: er.FailedCallsPrefix,
|
||||
utils.PartialRecordCacheCfg: partialRecordCache,
|
||||
utils.PartialCacheExpiryActionCfg: er.PartialCacheExpiryAction,
|
||||
utils.FieldsCfg: fields,
|
||||
utils.CacheDumpFieldsCfg: cacheDumpFields,
|
||||
}
|
||||
rdrMap[utils.PartialRecordCacheCfg] = partialRecordCache
|
||||
return rdrMap
|
||||
}
|
||||
|
||||
@@ -270,7 +270,6 @@ func TestERsCfgAsMapInterface(t *testing.T) {
|
||||
"source_path": "/var/spool/cgrates/ers/in",
|
||||
"tenant": "",
|
||||
"timezone": "",
|
||||
"xml_root_path": []string{},
|
||||
"cache_dump_fields": []map[string]any{},
|
||||
"concurrent_requests": 1024,
|
||||
"type": "*none",
|
||||
@@ -320,7 +319,6 @@ func TestERsCfgAsMapInterface(t *testing.T) {
|
||||
"source_path": "/tmp/ers/in",
|
||||
"tenant": "",
|
||||
"timezone": "",
|
||||
"xml_root_path": []string{},
|
||||
},
|
||||
},
|
||||
}
|
||||
@@ -534,7 +532,7 @@ func TestEventReeadersCFGAsMapInterface(t *testing.T) {
|
||||
ConcurrentReqs: 1,
|
||||
SourcePath: "test",
|
||||
ProcessedPath: "test",
|
||||
XmlRootPath: []string{},
|
||||
XmlRootPath: utils.HierarchyPath{"item1", "item2"},
|
||||
Timezone: "test",
|
||||
Filters: []string{},
|
||||
FailedCallsPrefix: "!",
|
||||
@@ -550,7 +548,6 @@ func TestEventReeadersCFGAsMapInterface(t *testing.T) {
|
||||
utils.ConcurrentReqsCfg: er.ConcurrentReqs,
|
||||
utils.SourcePathCfg: er.SourcePath,
|
||||
utils.ProcessedPathCfg: er.ProcessedPath,
|
||||
utils.XmlRootPathCfg: []string{},
|
||||
utils.TenantCfg: "test",
|
||||
utils.TimezoneCfg: er.Timezone,
|
||||
utils.FiltersCfg: er.Filters,
|
||||
@@ -560,6 +557,7 @@ func TestEventReeadersCFGAsMapInterface(t *testing.T) {
|
||||
utils.PartialCacheExpiryActionCfg: er.PartialCacheExpiryAction,
|
||||
utils.FieldsCfg: []map[string]any{},
|
||||
utils.CacheDumpFieldsCfg: []map[string]any{fct.AsMapInterface("")},
|
||||
utils.XmlRootPathCfg: []string{"item1", "item2"},
|
||||
}
|
||||
|
||||
tests := []struct {
|
||||
@@ -579,7 +577,7 @@ func TestEventReeadersCFGAsMapInterface(t *testing.T) {
|
||||
rcv := er.AsMapInterface(tt.arg)
|
||||
|
||||
if !reflect.DeepEqual(rcv, tt.exp) {
|
||||
t.Errorf("recived %v, expected %v", rcv, tt.exp)
|
||||
t.Errorf("expected %v,\nreceived %v", tt.exp, rcv)
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user