List of usage examples for java.util HashMap remove
public V remove(Object key)
From source file:com.ecofactor.qa.automation.api.HttpsReportsAPITest.java
/** * Missing start date location usage months. */// w w w. j a v a 2 s . co m @Test(groups = { "sanity1" }) public void missingStartDateLocationUsageMonths() { HashMap<String, String> params = getMonthParams(5); params.remove(HttpsReportsAPIConfig.START_DATE); String id = reportsAPIConfig.get(HttpsReportsAPIConfig.LOCATION_ID); String content = HttpsUtil.get(getLocationUsageURL(id), params, 400); JSONObject object = JsonUtil.parseObject(content); Assert.assertNotNull(object); Assert.assertNotNull(object.get(reportsAPIConfig.get(HttpsReportsAPIConfig.ERROR_MSG))); JSONArray mesgs = (JSONArray) object.get(reportsAPIConfig.get(HttpsReportsAPIConfig.ERROR_MSG)); for (Object mesg : mesgs) { Assert.assertEquals(mesg.toString().trim(), reportsAPIConfig.get(HttpsReportsAPIConfig.USAGE_START_DATE_ERROR)); } }
From source file:com.ecofactor.qa.automation.api.HttpsReportsAPITest.java
/** * Missing end date location usage months. *//*from ww w.j a v a 2s . com*/ @Test(groups = { "sanity1" }) public void missingEndDateLocationUsageMonths() { HashMap<String, String> params = getMonthParams(5); params.remove(HttpsReportsAPIConfig.END_DATE); String id = reportsAPIConfig.get(HttpsReportsAPIConfig.LOCATION_ID); String content = HttpsUtil.get(getLocationUsageURL(id), params, 400); JSONObject object = JsonUtil.parseObject(content); Assert.assertNotNull(object); Assert.assertNotNull(object.get(reportsAPIConfig.get(HttpsReportsAPIConfig.ERROR_MSG))); JSONArray mesgs = (JSONArray) object.get(reportsAPIConfig.get(HttpsReportsAPIConfig.ERROR_MSG)); for (Object mesg : mesgs) { Assert.assertEquals(mesg.toString().trim(), reportsAPIConfig.get(HttpsReportsAPIConfig.USAGE_END_DATE_ERROR)); } }
From source file:com.ecofactor.qa.automation.api.HttpsReportsAPITest.java
/** * Missing interval location usage months. *//*from w w w .j a v a 2 s . c om*/ @Test(groups = { "sanity1" }) public void missingIntervalLocationUsageMonths() { HashMap<String, String> params = getMonthParams(5); params.remove(HttpsReportsAPIConfig.INTERVAL); String id = reportsAPIConfig.get(HttpsReportsAPIConfig.LOCATION_ID); String content = HttpsUtil.get(getLocationUsageURL(id), params, 400); JSONObject object = JsonUtil.parseObject(content); Assert.assertNotNull(object); Assert.assertNotNull(object.get(reportsAPIConfig.get(HttpsReportsAPIConfig.ERROR_MSG))); JSONArray mesgs = (JSONArray) object.get(reportsAPIConfig.get(HttpsReportsAPIConfig.ERROR_MSG)); for (Object mesg : mesgs) { Assert.assertEquals(mesg.toString().trim(), reportsAPIConfig.get(HttpsReportsAPIConfig.USAGE_INTERVAL_ERROR)); } }
From source file:com.ecofactor.qa.automation.api.HttpsReportsAPITest.java
/** * Missing start date user usage months. *///from w w w.ja v a 2 s . c o m @Test(groups = { "sanity1" }) public void missingStartDateUserUsageMonths() { HashMap<String, String> params = getMonthParams(5); params.remove(HttpsReportsAPIConfig.START_DATE); String id = reportsAPIConfig.get(HttpsReportsAPIConfig.USER_ID); String content = HttpsUtil.get(getUserUsageURL(id), params, 400); JSONObject object = JsonUtil.parseObject(content); Assert.assertNotNull(object); Assert.assertNotNull(object.get(reportsAPIConfig.get(HttpsReportsAPIConfig.ERROR_MSG))); JSONArray mesgs = (JSONArray) object.get(reportsAPIConfig.get(HttpsReportsAPIConfig.ERROR_MSG)); for (Object mesg : mesgs) { Assert.assertEquals(mesg.toString().trim(), reportsAPIConfig.get(HttpsReportsAPIConfig.USAGE_START_DATE_ERROR)); } }
From source file:com.ecofactor.qa.automation.api.HttpsReportsAPITest.java
/** * Missing end date user usage months./* ww w . j av a 2 s . c om*/ */ @Test(groups = { "sanity1" }) public void missingEndDateUserUsageMonths() { HashMap<String, String> params = getMonthParams(5); params.remove(HttpsReportsAPIConfig.END_DATE); String id = reportsAPIConfig.get(HttpsReportsAPIConfig.USER_ID); String content = HttpsUtil.get(getUserUsageURL(id), params, 400); JSONObject object = JsonUtil.parseObject(content); Assert.assertNotNull(object); Assert.assertNotNull(object.get(reportsAPIConfig.get(HttpsReportsAPIConfig.ERROR_MSG))); JSONArray mesgs = (JSONArray) object.get(reportsAPIConfig.get(HttpsReportsAPIConfig.ERROR_MSG)); for (Object mesg : mesgs) { Assert.assertEquals(mesg.toString().trim(), reportsAPIConfig.get(HttpsReportsAPIConfig.USAGE_END_DATE_ERROR)); } }
From source file:com.ecofactor.qa.automation.api.HttpsReportsAPITest.java
/** * Missing interval user usage months./*from w ww .j av a 2s. c o m*/ */ @Test(groups = { "sanity1" }) public void missingIntervalUserUsageMonths() { HashMap<String, String> params = getMonthParams(5); params.remove(HttpsReportsAPIConfig.INTERVAL); String id = reportsAPIConfig.get(HttpsReportsAPIConfig.USER_ID); String content = HttpsUtil.get(getUserUsageURL(id), params, 400); JSONObject object = JsonUtil.parseObject(content); Assert.assertNotNull(object); Assert.assertNotNull(object.get(reportsAPIConfig.get(HttpsReportsAPIConfig.ERROR_MSG))); JSONArray mesgs = (JSONArray) object.get(reportsAPIConfig.get(HttpsReportsAPIConfig.ERROR_MSG)); for (Object mesg : mesgs) { Assert.assertEquals(mesg.toString().trim(), reportsAPIConfig.get(HttpsReportsAPIConfig.USAGE_INTERVAL_ERROR)); } }
From source file:com.dtolabs.rundeck.jetty.jaas.JettyCachingLdapLoginModule.java
private List<String> mergeRoles(List<String> roles, HashMap<String, List<String>> roleMemberOfMap) { List<String> newRoles = new ArrayList<String>(); List<String> mergedRoles = new ArrayList<String>(); mergedRoles.addAll(roles);//from w w w. ja v a 2s . c o m for (String role : roles) { if (roleMemberOfMap.containsKey(role)) { for (String newRole : roleMemberOfMap.get(role)) { if (!roles.contains(newRole)) { newRoles.add(newRole); } } roleMemberOfMap.remove(role); } } if (!newRoles.isEmpty()) { mergedRoles.addAll(mergeRoles(newRoles, roleMemberOfMap)); } return mergedRoles; }
From source file:de.dfki.madm.anomalydetection.evaluator.cluster_based.CMGOSEvaluator.java
private HashMap<Double, LinkedList<CovarianceMatrix>> getSorted( HashMap<Double, LinkedList<CovarianceMatrix>> map, CovarianceMatrix ret, int count) { Matrix mh = new Matrix(ret.getCovMat()); double det = mh.det(); if (map.containsKey(det)) { LinkedList<CovarianceMatrix> temp = map.get(det); temp.push(ret);//from ww w . j av a2 s . c o m map.put(det, temp); } else { LinkedList<CovarianceMatrix> temp = new LinkedList<CovarianceMatrix>(); temp.push(ret); map.put(det, temp); } if (map.keySet().size() > count) { ArrayList<Double> sortedList = new ArrayList<Double>(); sortedList.addAll(map.keySet()); Collections.sort(sortedList); map.remove(sortedList.get(sortedList.size() - 1)); sortedList = null; } return map; }
From source file:com.ecofactor.qa.automation.api.HttpsReportsAPITest.java
/** * Missing start date location savings./* w ww.j a va2 s .c o m*/ */ @Test(groups = { "sanity1" }) public void missingStartDateLocationSavings() { HashMap<String, String> params = getNotAccumulatedParams(5); params.remove(HttpsReportsAPIConfig.START_DATE); String id = reportsAPIConfig.get(HttpsReportsAPIConfig.USER_ID); String content = HttpsUtil.get(getLocationSavingsURL(id), params, 400); JSONObject object = JsonUtil.parseObject(content); Assert.assertNotNull(object); Assert.assertNotNull(object.get(reportsAPIConfig.get(HttpsReportsAPIConfig.ERROR_MSG))); JSONArray mesgs = (JSONArray) object.get(reportsAPIConfig.get(HttpsReportsAPIConfig.ERROR_MSG)); for (Object mesg : mesgs) { Assert.assertEquals(mesg.toString().trim(), reportsAPIConfig.get(HttpsReportsAPIConfig.SVG_START_DATE_ERROR)); } }
From source file:com.ecofactor.qa.automation.api.HttpsReportsAPITest.java
/** * Missing end date location savings./*from ww w . j av a 2 s. c o m*/ */ @Test(groups = { "sanity1" }) public void missingEndDateLocationSavings() { HashMap<String, String> params = getNotAccumulatedParams(5); params.remove(HttpsReportsAPIConfig.END_DATE); String id = reportsAPIConfig.get(HttpsReportsAPIConfig.USER_ID); String content = HttpsUtil.get(getLocationSavingsURL(id), params, 400); JSONObject object = JsonUtil.parseObject(content); Assert.assertNotNull(object); Assert.assertNotNull(object.get(reportsAPIConfig.get(HttpsReportsAPIConfig.ERROR_MSG))); JSONArray mesgs = (JSONArray) object.get(reportsAPIConfig.get(HttpsReportsAPIConfig.ERROR_MSG)); for (Object mesg : mesgs) { Assert.assertEquals(mesg.toString().trim(), reportsAPIConfig.get(HttpsReportsAPIConfig.SVG_END_DATE_ERROR)); } }