List of usage examples for org.apache.commons.collections MapUtils getMap
public static Map getMap(Map map, Object key, Map defaultValue)
From source file:com.iyonger.apm.web.service.PerfTestService.java
/** * Check if the given perfTest has too many errors. (20%) * * @param perfTest perftest// w w w . j a v a 2 s . c o m * @return true if too many errors. */ @SuppressWarnings("unchecked") public boolean hasTooManyError(PerfTest perfTest) { Map<String, Object> result = getStatistics(perfTest); Map<String, Object> totalStatistics = MapUtils.getMap(result, "totalStatistics", MapUtils.EMPTY_MAP); long tests = MapUtils.getDouble(totalStatistics, "Tests", 0D).longValue(); long errors = MapUtils.getDouble(totalStatistics, "Errors", 0D).longValue(); return ((((double) errors) / (tests + errors)) > 0.3d); }
From source file:com.iyonger.apm.web.service.PerfTestService.java
/** * Update the given {@link PerfTest} properties after test finished. * * @param perfTest perfTest//w ww.ja v a 2 s . c om */ public void updatePerfTestAfterTestFinish(PerfTest perfTest) { checkNotNull(perfTest); Map<String, Object> result = consoleManager.getConsoleUsingPort(perfTest.getPort()).getStatisticsData(); @SuppressWarnings("unchecked") Map<String, Object> totalStatistics = MapUtils.getMap(result, "totalStatistics", MapUtils.EMPTY_MAP); LOGGER.info("Total Statistics for test {} is {}", perfTest.getId(), totalStatistics); perfTest.setTps(parseDoubleWithSafety(totalStatistics, "TPS", 0D)); perfTest.setMeanTestTime(parseDoubleWithSafety(totalStatistics, "Mean_Test_Time_(ms)", 0D)); perfTest.setPeakTps(parseDoubleWithSafety(totalStatistics, "Peak_TPS", 0D)); perfTest.setTests(MapUtils.getDouble(totalStatistics, "Tests", 0D).longValue()); perfTest.setErrors(MapUtils.getDouble(totalStatistics, "Errors", 0D).longValue()); }