@Test
public void testGetPostProcessors() throws AmbariException {

  BaseResourceDefinition resourceDefinition = getResourceDefinition();
  List<ResourceDefinition.PostProcessor> postProcessors = resourceDefinition.getPostProcessors();
  Assert.assertEquals(1, postProcessors.size());
  ResourceDefinition.PostProcessor processor = postProcessors.iterator().next();
  Resource service = new ResourceImpl(Resource.Type.Service);
  service.setProperty("ServiceInfo/service_name", "Service1");
  TreeNode<Resource> parentNode  = new TreeNodeImpl<Resource>(null, null, "services");
  TreeNode<Resource> serviceNode = new TreeNodeImpl<Resource>(parentNode, service, "service1");
  parentNode.setProperty("isCollection", "true");
  
  ResourceProviderFactory factory = createMock(ResourceProviderFactory.class);
  MaintenanceStateHelper maintenanceStateHelper = createNiceMock(MaintenanceStateHelper.class);
  AmbariManagementController managementController = createMock(AmbariManagementController.class);
  expect(maintenanceStateHelper.isOperationAllowed(anyObject(Resource.Type.class),
          anyObject(Service.class))).andReturn(true).anyTimes();
  ResourceProvider serviceResourceProvider = new ServiceResourceProvider(PropertyHelper
      .getPropertyIds(Resource.Type.Service),
      PropertyHelper.getKeyPropertyIds(Resource.Type.Service),
      managementController, maintenanceStateHelper);
  
  expect(factory.getServiceResourceProvider(EasyMock.<Set<String>>anyObject(),
      EasyMock.<Map<Resource.Type, String>>anyObject(),
      anyObject(AmbariManagementController.class))).andReturn(serviceResourceProvider);
  
  AbstractControllerResourceProvider.init(factory);
  
  replay(factory, managementController, maintenanceStateHelper);
  
  processor.process(null, serviceNode, "http://c6401.ambari.apache.org:8080/api/v1/clusters/c1/services");
  String href = serviceNode.getStringProperty("href");
  Assert.assertEquals("http://c6401.ambari.apache.org:8080/api/v1/clusters/c1/services/Service1", href);
  Resource configGroup = new ResourceImpl(Resource.Type.ConfigGroup);
  configGroup.setProperty("ConfigGroup/id", "2");
  TreeNode<Resource> resourcesNode   = new TreeNodeImpl<Resource>(null, null, BaseManagementHandler.RESOURCES_NODE_NAME);
  TreeNode<Resource> configGroupNode = new TreeNodeImpl<Resource>(resourcesNode, configGroup, "configGroup1");
  resourcesNode.setProperty("isCollection", "true");
  processor.process(null, configGroupNode, "http://c6401.ambari.apache.org:8080/api/v1/clusters/c1/config_groups");
  href = configGroupNode.getStringProperty("href");
  Assert.assertEquals("http://c6401.ambari.apache.org:8080/api/v1/clusters/c1/config_groups/2", href);
}