@Test public void testGetRequestStatus() { Set<String> propertyIds = new HashSet<String>(); Map<Resource.Type, String> keyPropertyIds = new HashMap<Resource.Type, String>(); AmbariManagementController managementController = createMock(AmbariManagementController.class); MaintenanceStateHelper maintenanceStateHelper = createNiceMock(MaintenanceStateHelper.class); replay(maintenanceStateHelper); AbstractResourceProvider provider = new ServiceResourceProvider( propertyIds, keyPropertyIds, managementController, maintenanceStateHelper); RequestStatus status = provider.getRequestStatus(null); Assert.assertNull(status.getRequestResource()); Assert.assertEquals(Collections.emptySet(), status.getAssociatedResources()); RequestStatusResponse response = new RequestStatusResponse(99L); status = provider.getRequestStatus(response); Resource resource = status.getRequestResource(); Assert.assertEquals(99L, resource.getPropertyValue("Requests/id")); Assert.assertEquals(Collections.emptySet(), status.getAssociatedResources()); status = provider.getRequestStatus(response, null); resource = status.getRequestResource(); Assert.assertEquals(99L, resource.getPropertyValue("Requests/id")); Assert.assertEquals(Collections.emptySet(), status.getAssociatedResources()); Resource associatedResource = new ResourceImpl(Resource.Type.Service); Set<Resource> associatedResources = Collections.singleton(associatedResource); status = provider.getRequestStatus(response, associatedResources); resource = status.getRequestResource(); Assert.assertEquals(99L, resource.getPropertyValue("Requests/id")); Assert.assertEquals(associatedResources, status.getAssociatedResources()); }
protected RequestStatus getRequestStatus(RequestStatusResponse response, Set<Resource> associatedResources) { return getRequestStatus(response, associatedResources, null); }
AbstractResourceProvider extends BaseProvider implements ResourceProvider, ObservableResourceProvider { protected RequestStatus getRequestStatus(RequestStatusResponse response, Set<Resource> associatedResources) { return getRequestStatus(response, associatedResources, null); } }
AbstractResourceProvider extends BaseProvider implements ResourceProvider, ObservableResourceProvider { protected RequestStatus getRequestStatus(RequestStatusResponse response, Set<Resource> associatedResources) { return getRequestStatus(response, associatedResources, null); } protected  AbstractResourceProvider(Set<String> propertyIds,
                                     Map<Resource.Type, String> keyPropertyIds); }
AbstractResourceProvider extends BaseProvider implements ResourceProvider, ObservableResourceProvider { protected RequestStatus getRequestStatus(RequestStatusResponse response, Set<Resource> associatedResources) { return getRequestStatus(response, associatedResources, null); } protected  AbstractResourceProvider(Set<String> propertyIds,
                                     Map<Resource.Type, String> keyPropertyIds); @Override Map<Resource.Type, String> getKeyPropertyIds(); @Override void updateObservers(ResourceProviderEvent event); @Override void addObserver(ResourceProviderObserver observer); static List<ConfigurationRequest> getConfigurationRequests(String parentCategory, Map<String, Object> properties); static void parseProperties(ConfigurationRequest config, String absCategory, String propName, String propValue); }
AbstractResourceProvider extends BaseProvider implements ResourceProvider, ObservableResourceProvider { protected RequestStatus getRequestStatus(RequestStatusResponse response, Set<Resource> associatedResources) { return getRequestStatus(response, associatedResources, null); } protected  AbstractResourceProvider(Set<String> propertyIds,
                                     Map<Resource.Type, String> keyPropertyIds); @Override Map<Resource.Type, String> getKeyPropertyIds(); @Override void updateObservers(ResourceProviderEvent event); @Override void addObserver(ResourceProviderObserver observer); static List<ConfigurationRequest> getConfigurationRequests(String parentCategory, Map<String, Object> properties); static void parseProperties(ConfigurationRequest config, String absCategory, String propName, String propValue); static Pattern propertiesAttributesPattern; }