Skip to content

Commit

Permalink
zip only unique concord files
Browse files Browse the repository at this point in the history
  • Loading branch information
brig committed Dec 2, 2024
1 parent 653663f commit 63c0d37
Showing 1 changed file with 8 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@
import java.nio.file.Path;
import java.nio.file.StandardOpenOption;
import java.util.Objects;
import java.util.stream.Collectors;

public class CodeCoverage implements ExecutionListener {

Expand Down Expand Up @@ -150,18 +151,15 @@ private static String flowCallName(Step step, State state, ThreadId threadId) {
}

private void saveFlows(ProcessDefinition processDefinition) {
var fileNames = processDefinition.flows().values().stream()
.map(v -> v.location().fileName())
.filter(Objects::nonNull)
.collect(Collectors.toSet());

persistenceService.persistFile(FLOWS_FILENAME, out -> {
try (ZipArchiveOutputStream zip = new ZipArchiveOutputStream(out)) {

for (var e : processDefinition.flows().entrySet()) {
String flowName = e.getKey();
String fileName = e.getValue().location().fileName();

if (fileName == null) {
log.warn("CodeCoverage: flow '{}' has no associated file name. Skipping...", flowName);
continue;
}

for (var fileName : fileNames) {
Path file = workDir.resolve(fileName);
if (Files.notExists(file)) {
log.warn("CodeCoverage: can't save flow '{}' -> file not exists. This is most likely a bug", fileName);
Expand All @@ -171,7 +169,7 @@ private void saveFlows(ProcessDefinition processDefinition) {
try {
IOUtils.zipFile(zip, file, fileName);
} catch (IOException ex) {
log.error("CodeCoverage: failed to add file '{}' for flow '{}'. Error: {}", fileName, flowName, ex.getMessage());
log.error("CodeCoverage: failed to add file '{}'. Error: {}", fileName, ex.getMessage());
throw ex;
}
}
Expand Down

0 comments on commit 63c0d37

Please sign in to comment.