@Test
public void testSetResourceProperty() {

  Set<String> propertyIds = new HashSet<String>();
  propertyIds.add("p1");
  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/sub5");
  Resource resource = new ResourceImpl(Resource.Type.Service);
  assertNull(resource.getPropertyValue("foo"));
  BaseProvider.setResourceProperty(resource, "foo", "value1", propertyIds);
  assertEquals("value1", resource.getPropertyValue("foo"));
  BaseProvider.setResourceProperty(resource, "cat2/bar", "value2", propertyIds);
  assertEquals("value2", resource.getPropertyValue("cat2/bar"));
  assertNull(resource.getPropertyValue("unsupported"));
  BaseProvider.setResourceProperty(resource, "unsupported", "valueX", propertyIds);
  assertNull(resource.getPropertyValue("unsupported"));
  // we should allow anything under the category cat5/sub5
  BaseProvider.setResourceProperty(resource, "cat5/sub5/prop5", "value5", propertyIds);
  assertEquals("value5", resource.getPropertyValue("cat5/sub5/prop5"));
  BaseProvider.setResourceProperty(resource, "cat5/sub5/sub5a/prop5a", "value5", propertyIds);
  assertEquals("value5", resource.getPropertyValue("cat5/sub5/sub5a/prop5a"));
  // we shouldn't allow anything under the category cat5/sub7
  BaseProvider.setResourceProperty(resource, "cat5/sub7/unsupported", "valueX", propertyIds);
  assertNull(resource.getPropertyValue("cat5/sub7/unsupported"));
}