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)); } }
public TopologySource addOrUpdateTopologySource(Long topologyId, Long sourceId, TopologySource topologySource) { Long currentTopologyVersionId = getCurrentVersionId(topologyId); topologySource.setId(sourceId); topologySource.setVersionId(currentTopologyVersionId); topologySource.setTopologyId(topologyId); validateTopologySource(topologySource); topologySource.setReconfigure(false); dao.addOrUpdate(topologySource); List<Long> newList = Collections.emptyList(); if (topologySource.getOutputStreamIds() != null) { newList = topologySource.getOutputStreamIds(); } else if (topologySource.getOutputStreams() != null) { newList = updateOutputStreams(topologySource); } List<Long> existing = getOutputStreamIds(topologySource); Sets.SetView<Long> streamIdsToRemove = Sets.difference(ImmutableSet.copyOf(existing), ImmutableSet.copyOf(newList)); Sets.SetView<Long> streamIdsToAdd = Sets.difference(ImmutableSet.copyOf(newList), ImmutableSet.copyOf(existing)); removeSourceStreamMapping(topologySource, Lists.newArrayList(streamIdsToRemove)); addSourceStreamMapping(topologySource, Lists.newArrayList(streamIdsToAdd)); TopologySource updatedSource = getTopologySource(topologyId, sourceId, currentTopologyVersionId); updatedSource.setVersionTimestamp(updateVersionTimestamp(currentTopologyVersionId).getTimestamp()); return updatedSource; }
oldToNewStreamIds, topologySource.getOutputStreams())); topologySource.setOutputStreams(null);