@Test public void getFiltersFromDbTest() throws Exception{ List<Map<String, Object>> filters=new ArrayList<>(); Map<String,Object>filter=new HashMap<>(); filter.put("filterId", "1"); filter.put("filtername", "policyViolation"); filters.add(filter); when( rdsepository.getDataFromPacman(anyString())).thenReturn(filters); List<Map<String,Object>>filtersfromDb= filterRepositoryImpl.getFiltersFromDb(1); assertTrue(filtersfromDb.size()>0); }
@Override public List<Map<String, Object>> getFiltersFromDb(int filterId) throws DataException { String ruleIdWithTargetTypeQuery = "SELECT opt.optionName as optionName,opt.optionValue as optionValue,opt.optionURL as optionURL FROM pac_v2_ui_filters filters LEFT JOIN pac_v2_ui_options opt ON filters.filterId = opt.filterId WHERE opt.filterId = " + filterId + ""; return rdsepository.getDataFromPacman(ruleIdWithTargetTypeQuery); }
FilterRepositoryImpl implements FilterRepository, Constants { @Override public List<Map<String, Object>> getFiltersFromDb(int filterId) throws DataException { String ruleIdWithTargetTypeQuery = "SELECT opt.optionName as optionName,opt.optionValue as optionValue,opt.optionURL as optionURL FROM pac_v2_ui_filters filters LEFT JOIN pac_v2_ui_options opt ON filters.filterId = opt.filterId WHERE opt.filterId = " + filterId + ""; return rdsepository.getDataFromPacman(ruleIdWithTargetTypeQuery); } }
FilterRepositoryImpl implements FilterRepository, Constants { @Override public List<Map<String, Object>> getFiltersFromDb(int filterId) throws DataException { String ruleIdWithTargetTypeQuery = "SELECT opt.optionName as optionName,opt.optionValue as optionValue,opt.optionURL as optionURL FROM pac_v2_ui_filters filters LEFT JOIN pac_v2_ui_options opt ON filters.filterId = opt.filterId WHERE opt.filterId = " + filterId + ""; return rdsepository.getDataFromPacman(ruleIdWithTargetTypeQuery); }  }
FilterRepositoryImpl implements FilterRepository, Constants { @Override public List<Map<String, Object>> getFiltersFromDb(int filterId) throws DataException { String ruleIdWithTargetTypeQuery = "SELECT opt.optionName as optionName,opt.optionValue as optionValue,opt.optionURL as optionURL FROM pac_v2_ui_filters filters LEFT JOIN pac_v2_ui_options opt ON filters.filterId = opt.filterId WHERE opt.filterId = " + filterId + ""; return rdsepository.getDataFromPacman(ruleIdWithTargetTypeQuery); }  @Override List<Map<String, Object>> getFiltersFromDb(int filterId); List<Map<String, Object>> getPoliciesFromDB(String targetTypes); Map<String, Long> getPoliciesFromES(String assetGroup); List<Map<String, Object>> getAccountsFromES(String assetGroup); Map<String, Long> getRegionsFromES(String assetGroup); Map<String, Long> getRulesFromES(String assetGroup); AssetCountDTO[] getListOfApplications(String assetGroup,
            String domain); AssetCountDTO[] getListOfEnvironments(String assetGroup,
            String application, String domain); AssetCountDTO[] getListOfTargetTypes(String assetGroup, String domain); }
FilterRepositoryImpl implements FilterRepository, Constants { @Override public List<Map<String, Object>> getFiltersFromDb(int filterId) throws DataException { String ruleIdWithTargetTypeQuery = "SELECT opt.optionName as optionName,opt.optionValue as optionValue,opt.optionURL as optionURL FROM pac_v2_ui_filters filters LEFT JOIN pac_v2_ui_options opt ON filters.filterId = opt.filterId WHERE opt.filterId = " + filterId + ""; return rdsepository.getDataFromPacman(ruleIdWithTargetTypeQuery); }  @Override List<Map<String, Object>> getFiltersFromDb(int filterId); List<Map<String, Object>> getPoliciesFromDB(String targetTypes); Map<String, Long> getPoliciesFromES(String assetGroup); List<Map<String, Object>> getAccountsFromES(String assetGroup); Map<String, Long> getRegionsFromES(String assetGroup); Map<String, Long> getRulesFromES(String assetGroup); AssetCountDTO[] getListOfApplications(String assetGroup,
            String domain); AssetCountDTO[] getListOfEnvironments(String assetGroup,
            String application, String domain); AssetCountDTO[] getListOfTargetTypes(String assetGroup, String domain);  }