@Test public void testGetResourcesCheckOrder() throws Exception{ ClusterControllerImpl controller = new ClusterControllerImpl(new TestProviderModule()); Set<String> propertyIds = new HashSet<String>(); Request request = PropertyHelper.getReadRequest(propertyIds); Iterable<Resource> iterable = controller.getResourceIterable(Resource.Type.Host, request, null); String lastHostName = null; int cnt = 0; for (Resource resource : iterable) { Assert.assertEquals(Resource.Type.Host, resource.getType()); String hostName = (String) resource.getPropertyValue(PropertyHelper.getPropertyId("Hosts", "host_name")); if (lastHostName != null) { Assert.assertTrue(hostName.compareTo(lastHostName) > 0); } lastHostName = hostName; ++cnt; } Assert.assertEquals(4, cnt); }
protected Iterable<Resource> getResourceIterable(Type type, Request request, Predicate predicate) throws UnsupportedPropertyException, SystemException, NoSuchParentResourceException, NoSuchResourceException { return getResources(type, request, predicate, null, null).getIterable(); }
ClusterControllerImpl implements ClusterController { protected Iterable<Resource> getResourceIterable(Type type, Request request, Predicate predicate) throws UnsupportedPropertyException, SystemException, NoSuchParentResourceException, NoSuchResourceException { return getResources(type, request, predicate, null, null).getIterable(); } }
ClusterControllerImpl implements ClusterController { protected Iterable<Resource> getResourceIterable(Type type, Request request, Predicate predicate) throws UnsupportedPropertyException, SystemException, NoSuchParentResourceException, NoSuchResourceException { return getResources(type, request, predicate, null, null).getIterable(); } ClusterControllerImpl(ProviderModule providerModule); }
ClusterControllerImpl implements ClusterController { protected Iterable<Resource> getResourceIterable(Type type, Request request, Predicate predicate) throws UnsupportedPropertyException, SystemException, NoSuchParentResourceException, NoSuchResourceException { return getResources(type, request, predicate, null, null).getIterable(); } ClusterControllerImpl(ProviderModule providerModule); @Override Predicate getAmendedPredicate(Type type, Predicate predicate); @Override QueryResponse getResources(Type type, Request request, Predicate predicate); @Override Set<Resource> populateResources(Type type,
                                         Set<Resource> resources,
                                         Request request,
                                         Predicate predicate); @Override Iterable<Resource> getIterable(Type type, QueryResponse queryResponse,
                                        Request request, Predicate predicate,
                                        PageRequest pageRequest,
                                        SortRequest sortRequest); @Override PageResponse getPage(Type type, QueryResponse queryResponse,
                              Request request, Predicate predicate,
                              PageRequest pageRequest, SortRequest sortRequest); @Override Schema getSchema(Type type); @Override RequestStatus createResources(Type type, Request request); @Override RequestStatus updateResources(Type type, Request request, Predicate predicate); @Override RequestStatus deleteResources(Type type, Request request, Predicate predicate); @Override ResourceProvider ensureResourceProvider(Type type); }
ClusterControllerImpl implements ClusterController { protected Iterable<Resource> getResourceIterable(Type type, Request request, Predicate predicate) throws UnsupportedPropertyException, SystemException, NoSuchParentResourceException, NoSuchResourceException { return getResources(type, request, predicate, null, null).getIterable(); } ClusterControllerImpl(ProviderModule providerModule); @Override Predicate getAmendedPredicate(Type type, Predicate predicate); @Override QueryResponse getResources(Type type, Request request, Predicate predicate); @Override Set<Resource> populateResources(Type type,
                                         Set<Resource> resources,
                                         Request request,
                                         Predicate predicate); @Override Iterable<Resource> getIterable(Type type, QueryResponse queryResponse,
                                        Request request, Predicate predicate,
                                        PageRequest pageRequest,
                                        SortRequest sortRequest); @Override PageResponse getPage(Type type, QueryResponse queryResponse,
                              Request request, Predicate predicate,
                              PageRequest pageRequest, SortRequest sortRequest); @Override Schema getSchema(Type type); @Override RequestStatus createResources(Type type, Request request); @Override RequestStatus updateResources(Type type, Request request, Predicate predicate); @Override RequestStatus deleteResources(Type type, Request request, Predicate predicate); @Override ResourceProvider ensureResourceProvider(Type type);  }