assertEquals(portNetServiceComponent.getAvailability(), AvailabilityType.UP);
}
@Test(dependsOnMethods = "testAvailability")
public void testMeasurement() throws Exception {
MeasurementReport report = new MeasurementReport();
Set<MeasurementScheduleRequest> metrics = new HashSet<MeasurementScheduleRequest>();
int scheduleId = 1;
metrics.add(new MeasurementScheduleRequest(scheduleId++, "ipAddress", 1000, true, DataType.TRAIT));
metrics.add(new MeasurementScheduleRequest(scheduleId++, "hostName", 1000, true, DataType.TRAIT));
metrics.add(new MeasurementScheduleRequest(scheduleId++, "connectTime", 1000, true, DataType.MEASUREMENT));
portNetServiceComponent.getValues(report, metrics);
Map<String, Object> datas = new HashMap<String, Object>();
for (MeasurementData data : report.getNumericData()) {
datas.put(data.getName(), data.getValue());
}
for (MeasurementData data : report.getTraitData()) {
datas.put(data.getName(), data.getValue());
}
assertEquals(getTrait(datas, "ipAddress"), LOOPBACK_ADDRESS.getHostAddress());
assertTrue(isNotBlank(getTrait(datas, "hostName")));
assertTrue(getMetric(datas, "connectTime") >= 0);