static public final Timer getDefaultTimer() { TimerInfo ti = new PropertiesManager.TimerInfo(); ti.numCollectors = 1; ti.slowCollectTime = 5; ti.step = 300; ti.timeout = 10; return new Timer("TimerTester", ti); }
static public final Map<String, Timer> getSimpleTimerMap() { PropertiesManager.TimerInfo ti = new PropertiesManager.TimerInfo(); ti.numCollectors = 1; ti.step = 300; ti.timeout = 10; Timer t = new Timer(Timer.DEFAULTNAME, ti); Map<String, Timer> timerMap = new HashMap<String, Timer>(1); timerMap.put(t.getName(), t); return timerMap; }
jrds.starter.Timer t = new jrds.starter.Timer(e.getKey(), e.getValue()); t.setParent(this); timers.put(e.getKey(), t);
@Test public void buildOther() throws IOException { PropertiesManager pm = Tools.makePm(testFolder, "timeout=1", "step=5", "timers=slow", "timer.slow.timeout=30", "timer.slow.step=3600", "timer.slow.slowcollecttime=15"); Timer t = new Timer("slow", pm.timers.get("slow")); Assert.assertEquals("bad timeout", 30, t.getTimeout()); Assert.assertEquals("bad step", 3600, t.getStep()); Assert.assertEquals("bad slow collect time", 15, t.getSlowCollectTime()); }
@Test public void buildDefault() throws IOException { PropertiesManager pm = Tools.makePm(testFolder, "timeout=1", "step=5", "slowcollecttime=1"); Timer t = new Timer(Timer.DEFAULTNAME, pm.timers.get(Timer.DEFAULTNAME)); Assert.assertEquals("bad timeout", 1, t.getTimeout()); Assert.assertEquals("bad step", 5, t.getStep()); Assert.assertEquals("bad slow collect time", 1, t.getSlowCollectTime()); }