Search in sources :

Example 1 with Resource

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);
    }
}
Also used : ProcessingElement(com.ibm.streamsx.rest.ProcessingElement) Instance(com.ibm.streamsx.rest.Instance) Resource(com.ibm.streamsx.rest.Resource) Metric(com.ibm.streamsx.rest.Metric) Job(com.ibm.streamsx.rest.Job)

Aggregations

Instance (com.ibm.streamsx.rest.Instance)1 Job (com.ibm.streamsx.rest.Job)1 Metric (com.ibm.streamsx.rest.Metric)1 ProcessingElement (com.ibm.streamsx.rest.ProcessingElement)1 Resource (com.ibm.streamsx.rest.Resource)1