List of usage examples for java.util HashMap remove
public V remove(Object key)
From source file:org.apache.samza.sql.interfaces.SqlIOConfig.java
public SqlIOConfig(String systemName, String streamName, List<String> sourceParts, Config systemConfig, TableDescriptor tableDescriptor) { HashMap<String, String> streamConfigs = new HashMap<>(systemConfig); this.source = getSourceFromSourceParts(sourceParts); this.sourceParts = sourceParts; this.systemStream = new SystemStream(systemName, streamName); this.tableDescriptor = Optional.ofNullable(tableDescriptor); // Remote table has no backing stream associated with it and hence streamId does not make sense. But let's keep it // for uniformity. Remote table has table descriptor defined. // Local table has both backing stream and a tableDescriptor defined. this.streamId = String.format("%s-%s", systemName, streamName); samzaRelConverterName = streamConfigs.get(CFG_SAMZA_REL_CONVERTER); Validate.notEmpty(samzaRelConverterName, String.format("%s is not set or empty for system %s", CFG_SAMZA_REL_CONVERTER, systemName)); if (isRemoteTable()) { samzaRelTableKeyConverterName = streamConfigs.get(CFG_SAMZA_REL_TABLE_KEY_CONVERTER); Validate.notEmpty(samzaRelTableKeyConverterName, String.format("%s is not set or empty for system %s", CFG_SAMZA_REL_CONVERTER, systemName)); } else {/* w w w . ja va 2 s . c o m*/ samzaRelTableKeyConverterName = ""; } relSchemaProviderName = streamConfigs.get(CFG_REL_SCHEMA_PROVIDER); // Removing the Samza SQL specific configs to get the remaining Samza configs. streamConfigs.remove(CFG_SAMZA_REL_CONVERTER); streamConfigs.remove(CFG_REL_SCHEMA_PROVIDER); if (!isRemoteTable()) { // The below config is required for local table and streams but not for remote table. streamConfigs.put(String.format(StreamConfig.PHYSICAL_NAME_FOR_STREAM_ID(), streamId), streamName); if (tableDescriptor != null) { // For local table, set the bootstrap config and default offset to oldest streamConfigs.put(String.format(StreamConfig.BOOTSTRAP_FOR_STREAM_ID(), streamId), "true"); streamConfigs.put(String.format(StreamConfig.CONSUMER_OFFSET_DEFAULT_FOR_STREAM_ID(), streamId), "oldest"); } } config = new MapConfig(streamConfigs); }
From source file:com.ecofactor.qa.automation.api.ReportsAPITest.java
/** * Missing start date location usage months. */// w w w . j a va 2 s. c om @Test(groups = { "sanity1" }) public void missingStartDateLocationUsageDays() { HashMap<String, String> params = getDayParams(); params.remove(ReportsAPIConfig.START_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_START_DATE_ERROR)); } }
From source file:com.ecofactor.qa.automation.api.ReportsAPITest.java
/** * Missing end date location usage days. */// w w w. j ava 2 s . c o m @Test(groups = { "sanity1" }) public void missingEndDateLocationUsageDays() { HashMap<String, String> params = getDayParams(); 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 start date user usage days./* w w w . jav a2 s. c om*/ */ @Test(groups = { "sanity1" }) public void missingStartDateUserUsageDays() { HashMap<String, String> params = getDayParams(); 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 days./*ww w .j a v a 2s .c om*/ */ @Test(groups = { "sanity1" }) public void missingEndDateUserUsageDays() { HashMap<String, String> params = getDayParams(); 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 start date location usage hours. *//*from ww w. j a v a 2s. co m*/ @Test(groups = { "sanity1" }) public void missingStartDateLocationUsageHours() { HashMap<String, String> params = getHourParams(); params.remove(ReportsAPIConfig.START_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_START_DATE_ERROR)); } }
From source file:com.ecofactor.qa.automation.api.ReportsAPITest.java
/** * Missing end date location usage hours. *///from w w w.java 2 s . c om @Test(groups = { "sanity1" }) public void missingEndDateLocationUsageHours() { HashMap<String, String> params = getHourParams(); 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 start date user usage hours.//from w w w .ja v a2 s .c o m */ @Test(groups = { "sanity1" }) public void missingStartDateUserUsageHours() { HashMap<String, String> params = getHourParams(); 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 hours./*from w w w.j a v a 2 s . co m*/ */ @Test(groups = { "sanity1" }) public void missingEndDateUserUsageHours() { HashMap<String, String> params = getHourParams(); 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 start date location usage months. *//*from www .ja v a 2s.c o m*/ @Test(groups = { "sanity1" }) public void missingStartDateLocationUsageMonths() { HashMap<String, String> params = getMonthParams(5); params.remove(ReportsAPIConfig.START_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_START_DATE_ERROR)); } }