|
|
|
|
@@ -29,7 +29,7 @@ func TestKyotoSplitSpans(t *testing.T) {
|
|
|
|
|
|
|
|
|
|
t1 := time.Date(2012, time.February, 2, 17, 30, 0, 0, time.UTC)
|
|
|
|
|
t2 := time.Date(2012, time.February, 2, 18, 30, 0, 0, time.UTC)
|
|
|
|
|
cd := &CallDescriptor{CstmId: "vdf", Subject: "rif", DestinationPrefix: "0256", TimeStart: t1, TimeEnd: t2, StorageGetter: getter}
|
|
|
|
|
cd := &CallDescriptor{CstmId: "vdf", Subject: "rif", DestinationPrefix: "0256", TimeStart: t1, TimeEnd: t2, storageGetter: getter}
|
|
|
|
|
|
|
|
|
|
cd.RestoreFromStorage()
|
|
|
|
|
timespans := cd.splitInTimeSpans()
|
|
|
|
|
@@ -44,7 +44,7 @@ func TestRedisSplitSpans(t *testing.T) {
|
|
|
|
|
|
|
|
|
|
t1 := time.Date(2012, time.February, 2, 17, 30, 0, 0, time.UTC)
|
|
|
|
|
t2 := time.Date(2012, time.February, 2, 18, 30, 0, 0, time.UTC)
|
|
|
|
|
cd := &CallDescriptor{CstmId: "vdf", Subject: "rif", DestinationPrefix: "0257", TimeStart: t1, TimeEnd: t2, StorageGetter: getter}
|
|
|
|
|
cd := &CallDescriptor{CstmId: "vdf", Subject: "rif", DestinationPrefix: "0257", TimeStart: t1, TimeEnd: t2, storageGetter: getter}
|
|
|
|
|
cd.RestoreFromStorage()
|
|
|
|
|
|
|
|
|
|
timespans := cd.splitInTimeSpans()
|
|
|
|
|
@@ -60,13 +60,13 @@ func TestKyotoGetCost(t *testing.T) {
|
|
|
|
|
|
|
|
|
|
t1 := time.Date(2012, time.February, 2, 17, 30, 0, 0, time.UTC)
|
|
|
|
|
t2 := time.Date(2012, time.February, 2, 18, 30, 0, 0, time.UTC)
|
|
|
|
|
cd := &CallDescriptor{CstmId: "vdf", Subject: "rif", DestinationPrefix: "0256", TimeStart: t1, TimeEnd: t2, StorageGetter: getter}
|
|
|
|
|
cd := &CallDescriptor{CstmId: "vdf", Subject: "rif", DestinationPrefix: "0256", TimeStart: t1, TimeEnd: t2, storageGetter: getter}
|
|
|
|
|
result, _ := cd.GetCost()
|
|
|
|
|
expected := &CallCost{CstmId: "vdf", Subject: "rif", DestinationPrefix: "0256", Cost: 540, ConnectFee: 0}
|
|
|
|
|
if result.Cost != expected.Cost || result.ConnectFee != expected.ConnectFee {
|
|
|
|
|
t.Errorf("Expected %v was %v", expected, result)
|
|
|
|
|
}
|
|
|
|
|
cd = &CallDescriptor{CstmId: "vdf", Subject: "rif", DestinationPrefix: "0257", TimeStart: t1, TimeEnd: t2, StorageGetter: getter}
|
|
|
|
|
cd = &CallDescriptor{CstmId: "vdf", Subject: "rif", DestinationPrefix: "0257", TimeStart: t1, TimeEnd: t2, storageGetter: getter}
|
|
|
|
|
result, _ = cd.GetCost()
|
|
|
|
|
expected = &CallCost{CstmId: "vdf", Subject: "rif", DestinationPrefix: "0257", Cost: 540, ConnectFee: 0}
|
|
|
|
|
}
|
|
|
|
|
@@ -77,7 +77,7 @@ func TestRedisGetCost(t *testing.T) {
|
|
|
|
|
|
|
|
|
|
t1 := time.Date(2012, time.February, 2, 17, 30, 0, 0, time.UTC)
|
|
|
|
|
t2 := time.Date(2012, time.February, 2, 18, 30, 0, 0, time.UTC)
|
|
|
|
|
cd := &CallDescriptor{CstmId: "vdf", Subject: "rif", DestinationPrefix: "0256", TimeStart: t1, TimeEnd: t2, StorageGetter: getter}
|
|
|
|
|
cd := &CallDescriptor{CstmId: "vdf", Subject: "rif", DestinationPrefix: "0256", TimeStart: t1, TimeEnd: t2, storageGetter: getter}
|
|
|
|
|
result, _ := cd.GetCost()
|
|
|
|
|
expected := &CallCost{CstmId: "vdf", Subject: "rif", DestinationPrefix: "0256", Cost: 540, ConnectFee: 0}
|
|
|
|
|
if result.Cost != expected.Cost || result.ConnectFee != expected.ConnectFee {
|
|
|
|
|
@@ -94,7 +94,7 @@ func TestMongoGetCost(t *testing.T) {
|
|
|
|
|
|
|
|
|
|
t1 := time.Date(2012, time.February, 2, 17, 30, 0, 0, time.UTC)
|
|
|
|
|
t2 := time.Date(2012, time.February, 2, 18, 30, 0, 0, time.UTC)
|
|
|
|
|
cd := &CallDescriptor{CstmId: "vdf", Subject: "rif", DestinationPrefix: "0256", TimeStart: t1, TimeEnd: t2, StorageGetter: getter}
|
|
|
|
|
cd := &CallDescriptor{CstmId: "vdf", Subject: "rif", DestinationPrefix: "0256", TimeStart: t1, TimeEnd: t2, storageGetter: getter}
|
|
|
|
|
result, _ := cd.GetCost()
|
|
|
|
|
expected := &CallCost{CstmId: "vdf", Subject: "rif", DestinationPrefix: "0256", Cost: 540, ConnectFee: 0}
|
|
|
|
|
if result.Cost != expected.Cost || result.ConnectFee != expected.ConnectFee {
|
|
|
|
|
@@ -108,7 +108,7 @@ func TestFullDestNotFound(t *testing.T) {
|
|
|
|
|
|
|
|
|
|
t1 := time.Date(2012, time.February, 2, 17, 30, 0, 0, time.UTC)
|
|
|
|
|
t2 := time.Date(2012, time.February, 2, 18, 30, 0, 0, time.UTC)
|
|
|
|
|
cd := &CallDescriptor{CstmId: "vdf", Subject: "rif", DestinationPrefix: "0256308200", TimeStart: t1, TimeEnd: t2, StorageGetter: getter}
|
|
|
|
|
cd := &CallDescriptor{CstmId: "vdf", Subject: "rif", DestinationPrefix: "0256308200", TimeStart: t1, TimeEnd: t2, storageGetter: getter}
|
|
|
|
|
result, _ := cd.GetCost()
|
|
|
|
|
expected := &CallCost{CstmId: "vdf", Subject: "rif", DestinationPrefix: "0256", Cost: 540, ConnectFee: 0}
|
|
|
|
|
if result.Cost != expected.Cost || result.ConnectFee != expected.ConnectFee {
|
|
|
|
|
@@ -122,7 +122,7 @@ func TestMultipleActivationPeriods(t *testing.T) {
|
|
|
|
|
|
|
|
|
|
t1 := time.Date(2012, time.February, 8, 17, 30, 0, 0, time.UTC)
|
|
|
|
|
t2 := time.Date(2012, time.February, 8, 18, 30, 0, 0, time.UTC)
|
|
|
|
|
cd := &CallDescriptor{CstmId: "vdf", Subject: "rif", DestinationPrefix: "0257308200", TimeStart: t1, TimeEnd: t2, StorageGetter: getter}
|
|
|
|
|
cd := &CallDescriptor{CstmId: "vdf", Subject: "rif", DestinationPrefix: "0257308200", TimeStart: t1, TimeEnd: t2, storageGetter: getter}
|
|
|
|
|
result, _ := cd.GetCost()
|
|
|
|
|
expected := &CallCost{CstmId: "vdf", Subject: "rif", DestinationPrefix: "0257", Cost: 330, ConnectFee: 0}
|
|
|
|
|
if result.Cost != expected.Cost || result.ConnectFee != expected.ConnectFee {
|
|
|
|
|
@@ -138,7 +138,7 @@ func TestSpansMultipleActivationPeriods(t *testing.T) {
|
|
|
|
|
|
|
|
|
|
t1 := time.Date(2012, time.February, 7, 23, 50, 0, 0, time.UTC)
|
|
|
|
|
t2 := time.Date(2012, time.February, 8, 0, 30, 0, 0, time.UTC)
|
|
|
|
|
cd := &CallDescriptor{CstmId: "vdf", Subject: "rif", DestinationPrefix: "0257308200", TimeStart: t1, TimeEnd: t2, StorageGetter: getter}
|
|
|
|
|
cd := &CallDescriptor{CstmId: "vdf", Subject: "rif", DestinationPrefix: "0257308200", TimeStart: t1, TimeEnd: t2, storageGetter: getter}
|
|
|
|
|
result, _ := cd.GetCost()
|
|
|
|
|
expected := &CallCost{CstmId: "vdf", Subject: "rif", DestinationPrefix: "0257", Cost: 360, ConnectFee: 0}
|
|
|
|
|
if result.Cost != expected.Cost || result.ConnectFee != expected.ConnectFee {
|
|
|
|
|
@@ -152,7 +152,7 @@ func TestLessThanAMinute(t *testing.T) {
|
|
|
|
|
|
|
|
|
|
t1 := time.Date(2012, time.February, 8, 23, 50, 0, 0, time.UTC)
|
|
|
|
|
t2 := time.Date(2012, time.February, 8, 23, 50, 30, 0, time.UTC)
|
|
|
|
|
cd := &CallDescriptor{CstmId: "vdf", Subject: "rif", DestinationPrefix: "0257308200", TimeStart: t1, TimeEnd: t2, StorageGetter: getter}
|
|
|
|
|
cd := &CallDescriptor{CstmId: "vdf", Subject: "rif", DestinationPrefix: "0257308200", TimeStart: t1, TimeEnd: t2, storageGetter: getter}
|
|
|
|
|
result, _ := cd.GetCost()
|
|
|
|
|
expected := &CallCost{CstmId: "vdf", Subject: "rif", DestinationPrefix: "0257", Cost: 0.5, ConnectFee: 0}
|
|
|
|
|
if result.Cost != expected.Cost || result.ConnectFee != expected.ConnectFee {
|
|
|
|
|
@@ -166,7 +166,7 @@ func TestUniquePrice(t *testing.T) {
|
|
|
|
|
|
|
|
|
|
t1 := time.Date(2012, time.February, 8, 22, 50, 0, 0, time.UTC)
|
|
|
|
|
t2 := time.Date(2012, time.February, 8, 23, 50, 21, 0, time.UTC)
|
|
|
|
|
cd := &CallDescriptor{CstmId: "vdf", Subject: "rif", DestinationPrefix: "0723045326", TimeStart: t1, TimeEnd: t2, StorageGetter: getter}
|
|
|
|
|
cd := &CallDescriptor{CstmId: "vdf", Subject: "rif", DestinationPrefix: "0723045326", TimeStart: t1, TimeEnd: t2, storageGetter: getter}
|
|
|
|
|
result, _ := cd.GetCost()
|
|
|
|
|
expected := &CallCost{CstmId: "vdf", Subject: "rif", DestinationPrefix: "0723", Cost: 60.35, ConnectFee: 0}
|
|
|
|
|
if result.Cost != expected.Cost || result.ConnectFee != expected.ConnectFee {
|
|
|
|
|
@@ -180,7 +180,7 @@ func TestPresentSecodCost(t *testing.T) {
|
|
|
|
|
|
|
|
|
|
t1 := time.Date(2012, time.February, 8, 22, 50, 0, 0, time.UTC)
|
|
|
|
|
t2 := time.Date(2012, time.February, 8, 23, 50, 21, 0, time.UTC)
|
|
|
|
|
cd := &CallDescriptor{CstmId: "vdf", Subject: "rif", DestinationPrefix: "0723", TimeStart: t1, TimeEnd: t2, StorageGetter: getter}
|
|
|
|
|
cd := &CallDescriptor{CstmId: "vdf", Subject: "rif", DestinationPrefix: "0723", TimeStart: t1, TimeEnd: t2, storageGetter: getter}
|
|
|
|
|
result, _ := cd.getPresentSecondCost()
|
|
|
|
|
expected := 0.016
|
|
|
|
|
if result != expected {
|
|
|
|
|
@@ -194,7 +194,7 @@ func TestMinutesCost(t *testing.T) {
|
|
|
|
|
|
|
|
|
|
t1 := time.Date(2012, time.February, 8, 22, 50, 0, 0, time.UTC)
|
|
|
|
|
t2 := time.Date(2012, time.February, 8, 22, 51, 50, 0, time.UTC)
|
|
|
|
|
cd := &CallDescriptor{CstmId: "vdf", Subject: "minutosu", DestinationPrefix: "0723", TimeStart: t1, TimeEnd: t2, StorageGetter: getter}
|
|
|
|
|
cd := &CallDescriptor{CstmId: "vdf", Subject: "minutosu", DestinationPrefix: "0723", TimeStart: t1, TimeEnd: t2, storageGetter: getter}
|
|
|
|
|
result, _ := cd.GetCost()
|
|
|
|
|
expected := &CallCost{CstmId: "vdf", Subject: "minutosu", DestinationPrefix: "0723", Cost: 0.1, ConnectFee: 0}
|
|
|
|
|
if result.Cost != expected.Cost || result.ConnectFee != expected.ConnectFee {
|
|
|
|
|
@@ -206,7 +206,7 @@ func TestMinutesCost(t *testing.T) {
|
|
|
|
|
func TestMaxSessionTimeNoUserBudget(t *testing.T) {
|
|
|
|
|
getter, _ := NewRedisStorage("tcp:127.0.0.1:6379", 10)
|
|
|
|
|
defer getter.Close()
|
|
|
|
|
cd := &CallDescriptor{CstmId: "vdf", Subject: "rif", DestinationPrefix: "0723", StorageGetter: getter, Amount: 1000}
|
|
|
|
|
cd := &CallDescriptor{CstmId: "vdf", Subject: "rif", DestinationPrefix: "0723", storageGetter: getter, Amount: 1000}
|
|
|
|
|
result, err := cd.GetMaxSessionTime()
|
|
|
|
|
if result != 1000 || err != nil {
|
|
|
|
|
t.Errorf("Expected %v was %v", 1000, result)
|
|
|
|
|
@@ -216,7 +216,7 @@ func TestMaxSessionTimeNoUserBudget(t *testing.T) {
|
|
|
|
|
func TestMaxSessionTimeWithUserBudget(t *testing.T) {
|
|
|
|
|
getter, _ := NewRedisStorage("tcp:127.0.0.1:6379", 10)
|
|
|
|
|
defer getter.Close()
|
|
|
|
|
cd := &CallDescriptor{CstmId: "vdf", Subject: "minutosu", DestinationPrefix: "0723", StorageGetter: getter, Amount: 5400}
|
|
|
|
|
cd := &CallDescriptor{CstmId: "vdf", Subject: "minutosu", DestinationPrefix: "0723", storageGetter: getter, Amount: 5400}
|
|
|
|
|
result, err := cd.GetMaxSessionTime()
|
|
|
|
|
if result != 1080 || err != nil {
|
|
|
|
|
t.Errorf("Expected %v was %v", 1080, result)
|
|
|
|
|
@@ -226,13 +226,29 @@ func TestMaxSessionTimeWithUserBudget(t *testing.T) {
|
|
|
|
|
func TestMaxSessionTimeNoCredit(t *testing.T) {
|
|
|
|
|
getter, _ := NewRedisStorage("tcp:127.0.0.1:6379", 10)
|
|
|
|
|
defer getter.Close()
|
|
|
|
|
cd := &CallDescriptor{CstmId: "vdf", Subject: "broker", DestinationPrefix: "0723", StorageGetter: getter, Amount: 5400}
|
|
|
|
|
cd := &CallDescriptor{CstmId: "vdf", Subject: "broker", DestinationPrefix: "0723", storageGetter: getter, Amount: 5400}
|
|
|
|
|
result, err := cd.GetMaxSessionTime()
|
|
|
|
|
if result != 100 || err != nil {
|
|
|
|
|
t.Errorf("Expected %v was %v", 100, result)
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
func TestGetCostWithVolumeDiscount(t *testing.T) {
|
|
|
|
|
getter, _ := NewKyotoStorage("test.kch")
|
|
|
|
|
defer getter.Close()
|
|
|
|
|
vd1 := &VolumeDiscount{100, 10}
|
|
|
|
|
vd2 := &VolumeDiscount{500, 20}
|
|
|
|
|
seara := &TariffPlan{Id: "seara", SmsCredit: 100, VolumeDiscountThresholds: []*VolumeDiscount{vd1, vd2}}
|
|
|
|
|
rifsBudget := &UserBudget{Id: "other", Credit: 21, tariffPlan: seara, ResetDayOfTheMonth: 10, VolumeDiscountSeconds: 105}
|
|
|
|
|
t1 := time.Date(2012, time.February, 2, 17, 30, 0, 0, time.UTC)
|
|
|
|
|
t2 := time.Date(2012, time.February, 2, 18, 30, 0, 0, time.UTC)
|
|
|
|
|
cd := &CallDescriptor{CstmId: "vdf", Subject: "rif", DestinationPrefix: "0723", TimeStart: t1, TimeEnd: t2, storageGetter: getter, userBudget: rifsBudget}
|
|
|
|
|
callCost, err := cd.GetCost()
|
|
|
|
|
if callCost.Cost != 54.0 || err != nil {
|
|
|
|
|
t.Errorf("Expected %v was %v", 54.0, callCost)
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/*********************************** BENCHMARKS ***************************************/
|
|
|
|
|
func BenchmarkRedisGetting(b *testing.B) {
|
|
|
|
|
b.StopTimer()
|
|
|
|
|
@@ -255,7 +271,7 @@ func BenchmarkRedisRestoring(b *testing.B) {
|
|
|
|
|
|
|
|
|
|
t1 := time.Date(2012, time.February, 2, 17, 30, 0, 0, time.UTC)
|
|
|
|
|
t2 := time.Date(2012, time.February, 2, 18, 30, 0, 0, time.UTC)
|
|
|
|
|
cd := &CallDescriptor{CstmId: "vdf", Subject: "rif", DestinationPrefix: "0256", TimeStart: t1, TimeEnd: t2, StorageGetter: getter}
|
|
|
|
|
cd := &CallDescriptor{CstmId: "vdf", Subject: "rif", DestinationPrefix: "0256", TimeStart: t1, TimeEnd: t2, storageGetter: getter}
|
|
|
|
|
b.StartTimer()
|
|
|
|
|
for i := 0; i < b.N; i++ {
|
|
|
|
|
cd.RestoreFromStorage()
|
|
|
|
|
@@ -269,7 +285,7 @@ func BenchmarkRedisGetCost(b *testing.B) {
|
|
|
|
|
|
|
|
|
|
t1 := time.Date(2012, time.February, 2, 17, 30, 0, 0, time.UTC)
|
|
|
|
|
t2 := time.Date(2012, time.February, 2, 18, 30, 0, 0, time.UTC)
|
|
|
|
|
cd := &CallDescriptor{CstmId: "vdf", Subject: "rif", DestinationPrefix: "0256", TimeStart: t1, TimeEnd: t2, StorageGetter: getter}
|
|
|
|
|
cd := &CallDescriptor{CstmId: "vdf", Subject: "rif", DestinationPrefix: "0256", TimeStart: t1, TimeEnd: t2, storageGetter: getter}
|
|
|
|
|
b.StartTimer()
|
|
|
|
|
for i := 0; i < b.N; i++ {
|
|
|
|
|
cd.GetCost()
|
|
|
|
|
@@ -283,7 +299,7 @@ func BenchmarkKyotoGetting(b *testing.B) {
|
|
|
|
|
|
|
|
|
|
t1 := time.Date(2012, time.February, 2, 17, 30, 0, 0, time.UTC)
|
|
|
|
|
t2 := time.Date(2012, time.February, 2, 18, 30, 0, 0, time.UTC)
|
|
|
|
|
cd := &CallDescriptor{CstmId: "vdf", Subject: "rif", DestinationPrefix: "0256", TimeStart: t1, TimeEnd: t2, StorageGetter: getter}
|
|
|
|
|
cd := &CallDescriptor{CstmId: "vdf", Subject: "rif", DestinationPrefix: "0256", TimeStart: t1, TimeEnd: t2, storageGetter: getter}
|
|
|
|
|
b.StartTimer()
|
|
|
|
|
for i := 0; i < b.N; i++ {
|
|
|
|
|
key := cd.GetKey()
|
|
|
|
|
@@ -298,7 +314,7 @@ func BenchmarkKyotoRestoring(b *testing.B) {
|
|
|
|
|
|
|
|
|
|
t1 := time.Date(2012, time.February, 2, 17, 30, 0, 0, time.UTC)
|
|
|
|
|
t2 := time.Date(2012, time.February, 2, 18, 30, 0, 0, time.UTC)
|
|
|
|
|
cd := &CallDescriptor{CstmId: "vdf", Subject: "rif", DestinationPrefix: "0256", TimeStart: t1, TimeEnd: t2, StorageGetter: getter}
|
|
|
|
|
cd := &CallDescriptor{CstmId: "vdf", Subject: "rif", DestinationPrefix: "0256", TimeStart: t1, TimeEnd: t2, storageGetter: getter}
|
|
|
|
|
b.StartTimer()
|
|
|
|
|
for i := 0; i < b.N; i++ {
|
|
|
|
|
cd.RestoreFromStorage()
|
|
|
|
|
@@ -312,7 +328,7 @@ func BenchmarkSplitting(b *testing.B) {
|
|
|
|
|
|
|
|
|
|
t1 := time.Date(2012, time.February, 2, 17, 30, 0, 0, time.UTC)
|
|
|
|
|
t2 := time.Date(2012, time.February, 2, 18, 30, 0, 0, time.UTC)
|
|
|
|
|
cd := &CallDescriptor{CstmId: "vdf", Subject: "rif", DestinationPrefix: "0256", TimeStart: t1, TimeEnd: t2, StorageGetter: getter}
|
|
|
|
|
cd := &CallDescriptor{CstmId: "vdf", Subject: "rif", DestinationPrefix: "0256", TimeStart: t1, TimeEnd: t2, storageGetter: getter}
|
|
|
|
|
cd.RestoreFromStorage()
|
|
|
|
|
b.StartTimer()
|
|
|
|
|
for i := 0; i < b.N; i++ {
|
|
|
|
|
@@ -327,7 +343,7 @@ func BenchmarkKyotoGetCost(b *testing.B) {
|
|
|
|
|
|
|
|
|
|
t1 := time.Date(2012, time.February, 2, 17, 30, 0, 0, time.UTC)
|
|
|
|
|
t2 := time.Date(2012, time.February, 2, 18, 30, 0, 0, time.UTC)
|
|
|
|
|
cd := &CallDescriptor{CstmId: "vdf", Subject: "rif", DestinationPrefix: "0256", TimeStart: t1, TimeEnd: t2, StorageGetter: getter}
|
|
|
|
|
cd := &CallDescriptor{CstmId: "vdf", Subject: "rif", DestinationPrefix: "0256", TimeStart: t1, TimeEnd: t2, storageGetter: getter}
|
|
|
|
|
b.StartTimer()
|
|
|
|
|
for i := 0; i < b.N; i++ {
|
|
|
|
|
cd.GetCost()
|
|
|
|
|
@@ -355,7 +371,7 @@ func BenchmarkMongoGetCost(b *testing.B) {
|
|
|
|
|
|
|
|
|
|
t1 := time.Date(2012, time.February, 2, 17, 30, 0, 0, time.UTC)
|
|
|
|
|
t2 := time.Date(2012, time.February, 2, 18, 30, 0, 0, time.UTC)
|
|
|
|
|
cd := &CallDescriptor{CstmId: "vdf", Subject: "rif", DestinationPrefix: "0256", TimeStart: t1, TimeEnd: t2, StorageGetter: getter}
|
|
|
|
|
cd := &CallDescriptor{CstmId: "vdf", Subject: "rif", DestinationPrefix: "0256", TimeStart: t1, TimeEnd: t2, storageGetter: getter}
|
|
|
|
|
b.StartTimer()
|
|
|
|
|
for i := 0; i < b.N; i++ {
|
|
|
|
|
cd.GetCost()
|
|
|
|
|
@@ -366,7 +382,7 @@ func BenchmarkKyotoSingleGetSessionTime(b *testing.B) {
|
|
|
|
|
b.StopTimer()
|
|
|
|
|
getter, _ := NewKyotoStorage("test.kch")
|
|
|
|
|
defer getter.Close()
|
|
|
|
|
cd := &CallDescriptor{CstmId: "vdf", Subject: "minutosu", DestinationPrefix: "0723", StorageGetter: getter, Amount: 100}
|
|
|
|
|
cd := &CallDescriptor{CstmId: "vdf", Subject: "minutosu", DestinationPrefix: "0723", storageGetter: getter, Amount: 100}
|
|
|
|
|
b.StartTimer()
|
|
|
|
|
for i := 0; i < b.N; i++ {
|
|
|
|
|
cd.GetMaxSessionTime()
|
|
|
|
|
@@ -377,7 +393,7 @@ func BenchmarkKyotoMultipleGetSessionTime(b *testing.B) {
|
|
|
|
|
b.StopTimer()
|
|
|
|
|
getter, _ := NewKyotoStorage("test.kch")
|
|
|
|
|
defer getter.Close()
|
|
|
|
|
cd := &CallDescriptor{CstmId: "vdf", Subject: "minutosu", DestinationPrefix: "0723", StorageGetter: getter, Amount: 5400}
|
|
|
|
|
cd := &CallDescriptor{CstmId: "vdf", Subject: "minutosu", DestinationPrefix: "0723", storageGetter: getter, Amount: 5400}
|
|
|
|
|
b.StartTimer()
|
|
|
|
|
for i := 0; i < b.N; i++ {
|
|
|
|
|
cd.GetMaxSessionTime()
|
|
|
|
|
@@ -388,7 +404,7 @@ func BenchmarkRedisSingleGetSessionTime(b *testing.B) {
|
|
|
|
|
b.StopTimer()
|
|
|
|
|
getter, _ := NewRedisStorage("", 10)
|
|
|
|
|
defer getter.Close()
|
|
|
|
|
cd := &CallDescriptor{CstmId: "vdf", Subject: "minutosu", DestinationPrefix: "0723", StorageGetter: getter, Amount: 100}
|
|
|
|
|
cd := &CallDescriptor{CstmId: "vdf", Subject: "minutosu", DestinationPrefix: "0723", storageGetter: getter, Amount: 100}
|
|
|
|
|
b.StartTimer()
|
|
|
|
|
for i := 0; i < b.N; i++ {
|
|
|
|
|
cd.GetMaxSessionTime()
|
|
|
|
|
@@ -399,7 +415,7 @@ func BenchmarkRedisMultipleGetSessionTime(b *testing.B) {
|
|
|
|
|
b.StopTimer()
|
|
|
|
|
getter, _ := NewRedisStorage("", 10)
|
|
|
|
|
defer getter.Close()
|
|
|
|
|
cd := &CallDescriptor{CstmId: "vdf", Subject: "minutosu", DestinationPrefix: "0723", StorageGetter: getter, Amount: 5400}
|
|
|
|
|
cd := &CallDescriptor{CstmId: "vdf", Subject: "minutosu", DestinationPrefix: "0723", storageGetter: getter, Amount: 5400}
|
|
|
|
|
b.StartTimer()
|
|
|
|
|
for i := 0; i < b.N; i++ {
|
|
|
|
|
cd.GetMaxSessionTime()
|
|
|
|
|
@@ -410,7 +426,7 @@ func BenchmarkMongoSingleGetSessionTime(b *testing.B) {
|
|
|
|
|
b.StopTimer()
|
|
|
|
|
getter, _ := NewMongoStorage("127.0.0.1", "test")
|
|
|
|
|
defer getter.Close()
|
|
|
|
|
cd := &CallDescriptor{CstmId: "vdf", Subject: "minutosu", DestinationPrefix: "0723", StorageGetter: getter, Amount: 100}
|
|
|
|
|
cd := &CallDescriptor{CstmId: "vdf", Subject: "minutosu", DestinationPrefix: "0723", storageGetter: getter, Amount: 100}
|
|
|
|
|
b.StartTimer()
|
|
|
|
|
for i := 0; i < b.N; i++ {
|
|
|
|
|
cd.GetMaxSessionTime()
|
|
|
|
|
@@ -421,7 +437,7 @@ func BenchmarkMongoMultipleGetSessionTime(b *testing.B) {
|
|
|
|
|
b.StopTimer()
|
|
|
|
|
getter, _ := NewMongoStorage("127.0.0.1", "test")
|
|
|
|
|
defer getter.Close()
|
|
|
|
|
cd := &CallDescriptor{CstmId: "vdf", Subject: "minutosu", DestinationPrefix: "0723", StorageGetter: getter, Amount: 5400}
|
|
|
|
|
cd := &CallDescriptor{CstmId: "vdf", Subject: "minutosu", DestinationPrefix: "0723", storageGetter: getter, Amount: 5400}
|
|
|
|
|
b.StartTimer()
|
|
|
|
|
for i := 0; i < b.N; i++ {
|
|
|
|
|
cd.GetMaxSessionTime()
|
|
|
|
|
|