@Test
public void testGetResources() throws Exception {

  Resource.Type type = Resource.Type.Stack;
  AmbariManagementController managementController = createMock(AmbariManagementController.class);
  Set<StackResponse> allResponse = new HashSet<StackResponse>();
  allResponse.add(new StackResponse("Stack1"));
  allResponse.add(new StackResponse("Stack2"));
  // set expectations
  expect(managementController.getStacks(EasyMock.<Set<StackRequest>>anyObject())).andReturn(allResponse).once();
  // replay
  replay(managementController);
  ResourceProvider provider = AbstractControllerResourceProvider.getResourceProvider(
      type,
      PropertyHelper.getPropertyIds(type),
      PropertyHelper.getKeyPropertyIds(type),
      managementController);
  Set<String> propertyIds = new HashSet<String>();
  propertyIds.add(StackResourceProvider.STACK_NAME_PROPERTY_ID);
  // create the request
  Request request = PropertyHelper.getReadRequest(propertyIds);
  // get all ... no predicate
  Set<Resource> resources = provider.getResources(request, null);
  Assert.assertEquals(2, resources.size());
  Set<String> stackNames = new HashSet<String>();
  stackNames.add("Stack1");
  stackNames.add("Stack2");
  for (Resource resource : resources) {
    String stackName = (String) resource.getPropertyValue(StackResourceProvider.STACK_NAME_PROPERTY_ID);
    Assert.assertTrue(stackNames.contains(stackName));
  }
  // verify
  verify(managementController);
}