replaced storageGetter with dataStorage

This commit is contained in:
Radu Ioan Fericean
2013-12-17 22:37:51 +02:00
parent e03bbc9b96
commit 4638bad4d1
8 changed files with 31 additions and 31 deletions

View File

@@ -39,11 +39,11 @@ func TestDestinationStoreRestore(t *testing.T) {
func TestDestinationStorageStore(t *testing.T) {
nationale := &Destination{Id: "nat", Prefixes: []string{"0257", "0256", "0723"}}
err := storageGetter.SetDestination(nationale)
err := dataStorage.SetDestination(nationale)
if err != nil {
t.Error("Error storing destination: ", err)
}
result, err := storageGetter.GetDestination(nationale.Id)
result, err := dataStorage.GetDestination(nationale.Id)
if nationale.containsPrefix("0257") == 0 || nationale.containsPrefix("0256") == 0 || nationale.containsPrefix("0723") == 0 {
t.Errorf("Expected %q was %q", nationale, result)
}
@@ -74,28 +74,28 @@ func TestDestinationContainsPrefixWrong(t *testing.T) {
}
func TestDestinationGetExists(t *testing.T) {
d, err := storageGetter.GetDestination("NAT")
d, err := dataStorage.GetDestination("NAT")
if err != nil || d == nil {
t.Error("Could not get destination: ", d)
}
}
func TestDestinationGetExistsCache(t *testing.T) {
storageGetter.GetDestination("NAT")
dataStorage.GetDestination("NAT")
if _, err := cache2go.GetCached(DESTINATION_PREFIX + "0256"); err != nil {
t.Error("Destination not cached:", err)
}
}
func TestDestinationGetNotExists(t *testing.T) {
d, err := storageGetter.GetDestination("not existing")
d, err := dataStorage.GetDestination("not existing")
if d != nil {
t.Error("Got false destination: ", d, err)
}
}
func TestDestinationGetNotExistsCache(t *testing.T) {
storageGetter.GetDestination("not existing")
dataStorage.GetDestination("not existing")
if d, err := cache2go.GetCached("not existing"); err == nil {
t.Error("Bad destination cached: ", d)
}
@@ -106,7 +106,7 @@ func TestDestinationGetNotExistsCache(t *testing.T) {
func BenchmarkDestinationStorageStoreRestore(b *testing.B) {
nationale := &Destination{Id: "nat", Prefixes: []string{"0257", "0256", "0723"}}
for i := 0; i < b.N; i++ {
storageGetter.SetDestination(nationale)
storageGetter.GetDestination(nationale.Id)
dataStorage.SetDestination(nationale)
dataStorage.GetDestination(nationale.Id)
}
}