SLSRunner extends Configured implements Tool { static void enableDNSCaching(Configuration conf) { if (conf.getBoolean(SLSConfiguration.DNS_CACHING_ENABLED, SLSConfiguration.DNS_CACHING_ENABLED_DEFAULT)) { Security.setProperty(NETWORK_CACHE_TTL, "-1"); Security.setProperty(NETWORK_NEGATIVE_CACHE_TTL, "-1"); } } SLSRunner();  SLSRunner(Configuration tempConf); @Override void setConf(Configuration conf); static Map<String, Object> getSimulateInfoMap(); void setSimulationParams(TraceType inType, String[] inTraces,
      String nodes, String outDir, Set<String> trackApps,
      boolean printsimulation); void start(); Map<NodeId, NMSimulator> getNmMap(); static void decreaseRemainingApps(); void stop(); int run(final String[] argv); static void main(String[] argv); final static Logger LOG; static final String NETWORK_CACHE_TTL; static final String NETWORK_NEGATIVE_CACHE_TTL; }
@Test public void testEnableCaching() { String networkCacheDefault = Security.getProperty( SLSRunner.NETWORK_CACHE_TTL); String networkNegativeCacheDefault = Security.getProperty(SLSRunner.NETWORK_NEGATIVE_CACHE_TTL); try { Configuration conf = new Configuration(false); conf.setBoolean(SLSConfiguration.DNS_CACHING_ENABLED, false); SLSRunner.enableDNSCaching(conf); assertEquals(networkCacheDefault, Security.getProperty(SLSRunner.NETWORK_CACHE_TTL)); assertEquals(networkNegativeCacheDefault, Security.getProperty(SLSRunner.NETWORK_NEGATIVE_CACHE_TTL)); conf.setBoolean(SLSConfiguration.DNS_CACHING_ENABLED, true); SLSRunner.enableDNSCaching(conf); assertEquals("-1", Security.getProperty(SLSRunner.NETWORK_CACHE_TTL)); assertEquals("-1", Security.getProperty(SLSRunner.NETWORK_NEGATIVE_CACHE_TTL)); } finally { Security.setProperty(SLSRunner.NETWORK_CACHE_TTL, String.valueOf(networkCacheDefault)); Security.setProperty(SLSRunner.NETWORK_NEGATIVE_CACHE_TTL, String.valueOf(networkNegativeCacheDefault)); } }