• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Golang engine.InitDataDb函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Golang中github.com/cgrates/cgrates/engine.InitDataDb函数的典型用法代码示例。如果您正苦于以下问题:Golang InitDataDb函数的具体用法?Golang InitDataDb怎么用?Golang InitDataDb使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了InitDataDb函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Golang代码示例。

示例1: TestSMGRplcResetDB

// Remove data in both rating and accounting db
func TestSMGRplcResetDB(t *testing.T) {
	if err := engine.InitDataDb(smgRplcMasterCfg); err != nil {
		t.Fatal(err)
	}
	if err := engine.InitStorDb(smgRplcMasterCfg); err != nil {
		t.Fatal(err)
	}
}
开发者ID:cgrates,项目名称:cgrates,代码行数:9,代码来源:smgreplc_it_test.go


示例2: TestSTIResetDataDb

// Remove data in both rating and accounting db
func TestSTIResetDataDb(t *testing.T) {
	if !*testSureTax {
		return
	}
	if err := engine.InitDataDb(stiCfg); err != nil {
		t.Fatal(err)
	}
}
开发者ID:henrylee2cn,项目名称:cgrates,代码行数:9,代码来源:suretax_it_test.go


示例3: TestV2CdrsMongoInitDataDb

func TestV2CdrsMongoInitDataDb(t *testing.T) {
	if !*testLocal {
		return
	}
	if err := engine.InitDataDb(cdrsMongoCfg); err != nil {
		t.Fatal(err)
	}
}
开发者ID:iwada,项目名称:cgrates,代码行数:8,代码来源:cdrs_mongo_local_test.go


示例4: TestApierV2itResetDataDb

// Remove data in both rating and accounting db
func TestApierV2itResetDataDb(t *testing.T) {
	if !*testIT {
		return
	}
	if err := engine.InitDataDb(apierCfg); err != nil {
		t.Fatal(err)
	}
}
开发者ID:rinor,项目名称:cgrates,代码行数:9,代码来源:apierv2_it_test.go


示例5: TestTutKamCallsResetDataDb

// Remove data in both rating and accounting db
func TestTutKamCallsResetDataDb(t *testing.T) {
	if !*testCalls {
		return
	}
	if err := engine.InitDataDb(tutKamCallsCfg); err != nil {
		t.Fatal(err)
	}
}
开发者ID:bhepp,项目名称:cgrates,代码行数:9,代码来源:tutorial_kam_calls_test.go


示例6: TestV2CDRsPSQLInitDataDb

func TestV2CDRsPSQLInitDataDb(t *testing.T) {
	if !*testLocal {
		return
	}
	if err := engine.InitDataDb(cdrsPsqlCfg); err != nil {
		t.Fatal(err)
	}
}
开发者ID:iwada,项目名称:cgrates,代码行数:8,代码来源:cdrs_psql_local_test.go


示例7: TestCDRStatsLclInitDataDb

func TestCDRStatsLclInitDataDb(t *testing.T) {
	if !*testLocal {
		return
	}
	if err := engine.InitDataDb(cdrstCfg); err != nil {
		t.Fatal(err)
	}
}
开发者ID:eloycoto,项目名称:cgrates,代码行数:8,代码来源:cdrstatsv1_local_test.go


示例8: TestSMGV1ResetDataDb

// Remove data in both rating and accounting db
func TestSMGV1ResetDataDb(t *testing.T) {
	if !*testLocal {
		return
	}
	if err := engine.InitDataDb(smgV1Cfg); err != nil {
		t.Fatal(err)
	}
}
开发者ID:kevinlovesing,项目名称:cgrates,代码行数:9,代码来源:smgenericv1_it_test.go


示例9: TestTutLocalResetDataDb

// Remove data in both rating and accounting db
func TestTutLocalResetDataDb(t *testing.T) {
	if !*testLocal {
		return
	}
	if err := engine.InitDataDb(tutFsLocalCfg); err != nil {
		t.Fatal(err)
	}
}
开发者ID:nikbyte,项目名称:cgrates,代码行数:9,代码来源:tutorial_local_test.go


示例10: TestMCDRCResetDataDb

// Remove data in both rating and accounting db
func TestMCDRCResetDataDb(t *testing.T) {
	if !*testLocal {
		return
	}
	if err := engine.InitDataDb(cfg); err != nil {
		t.Fatal(err)
	}
}
开发者ID:eloycoto,项目名称:cgrates,代码行数:9,代码来源:multiplecdrc_local_test.go


示例11: TestTPitResetDataDb

// Remove data in both rating and accounting db
func TestTPitResetDataDb(t *testing.T) {
	if !*testTP {
		return
	}
	if err := engine.InitDataDb(tpCfg); err != nil {
		t.Fatal(err)
	}
}
开发者ID:iwada,项目名称:cgrates,代码行数:9,代码来源:tp_it_test.go


示例12: TestSMGResetDataDb

// Remove data in both rating and accounting db
func TestSMGResetDataDb(t *testing.T) {
	if !*testIntegration {
		return
	}
	if err := engine.InitDataDb(daCfg); err != nil {
		t.Fatal(err)
	}
}
开发者ID:bhepp,项目名称:cgrates,代码行数:9,代码来源:smg_it_test.go


示例13: TestDestManagCacheWithGetCache

func TestDestManagCacheWithGetCache(t *testing.T) {
	if !*testIntegration {
		return
	}
	if err := engine.InitDataDb(destCfg); err != nil {
		t.Fatal(err)
	}
	var reply string
	if err := destRPC.Call("ApierV1.ReloadCache", utils.AttrReloadCache{}, &reply); err != nil {
		t.Error("Got error on ApierV1.ReloadCache: ", err.Error())
	} else if reply != utils.OK {
		t.Errorf("Calling ApierV1.ReloadCache received: %+v", reply)
	}
	attrs := &utils.AttrLoadTpFromFolder{FolderPath: path.Join(*dataDir, "tariffplans", "test", "destinations", "cacheall"), FlushDb: true}
	if err := destRPC.Call("ApierV2.LoadTariffPlanFromFolder", attrs, &destLoadInst); err != nil {
		t.Error(err)
	} else if destLoadInst.RatingLoadID == "" || destLoadInst.AccountingLoadID == "" {
		t.Error("Empty loadId received, loadInstance: ", destLoadInst)
	}
	time.Sleep(time.Duration(*waitRater) * time.Millisecond) // Give time for scheduler to execute topups

	dests := make([]*engine.Destination, 0)
	if err := destRPC.Call("ApierV2.GetDestinations", v2.AttrGetDestinations{DestinationIDs: []string{}}, &dests); err != nil {
		t.Error("Got error on ApierV2.GetDestinations: ", err.Error())
	} else if len(dests) != 1 {
		t.Errorf("Calling ApierV2.GetDestinations got reply: %v", utils.ToIJSON(dests))
	}

	var rcvStats utils.CacheStats
	if err := destRPC.Call("ApierV1.GetCacheStats", utils.AttrCacheStats{}, &rcvStats); err != nil {
		t.Error("Got error on ApierV1.GetCacheStats: ", err.Error())
	} else if rcvStats.Destinations != 2 {
		t.Errorf("Calling ApierV1.GetCacheStats received: %+v", rcvStats)
	}

	attrs = &utils.AttrLoadTpFromFolder{FolderPath: path.Join(*dataDir, "tariffplans", "test", "destinations", "cacheone"), FlushDb: true}
	if err := destRPC.Call("ApierV2.LoadTariffPlanFromFolder", attrs, &destLoadInst); err != nil {
		t.Error(err)
	} else if destLoadInst.RatingLoadID == "" || destLoadInst.AccountingLoadID == "" {
		t.Error("Empty loadId received, loadInstance: ", destLoadInst)
	}
	time.Sleep(time.Duration(*waitRater) * time.Millisecond) // Give time for scheduler to execute topups

	dests = make([]*engine.Destination, 0)
	if err := destRPC.Call("ApierV2.GetDestinations", v2.AttrGetDestinations{DestinationIDs: []string{}}, &dests); err != nil {
		t.Error("Got error on ApierV2.GetDestinations: ", err.Error())
	} else if len(dests) != 1 {
		t.Errorf("Calling ApierV2.GetDestinations got reply: %v", utils.ToIJSON(dests))
	}

	if err := destRPC.Call("ApierV1.GetCacheStats", utils.AttrCacheStats{}, &rcvStats); err != nil {
		t.Error("Got error on ApierV1.GetCacheStats: ", err.Error())
	} else if rcvStats.Destinations != 1 {
		t.Errorf("Calling ApierV1.GetCacheStats received: %+v", rcvStats)
	}
}
开发者ID:iwada,项目名称:cgrates,代码行数:56,代码来源:dest_management_it_test.go


示例14: TestRPCITLclInitCfg

func TestRPCITLclInitCfg(t *testing.T) {
	rpcITCfgPath1 = path.Join(*dataDir, "conf", "samples", "multiral1")
	rpcITCfgPath2 = path.Join(*dataDir, "conf", "samples", "multiral2")
	rpcITCfg1, err = config.NewCGRConfigFromFolder(rpcITCfgPath1)
	if err != nil {
		t.Error(err)
	}
	rpcITCfg2, err = config.NewCGRConfigFromFolder(rpcITCfgPath2)
	if err != nil {
		t.Error(err)
	}
	if err := engine.InitDataDb(rpcITCfg1); err != nil {
		t.Fatal(err)
	}
}
开发者ID:cgrates,项目名称:cgrates,代码行数:15,代码来源:rpcclient_it_test.go


示例15: testV2CDRsInitDataDb

func testV2CDRsInitDataDb(t *testing.T) {
	if err := engine.InitDataDb(cdrsCfg); err != nil {
		t.Fatal(err)
	}
}
开发者ID:cgrates,项目名称:cgrates,代码行数:5,代码来源:cdrs_it_test.go


示例16: TestTutSMGResetDataDb

// Remove data in both rating and accounting db
func TestTutSMGResetDataDb(t *testing.T) {
	if err := engine.InitDataDb(tutSMGCfg); err != nil {
		t.Fatal(err)
	}
}
开发者ID:cgrates,项目名称:cgrates,代码行数:6,代码来源:tut_smgeneric_it_test.go


示例17: TestDmtAgentResetDataDb

// Remove data in both rating and accounting db
func TestDmtAgentResetDataDb(t *testing.T) {
	if err := engine.InitDataDb(daCfg); err != nil {
		t.Fatal(err)
	}
}
开发者ID:cgrates,项目名称:cgrates,代码行数:6,代码来源:dmtagent_it_test.go


示例18: TestTutOsipsCallsResetDataDb

// Remove data in both rating and accounting db
func TestTutOsipsCallsResetDataDb(t *testing.T) {
	if err := engine.InitDataDb(tutOsipsCallsCfg); err != nil {
		t.Fatal(err)
	}
}
开发者ID:cgrates,项目名称:cgrates,代码行数:6,代码来源:tutorial_osips_calls_test.go


示例19: TestDestManagCacheWithGetCost

func TestDestManagCacheWithGetCost(t *testing.T) {
	if !*testIntegration {
		return
	}
	if err := engine.InitDataDb(destCfg); err != nil {
		t.Fatal(err)
	}
	var reply string
	if err := destRPC.Call("ApierV1.ReloadCache", utils.AttrReloadCache{}, &reply); err != nil {
		t.Error("Got error on ApierV1.ReloadCache: ", err.Error())
	} else if reply != utils.OK {
		t.Errorf("Calling ApierV1.ReloadCache received: %+v", reply)
	}
	attrs := &utils.AttrLoadTpFromFolder{FolderPath: path.Join(*dataDir, "tariffplans", "test", "destinations", "cacheall"), FlushDb: true}
	if err := destRPC.Call("ApierV2.LoadTariffPlanFromFolder", attrs, &destLoadInst); err != nil {
		t.Error(err)
	} else if destLoadInst.RatingLoadID == "" || destLoadInst.AccountingLoadID == "" {
		t.Error("Empty loadId received, loadInstance: ", destLoadInst)
	}
	time.Sleep(time.Duration(*waitRater) * time.Millisecond) // Give time for scheduler to execute topups

	dests := make([]*engine.Destination, 0)
	if err := destRPC.Call("ApierV2.GetDestinations", v2.AttrGetDestinations{DestinationIDs: []string{}}, &dests); err != nil {
		t.Error("Got error on ApierV2.GetDestinations: ", err.Error())
	} else if len(dests) != 1 {
		t.Errorf("Calling ApierV2.GetDestinations got reply: %v", utils.ToIJSON(dests))
	}

	var cc engine.CallCost
	cd := &engine.CallDescriptor{
		Direction:   "*out",
		Tenant:      "cgrates.org",
		Category:    "call",
		Account:     "test",
		Destination: "1002",
		TimeStart:   time.Date(2016, 2, 24, 0, 0, 0, 0, time.UTC),
		TimeEnd:     time.Date(2016, 2, 24, 0, 0, 10, 0, time.UTC),
	}
	if err := destRPC.Call("Responder.GetCost", cd, &cc); err != nil {
		t.Error(err)
	} else if cc.Cost != 1.6667 {
		t.Error("Empty loadId received, loadInstance: ", utils.ToIJSON(cc))
	}

	attrs = &utils.AttrLoadTpFromFolder{FolderPath: path.Join(*dataDir, "tariffplans", "test", "destinations", "cacheone"), FlushDb: true}
	if err := destRPC.Call("ApierV2.LoadTariffPlanFromFolder", attrs, &destLoadInst); err != nil {
		t.Error(err)
	} else if destLoadInst.RatingLoadID == "" || destLoadInst.AccountingLoadID == "" {
		t.Error("Empty loadId received, loadInstance: ", destLoadInst)
	}
	time.Sleep(time.Duration(*waitRater) * time.Millisecond) // Give time for scheduler to execute topups

	dests = make([]*engine.Destination, 0)
	if err := destRPC.Call("ApierV2.GetDestinations", v2.AttrGetDestinations{DestinationIDs: []string{}}, &dests); err != nil {
		t.Error("Got error on ApierV2.GetDestinations: ", err.Error())
	} else if len(dests) != 1 {
		t.Errorf("Calling ApierV2.GetDestinations got reply: %v", utils.ToIJSON(dests))
	}

	if err := destRPC.Call("Responder.GetCost", cd, &cc); err.Error() != utils.ErrUnauthorizedDestination.Error() {
		t.Error(err)
	}
}
开发者ID:iwada,项目名称:cgrates,代码行数:63,代码来源:dest_management_it_test.go


示例20: TestSMGVoiceResetDataDb

// Remove data in both rating and accounting db
func TestSMGVoiceResetDataDb(t *testing.T) {
	if err := engine.InitDataDb(daCfg); err != nil {
		t.Fatal(err)
	}
}
开发者ID:cgrates,项目名称:cgrates,代码行数:6,代码来源:smg_it_test.go



注:本文中的github.com/cgrates/cgrates/engine.InitDataDb函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Golang engine.InitStorDb函数代码示例发布时间:2022-05-23
下一篇:
Golang engine.ConfigureRatingStorage函数代码示例发布时间:2022-05-23
热门推荐
热门话题
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap