use of com.ibm.streamsx.rest.Resource in project streamsx.topology by IBMStreams.
the class StreamsConnectionTest method checkResourceAllocation.
private static void checkResourceAllocation(ResourceAllocation ra, boolean app) throws IOException {
if (ra == null)
return;
assertEquals("resourceAllocation", ra.getResourceType());
if (app)
assertTrue(ra.isApplicationResource());
assertNotNull(ra.getSchedulerStatus());
assertNotNull(ra.getStatus());
Instance rai = ra.getInstance();
for (ProcessingElement pe : ra.getPes()) {
assertNotNull(pe);
assertNotNull(pe.getStatus());
}
for (Job job : ra.getJobs()) {
assertNotNull(job);
assertNotNull(job.getStatus());
}
assertSame(rai, ra.getInstance());
Resource r = ra.getResource();
assertNotNull(r.getId());
assertNotNull(r.getDisplayName());
assertNotNull(r.getIpAddress());
assertEquals("resource", r.getResourceType());
for (Metric metric : r.getMetrics()) {
assertTrue((metric.getMetricKind().equals("counter")) || (metric.getMetricKind().equals("gauge")));
assertEquals("system", metric.getMetricType());
assertEquals("metric", metric.getResourceType());
assertNotNull(metric.getName());
assertNotNull(metric.getDescription());
assertTrue(metric.getLastTimeRetrieved() > 0);
}
}
Aggregations