List of usage examples for java.util HashMap remove
public V remove(Object key)
From source file:com.ecofactor.qa.automation.api.ReportsAPITest.java
/** * Missing end date location usage months. */// w w w. j a v a 2 s . co m @Test(groups = { "sanity1" }) public void missingEndDateLocationUsageMonths() { HashMap<String, String> params = getMonthParams(5); params.remove(ReportsAPIConfig.END_DATE); String id = reportsAPIConfig.get(ReportsAPIConfig.LOCATION_ID); String content = HttpUtil.get(getLocationUsageURL(id), params, 400); JSONObject object = JsonUtil.parseObject(content); Assert.assertNotNull(object); Assert.assertNotNull(object.get(reportsAPIConfig.get(ReportsAPIConfig.ERROR_MSG))); JSONArray mesgs = (JSONArray) object.get(reportsAPIConfig.get(ReportsAPIConfig.ERROR_MSG)); for (Object mesg : mesgs) { Assert.assertEquals(mesg.toString().trim(), reportsAPIConfig.get(ReportsAPIConfig.USAGE_END_DATE_ERROR)); } }
From source file:com.ecofactor.qa.automation.api.ReportsAPITest.java
/** * Missing interval location usage months. *//*from w ww.j a va 2 s. com*/ @Test(groups = { "sanity1" }) public void missingIntervalLocationUsageMonths() { HashMap<String, String> params = getMonthParams(5); params.remove(ReportsAPIConfig.INTERVAL); String id = reportsAPIConfig.get(ReportsAPIConfig.LOCATION_ID); String content = HttpUtil.get(getLocationUsageURL(id), params, 400); JSONObject object = JsonUtil.parseObject(content); Assert.assertNotNull(object); Assert.assertNotNull(object.get(reportsAPIConfig.get(ReportsAPIConfig.ERROR_MSG))); JSONArray mesgs = (JSONArray) object.get(reportsAPIConfig.get(ReportsAPIConfig.ERROR_MSG)); for (Object mesg : mesgs) { Assert.assertEquals(mesg.toString().trim(), reportsAPIConfig.get(ReportsAPIConfig.USAGE_INTERVAL_ERROR)); } }
From source file:com.ecofactor.qa.automation.api.ReportsAPITest.java
/** * Missing start date user usage months. *///from w ww. jav a 2s .com @Test(groups = { "sanity1" }) public void missingStartDateUserUsageMonths() { HashMap<String, String> params = getMonthParams(5); params.remove(ReportsAPIConfig.START_DATE); String id = reportsAPIConfig.get(ReportsAPIConfig.USER_ID); String content = HttpUtil.get(getUserUsageURL(id), params, 400); JSONObject object = JsonUtil.parseObject(content); Assert.assertNotNull(object); Assert.assertNotNull(object.get(reportsAPIConfig.get(ReportsAPIConfig.ERROR_MSG))); JSONArray mesgs = (JSONArray) object.get(reportsAPIConfig.get(ReportsAPIConfig.ERROR_MSG)); for (Object mesg : mesgs) { Assert.assertEquals(mesg.toString().trim(), reportsAPIConfig.get(ReportsAPIConfig.USAGE_START_DATE_ERROR)); } }
From source file:com.ecofactor.qa.automation.api.ReportsAPITest.java
/** * Missing end date user usage months.//from w w w .ja v a 2 s .c om */ @Test(groups = { "sanity1" }) public void missingEndDateUserUsageMonths() { HashMap<String, String> params = getMonthParams(5); params.remove(ReportsAPIConfig.END_DATE); String id = reportsAPIConfig.get(ReportsAPIConfig.USER_ID); String content = HttpUtil.get(getUserUsageURL(id), params, 400); JSONObject object = JsonUtil.parseObject(content); Assert.assertNotNull(object); Assert.assertNotNull(object.get(reportsAPIConfig.get(ReportsAPIConfig.ERROR_MSG))); JSONArray mesgs = (JSONArray) object.get(reportsAPIConfig.get(ReportsAPIConfig.ERROR_MSG)); for (Object mesg : mesgs) { Assert.assertEquals(mesg.toString().trim(), reportsAPIConfig.get(ReportsAPIConfig.USAGE_END_DATE_ERROR)); } }
From source file:com.ecofactor.qa.automation.api.ReportsAPITest.java
/** * Missing interval user usage months./*from ww w.j a v a 2 s . c o m*/ */ @Test(groups = { "sanity1" }) public void missingIntervalUserUsageMonths() { HashMap<String, String> params = getMonthParams(5); params.remove(ReportsAPIConfig.INTERVAL); String id = reportsAPIConfig.get(ReportsAPIConfig.USER_ID); String content = HttpUtil.get(getUserUsageURL(id), params, 400); JSONObject object = JsonUtil.parseObject(content); Assert.assertNotNull(object); Assert.assertNotNull(object.get(reportsAPIConfig.get(ReportsAPIConfig.ERROR_MSG))); JSONArray mesgs = (JSONArray) object.get(reportsAPIConfig.get(ReportsAPIConfig.ERROR_MSG)); for (Object mesg : mesgs) { Assert.assertEquals(mesg.toString().trim(), reportsAPIConfig.get(ReportsAPIConfig.USAGE_INTERVAL_ERROR)); } }
From source file:org.sakaiproject.tool.assessment.ui.listener.author.SaveAssessmentAttachmentListener.java
private List prepareAssessmentAttachment(AssessmentIfc assessment, AssessmentService assessmentService) { ToolSession session = SessionManager.getCurrentToolSession(); if (session.getAttribute(FilePickerHelper.FILE_PICKER_ATTACHMENTS) != null) { Set attachmentSet = new HashSet(); if (assessment != null) { attachmentSet = assessment.getAssessmentAttachmentSet(); }/*from www .j a v a 2s . c om*/ HashMap map = getResourceIdHash(attachmentSet); ArrayList newAttachmentList = new ArrayList(); String protocol = ContextUtil.getProtocol(); List refs = (List) session.getAttribute(FilePickerHelper.FILE_PICKER_ATTACHMENTS); if (refs != null && refs.size() > 0) { Reference ref; for (int i = 0; i < refs.size(); i++) { ref = (Reference) refs.get(i); String resourceId = ref.getId(); if (map.get(resourceId) == null) { // new attachment, add log.debug("**** ref.Id=" + ref.getId()); log.debug("**** ref.name=" + ref.getProperties().getProperty(ref.getProperties().getNamePropDisplayName())); AssessmentAttachmentIfc newAttach = assessmentService.createAssessmentAttachment(assessment, ref.getId(), ref.getProperties().getProperty(ref.getProperties().getNamePropDisplayName()), protocol); newAttachmentList.add(newAttach); } else { // attachment already exist, let's add it to new list and check it off from map newAttachmentList.add((AssessmentAttachmentIfc) map.get(resourceId)); map.remove(resourceId); } } } session.removeAttribute(FilePickerHelper.FILE_PICKER_ATTACHMENTS); session.removeAttribute(FilePickerHelper.FILE_PICKER_CANCEL); return newAttachmentList; } return new ArrayList(); }
From source file:com.ecofactor.qa.automation.api.ReportsAPITest.java
/** * Missing end date location savings./*from w ww .j a va 2s . co m*/ */ @Test(groups = { "sanity1" }) public void missingEndDateLocationSavings() { HashMap<String, String> params = getNotAccumulatedParams(5); params.remove(ReportsAPIConfig.END_DATE); String id = reportsAPIConfig.get(ReportsAPIConfig.USER_ID); String content = HttpUtil.get(getLocationSavingsURL(id), params, 400); JSONObject object = JsonUtil.parseObject(content); Assert.assertNotNull(object); Assert.assertNotNull(object.get(reportsAPIConfig.get(ReportsAPIConfig.ERROR_MSG))); JSONArray mesgs = (JSONArray) object.get(reportsAPIConfig.get(ReportsAPIConfig.ERROR_MSG)); for (Object mesg : mesgs) { Assert.assertEquals(mesg.toString().trim(), reportsAPIConfig.get(ReportsAPIConfig.SVG_END_DATE_ERROR)); } }
From source file:com.ecofactor.qa.automation.api.ReportsAPITest.java
/** * Missing end date user savings.//w w w . ja v a 2 s .c om */ @Test(groups = { "sanity1" }) public void missingEndDateUserSavings() { HashMap<String, String> params = getNotAccumulatedParams(5); params.remove(ReportsAPIConfig.END_DATE); String id = reportsAPIConfig.get(ReportsAPIConfig.USER_ID); String content = HttpUtil.get(getUserSavingsURL(id), params, 400); JSONObject object = JsonUtil.parseObject(content); Assert.assertNotNull(object); Assert.assertNotNull(object.get(reportsAPIConfig.get(ReportsAPIConfig.ERROR_MSG))); JSONArray mesgs = (JSONArray) object.get(reportsAPIConfig.get(ReportsAPIConfig.ERROR_MSG)); for (Object mesg : mesgs) { Assert.assertEquals(mesg.toString().trim(), reportsAPIConfig.get(ReportsAPIConfig.SVG_END_DATE_ERROR)); } }
From source file:com.ecofactor.qa.automation.api.ReportsAPITest.java
/** * Invalid location savings.// w w w. ja v a2 s. c o m */ @Test(groups = { "sanity1" }) public void invalidLocationSavings() { HashMap<String, String> params = getNotAccumulatedParams(5); params.remove(ReportsAPIConfig.ACCUMULATED); params.put(ReportsAPIConfig.ACCUMULATED, ""); String id = reportsAPIConfig.get(ReportsAPIConfig.LOCATION_ID); String content = HttpUtil.get(getLocationSavingsURL(id), params, 500); JSONObject object = JsonUtil.parseObject(content); Assert.assertNotNull(object); Assert.assertNotNull(object.get(reportsAPIConfig.get(ReportsAPIConfig.ERROR_MSG))); JSONArray mesgs = (JSONArray) object.get(reportsAPIConfig.get(ReportsAPIConfig.ERROR_MSG)); for (Object mesg : mesgs) { Assert.assertTrue(mesg.toString().startsWith(reportsAPIConfig.get(ReportsAPIConfig.INTERNAL_ERROR))); } }
From source file:com.ecofactor.qa.automation.api.ReportsAPITest.java
/** * Missing start date location savings.// ww w .ja va 2 s . com */ @Test(groups = { "sanity1" }) public void missingStartDateLocationSavings() { HashMap<String, String> params = getNotAccumulatedParams(5); params.remove(ReportsAPIConfig.START_DATE); String id = reportsAPIConfig.get(ReportsAPIConfig.USER_ID); String content = HttpUtil.get(getLocationSavingsURL(id), params, 400); JSONObject object = JsonUtil.parseObject(content); Assert.assertNotNull(object); Assert.assertNotNull(object.get(reportsAPIConfig.get(ReportsAPIConfig.ERROR_MSG))); JSONArray mesgs = (JSONArray) object.get(reportsAPIConfig.get(ReportsAPIConfig.ERROR_MSG)); for (Object mesg : mesgs) { Assert.assertEquals(mesg.toString().trim(), reportsAPIConfig.get(ReportsAPIConfig.SVG_START_DATE_ERROR)); } }