@Test
public void testGetResources() throws Exception {

  Resource.Type type = Resource.Type.Extension;
  AmbariManagementController managementController = createMock(AmbariManagementController.class);
  Set<ExtensionResponse> allResponse = new HashSet<ExtensionResponse>();
  allResponse.add(new ExtensionResponse("Extension1"));
  allResponse.add(new ExtensionResponse("Extension2"));
  // set expectations
  expect(managementController.getExtensions(EasyMock.<Set<ExtensionRequest>>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(ExtensionResourceProvider.EXTENSION_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> extensionNames = new HashSet<String>();
  extensionNames.add("Extension1");
  extensionNames.add("Extension2");
  for (Resource resource : resources) {
    String extensionName = (String) resource.getPropertyValue(ExtensionResourceProvider.EXTENSION_NAME_PROPERTY_ID);
    Assert.assertTrue(extensionNames.contains(extensionName));
  }
  // verify
  verify(managementController);
}