@Test public void getPatchingDetailsTest() throws Exception { Map<String, Object> patchingProgressMap = new HashMap<>(); List<Map<String, Object>> patchingProgressList = new ArrayList<>(); patchingProgressMap.put("_resourceid", "_resourceid"); patchingProgressMap.put("issueStatus", "open"); patchingProgressMap.put("reason-to-close", "2020"); patchingProgressMap.put("executiveSponsor", "John Doe"); patchingProgressMap.put("director", "John Doel"); patchingProgressMap.put("appTag", "Cloud Core"); patchingProgressMap.put("tags.Application", "Cloud Core"); patchingProgressMap.put("tags.Environment", "COM"); patchingProgressMap.put("Cloud Core", "abc"); patchingProgressMap.put("sourceType", "webservice"); patchingProgressMap.put("kernelVersion", "4.14.47-56.37.amzn1.x86_64"); patchingProgressMap.put("description", "Kernel version is compliant"); patchingProgressList.add(patchingProgressMap); Map<String, Object> closedInfoMap = new HashMap<>(); closedInfoMap.put("sourceType", "webservice"); closedInfoMap.put("kernelVersion", "44.14.47-56.37.amzn1.x86_64"); closedInfoMap.put("description", "Kernel version is compliant"); Map<String, Object> instanceInfoMap = new HashMap<>(); List<Map<String, Object>> instanceInfoList = new ArrayList<>(); instanceInfoMap.put("_resourceid", "_resourceid"); instanceInfoMap.put("tags.Application", "Cloud Core"); instanceInfoMap.put("reason-to-close", closedInfoMap); instanceInfoMap.put("tags.Environment", "env"); instanceInfoMap.put("Cloud Core", "abc"); instanceInfoMap.put("issueStatus", "open"); instanceInfoMap.put("_resourceid", closedInfoMap); instanceInfoList.add(instanceInfoMap); when(filterRepository.getListOfTargetTypes(anyString(),anyString())) .thenReturn(CommonTestUtil.getAssetCountByApps()); when(projectionRepository.getAppsDetails(anyString())) .thenReturn(patchingProgressList); when(repository.getIssueInfo(anyString())) .thenReturn(patchingProgressList); when(repository.getInstanceInfo(anyString(),anyObject())) .thenReturn(instanceInfoList); when(repository.getClosedIssueInfo(anyString(),anyInt())) .thenReturn(instanceInfoList); when(repository.getOnpremIssueInfo(anyString())) .thenReturn(patchingProgressList); when(repository.getOnpremResourceInfo(anyString(),anyObject())) .thenReturn(patchingProgressList); assertThat(patchingServiceImpl.getPatchingDetails("anyString",new HashMap<String, String>()), is(notNullValue())); }
@Override public List<Map<String, Object>> getPatchingDetails(String assetGroup, Map<String, String> filter) throws ServiceException { List<Map<String, Object>> patchingDetailsList; try { patchingDetailsList = new ArrayList<>(); AssetCountDTO[] targetTypes = filterRepository .getListOfTargetTypes(assetGroup, null); for (AssetCountDTO targettype : targetTypes) { if (StringUtils.isNotBlank(targettype.getType()) && ("ec2".equals(targettype.getType()))) { List<Map<String, Object>> cloudAppsList = getCloudAppList(CLOUD); Map<String, Object> cloudappstodirectorMap = getCloudAppstodirectorMap( cloudAppsList, DIRECTOR); Map<String, Object> cloudappstoExecutiveMap = getCloudAppstodirectorMap( cloudAppsList, EXCUTIVE_SPONSOR); List<Map<String, Object>> issueInfo = repository .getIssueInfo(assetGroup); Map<String, String> instanceIssueStatusLookup = prepareInstanceToIssueStatusLookup(issueInfo); List<Map<String, Object>> instanceInfo = repository .getInstanceInfo(assetGroup, filter); List<Map<String, Object>> closedInfo = repository .getClosedIssueInfo(assetGroup, instanceInfo.size()); Map<String, String> closedInfoLookup = prepareInstanceToClosedIssueStatusLookup(closedInfo); patchingDetailsListForEc2(patchingDetailsList, instanceInfo, instanceIssueStatusLookup, cloudappstodirectorMap, cloudappstoExecutiveMap, closedInfoLookup, targettype.getType()); } } } catch (DataException e) { throw new ServiceException(e); } return patchingDetailsList; }
PatchingServiceImpl implements PatchingService, Constants { @Override public List<Map<String, Object>> getPatchingDetails(String assetGroup, Map<String, String> filter) throws ServiceException { List<Map<String, Object>> patchingDetailsList; try { patchingDetailsList = new ArrayList<>(); AssetCountDTO[] targetTypes = filterRepository .getListOfTargetTypes(assetGroup, null); for (AssetCountDTO targettype : targetTypes) { if (StringUtils.isNotBlank(targettype.getType()) && ("ec2".equals(targettype.getType()))) { List<Map<String, Object>> cloudAppsList = getCloudAppList(CLOUD); Map<String, Object> cloudappstodirectorMap = getCloudAppstodirectorMap( cloudAppsList, DIRECTOR); Map<String, Object> cloudappstoExecutiveMap = getCloudAppstodirectorMap( cloudAppsList, EXCUTIVE_SPONSOR); List<Map<String, Object>> issueInfo = repository .getIssueInfo(assetGroup); Map<String, String> instanceIssueStatusLookup = prepareInstanceToIssueStatusLookup(issueInfo); List<Map<String, Object>> instanceInfo = repository .getInstanceInfo(assetGroup, filter); List<Map<String, Object>> closedInfo = repository .getClosedIssueInfo(assetGroup, instanceInfo.size()); Map<String, String> closedInfoLookup = prepareInstanceToClosedIssueStatusLookup(closedInfo); patchingDetailsListForEc2(patchingDetailsList, instanceInfo, instanceIssueStatusLookup, cloudappstodirectorMap, cloudappstoExecutiveMap, closedInfoLookup, targettype.getType()); } } } catch (DataException e) { throw new ServiceException(e); } return patchingDetailsList; } }
PatchingServiceImpl implements PatchingService, Constants { @Override public List<Map<String, Object>> getPatchingDetails(String assetGroup, Map<String, String> filter) throws ServiceException { List<Map<String, Object>> patchingDetailsList; try { patchingDetailsList = new ArrayList<>(); AssetCountDTO[] targetTypes = filterRepository .getListOfTargetTypes(assetGroup, null); for (AssetCountDTO targettype : targetTypes) { if (StringUtils.isNotBlank(targettype.getType()) && ("ec2".equals(targettype.getType()))) { List<Map<String, Object>> cloudAppsList = getCloudAppList(CLOUD); Map<String, Object> cloudappstodirectorMap = getCloudAppstodirectorMap( cloudAppsList, DIRECTOR); Map<String, Object> cloudappstoExecutiveMap = getCloudAppstodirectorMap( cloudAppsList, EXCUTIVE_SPONSOR); List<Map<String, Object>> issueInfo = repository .getIssueInfo(assetGroup); Map<String, String> instanceIssueStatusLookup = prepareInstanceToIssueStatusLookup(issueInfo); List<Map<String, Object>> instanceInfo = repository .getInstanceInfo(assetGroup, filter); List<Map<String, Object>> closedInfo = repository .getClosedIssueInfo(assetGroup, instanceInfo.size()); Map<String, String> closedInfoLookup = prepareInstanceToClosedIssueStatusLookup(closedInfo); patchingDetailsListForEc2(patchingDetailsList, instanceInfo, instanceIssueStatusLookup, cloudappstodirectorMap, cloudappstoExecutiveMap, closedInfoLookup, targettype.getType()); } } } catch (DataException e) { throw new ServiceException(e); } return patchingDetailsList; }  }
PatchingServiceImpl implements PatchingService, Constants { @Override public List<Map<String, Object>> getPatchingDetails(String assetGroup, Map<String, String> filter) throws ServiceException { List<Map<String, Object>> patchingDetailsList; try { patchingDetailsList = new ArrayList<>(); AssetCountDTO[] targetTypes = filterRepository .getListOfTargetTypes(assetGroup, null); for (AssetCountDTO targettype : targetTypes) { if (StringUtils.isNotBlank(targettype.getType()) && ("ec2".equals(targettype.getType()))) { List<Map<String, Object>> cloudAppsList = getCloudAppList(CLOUD); Map<String, Object> cloudappstodirectorMap = getCloudAppstodirectorMap( cloudAppsList, DIRECTOR); Map<String, Object> cloudappstoExecutiveMap = getCloudAppstodirectorMap( cloudAppsList, EXCUTIVE_SPONSOR); List<Map<String, Object>> issueInfo = repository .getIssueInfo(assetGroup); Map<String, String> instanceIssueStatusLookup = prepareInstanceToIssueStatusLookup(issueInfo); List<Map<String, Object>> instanceInfo = repository .getInstanceInfo(assetGroup, filter); List<Map<String, Object>> closedInfo = repository .getClosedIssueInfo(assetGroup, instanceInfo.size()); Map<String, String> closedInfoLookup = prepareInstanceToClosedIssueStatusLookup(closedInfo); patchingDetailsListForEc2(patchingDetailsList, instanceInfo, instanceIssueStatusLookup, cloudappstodirectorMap, cloudappstoExecutiveMap, closedInfoLookup, targettype.getType()); } } } catch (DataException e) { throw new ServiceException(e); } return patchingDetailsList; }  @Override List<Map<String, Object>> getNonCompliantNumberForAG(
            String assetGroup); @Override List<Map<String, Object>> getNonCompliantExecsForAG(String assetGroup); @Override List<Map<String, Object>> getPatchingDetails(String assetGroup,
            Map<String, String> filter); @Override Map<String, Object> getPatchingProgress(String assetGroup, int year,
            int quarter); @Override List<Map<String, Object>> getQuartersWithPatchingData(
            String assetGroup); @Override LocalDate getFirstDayOfQuarter(int quarterNumber, int year); @Override LocalDate getLastDayOfQuarter(int quarterNumber, int year); @Override int getOngoingQuarter(); @Override int getOngoingYear(); @Override Object filterMatchingCollectionElements(
            List<Map<String, Object>> masterDetailList, String searchText,
            boolean b); @Override Medal getStarRatingForAgPatching(String ag, int quarter, int year); }
PatchingServiceImpl implements PatchingService, Constants { @Override public List<Map<String, Object>> getPatchingDetails(String assetGroup, Map<String, String> filter) throws ServiceException { List<Map<String, Object>> patchingDetailsList; try { patchingDetailsList = new ArrayList<>(); AssetCountDTO[] targetTypes = filterRepository .getListOfTargetTypes(assetGroup, null); for (AssetCountDTO targettype : targetTypes) { if (StringUtils.isNotBlank(targettype.getType()) && ("ec2".equals(targettype.getType()))) { List<Map<String, Object>> cloudAppsList = getCloudAppList(CLOUD); Map<String, Object> cloudappstodirectorMap = getCloudAppstodirectorMap( cloudAppsList, DIRECTOR); Map<String, Object> cloudappstoExecutiveMap = getCloudAppstodirectorMap( cloudAppsList, EXCUTIVE_SPONSOR); List<Map<String, Object>> issueInfo = repository .getIssueInfo(assetGroup); Map<String, String> instanceIssueStatusLookup = prepareInstanceToIssueStatusLookup(issueInfo); List<Map<String, Object>> instanceInfo = repository .getInstanceInfo(assetGroup, filter); List<Map<String, Object>> closedInfo = repository .getClosedIssueInfo(assetGroup, instanceInfo.size()); Map<String, String> closedInfoLookup = prepareInstanceToClosedIssueStatusLookup(closedInfo); patchingDetailsListForEc2(patchingDetailsList, instanceInfo, instanceIssueStatusLookup, cloudappstodirectorMap, cloudappstoExecutiveMap, closedInfoLookup, targettype.getType()); } } } catch (DataException e) { throw new ServiceException(e); } return patchingDetailsList; }  @Override List<Map<String, Object>> getNonCompliantNumberForAG(
            String assetGroup); @Override List<Map<String, Object>> getNonCompliantExecsForAG(String assetGroup); @Override List<Map<String, Object>> getPatchingDetails(String assetGroup,
            Map<String, String> filter); @Override Map<String, Object> getPatchingProgress(String assetGroup, int year,
            int quarter); @Override List<Map<String, Object>> getQuartersWithPatchingData(
            String assetGroup); @Override LocalDate getFirstDayOfQuarter(int quarterNumber, int year); @Override LocalDate getLastDayOfQuarter(int quarterNumber, int year); @Override int getOngoingQuarter(); @Override int getOngoingYear(); @Override Object filterMatchingCollectionElements(
            List<Map<String, Object>> masterDetailList, String searchText,
            boolean b); @Override Medal getStarRatingForAgPatching(String ag, int quarter, int year);  }