@Test public void testGetOMDistribution_NoOMData() throws IOException, Exception { log.debug("== testGetOMDistribution_NoOMData() Test Start =="); String offset = "-7"; String omcd = "RE003"; String omc2n = "8.3"; String omdep = "5"; String ominp = "50"; String dmr = "2.5"; HashMap<String, Object> data = new HashMap<String, Object>(); AcePathfinderUtil.insertValue(data, "pdate", "19990415"); ArrayList<HashMap<String, String>> events = ExperimentHelper.getOMDistribution(data, offset, omcd, omc2n, omdep, ominp, dmr); // try { // assertEquals("getRootDistribution: om no data", 1, events.size()); // } catch (Error e) { // log.error(e.getMessage()); // } assertEquals("getRootDistribution: om no data", 0, events.size()); log.info("getOMDistribution output: {}", data.toString()); log.debug("== testGetOMDistribution_NoOMData() Test End =="); }
@Test public void testGetOMDistribution2() throws IOException, Exception { log.debug("== testGetOMDistribution2() Test Start =="); String offset = "-7"; String omcd = "RE003"; String omc2n = "8.3"; String omdep = "5"; String ominp = "50"; String dmr = "2.5"; Map expected_1 = new HashMap(); expected_1.put("event", "organic_matter"); expected_1.put("date", "19990408"); expected_1.put("omcd", "RE003"); expected_1.put("omamt", "1000"); expected_1.put("omc2n", "8.3"); expected_1.put("omdep", "5"); expected_1.put("ominp", "50"); expected_1.put("omn%", "4.82"); Map acctual_1; HashMap<String, Object> data = new HashMap<String, Object>(); AcePathfinderUtil.insertValue(data, "pdate", "19990415"); AcePathfinderUtil.insertValue(data, "om_tot", "1000"); log.debug((String) data.get("om_tot")); ArrayList<HashMap<String, String>> events = ExperimentHelper.getOMDistribution(data, offset, omcd, omc2n, omdep, ominp, dmr); acctual_1 = events.get(0); assertEquals("getRootDistribution: om app 2", expected_1, acctual_1); log.info("getOMDistribution output 2: {}", data.toString()); log.debug("== testGetOMDistribution2() Test End =="); }
@Test public void testGetOMDistribution() throws IOException, Exception { log.debug("== testGetOMDistribution() Test Start =="); String line; String offset = "-7"; String omcd = "RE003"; String omc2n = "8.3"; String omdep = "5"; String ominp = "50"; String dmr = "2.5"; // planting data is 19990415 // fen_tot is 110 Map expected_1 = new HashMap(); expected_1.put("event", "organic_matter"); expected_1.put("date", "19990408"); expected_1.put("omcd", "RE003"); expected_1.put("omamt", "1000"); expected_1.put("omc2n", "8.3"); expected_1.put("omdep", "5"); expected_1.put("ominp", "50"); expected_1.put("omn%", "4.82"); Map acctual_1; // BufferedReader br = new BufferedReader( // new InputStreamReader( // new FileInputStream(resource2.getPath()))); // if ((line = br.readLine()) != null) { // HashMap<String, ArrayList<Map>> data = new LinkedHashMap<String, ArrayList<Map>>(); // Map<String, Object> expData = JSONAdapter.fromJSON(line); // data.put("experiments", new ArrayList()); // data.put("weathers", new ArrayList()); // data.get("experiments").add(expData); // data.get("weathers").add((Map) expData.get("weather")); // expData.put("omamt", "1000"); // Map omEvent = new LinkedHashMap(); // omEvent.put("event", "organic-materials"); // omEvent.put("date", "19990414"); HashMap<String, Object> data = new HashMap<String, Object>(); AcePathfinderUtil.insertValue(data, "pdate", "19990415"); AcePathfinderUtil.insertValue(data, "omamt", "1000"); ArrayList<HashMap<String, String>> events = ExperimentHelper.getOMDistribution(data, offset, omcd, omc2n, omdep, ominp, dmr); acctual_1 = events.get(0); // } // try { // assertEquals("getRootDistribution: om app 1", expected_1, acctual_1); // } catch (Error e) { // log.error(e.getMessage()); // } assertEquals("getRootDistribution: om app 1", expected_1, acctual_1); log.info("getOMDistribution output: {}", data.toString()); log.debug("== testGetOMDistribution() Test End =="); }