@Test public void testPopulateResources() throws Exception { TestStreamProvider streamProvider = new TestStreamProvider("temporal_ganglia_report_data.json"); TestGangliaHostProvider hostProvider = new TestGangliaHostProvider(); GangliaReportPropertyProvider propertyProvider = new GangliaReportPropertyProvider( PropertyHelper.getMetricPropertyIds(Resource.Type.Cluster), streamProvider, configuration, hostProvider, CLUSTER_NAME_PROPERTY_ID); Resource resource = new ResourceImpl(Resource.Type.Cluster); resource.setProperty(CLUSTER_NAME_PROPERTY_ID, "c1"); Map<String, TemporalInfo> temporalInfoMap = new HashMap<String, TemporalInfo>(); temporalInfoMap.put(PROPERTY_ID, new TemporalInfoImpl(10L, 20L, 1L)); Request request = PropertyHelper.getReadRequest(Collections.singleton(PROPERTY_ID), temporalInfoMap); Assert.assertEquals(1, propertyProvider.populateResources(Collections.singleton(resource), request, null).size()); String expected = (configuration.isHttpsEnabled() ? "https" : "http") + ": Assert.assertEquals(expected, streamProvider.getLastSpec()); Assert.assertEquals(2, PropertyHelper.getProperties(resource).size()); Assert.assertNotNull(resource.getPropertyValue(PROPERTY_ID)); }
@Override public Set<Resource> populateResources(Set<Resource> resources, Request request, Predicate predicate) throws SystemException { Set<Resource> keepers = new HashSet<Resource>(); for (Resource resource : resources) { if (populateResource(resource, request, predicate)) { keepers.add(resource); } } return keepers; }
GangliaReportPropertyProvider extends MetricsReportPropertyProvider { @Override public Set<Resource> populateResources(Set<Resource> resources, Request request, Predicate predicate) throws SystemException { Set<Resource> keepers = new HashSet<Resource>(); for (Resource resource : resources) { if (populateResource(resource, request, predicate)) { keepers.add(resource); } } return keepers; } }
GangliaReportPropertyProvider extends MetricsReportPropertyProvider { @Override public Set<Resource> populateResources(Set<Resource> resources, Request request, Predicate predicate) throws SystemException { Set<Resource> keepers = new HashSet<Resource>(); for (Resource resource : resources) { if (populateResource(resource, request, predicate)) { keepers.add(resource); } } return keepers; } GangliaReportPropertyProvider(Map<String, Map<String, PropertyInfo>> componentPropertyInfoMap,
                                       StreamProvider streamProvider,
                                       ComponentSSLConfiguration configuration,
                                       MetricHostProvider hostProvider,
                                       String clusterNamePropertyId); }
GangliaReportPropertyProvider extends MetricsReportPropertyProvider { @Override public Set<Resource> populateResources(Set<Resource> resources, Request request, Predicate predicate) throws SystemException { Set<Resource> keepers = new HashSet<Resource>(); for (Resource resource : resources) { if (populateResource(resource, request, predicate)) { keepers.add(resource); } } return keepers; } GangliaReportPropertyProvider(Map<String, Map<String, PropertyInfo>> componentPropertyInfoMap,
                                       StreamProvider streamProvider,
                                       ComponentSSLConfiguration configuration,
                                       MetricHostProvider hostProvider,
                                       String clusterNamePropertyId); @Override Set<Resource> populateResources(Set<Resource> resources, Request request, Predicate predicate); }
GangliaReportPropertyProvider extends MetricsReportPropertyProvider { @Override public Set<Resource> populateResources(Set<Resource> resources, Request request, Predicate predicate) throws SystemException { Set<Resource> keepers = new HashSet<Resource>(); for (Resource resource : resources) { if (populateResource(resource, request, predicate)) { keepers.add(resource); } } return keepers; } GangliaReportPropertyProvider(Map<String, Map<String, PropertyInfo>> componentPropertyInfoMap,
                                       StreamProvider streamProvider,
                                       ComponentSSLConfiguration configuration,
                                       MetricHostProvider hostProvider,
                                       String clusterNamePropertyId); @Override Set<Resource> populateResources(Set<Resource> resources, Request request, Predicate predicate);  }