protected long calculateTimestamp(EtmPoint measurement) { return Util.getTimestamp(new Date(measurement.getStartTimeMillis())); }
public String format(EtmPoint aEtmPoint) { String parentName = aEtmPoint.getParent() == null ? "" : calculateParentHierarchie(aEtmPoint); return new StringBuffer(). append("measurementPoint=<"). append(aEtmPoint.getName()). append(">, parent=<"). append(parentName). append(">, transactionTime=<"). append(numberFormat.format(aEtmPoint.getTransactionTime())). append(">, recordingTime=<"). append(aEtmPoint.getStartTimeMillis()). append(">").toString(); }
public void testOutput() { EtmPoint etmPoint = new TestPointGenerator().getEtmPoint(); DefaultOutputFormatter formatter = new DefaultOutputFormatter(); // validate MS format NumberFormat numberFormat = NumberFormat.getInstance(Locale.getDefault()); numberFormat.setMinimumFractionDigits(3); numberFormat.setMaximumFractionDigits(3); numberFormat.setGroupingUsed(false); String s = formatter.format(etmPoint); assertTrue(s.indexOf(etmPoint.getName()) > 0); if (etmPoint.getParent() != null) { assertTrue(s.indexOf("parent=<" + etmPoint.getParent().getName() + ">") > 0); } assertTrue(s.indexOf(String.valueOf(etmPoint.getStartTimeMillis())) > 0); assertTrue(s.indexOf(numberFormat.format(etmPoint.getTransactionTime())) > 0); }