@Test
public void testGetResourceProvider() throws Exception {

  Set<String> propertyIds = new HashSet<String>();
  propertyIds.add("foo");
  propertyIds.add("cat1/foo");
  propertyIds.add("cat2/bar");
  propertyIds.add("cat2/baz");
  propertyIds.add("cat3/sub1/bam");
  propertyIds.add("cat4/sub2/sub3/bat");
  propertyIds.add("cat5/subcat5/map");
  Map<Resource.Type, String> keyPropertyIds = new HashMap<Resource.Type, String>();
  AmbariManagementController managementController = createMock(AmbariManagementController.class);
  ResourceProviderFactory factory = createMock(ResourceProviderFactory.class);
  MaintenanceStateHelper maintenanceStateHelper = createNiceMock(MaintenanceStateHelper.class);
  ResourceProvider serviceResourceProvider = new ServiceResourceProvider(propertyIds, keyPropertyIds, managementController, maintenanceStateHelper);
  expect(factory.getServiceResourceProvider(propertyIds, keyPropertyIds, managementController)).andReturn(serviceResourceProvider);
  AbstractControllerResourceProvider.init(factory);
  replay(managementController, factory, maintenanceStateHelper);
  AbstractResourceProvider provider =
      (AbstractResourceProvider) AbstractControllerResourceProvider.getResourceProvider(
          Resource.Type.Service,
          propertyIds,
          keyPropertyIds,
          managementController);
  Assert.assertTrue(provider instanceof ServiceResourceProvider);
}