public virtual void TestCachingCachesNegativeEntries() { StaticMapping staticMapping = NewInstance(); CachedDNSToSwitchMapping cachedMap = new CachedDNSToSwitchMapping(staticMapping); AssertMapSize(cachedMap, 0); AssertMapSize(staticMapping, 0); IList <string> resolved = cachedMap.Resolve(CreateQueryList()); //and verify the cache is no longer empty while the static map is AssertMapSize(staticMapping, 0); AssertMapSize(cachedMap, 2); }
public virtual void TestCachingRelaysResolveQueries() { StaticMapping mapping = NewInstance(); mapping.SetConf(CreateConf("top")); StaticMapping staticMapping = mapping; CachedDNSToSwitchMapping cachedMap = new CachedDNSToSwitchMapping(staticMapping); AssertMapSize(cachedMap, 0); //add a node to the static map StaticMapping.AddNodeToRack("n1", "/r1"); //verify it is there AssertMapSize(staticMapping, 1); //verify that the cache hasn't picked it up yet AssertMapSize(cachedMap, 0); //now relay the query cachedMap.Resolve(CreateQueryList()); //and verify the cache is no longer empty AssertMapSize(cachedMap, 2); }