@Test
public void testCheckPropertyIds() 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);
  MaintenanceStateHelper maintenanceStateHelperMock = createNiceMock(MaintenanceStateHelper.class);
  AbstractResourceProvider provider = new ServiceResourceProvider(propertyIds,
      keyPropertyIds,
      managementController, maintenanceStateHelperMock);
  Set<String> unsupported = provider.checkPropertyIds(Collections.singleton("foo"));
  Assert.assertTrue(unsupported.isEmpty());
  // note that key is not in the set of known property ids.  We allow it if its parent is a known property.
  // this allows for Map type properties where we want to treat the entries as individual properties
  Assert.assertTrue(provider.checkPropertyIds(Collections.singleton("cat5/subcat5/map/key")).isEmpty());
  unsupported = provider.checkPropertyIds(Collections.singleton("bar"));
  Assert.assertEquals(1, unsupported.size());
  Assert.assertTrue(unsupported.contains("bar"));
  unsupported = provider.checkPropertyIds(Collections.singleton("cat1/foo"));
  Assert.assertTrue(unsupported.isEmpty());
  unsupported = provider.checkPropertyIds(Collections.singleton("cat1"));
  Assert.assertTrue(unsupported.isEmpty());
  unsupported = provider.checkPropertyIds(Collections.singleton("config"));
  Assert.assertTrue(unsupported.isEmpty());
  unsupported = provider.checkPropertyIds(Collections.singleton("config/unknown_property"));
  Assert.assertTrue(unsupported.isEmpty());
}