@Test public void testExecute__Cluster_instance_noSpecifiedProps() throws Exception { ResourceDefinition resourceDefinition = createNiceMock(ResourceDefinition.class); Map<Resource.Type, String> mapIds = new HashMap<Resource.Type, String>(); mapIds.put(Resource.Type.Cluster, "cluster"); expect(resourceDefinition.getType()).andReturn(Resource.Type.Cluster).anyTimes(); Set<SubResourceDefinition> setChildren = new HashSet<SubResourceDefinition>(); setChildren.add(new SubResourceDefinition(Resource.Type.Host)); expect(resourceDefinition.getSubResourceDefinitions()).andReturn(setChildren).anyTimes(); replay(resourceDefinition); QueryImpl instance = new TestQuery(mapIds, resourceDefinition); Result result = instance.execute(); verify(resourceDefinition); TreeNode<Resource> tree = result.getResultTree(); Assert.assertEquals(1, tree.getChildren().size()); TreeNode<Resource> clusterNode = tree.getChild("Cluster:1"); Assert.assertEquals("Cluster:1", clusterNode.getName()); Assert.assertEquals(Resource.Type.Cluster, clusterNode.getObject().getType()); Assert.assertEquals(1, clusterNode.getChildren().size()); TreeNode<Resource> hostNode = clusterNode.getChild("hosts"); Assert.assertEquals(4, hostNode.getChildren().size()); }
@Override public Result execute() throws UnsupportedPropertyException, SystemException, NoSuchResourceException, NoSuchParentResourceException { queryForResources(); return getResult(null); }
QueryImpl implements Query, ResourceInstance { @Override public Result execute() throws UnsupportedPropertyException, SystemException, NoSuchResourceException, NoSuchParentResourceException { queryForResources(); return getResult(null); } }
QueryImpl implements Query, ResourceInstance { @Override public Result execute() throws UnsupportedPropertyException, SystemException, NoSuchResourceException, NoSuchParentResourceException { queryForResources(); return getResult(null); } QueryImpl(Map<Resource.Type, String> keyValueMap,
                   ResourceDefinition resourceDefinition,
                   ClusterController clusterController); }
QueryImpl implements Query, ResourceInstance { @Override public Result execute() throws UnsupportedPropertyException, SystemException, NoSuchResourceException, NoSuchParentResourceException { queryForResources(); return getResult(null); } QueryImpl(Map<Resource.Type, String> keyValueMap,
                   ResourceDefinition resourceDefinition,
                   ClusterController clusterController); @Override void addProperty(String propertyId, TemporalInfo temporalInfo); @Override void addLocalProperty(String property); @Override Result execute(); @Override Predicate getPredicate(); @Override Set<String> getProperties(); @Override void setUserPredicate(Predicate predicate); @Override void setPageRequest(PageRequest pageRequest); @Override void setSortRequest(SortRequest sortRequest); @Override void setRenderer(Renderer renderer); @Override void setRequestInfoProps(Map<String, String> requestInfoProperties); @Override Map<String, String> getRequestInfoProps(); @Override void setKeyValueMap(Map<Resource.Type, String> keyValueMap); @Override Map<Resource.Type, String> getKeyValueMap(); @Override Query getQuery(); @Override ResourceDefinition getResourceDefinition(); @Override boolean isCollectionResource(); @Override Map<String, ResourceInstance> getSubResources(); @Override boolean equals(Object o); @Override int hashCode(); }
QueryImpl implements Query, ResourceInstance { @Override public Result execute() throws UnsupportedPropertyException, SystemException, NoSuchResourceException, NoSuchParentResourceException { queryForResources(); return getResult(null); } QueryImpl(Map<Resource.Type, String> keyValueMap,
                   ResourceDefinition resourceDefinition,
                   ClusterController clusterController); @Override void addProperty(String propertyId, TemporalInfo temporalInfo); @Override void addLocalProperty(String property); @Override Result execute(); @Override Predicate getPredicate(); @Override Set<String> getProperties(); @Override void setUserPredicate(Predicate predicate); @Override void setPageRequest(PageRequest pageRequest); @Override void setSortRequest(SortRequest sortRequest); @Override void setRenderer(Renderer renderer); @Override void setRequestInfoProps(Map<String, String> requestInfoProperties); @Override Map<String, String> getRequestInfoProps(); @Override void setKeyValueMap(Map<Resource.Type, String> keyValueMap); @Override Map<Resource.Type, String> getKeyValueMap(); @Override Query getQuery(); @Override ResourceDefinition getResourceDefinition(); @Override boolean isCollectionResource(); @Override Map<String, ResourceInstance> getSubResources(); @Override boolean equals(Object o); @Override int hashCode();  }