@Then("^The metric \"(.+)\" was last published in the list \"(.+)\" on \"(.+)\"$") public void checkLastPublishDateOfMetricInList(String metric, String lstKey, String date) throws Exception { MetricInfoListResult metList = (MetricInfoListResult) stepData.get(lstKey); Date tmpCaptured = KapuaDateUtils.parseDate(date); for (MetricInfo tmpMet : metList.getItems()) { if (tmpMet.getName().equals(metric)) { assertEquals(tmpMet.getLastMessageOn(), tmpCaptured); return; } } fail(String.format("There is no metric [%s]", metric)); }
@Then("^Client \"(.+)\" last published a metric in the list \"(.+)\" on \"(.+)\"$") public void checkLastPublishDateOfClientMetric(String clientId, String lstKey, String date) throws Exception { MetricInfoListResult metList = (MetricInfoListResult) stepData.get(lstKey); Date tmpCaptured = KapuaDateUtils.parseDate(date); for (MetricInfo tmpMet : metList.getItems()) { if (tmpMet.getClientId().equals(clientId)) { assertEquals(tmpMet.getLastMessageOn(), tmpCaptured); return; } } fail(String.format("No metric matches the client id [%s]", clientId)); }