Пример #1
0
 /**
  * Verify the cached mapper delegates the switch mapping query to the inner mapping, which again
  * handles arbitrary DNSToSwitchMapping implementations
  *
  * @throws Throwable on any problem
  */
 @Test
 public void testCachingRelaysStringOperationsToNullScript() throws Throwable {
   Configuration conf = new Configuration();
   ScriptBasedMapping scriptMapping = new ScriptBasedMapping(conf);
   assertTrue(
       "Did not find " + ScriptBasedMapping.NO_SCRIPT + " in " + scriptMapping,
       scriptMapping.toString().contains(ScriptBasedMapping.NO_SCRIPT));
   CachedDNSToSwitchMapping mapping = new CachedDNSToSwitchMapping(scriptMapping);
   assertTrue(
       "Did not find " + ScriptBasedMapping.NO_SCRIPT + " in " + mapping,
       mapping.toString().contains(ScriptBasedMapping.NO_SCRIPT));
 }
Пример #2
0
 /**
  * Verify the cached mapper delegates the switch mapping query to the inner mapping, which again
  * handles arbitrary DNSToSwitchMapping implementations
  *
  * @throws Throwable on any problem
  */
 @Test
 public void testCachingRelaysStringOperations() throws Throwable {
   Configuration conf = new Configuration();
   String scriptname = "mappingscript.sh";
   conf.set(CommonConfigurationKeys.NET_TOPOLOGY_SCRIPT_FILE_NAME_KEY, scriptname);
   ScriptBasedMapping scriptMapping = new ScriptBasedMapping(conf);
   assertTrue(
       "Did not find " + scriptname + " in " + scriptMapping,
       scriptMapping.toString().contains(scriptname));
   CachedDNSToSwitchMapping mapping = new CachedDNSToSwitchMapping(scriptMapping);
   assertTrue(
       "Did not find " + scriptname + " in " + mapping, mapping.toString().contains(scriptname));
 }
Пример #3
0
 /**
  * Verify the cached mapper delegates the switch mapping query to the inner mapping, which again
  * handles arbitrary DNSToSwitchMapping implementations
  *
  * @throws Throwable on any problem
  */
 @Test
 public void testCachingRelays() throws Throwable {
   CachedDNSToSwitchMapping mapping = new CachedDNSToSwitchMapping(new StandaloneSwitchMapping());
   assertFalse("Expected to be multi switch " + mapping, mapping.isSingleSwitch());
 }