private Map<String, List<Map<String, Object>>> readExpectedRecordsFromTestCaseSinks(List<StreamlineSink> sinks, List<TopologyTestRunCaseSink> testRunCaseSinks) { Map<String, String> sinkIdToName = sinks.stream() .collect(toMap(s -> s.getId(), s -> s.getName())); return testRunCaseSinks.stream() .filter(Objects::nonNull) .collect(toMap(s -> sinkIdToName.get(String.valueOf(s.getSinkId())), s -> { try { String records = s.getRecords(); if (StringUtils.isEmpty(records)) { return new ArrayList<Map<String, Object>>(); } else { return objectMapper.readValue(records, new TypeReference<List<Map<String, Object>>>() { }); } } catch (IOException e) { throw new RuntimeException(e); } })); }
@Override public int hashCode() { int result = getId() != null ? getId().hashCode() : 0; result = 31 * result + (getTestCaseId() != null ? getTestCaseId().hashCode() : 0); result = 31 * result + (getSinkId() != null ? getSinkId().hashCode() : 0); result = 31 * result + (getVersionId() != null ? getVersionId().hashCode() : 0); result = 31 * result + (getRecords() != null ? getRecords().hashCode() : 0); result = 31 * result + (getTimestamp() != null ? getTimestamp().hashCode() : 0); return result; }
@Override public boolean equals(Object o) { if (this == o) return true; if (!(o instanceof TopologyTestRunCaseSink)) return false; TopologyTestRunCaseSink that = (TopologyTestRunCaseSink) o; if (getId() != null ? !getId().equals(that.getId()) : that.getId() != null) return false; if (getTestCaseId() != null ? !getTestCaseId().equals(that.getTestCaseId()) : that.getTestCaseId() != null) return false; if (getSinkId() != null ? !getSinkId().equals(that.getSinkId()) : that.getSinkId() != null) return false; if (getVersionId() != null ? !getVersionId().equals(that.getVersionId()) : that.getVersionId() != null) return false; if (getRecords() != null ? !getRecords().equals(that.getRecords()) : that.getRecords() != null) return false; return getTimestamp() != null ? getTimestamp().equals(that.getTimestamp()) : that.getTimestamp() == null; }
public TopologyTestRunCaseSink(TopologyTestRunCaseSink other) { if (other != null) { setId(other.getId()); setTestCaseId(other.getTestCaseId()); setSinkId(other.getSinkId()); setVersionId(other.getVersionId()); setRecords(other.getRecords()); setTimestamp(other.getTimestamp()); } }