@Test public void getAppsDetailsTest() throws Exception { List<Map<String, Object>> appdetails = new ArrayList<>(); Map<String, Object> apps = new HashMap<>(); apps.put("appTag", "app1"); apps.put("director", "Mark"); apps.put("executiveSponsor", "Matt"); appdetails.add(apps); when( esRepository.getSortedDataFromESBySize(anyString(), anyString(), anyObject(), anyObject(), anyObject(), anyObject(), anyInt(), anyInt(), anyString(), anyObject(), anyObject())).thenReturn(appdetails); projectionRepositoryImpl.getAppsDetails("cloud"); when( esRepository.getSortedDataFromESBySize(anyString(), anyString(), anyObject(), anyObject(), anyObject(), anyObject(), anyInt(), anyInt(), anyString(), anyObject(), anyObject())).thenThrow( new RuntimeException()); assertThatThrownBy(() -> projectionRepositoryImpl.getAppsDetails("cloud")).isInstanceOf(DataException.class); }
@SuppressWarnings("deprecation") public List<Map<String, Object>> getAppsDetails(String appType) throws DataException { Map<String, Object> mustFilter = new HashMap<>(); mustFilter.put("_appType.keyword", appType); mustFilter.put("latest", true); ArrayList<String> fields = new ArrayList<>(); fields.add("appTag"); fields.add("director"); fields.add("executiveSponsor"); try { return esRepository.getSortedDataFromESBySize("aws_apps", "apps", mustFilter, null, null, fields, 0, TEN_THOUSAND, null, null, null); } catch (Exception e) { logger.error(e); throw new DataException(e); } }
ProjectionRepositoryImpl implements ProjectionRepository, Constants { @SuppressWarnings("deprecation") public List<Map<String, Object>> getAppsDetails(String appType) throws DataException { Map<String, Object> mustFilter = new HashMap<>(); mustFilter.put("_appType.keyword", appType); mustFilter.put("latest", true); ArrayList<String> fields = new ArrayList<>(); fields.add("appTag"); fields.add("director"); fields.add("executiveSponsor"); try { return esRepository.getSortedDataFromESBySize("aws_apps", "apps", mustFilter, null, null, fields, 0, TEN_THOUSAND, null, null, null); } catch (Exception e) { logger.error(e); throw new DataException(e); } } }
ProjectionRepositoryImpl implements ProjectionRepository, Constants { @SuppressWarnings("deprecation") public List<Map<String, Object>> getAppsDetails(String appType) throws DataException { Map<String, Object> mustFilter = new HashMap<>(); mustFilter.put("_appType.keyword", appType); mustFilter.put("latest", true); ArrayList<String> fields = new ArrayList<>(); fields.add("appTag"); fields.add("director"); fields.add("executiveSponsor"); try { return esRepository.getSortedDataFromESBySize("aws_apps", "apps", mustFilter, null, null, fields, 0, TEN_THOUSAND, null, null, null); } catch (Exception e) { logger.error(e); throw new DataException(e); } }  }
ProjectionRepositoryImpl implements ProjectionRepository, Constants { @SuppressWarnings("deprecation") public List<Map<String, Object>> getAppsDetails(String appType) throws DataException { Map<String, Object> mustFilter = new HashMap<>(); mustFilter.put("_appType.keyword", appType); mustFilter.put("latest", true); ArrayList<String> fields = new ArrayList<>(); fields.add("appTag"); fields.add("director"); fields.add("executiveSponsor"); try { return esRepository.getSortedDataFromESBySize("aws_apps", "apps", mustFilter, null, null, fields, 0, TEN_THOUSAND, null, null, null); } catch (Exception e) { logger.error(e); throw new DataException(e); } }  @Override Boolean updateProjectionByTargetType(ProjectionRequest projectionRequest); @Override List<Map<String, Object>> getProjectionDetailsFromDb(String targetType, int year, int quarter); @Override Long getTotalAssetCountByTargetType(String targetType); List<LocalDate> getListOfLastWeekDateOfQuarter(); int getWeekNoByDate(LocalDate date); @Override Map<Integer, Long> getPatchingSnapshot(String assetGroup); Map<String, Long> getUnPatchedDetailsByApplication(String assetGroup, String resourceType); Map<String, Long> getAssetDetailsByApplication(String assetGroup, String resourceType); Long getAssetCountByAg(String assetGroup, String resourceType); @SuppressWarnings("deprecation") List<Map<String, Object>> getAppsDetails(String appType); }
ProjectionRepositoryImpl implements ProjectionRepository, Constants { @SuppressWarnings("deprecation") public List<Map<String, Object>> getAppsDetails(String appType) throws DataException { Map<String, Object> mustFilter = new HashMap<>(); mustFilter.put("_appType.keyword", appType); mustFilter.put("latest", true); ArrayList<String> fields = new ArrayList<>(); fields.add("appTag"); fields.add("director"); fields.add("executiveSponsor"); try { return esRepository.getSortedDataFromESBySize("aws_apps", "apps", mustFilter, null, null, fields, 0, TEN_THOUSAND, null, null, null); } catch (Exception e) { logger.error(e); throw new DataException(e); } }  @Override Boolean updateProjectionByTargetType(ProjectionRequest projectionRequest); @Override List<Map<String, Object>> getProjectionDetailsFromDb(String targetType, int year, int quarter); @Override Long getTotalAssetCountByTargetType(String targetType); List<LocalDate> getListOfLastWeekDateOfQuarter(); int getWeekNoByDate(LocalDate date); @Override Map<Integer, Long> getPatchingSnapshot(String assetGroup); Map<String, Long> getUnPatchedDetailsByApplication(String assetGroup, String resourceType); Map<String, Long> getAssetDetailsByApplication(String assetGroup, String resourceType); Long getAssetCountByAg(String assetGroup, String resourceType); @SuppressWarnings("deprecation") List<Map<String, Object>> getAppsDetails(String appType);  }