@Test
public void testGetResources() throws Exception{

     
  Map<String, String> attributes = new HashMap<String, String>();
  attributes.put("final", "true");
  Resource.Type type = Resource.Type.StackLevelConfiguration;
  AmbariManagementController managementController = createMock(AmbariManagementController.class);
  Set<StackConfigurationResponse> allResponse = new HashSet<StackConfigurationResponse>();
  
  allResponse.add(new StackConfigurationResponse(PROPERTY_NAME, PROPERTY_VALUE, PROPERTY_DESC, TYPE, attributes));
 
  // set expectations
  expect(managementController.getStackLevelConfigurations(
      AbstractResourceProviderTest.Matcher.getStackLevelConfigurationRequestSet(null, null, null))).
      andReturn(allResponse).times(1);
  // replay
  replay(managementController);
  ResourceProvider provider = AbstractControllerResourceProvider.getResourceProvider(
      type,
      PropertyHelper.getPropertyIds(type),
      PropertyHelper.getKeyPropertyIds(type),
      managementController);
  Set<String> propertyIds = new HashSet<String>();
  propertyIds.add(StackLevelConfigurationResourceProvider.STACK_NAME_PROPERTY_ID);
  propertyIds.add(StackLevelConfigurationResourceProvider.STACK_VERSION_PROPERTY_ID);
  propertyIds.add(StackLevelConfigurationResourceProvider.PROPERTY_NAME_PROPERTY_ID);
  propertyIds.add(StackLevelConfigurationResourceProvider.PROPERTY_VALUE_PROPERTY_ID);
  propertyIds.add(StackLevelConfigurationResourceProvider.PROPERTY_DESCRIPTION_PROPERTY_ID);
  propertyIds.add(StackLevelConfigurationResourceProvider.PROPERTY_TYPE_PROPERTY_ID);
  propertyIds.add(StackLevelConfigurationResourceProvider.PROPERTY_FINAL_PROPERTY_ID);
  // create the request
  Request request = PropertyHelper.getReadRequest(propertyIds);
  // get all ... no predicate
  Set<Resource> resources = provider.getResources(request, null);
  Assert.assertEquals(allResponse.size(), resources.size());
  
  for (Resource resource : resources) {   
    String propertyName = (String) resource.getPropertyValue(StackLevelConfigurationResourceProvider.PROPERTY_NAME_PROPERTY_ID);
    String propertyValue = (String) resource.getPropertyValue(StackLevelConfigurationResourceProvider.PROPERTY_VALUE_PROPERTY_ID);
    String propertyDesc = (String) 
        resource.getPropertyValue(StackLevelConfigurationResourceProvider.PROPERTY_DESCRIPTION_PROPERTY_ID);
    String propertyType = (String) 
        resource.getPropertyValue(StackLevelConfigurationResourceProvider.PROPERTY_TYPE_PROPERTY_ID);
    String propertyIsFinal = (String)
        resource.getPropertyValue(StackLevelConfigurationResourceProvider.PROPERTY_FINAL_PROPERTY_ID);
    
    Assert.assertEquals(PROPERTY_NAME, propertyName);
    Assert.assertEquals(PROPERTY_VALUE, propertyValue);
    Assert.assertEquals(PROPERTY_DESC, propertyDesc);
    Assert.assertEquals(TYPE, propertyType);
    Assert.assertEquals("true", propertyIsFinal);
  }
  // verify
  verify(managementController);
}