private Map<Long, Map<String, List<Map<String, Object>>>> readTestRecordsFromTestCaseSources(List<TopologyTestRunCaseSource> testRunCaseSources) { return testRunCaseSources.stream() .collect(toMap(s -> s.getSourceId(), s -> { try { Map<String, String> map = objectMapper.readValue(s.getRecords(), new TypeReference<Map<String, String>>() {}); Map<String, List<Map<String, Object>>> result = new HashMap<>(); for (Map.Entry<String, String> entry: map.entrySet()) { result.put(entry.getKey(), objectMapper.readValue(entry.getValue(), new TypeReference<List<Map<String, Object>>>(){})); } return result; } catch (IOException e) { throw new RuntimeException(e); } })); }
private void doValidationForTestRunCaseSource(Long topologyId, Long testCaseId, TopologyTestRunCaseSource testRunCaseSource) throws IOException { TopologySource topologySource = getAssociatedTopologySource(topologyId, testCaseId, testRunCaseSource.getSourceId()); Map<String, String> map = objectMapper.readValue(testRunCaseSource.getRecords(), new TypeReference<Map<String, String>>() {}); for (Map.Entry<String, String> entry: map.entrySet()) { List<Map<String, Object>> values = objectMapper.readValue(entry.getValue(), new TypeReference<List<Map<String, Object>>>(){}); values.forEach(v -> convertValueToConformStream(topologySource.getOutputStreams(), entry.getKey(), v)); } }
@Override public int hashCode() { int result = getId() != null ? getId().hashCode() : 0; result = 31 * result + (getTestCaseId() != null ? getTestCaseId().hashCode() : 0); result = 31 * result + (getSourceId() != null ? getSourceId().hashCode() : 0); result = 31 * result + (getVersionId() != null ? getVersionId().hashCode() : 0); result = 31 * result + (getRecords() != null ? getRecords().hashCode() : 0); result = 31 * result + (getOccurrence() != null ? getOccurrence().hashCode() : 0); result = 31 * result + (getSleepMsPerIteration() != null ? getSleepMsPerIteration().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 TopologyTestRunCaseSource)) return false; TopologyTestRunCaseSource that = (TopologyTestRunCaseSource) 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 (getSourceId() != null ? !getSourceId().equals(that.getSourceId()) : that.getSourceId() != 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; if (getOccurrence() != null ? !getOccurrence().equals(that.getOccurrence()) : that.getOccurrence() != null) return false; if (getSleepMsPerIteration() != null ? !getSleepMsPerIteration().equals(that.getSleepMsPerIteration()) : that.getSleepMsPerIteration() != null) return false; return getTimestamp() != null ? getTimestamp().equals(that.getTimestamp()) : that.getTimestamp() == null; }
public TopologyTestRunCaseSource(TopologyTestRunCaseSource other) { if (other != null) { setId(other.getId()); setTestCaseId(other.getTestCaseId()); setSourceId(other.getSourceId()); setVersionId(other.getVersionId()); setRecords(other.getRecords()); setOccurrence(other.getOccurrence()); setSleepMsPerIteration(other.getSleepMsPerIteration()); setTimestamp(other.getTimestamp()); } }