當前位置: 首頁>>代碼示例>>Golang>>正文


Golang config.NewDefaultCGRConfig函數代碼示例

本文整理匯總了Golang中github.com/cgrates/cgrates/config.NewDefaultCGRConfig函數的典型用法代碼示例。如果您正苦於以下問題:Golang NewDefaultCGRConfig函數的具體用法?Golang NewDefaultCGRConfig怎麽用?Golang NewDefaultCGRConfig使用的例子?那麽, 這裏精選的函數代碼示例或許可以為您提供幫助。


在下文中一共展示了NewDefaultCGRConfig函數的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Golang代碼示例。

示例1: TestAlternativeFieldSeparator

func TestAlternativeFieldSeparator(t *testing.T) {
	writer := &bytes.Buffer{}
	cfg, _ := config.NewDefaultCGRConfig()
	storedCdr1 := &engine.CDR{CGRID: utils.Sha1("dsafdsaf", time.Unix(1383813745, 0).UTC().String()), ToR: utils.VOICE, OriginID: "dsafdsaf", OriginHost: "192.168.1.1",
		RequestType: utils.META_RATED, Direction: "*out", Tenant: "cgrates.org",
		Category: "call", Account: "1001", Subject: "1001", Destination: "1002", SetupTime: time.Unix(1383813745, 0).UTC(), AnswerTime: time.Unix(1383813746, 0).UTC(),
		Usage: time.Duration(10) * time.Second, RunID: utils.DEFAULT_RUNID,
		ExtraFields: map[string]string{"extra1": "val_extra1", "extra2": "val_extra2", "extra3": "val_extra3"}, Cost: 1.01,
	}
	cdre, err := NewCdrExporter([]*engine.CDR{storedCdr1}, nil, cfg.CdreProfiles["*default"], utils.CSV, '|',
		"firstexport", 0.0, 0.0, 0.0, 0.0, 0.0, 0, 4, cfg.RoundingDecimals, "", 0, cfg.HttpSkipTlsVerify, "")
	if err != nil {
		t.Error("Unexpected error received: ", err)
	}
	csvWriter := csv.NewWriter(writer)
	if err := cdre.writeCsv(csvWriter); err != nil {
		t.Error("Unexpected error: ", err)
	}
	expected := `dbafe9c8614c785a65aabd116dd3959c3c56f7f6|*default|*voice|dsafdsaf|*rated|*out|cgrates.org|call|1001|1001|1002|2013-11-07T08:42:25Z|2013-11-07T08:42:26Z|10|1.0100`
	result := strings.TrimSpace(writer.String())
	if result != expected {
		t.Errorf("Expected: \n%s received: \n%s.", expected, result)
	}
	if cdre.TotalCost() != 1.01 {
		t.Error("Unexpected TotalCost: ", cdre.TotalCost())
	}
}
開發者ID:bhepp,項目名稱:cgrates,代碼行數:27,代碼來源:csv_test.go

示例2: TestParseFsHangup

func TestParseFsHangup(t *testing.T) {
	cfg, _ = config.NewDefaultCGRConfig()
	config.SetCgrConfig(cfg)
	ev := new(FSEvent).New(hangupEv)
	setupTime, _ := ev.GetSetupTime(utils.META_DEFAULT)
	answerTime, _ := ev.GetAnswerTime(utils.META_DEFAULT)
	dur, _ := ev.GetDuration(utils.META_DEFAULT)
	if ev.GetReqType(utils.META_DEFAULT) != utils.PSEUDOPREPAID ||
		ev.GetDirection(utils.META_DEFAULT) != "*out" ||
		ev.GetTenant(utils.META_DEFAULT) != "cgrates.org" ||
		ev.GetCategory(utils.META_DEFAULT) != "call" ||
		ev.GetAccount(utils.META_DEFAULT) != "1003" ||
		ev.GetSubject(utils.META_DEFAULT) != "1003" ||
		ev.GetDestination(utils.META_DEFAULT) != "1002" ||
		setupTime.UTC() != time.Date(2014, 4, 25, 16, 8, 27, 0, time.UTC) ||
		answerTime.UTC() != time.Date(2014, 4, 25, 16, 8, 40, 0, time.UTC) ||
		dur != time.Duration(5)*time.Second {
		t.Error("Default values not matching",
			ev.GetReqType(utils.META_DEFAULT) != utils.PSEUDOPREPAID,
			ev.GetDirection(utils.META_DEFAULT) != "*out",
			ev.GetTenant(utils.META_DEFAULT) != "cgrates.org",
			ev.GetCategory(utils.META_DEFAULT) != "call",
			ev.GetAccount(utils.META_DEFAULT) != "1003",
			ev.GetSubject(utils.META_DEFAULT) != "1003",
			ev.GetDestination(utils.META_DEFAULT) != "1002",
			setupTime.UTC() != time.Date(2014, 4, 25, 17, 8, 27, 0, time.UTC),
			answerTime.UTC() != time.Date(2014, 4, 25, 17, 8, 40, 0, time.UTC),
			dur != time.Duration(5)*time.Second)
	}
}
開發者ID:intralanman,項目名稱:cgrates,代碼行數:30,代碼來源:fsevent_test.go

示例3: TestCsvCdrWriter

func TestCsvCdrWriter(t *testing.T) {
	writer := &bytes.Buffer{}
	cfg, _ := config.NewDefaultCGRConfig()
	logDb, _ := engine.NewMapStorage()
	storedCdr1 := &utils.StoredCdr{CgrId: utils.Sha1("dsafdsaf", time.Unix(1383813745, 0).UTC().String()), TOR: utils.VOICE, AccId: "dsafdsaf", CdrHost: "192.168.1.1",
		ReqType: "rated", Direction: "*out", Tenant: "cgrates.org",
		Category: "call", Account: "1001", Subject: "1001", Destination: "1002", SetupTime: time.Unix(1383813745, 0).UTC(), AnswerTime: time.Unix(1383813746, 0).UTC(),
		Usage: time.Duration(10) * time.Second, MediationRunId: utils.DEFAULT_RUNID,
		ExtraFields: map[string]string{"extra1": "val_extra1", "extra2": "val_extra2", "extra3": "val_extra3"}, Cost: 1.01,
	}
	cdre, err := NewCdrExporter([]*utils.StoredCdr{storedCdr1}, logDb, cfg.CdreDefaultInstance, utils.CSV, ',', "firstexport", 0.0, 0.0, 0, 4, cfg.RoundingDecimals, "", 0, cfg.HttpSkipTlsVerify)
	if err != nil {
		t.Error("Unexpected error received: ", err)
	}
	csvWriter := csv.NewWriter(writer)
	if err := cdre.writeCsv(csvWriter); err != nil {
		t.Error("Unexpected error: ", err)
	}
	expected := `dbafe9c8614c785a65aabd116dd3959c3c56f7f6,default,*voice,dsafdsaf,rated,*out,cgrates.org,call,1001,1001,1002,2013-11-07T08:42:25Z,2013-11-07T08:42:26Z,10000000000,1.0100`
	result := strings.TrimSpace(writer.String())
	if result != expected {
		t.Errorf("Expected: \n%s received: \n%s.", expected, result)
	}
	if cdre.TotalCost() != 1.01 {
		t.Error("Unexpected TotalCost: ", cdre.TotalCost())
	}
}
開發者ID:intralanman,項目名稱:cgrates,代碼行數:27,代碼來源:csv_test.go

示例4: TestParseFsHangup

func TestParseFsHangup(t *testing.T) {
	cfg, _ := config.NewDefaultCGRConfig()
	config.SetCgrConfig(cfg)
	ev := new(FSEvent).AsEvent(hangupEv)
	setupTime, _ := ev.GetSetupTime(utils.META_DEFAULT, "")
	answerTime, _ := ev.GetAnswerTime(utils.META_DEFAULT, "")
	dur, _ := ev.GetDuration(utils.META_DEFAULT)
	if ev.GetReqType(utils.META_DEFAULT) != utils.META_PREPAID ||
		ev.GetDirection(utils.META_DEFAULT) != "*out" ||
		ev.GetTenant(utils.META_DEFAULT) != "cgrates.org" ||
		ev.GetCategory(utils.META_DEFAULT) != "call" ||
		ev.GetAccount(utils.META_DEFAULT) != "1001" ||
		ev.GetSubject(utils.META_DEFAULT) != "1001" ||
		ev.GetDestination(utils.META_DEFAULT) != "1003" ||
		setupTime.UTC() != time.Date(2015, 7, 7, 14, 52, 8, 0, time.UTC) ||
		answerTime.UTC() != time.Date(2015, 7, 7, 14, 52, 8, 0, time.UTC) ||
		dur != time.Duration(66)*time.Second ||
		ev.GetSupplier(utils.META_DEFAULT) != "supplier1" ||
		ev.GetDisconnectCause(utils.META_DEFAULT) != "NORMAL_CLEARING" {
		t.Error("Default values not matching",
			ev.GetReqType(utils.META_DEFAULT) != utils.META_PREPAID,
			ev.GetDirection(utils.META_DEFAULT) != "*out",
			ev.GetTenant(utils.META_DEFAULT) != "cgrates.org",
			ev.GetCategory(utils.META_DEFAULT) != "call",
			ev.GetAccount(utils.META_DEFAULT) != "1001",
			ev.GetSubject(utils.META_DEFAULT) != "1001",
			ev.GetDestination(utils.META_DEFAULT) != "1003",
			setupTime.UTC() != time.Date(2015, 7, 7, 14, 52, 8, 0, time.UTC),
			answerTime.UTC() != time.Date(2015, 7, 7, 14, 52, 8, 0, time.UTC),
			dur != time.Duration(66)*time.Second,
			ev.GetSupplier(utils.META_DEFAULT) != "supplier1",
			ev.GetDisconnectCause(utils.META_DEFAULT) != "NORMAL_CLEARING")
	}
}
開發者ID:bhepp,項目名稱:cgrates,代碼行數:34,代碼來源:fsevent_test.go

示例5: TestOnStorITRedisConnect

func TestOnStorITRedisConnect(t *testing.T) {
	cfg, _ := config.NewDefaultCGRConfig()
	rdsITdb, err = NewRedisStorage(fmt.Sprintf("%s:%s", cfg.TpDbHost, cfg.TpDbPort), 4, cfg.TpDbPass, cfg.DBDataEncoding, utils.REDIS_MAX_CONNS, nil, 1)
	if err != nil {
		t.Fatal("Could not connect to Redis", err.Error())
	}
}
開發者ID:cgrates,項目名稱:cgrates,代碼行數:7,代碼來源:onstor_it_test.go

示例6: TestConnDataDbs

// Create connection to ratingDb
// Will use 3 different datadbs in order to be able to see differences in data loaded
func TestConnDataDbs(t *testing.T) {
	if !*testLocal {
		return
	}
	lCfg, _ = config.NewDefaultCGRConfig()
	var err error
	if ratingDbCsv, err = ConfigureRatingStorage(lCfg.TpDbType, lCfg.TpDbHost, lCfg.TpDbPort, "4", lCfg.TpDbUser, lCfg.TpDbPass, lCfg.DBDataEncoding, nil, 1); err != nil {
		t.Fatal("Error on ratingDb connection: ", err.Error())
	}
	if ratingDbStor, err = ConfigureRatingStorage(lCfg.TpDbType, lCfg.TpDbHost, lCfg.TpDbPort, "5", lCfg.TpDbUser, lCfg.TpDbPass, lCfg.DBDataEncoding, nil, 1); err != nil {
		t.Fatal("Error on ratingDb connection: ", err.Error())
	}
	if ratingDbApier, err = ConfigureRatingStorage(lCfg.TpDbType, lCfg.TpDbHost, lCfg.TpDbPort, "6", lCfg.TpDbUser, lCfg.TpDbPass, lCfg.DBDataEncoding, nil, 1); err != nil {
		t.Fatal("Error on ratingDb connection: ", err.Error())
	}
	if accountDbCsv, err = ConfigureAccountingStorage(lCfg.DataDbType, lCfg.DataDbHost, lCfg.DataDbPort, "7",
		lCfg.DataDbUser, lCfg.DataDbPass, lCfg.DBDataEncoding, nil, 1); err != nil {
		t.Fatal("Error on ratingDb connection: ", err.Error())
	}
	if accountDbStor, err = ConfigureAccountingStorage(lCfg.DataDbType, lCfg.DataDbHost, lCfg.DataDbPort, "8",
		lCfg.DataDbUser, lCfg.DataDbPass, lCfg.DBDataEncoding, nil, 1); err != nil {
		t.Fatal("Error on ratingDb connection: ", err.Error())
	}
	if accountDbApier, err = ConfigureAccountingStorage(lCfg.DataDbType, lCfg.DataDbHost, lCfg.DataDbPort, "9",
		lCfg.DataDbUser, lCfg.DataDbPass, lCfg.DBDataEncoding, nil, 1); err != nil {
		t.Fatal("Error on ratingDb connection: ", err.Error())
	}
	for _, db := range []Storage{ratingDbCsv, ratingDbStor, ratingDbApier, accountDbCsv, accountDbStor, accountDbApier} {
		if err = db.Flush(""); err != nil {
			t.Fatal("Error when flushing datadb")
		}
	}

}
開發者ID:eloycoto,項目名稱:cgrates,代碼行數:36,代碼來源:loader_local_test.go

示例7: TestDmtAgentCCRAsSMGenericEvent

func TestDmtAgentCCRAsSMGenericEvent(t *testing.T) {
	if !*testIntegration {
		return
	}
	cfgDefaults, _ := config.NewDefaultCGRConfig()
	loadDictionaries(cfgDefaults.DiameterAgentCfg().DictionariesDir, "UNIT_TEST")
	ccr := &CCR{
		SessionId:         "routinga;1442095190;1476802709",
		OriginHost:        cfgDefaults.DiameterAgentCfg().OriginHost,
		OriginRealm:       cfgDefaults.DiameterAgentCfg().OriginRealm,
		DestinationHost:   cfgDefaults.DiameterAgentCfg().OriginHost,
		DestinationRealm:  cfgDefaults.DiameterAgentCfg().OriginRealm,
		AuthApplicationId: 4,
		ServiceContextId:  "[email protected]",
		CCRequestType:     1,
		CCRequestNumber:   0,
		EventTimestamp:    time.Date(2015, 11, 23, 12, 22, 24, 0, time.UTC),
		ServiceIdentifier: 0,
		SubscriptionId: []struct {
			SubscriptionIdType int    `avp:"Subscription-Id-Type"`
			SubscriptionIdData string `avp:"Subscription-Id-Data"`
		}{
			struct {
				SubscriptionIdType int    `avp:"Subscription-Id-Type"`
				SubscriptionIdData string `avp:"Subscription-Id-Data"`
			}{SubscriptionIdType: 0, SubscriptionIdData: "4986517174963"},
			struct {
				SubscriptionIdType int    `avp:"Subscription-Id-Type"`
				SubscriptionIdData string `avp:"Subscription-Id-Data"`
			}{SubscriptionIdType: 0, SubscriptionIdData: "4986517174963"}},
		debitInterval: time.Duration(300) * time.Second,
	}
	ccr.RequestedServiceUnit.CCTime = 300
	ccr.ServiceInformation.INInformation.CallingPartyAddress = "4986517174963"
	ccr.ServiceInformation.INInformation.CalledPartyAddress = "4986517174964"
	ccr.ServiceInformation.INInformation.RealCalledNumber = "4986517174964"
	ccr.ServiceInformation.INInformation.ChargeFlowType = 0
	ccr.ServiceInformation.INInformation.CallingVlrNumber = "49123956767"
	ccr.ServiceInformation.INInformation.CallingCellIDOrSAI = "12340185301425"
	ccr.ServiceInformation.INInformation.BearerCapability = "capable"
	ccr.ServiceInformation.INInformation.CallReferenceNumber = "askjadkfjsdf"
	ccr.ServiceInformation.INInformation.MSCAddress = "123324234"
	ccr.ServiceInformation.INInformation.TimeZone = 0
	ccr.ServiceInformation.INInformation.CalledPartyNP = "4986517174964"
	ccr.ServiceInformation.INInformation.SSPTime = "20091020120101"
	var err error
	if ccr.diamMessage, err = ccr.AsDiameterMessage(); err != nil {
		t.Error(err)
	}
	eSMGE := sessionmanager.SMGenericEvent{"EventName": "DIAMETER_CCR", "AccId": "routinga;1442095190;1476802709",
		"Account": "*users", "AnswerTime": "2015-11-23 12:22:24 +0000 UTC", "Category": "call",
		"Destination": "4986517174964", "Direction": "*out", "ReqType": "*users", "SetupTime": "2015-11-23 12:22:24 +0000 UTC",
		"Subject": "*users", "SubscriberId": "4986517174963", "TOR": "*voice", "Tenant": "*users", "Usage": "300"}
	if smge, err := ccr.AsSMGenericEvent(cfgDefaults.DiameterAgentCfg().RequestProcessors[0].ContentFields); err != nil {
		t.Error(err)
	} else if !reflect.DeepEqual(eSMGE, smge) {
		t.Errorf("Expecting: %+v, received: %+v", eSMGE, smge)
	}
}
開發者ID:perrault,項目名稱:cgrates,代碼行數:59,代碼來源:dmtagent_it_test.go

示例8: TestWriteCdr

// Write one CDR and test it's results only for content buffer
func TestWriteCdr(t *testing.T) {
	wrBuf := &bytes.Buffer{}
	logDb, _ := engine.NewMapStorage()
	cfg, _ := config.NewDefaultCGRConfig()
	fixedWidth := utils.CDRE_FIXED_WIDTH
	exportTpl := &config.CgrXmlCdreCfg{
		CdrFormat: &fixedWidth,
		Header:    &config.CgrXmlCfgCdrHeader{Fields: hdrCfgFlds},
		Content:   &config.CgrXmlCfgCdrContent{Fields: contentCfgFlds},
		Trailer:   &config.CgrXmlCfgCdrTrailer{Fields: trailerCfgFlds},
	}
	cdr := &utils.StoredCdr{CgrId: utils.Sha1("dsafdsaf", time.Date(2013, 11, 7, 8, 42, 20, 0, time.UTC).String()),
		TOR: utils.VOICE, OrderId: 1, AccId: "dsafdsaf", CdrHost: "192.168.1.1",
		ReqType: "rated", Direction: "*out", Tenant: "cgrates.org",
		Category: "call", Account: "1001", Subject: "1001", Destination: "1002",
		SetupTime:  time.Date(2013, 11, 7, 8, 42, 20, 0, time.UTC),
		AnswerTime: time.Date(2013, 11, 7, 8, 42, 26, 0, time.UTC),
		Usage:      time.Duration(10) * time.Second, MediationRunId: utils.DEFAULT_RUNID, Cost: 2.34567,
		ExtraFields: map[string]string{"field_extr1": "val_extr1", "fieldextr2": "valextr2"},
	}
	cdre, err := NewCdrExporter([]*utils.StoredCdr{cdr}, logDb, exportTpl.AsCdreConfig(), utils.CDRE_FIXED_WIDTH, ',', "fwv_1", 0.0, 0.0, 0, 4, cfg.RoundingDecimals, "", -1, cfg.HttpSkipTlsVerify)
	if err != nil {
		t.Error(err)
	}
	eHeader := "10   VOI0000007111308420024031415390001                                                                                                         \n"
	eContentOut := "201001        1001                1002                    0211  07111308420010          1       3dsafdsaf                             0002.34570\n"
	eTrailer := "90   VOI0000000000100000010071113084260071113084200                                                                                             \n"
	if err := cdre.writeOut(wrBuf); err != nil {
		t.Error(err)
	}
	allOut := wrBuf.String()
	eAllOut := eHeader + eContentOut + eTrailer
	if math.Mod(float64(len(allOut)), 145) != 0 {
		t.Error("Unexpected export content length", len(allOut))
	} else if len(allOut) != len(eAllOut) {
		t.Errorf("Output does not match expected length. Have output %q, expecting: %q", allOut, eAllOut)
	}
	// Test stats
	if !cdre.firstCdrATime.Equal(cdr.AnswerTime) {
		t.Error("Unexpected firstCdrATime in stats: ", cdre.firstCdrATime)
	} else if !cdre.lastCdrATime.Equal(cdr.AnswerTime) {
		t.Error("Unexpected lastCdrATime in stats: ", cdre.lastCdrATime)
	} else if cdre.numberOfRecords != 1 {
		t.Error("Unexpected number of records in the stats: ", cdre.numberOfRecords)
	} else if cdre.totalDuration != cdr.Usage {
		t.Error("Unexpected total duration in the stats: ", cdre.totalDuration)
	} else if cdre.totalCost != utils.Round(cdr.Cost, cdre.roundDecimals, utils.ROUNDING_MIDDLE) {
		t.Error("Unexpected total cost in the stats: ", cdre.totalCost)
	}
	if cdre.FirstOrderId() != 1 {
		t.Error("Unexpected FirstOrderId", cdre.FirstOrderId())
	}
	if cdre.LastOrderId() != 1 {
		t.Error("Unexpected LastOrderId", cdre.LastOrderId())
	}
	if cdre.TotalCost() != utils.Round(cdr.Cost, cdre.roundDecimals, utils.ROUNDING_MIDDLE) {
		t.Error("Unexpected TotalCost: ", cdre.TotalCost())
	}
}
開發者ID:intralanman,項目名稱:cgrates,代碼行數:60,代碼來源:fixedwidth_test.go

示例9: init

func init() {
	cfgDcT, _ = config.NewDefaultCGRConfig()
	if DEBUG {
		acntDb, _ = NewMapStorage()
	} else {
		acntDb, _ = NewRedisStorage("127.0.0.1:6379", 13, "", utils.MSGPACK)
	}
	acntDb.CacheAccounting(nil, nil, nil, nil)
}
開發者ID:intralanman,項目名稱:cgrates,代碼行數:9,代碼來源:handler_derivedcharging_test.go

示例10: TestConnectRedis

func TestConnectRedis(t *testing.T) {
	if !*testLocal {
		return
	}
	cfg, _ = config.NewDefaultCGRConfig()
	rds, err = NewRedisStorage(fmt.Sprintf("%s:%s", cfg.RatingDBHost, cfg.RatingDBPort), 4, cfg.RatingDBPass, cfg.DBDataEncoding)
	if err != nil {
		t.Fatal("Could not connect to Redis", err.Error())
	}
}
開發者ID:intralanman,項目名稱:cgrates,代碼行數:10,代碼來源:storage_redis_local_test.go

示例11: TestMongoCreateTables

func TestMongoCreateTables(t *testing.T) {
	if !*testLocal {
		return
	}
	cgrConfig, _ := config.NewDefaultCGRConfig()
	var err error
	if mongoDb, err = NewMongoStorage("localhost", "27017", cgrConfig.StorDBName, cgrConfig.StorDBUser, cgrConfig.StorDBPass); err != nil {
		t.Error("Error on opening database connection: ", err)
	}
}
開發者ID:henrylee2cn,項目名稱:cgrates,代碼行數:10,代碼來源:storage_mongo_local_test.go

示例12: TestConnectRedis

func TestConnectRedis(t *testing.T) {
	if !*testLocal {
		return
	}
	cfg, _ := config.NewDefaultCGRConfig()
	rds, err = NewRedisStorage(fmt.Sprintf("%s:%s", cfg.TpDbHost, cfg.TpDbPort), 4, cfg.TpDbPass, cfg.DBDataEncoding, utils.REDIS_MAX_CONNS)
	if err != nil {
		t.Fatal("Could not connect to Redis", err.Error())
	}
}
開發者ID:bhepp,項目名稱:cgrates,代碼行數:10,代碼來源:storage_redis_local_test.go

示例13: TestAuthSetStorage

func TestAuthSetStorage(t *testing.T) {
	ratingDbAuth, _ = engine.NewMapStorageJson()
	engine.SetRatingStorage(ratingDbAuth)
	acntDbAuth, _ = engine.NewMapStorageJson()
	engine.SetAccountingStorage(acntDbAuth)
	cfg, _ := config.NewDefaultCGRConfig()
	config.SetCgrConfig(cfg)
	rsponder = new(engine.Responder)

}
開發者ID:kevinlovesing,項目名稱:cgrates,代碼行數:10,代碼來源:auth_test.go

示例14: TestFsEvGetExtraFields

func TestFsEvGetExtraFields(t *testing.T) {
	cfg, _ := config.NewDefaultCGRConfig()
	cfg.SmFsConfig.ExtraFields = []*utils.RSRField{&utils.RSRField{Id: "Channel-Read-Codec-Name"}, &utils.RSRField{Id: "Channel-Write-Codec-Name"}, &utils.RSRField{Id: "NonExistingHeader"}}
	config.SetCgrConfig(cfg)
	ev := new(FSEvent).AsEvent(hangupEv)
	expectedExtraFields := map[string]string{"Channel-Read-Codec-Name": "SPEEX", "Channel-Write-Codec-Name": "SPEEX", "NonExistingHeader": ""}
	if extraFields := ev.GetExtraFields(); !reflect.DeepEqual(expectedExtraFields, extraFields) {
		t.Errorf("Expecting: %+v, received: %+v", expectedExtraFields, extraFields)
	}
}
開發者ID:bhepp,項目名稱:cgrates,代碼行數:10,代碼來源:fsevent_test.go

示例15: TestFirstNonEmpty

func TestFirstNonEmpty(t *testing.T) {
	fsCdrCfg, _ = config.NewDefaultCGRConfig()
	fsCdr, err := NewFSCdr(body, fsCdrCfg)
	if err != nil {
		t.Errorf("Error loading cdr: %v", err)
	}
	//fsc := fsCdr.(FSCdr)
	if _, ok := fsCdr.vars["cgr_reqtype"]; !ok {
		t.Error("Error parsing cdr: ", fsCdr)
	}
}
開發者ID:iwada,項目名稱:cgrates,代碼行數:11,代碼來源:fscdr_test.go


注:本文中的github.com/cgrates/cgrates/config.NewDefaultCGRConfig函數示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。