@Test public void testGetMeasurements() throws Exception { final int numberOfMetrics = 10; Date dates[] = new Date[numberOfMetrics]; DefaultMeasurementSet defaultMeasurementSet = new DefaultMeasurementSet(); for (int i = 0; i < numberOfMetrics; i++) { Calendar calendar = Calendar.getInstance(); calendar.add(Calendar.DAY_OF_YEAR, i); dates[i] = calendar.getTime(); DefaultMeasurement defaultMeasurement = new DefaultMeasurement(); defaultMeasurement.setNodeId(i); defaultMeasurement.setService("service" + i); defaultMeasurement.setNetInterface("interface" + i); defaultMeasurement.setTimestamp(dates[i]); defaultMeasurement.setMetricId("metric" + i); defaultMeasurement.setValue("value" + i); defaultMeasurementSet.addMeasurement(defaultMeasurement); } List<Measurement> measurementList = defaultMeasurementSet.getMeasurements(); Assert.assertEquals(measurementList.size(), numberOfMetrics); for (Measurement measurement : measurementList) { Assert.assertEquals(measurement.getService(), "service" + measurement.getNodeId()); Assert.assertEquals(measurement.getNetInterface(), "interface" + measurement.getNodeId()); Assert.assertEquals(measurement.getMetricId(), "metric" + measurement.getNodeId()); Assert.assertEquals(measurement.getValue(), "value" + measurement.getNodeId()); Assert.assertEquals(measurement.getTimestamp(), dates[measurement.getNodeId()]); } }
@Override public List<Measurement> getMeasurements() { return m_measurements; }
DefaultMeasurementSet implements MeasurementSet { @Override public List<Measurement> getMeasurements() { return m_measurements; } }
DefaultMeasurementSet implements MeasurementSet { @Override public List<Measurement> getMeasurements() { return m_measurements; }  }
DefaultMeasurementSet implements MeasurementSet { @Override public List<Measurement> getMeasurements() { return m_measurements; }  void addMeasurement(Measurement measurement); @Override String getJson(); @Override List<Measurement> getMeasurements(); @Override String toString(); }
DefaultMeasurementSet implements MeasurementSet { @Override public List<Measurement> getMeasurements() { return m_measurements; }  void addMeasurement(Measurement measurement); @Override String getJson(); @Override List<Measurement> getMeasurements(); @Override String toString();  }