PropertyHelper.getPropertyId("HostRoles", "state"),
new EmptyPropertyProvider(),
new EmptyPropertyProvider());
Resource resource = new ResourceImpl(Resource.Type.HostComponent);
resource.setProperty("HostRoles/cluster_name", "c1");
resource.setProperty(HOST_COMPONENT_HOST_NAME_PROPERTY_ID, "ip-10-39-113-33.ec2.internal");
resource.setProperty(HOST_COMPONENT_COMPONENT_NAME_PROPERTY_ID, "JOURNALNODE");
Object[][] testData = {
{"metrics", "boottime", 1378290058.0},
{"metrics/cpu", "cpu_aidle", 0.0},
{"metrics/cpu", "cpu_idle", 88.2},
{"metrics/cpu", "cpu_nice", 0.0},
{"metrics/cpu", "cpu_num", 2.0},
{"metrics/cpu", "cpu_speed", 3583.0},
{"metrics/cpu", "cpu_system", 8.4},
{"metrics/cpu", "cpu_user", 3.3},
{"metrics/cpu", "cpu_wio", 0.1},
{"metrics/disk", "disk_free", 92.428},
{"metrics/disk", "disk_total", 101.515},
{"metrics/disk", "part_max_used", 12.8},
{"metrics/load", "load_fifteen", 0.026},
{"metrics/load", "load_five", 0.114},
{"metrics/load", "load_one", 0.226},
{"metrics/memory", "mem_buffers", 129384.0},
{"metrics/memory", "mem_cached", 589576.0},
{"metrics/memory", "mem_free", 1365496.0},
{"metrics/memory", "mem_shared", 0.0},
{"metrics/memory", "mem_total", 4055144.0},
{"metrics/memory", "swap_free", 4128760.0},
{"metrics/memory", "swap_total", 4128760.0},
{"metrics/network", "bytes_in", 22547.48},
{"metrics/network", "bytes_out", 5772.33},
{"metrics/network", "pkts_in", 24.0},
{"metrics/network", "pkts_out", 35.4},
{"metrics/process", "proc_run", 4.0},
{"metrics/process", "proc_total", 657.0},
{"metrics/dfs/journalNode", "batchesWritten", 0.0},
{"metrics/dfs/journalNode", "batchesWrittenWhileLagging", 0.0},
{"metrics/dfs/journalNode", "bytesWritten", 0.0},
{"metrics/dfs/journalNode", "currentLagTxns", 0.0},
{"metrics/dfs/journalNode", "lastPromisedEpoch", 5.0},
{"metrics/dfs/journalNode", "lastWriterEpoch", 5.0},
{"metrics/dfs/journalNode", "lastWrittenTxId", 613.0},
{"metrics/dfs/journalNode", "syncs60s50thPercentileLatencyMicros", 0.0},
{"metrics/dfs/journalNode", "syncs60s75thPercentileLatencyMicros", 0.0},
{"metrics/dfs/journalNode", "syncs60s90thPercentileLatencyMicros", 0.0},
{"metrics/dfs/journalNode", "syncs60s95thPercentileLatencyMicros", 0.0},
{"metrics/dfs/journalNode", "syncs60s99thPercentileLatencyMicros", 0.0},
{"metrics/dfs/journalNode", "syncs60s_num_ops", 0.0},
{"metrics/dfs/journalNode", "syncs300s50thPercentileLatencyMicros", 0.0},
{"metrics/dfs/journalNode", "syncs300s75thPercentileLatencyMicros", 0.0},
{"metrics/dfs/journalNode", "syncs300s90thPercentileLatencyMicros", 0.0},
{"metrics/dfs/journalNode", "syncs300s95thPercentileLatencyMicros", 0.0},
{"metrics/dfs/journalNode", "syncs300s99thPercentileLatencyMicros", 0.0},
{"metrics/dfs/journalNode", "syncs300s_num_ops", 0.0},
{"metrics/dfs/journalNode", "syncs3600s50thPercentileLatencyMicros", 0.0},
{"metrics/dfs/journalNode", "syncs3600s75thPercentileLatencyMicros", 0.0},
{"metrics/dfs/journalNode", "syncs3600s90thPercentileLatencyMicros", 0.0},
{"metrics/dfs/journalNode", "syncs3600s95thPercentileLatencyMicros", 0.0},
{"metrics/dfs/journalNode", "syncs3600s99thPercentileLatencyMicros", 0.0},
{"metrics/dfs/journalNode", "syncs3600s_num_ops", 0.0},
{"metrics/dfs/journalNode", "txnsWritten", 0.0}
};
Map<String, TemporalInfo> temporalInfoMap = new HashMap<String, TemporalInfo>();
Set<String> properties = new LinkedHashSet<String>();
for (Object[] row : testData) {
properties.add(PropertyHelper.getPropertyId(row[0].toString(), row[1].toString()));
}
Request request = PropertyHelper.getReadRequest(properties, temporalInfoMap);
Assert.assertEquals(1, propertyProvider.populateResources(Collections.singleton(resource), request, null).size());
Map<String, Object> p = PropertyHelper.getProperties(resource);
for (String key : p.keySet()) {
if (!properties.contains(key)) {
System.out.printf(key);
}
}
// size + properties defined before "Object[][] testData ... " above
Assert.assertEquals(properties.size() + 3, PropertyHelper.getProperties(resource).size());
int i = 0;
for (String property : properties) {
Assert.assertEquals(testData[i++][2], resource.getPropertyValue(property));
}
}