@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: String href = serviceNode.getStringProperty("href"); Assert.assertEquals("http: 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: href = configGroupNode.getStringProperty("href"); Assert.assertEquals("http: }
@Override public List<PostProcessor> getPostProcessors() { List<PostProcessor> listProcessors = new ArrayList<PostProcessor>(); listProcessors.add(new BaseHrefPostProcessor()); return listProcessors; }
BaseResourceDefinition implements ResourceDefinition { @Override public List<PostProcessor> getPostProcessors() { List<PostProcessor> listProcessors = new ArrayList<PostProcessor>(); listProcessors.add(new BaseHrefPostProcessor()); return listProcessors; } }
BaseResourceDefinition implements ResourceDefinition { @Override public List<PostProcessor> getPostProcessors() { List<PostProcessor> listProcessors = new ArrayList<PostProcessor>(); listProcessors.add(new BaseHrefPostProcessor()); return listProcessors; } BaseResourceDefinition(Resource.Type resourceType);  BaseResourceDefinition(Resource.Type resourceType, Resource.Type ... subTypes);  BaseResourceDefinition(Resource.Type resourceType,
                                Collection<Resource.Type> subTypes,
                                Map<DirectiveType, ? extends Collection<String>> directives); }
BaseResourceDefinition implements ResourceDefinition { @Override public List<PostProcessor> getPostProcessors() { List<PostProcessor> listProcessors = new ArrayList<PostProcessor>(); listProcessors.add(new BaseHrefPostProcessor()); return listProcessors; } BaseResourceDefinition(Resource.Type resourceType);  BaseResourceDefinition(Resource.Type resourceType, Resource.Type ... subTypes);  BaseResourceDefinition(Resource.Type resourceType,
                                Collection<Resource.Type> subTypes,
                                Map<DirectiveType, ? extends Collection<String>> directives); @Override Resource.Type getType(); @Override Set<SubResourceDefinition> getSubResourceDefinitions(); @Override List<PostProcessor> getPostProcessors(); @Override Renderer getRenderer(String name); @Override Collection<String> getReadDirectives(); @Override Collection<String> getCreateDirectives(); @Override Collection<String> getUpdateDirectives(); @Override Collection<String> getDeleteDirectives(); @Override boolean equals(Object o); @Override int hashCode(); @Override boolean isCreatable(); }
BaseResourceDefinition implements ResourceDefinition { @Override public List<PostProcessor> getPostProcessors() { List<PostProcessor> listProcessors = new ArrayList<PostProcessor>(); listProcessors.add(new BaseHrefPostProcessor()); return listProcessors; } BaseResourceDefinition(Resource.Type resourceType);  BaseResourceDefinition(Resource.Type resourceType, Resource.Type ... subTypes);  BaseResourceDefinition(Resource.Type resourceType,
                                Collection<Resource.Type> subTypes,
                                Map<DirectiveType, ? extends Collection<String>> directives); @Override Resource.Type getType(); @Override Set<SubResourceDefinition> getSubResourceDefinitions(); @Override List<PostProcessor> getPostProcessors(); @Override Renderer getRenderer(String name); @Override Collection<String> getReadDirectives(); @Override Collection<String> getCreateDirectives(); @Override Collection<String> getUpdateDirectives(); @Override Collection<String> getDeleteDirectives(); @Override boolean equals(Object o); @Override int hashCode(); @Override boolean isCreatable();  }