@Test public void getOnpremIssueInfoTest() throws Exception { List<Map<String, Object>> onpremIssueInfo = new ArrayList<>(); Map<String, Object> issueInfo = new HashMap<>(); issueInfo.put("_resourceId", 1234); issueInfo.put("issueStatus", "open"); onpremIssueInfo.add(issueInfo); when( elasticSearchRepository.getSortedDataFromES(anyString(), anyString(), anyObject(), anyObject(), anyObject(), anyObject(), anyObject(), anyObject())).thenReturn(onpremIssueInfo); patchingRepositoryImpl.getOnpremIssueInfo("aws-all"); when( elasticSearchRepository.getSortedDataFromES(anyString(), anyString(), anyObject(), anyObject(), anyObject(), anyObject(), anyObject(), anyObject())).thenThrow(new RuntimeException()); assertThatThrownBy(() -> patchingRepositoryImpl.getOnpremIssueInfo("aws-all")) .isInstanceOf(DataException.class); }
@Override public List<Map<String, Object>> getOnpremIssueInfo(String assetGroup) throws DataException { Map<String, Object> mustFilter = new HashMap<>(); mustFilter.put(CommonUtils.convertAttributetoKeyword(RULEID), ONPREM_KERNEL_COMPLIANCE_RULE); Map<String, Object> mustNotFilter = new HashMap<>(); mustNotFilter.put(CommonUtils.convertAttributetoKeyword(ISSUE_STATUS), CLOSED); try{ return elasticSearchRepository.getSortedDataFromES(assetGroup, "issue_onpremserver", mustFilter, mustNotFilter, null, Arrays.asList(RESOURCEID, "issueStatus"), null, null); } catch(Exception e){ throw new DataException(e); } }
PatchingRepositoryImpl implements PatchingRepository, Constants { @Override public List<Map<String, Object>> getOnpremIssueInfo(String assetGroup) throws DataException { Map<String, Object> mustFilter = new HashMap<>(); mustFilter.put(CommonUtils.convertAttributetoKeyword(RULEID), ONPREM_KERNEL_COMPLIANCE_RULE); Map<String, Object> mustNotFilter = new HashMap<>(); mustNotFilter.put(CommonUtils.convertAttributetoKeyword(ISSUE_STATUS), CLOSED); try{ return elasticSearchRepository.getSortedDataFromES(assetGroup, "issue_onpremserver", mustFilter, mustNotFilter, null, Arrays.asList(RESOURCEID, "issueStatus"), null, null); } catch(Exception e){ throw new DataException(e); } } }
PatchingRepositoryImpl implements PatchingRepository, Constants { @Override public List<Map<String, Object>> getOnpremIssueInfo(String assetGroup) throws DataException { Map<String, Object> mustFilter = new HashMap<>(); mustFilter.put(CommonUtils.convertAttributetoKeyword(RULEID), ONPREM_KERNEL_COMPLIANCE_RULE); Map<String, Object> mustNotFilter = new HashMap<>(); mustNotFilter.put(CommonUtils.convertAttributetoKeyword(ISSUE_STATUS), CLOSED); try{ return elasticSearchRepository.getSortedDataFromES(assetGroup, "issue_onpremserver", mustFilter, mustNotFilter, null, Arrays.asList(RESOURCEID, "issueStatus"), null, null); } catch(Exception e){ throw new DataException(e); } }  }
PatchingRepositoryImpl implements PatchingRepository, Constants { @Override public List<Map<String, Object>> getOnpremIssueInfo(String assetGroup) throws DataException { Map<String, Object> mustFilter = new HashMap<>(); mustFilter.put(CommonUtils.convertAttributetoKeyword(RULEID), ONPREM_KERNEL_COMPLIANCE_RULE); Map<String, Object> mustNotFilter = new HashMap<>(); mustNotFilter.put(CommonUtils.convertAttributetoKeyword(ISSUE_STATUS), CLOSED); try{ return elasticSearchRepository.getSortedDataFromES(assetGroup, "issue_onpremserver", mustFilter, mustNotFilter, null, Arrays.asList(RESOURCEID, "issueStatus"), null, null); } catch(Exception e){ throw new DataException(e); } }  @Override List<Map<String, Object>> getPatchingProgress(String assetGroup,
            LocalDate startDate, LocalDate endDate); @Override List<Map<String, Object>> getIssueInfo(String assetGroup); List<Map<String, Object>> getClosedIssueInfo(String assetGroup,
            int size); @Override List<Map<String, Object>> getInstanceInfo(String assetGroup,
            Map<String, String> filters); @Override List<Map<String, Object>> getExecAndDirectorInfo(); @Override long getInstanceInfoCount(String assetGroup,
            Map<String, String> filters, String searchText); @Override String getAmilAvailDate(int year, int quarter); @Override int getPatchingWindow(); @Override Map<String, Long> getQuartersWithPatchingData(String assetGroup); Map<String, Object> addParentConditionPatching(String targetType); @Override List<Map<String, Object>> getOnpremIssueInfo(String assetGroup); @Override List<Map<String, Object>> getOnpremResourceInfo(String assetGroup,
            Map<String, String> filters); @Override Map<String, Object> getDirectorsAndExcutiveSponsers(String appTag,
            String appType); @Override Map<String, Long> getNonCompliantNumberForAgAndResourceType(
            String assetGroup, String resourceType); @Override List<Map<String, Object>> getPatchingPercentForDateRange(String assetGroup, LocalDate fromDate,
			LocalDate toDate); }
PatchingRepositoryImpl implements PatchingRepository, Constants { @Override public List<Map<String, Object>> getOnpremIssueInfo(String assetGroup) throws DataException { Map<String, Object> mustFilter = new HashMap<>(); mustFilter.put(CommonUtils.convertAttributetoKeyword(RULEID), ONPREM_KERNEL_COMPLIANCE_RULE); Map<String, Object> mustNotFilter = new HashMap<>(); mustNotFilter.put(CommonUtils.convertAttributetoKeyword(ISSUE_STATUS), CLOSED); try{ return elasticSearchRepository.getSortedDataFromES(assetGroup, "issue_onpremserver", mustFilter, mustNotFilter, null, Arrays.asList(RESOURCEID, "issueStatus"), null, null); } catch(Exception e){ throw new DataException(e); } }  @Override List<Map<String, Object>> getPatchingProgress(String assetGroup,
            LocalDate startDate, LocalDate endDate); @Override List<Map<String, Object>> getIssueInfo(String assetGroup); List<Map<String, Object>> getClosedIssueInfo(String assetGroup,
            int size); @Override List<Map<String, Object>> getInstanceInfo(String assetGroup,
            Map<String, String> filters); @Override List<Map<String, Object>> getExecAndDirectorInfo(); @Override long getInstanceInfoCount(String assetGroup,
            Map<String, String> filters, String searchText); @Override String getAmilAvailDate(int year, int quarter); @Override int getPatchingWindow(); @Override Map<String, Long> getQuartersWithPatchingData(String assetGroup); Map<String, Object> addParentConditionPatching(String targetType); @Override List<Map<String, Object>> getOnpremIssueInfo(String assetGroup); @Override List<Map<String, Object>> getOnpremResourceInfo(String assetGroup,
            Map<String, String> filters); @Override Map<String, Object> getDirectorsAndExcutiveSponsers(String appTag,
            String appType); @Override Map<String, Long> getNonCompliantNumberForAgAndResourceType(
            String assetGroup, String resourceType); @Override List<Map<String, Object>> getPatchingPercentForDateRange(String assetGroup, LocalDate fromDate,
			LocalDate toDate);  }