@Test public void getPoliciesFromDBTest()throws DataException{ List<Map<String, Object>> policies=new ArrayList<>(); Map<String,Object>policy=new HashMap<>(); policy.put("policyId", "Tagging_policy"); policy.put("policyDescription", "Tagging policy compliance"); policies.add(policy); when( rdsepository.getDataFromPacman(anyString())).thenReturn(policies); List<Map<String,Object>>policiesfromDb= filterRepositoryImpl.getPoliciesFromDB("ec2"); assertTrue(policiesfromDb.size()>0); }
public List<Map<String, Object>> getPoliciesFromDB(String targetTypes) throws DataException { String ruleIdQuery = "SELECT rule.policyId,policy.policyName FROM cf_RuleInstance rule LEFT JOIN cf_Policy policy ON rule.policyId = policy.policyId WHERE rule.status = 'ENABLED' AND targetType IN (" + targetTypes + ") GROUP BY rule.policyId"; return rdsepository.getDataFromPacman(ruleIdQuery); }
FilterRepositoryImpl implements FilterRepository, Constants { public List<Map<String, Object>> getPoliciesFromDB(String targetTypes) throws DataException { String ruleIdQuery = "SELECT rule.policyId,policy.policyName FROM cf_RuleInstance rule LEFT JOIN cf_Policy policy ON rule.policyId = policy.policyId WHERE rule.status = 'ENABLED' AND targetType IN (" + targetTypes + ") GROUP BY rule.policyId"; return rdsepository.getDataFromPacman(ruleIdQuery); } }
FilterRepositoryImpl implements FilterRepository, Constants { public List<Map<String, Object>> getPoliciesFromDB(String targetTypes) throws DataException { String ruleIdQuery = "SELECT rule.policyId,policy.policyName FROM cf_RuleInstance rule LEFT JOIN cf_Policy policy ON rule.policyId = policy.policyId WHERE rule.status = 'ENABLED' AND targetType IN (" + targetTypes + ") GROUP BY rule.policyId"; return rdsepository.getDataFromPacman(ruleIdQuery); }  }
FilterRepositoryImpl implements FilterRepository, Constants { public List<Map<String, Object>> getPoliciesFromDB(String targetTypes) throws DataException { String ruleIdQuery = "SELECT rule.policyId,policy.policyName FROM cf_RuleInstance rule LEFT JOIN cf_Policy policy ON rule.policyId = policy.policyId WHERE rule.status = 'ENABLED' AND targetType IN (" + targetTypes + ") GROUP BY rule.policyId"; return rdsepository.getDataFromPacman(ruleIdQuery); }  @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 { public List<Map<String, Object>> getPoliciesFromDB(String targetTypes) throws DataException { String ruleIdQuery = "SELECT rule.policyId,policy.policyName FROM cf_RuleInstance rule LEFT JOIN cf_Policy policy ON rule.policyId = policy.policyId WHERE rule.status = 'ENABLED' AND targetType IN (" + targetTypes + ") GROUP BY rule.policyId"; return rdsepository.getDataFromPacman(ruleIdQuery); }  @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);  }