From 4c6f0dd669a30baea7ff81daedad48da8dd118c8 Mon Sep 17 00:00:00 2001 From: Henry Coles Date: Tue, 29 Aug 2023 09:03:24 +0100 Subject: [PATCH] add close method to history store --- .../main/java/org/pitest/mutationtest/ClassHistory.java | 9 +++++++++ .../main/java/org/pitest/mutationtest/HistoryStore.java | 1 + .../pitest/mutationtest/incremental/HistoryListener.java | 2 +- .../mutationtest/incremental/NullHistoryStore.java | 5 +++++ .../incremental/ObjectOutputStreamHistoryStore.java | 5 +++++ 5 files changed, 21 insertions(+), 1 deletion(-) diff --git a/pitest-entry/src/main/java/org/pitest/mutationtest/ClassHistory.java b/pitest-entry/src/main/java/org/pitest/mutationtest/ClassHistory.java index 99e612285..c30b632b4 100644 --- a/pitest-entry/src/main/java/org/pitest/mutationtest/ClassHistory.java +++ b/pitest-entry/src/main/java/org/pitest/mutationtest/ClassHistory.java @@ -2,6 +2,7 @@ import java.io.Serializable; import java.util.Objects; +import java.util.StringJoiner; import org.pitest.classinfo.ClassName; import org.pitest.classinfo.HierarchicalClassId; @@ -47,4 +48,12 @@ public boolean equals(final Object obj) { return Objects.equals(id, other.id) && Objects.equals(coverageId, other.coverageId); } + + @Override + public String toString() { + return new StringJoiner(", ", ClassHistory.class.getSimpleName() + "[", "]") + .add("id=" + id) + .add("coverageId='" + coverageId + "'") + .toString(); + } } \ No newline at end of file diff --git a/pitest-entry/src/main/java/org/pitest/mutationtest/HistoryStore.java b/pitest-entry/src/main/java/org/pitest/mutationtest/HistoryStore.java index 0f2c0605c..8d20e4cac 100644 --- a/pitest-entry/src/main/java/org/pitest/mutationtest/HistoryStore.java +++ b/pitest-entry/src/main/java/org/pitest/mutationtest/HistoryStore.java @@ -20,4 +20,5 @@ public interface HistoryStore { Map getHistoricClassPath(); + void close(); } diff --git a/pitest-entry/src/main/java/org/pitest/mutationtest/incremental/HistoryListener.java b/pitest-entry/src/main/java/org/pitest/mutationtest/incremental/HistoryListener.java index c14790658..4a8f68f42 100644 --- a/pitest-entry/src/main/java/org/pitest/mutationtest/incremental/HistoryListener.java +++ b/pitest-entry/src/main/java/org/pitest/mutationtest/incremental/HistoryListener.java @@ -28,7 +28,7 @@ public void handleMutationResult(final ClassMutationResults metaData) { @Override public void runEnd() { - + this.historyStore.close(); } } diff --git a/pitest-entry/src/main/java/org/pitest/mutationtest/incremental/NullHistoryStore.java b/pitest-entry/src/main/java/org/pitest/mutationtest/incremental/NullHistoryStore.java index 83b3a265a..28f5c076b 100644 --- a/pitest-entry/src/main/java/org/pitest/mutationtest/incremental/NullHistoryStore.java +++ b/pitest-entry/src/main/java/org/pitest/mutationtest/incremental/NullHistoryStore.java @@ -35,6 +35,11 @@ public Map getHistoricClassPath() { return Collections.emptyMap(); } + @Override + public void close() { + + } + @Override public void recordClassPath(final Collection ids, final CoverageDatabase coverageInfo) { diff --git a/pitest-entry/src/main/java/org/pitest/mutationtest/incremental/ObjectOutputStreamHistoryStore.java b/pitest-entry/src/main/java/org/pitest/mutationtest/incremental/ObjectOutputStreamHistoryStore.java index ff6a05b52..d0c9d9c8e 100644 --- a/pitest-entry/src/main/java/org/pitest/mutationtest/incremental/ObjectOutputStreamHistoryStore.java +++ b/pitest-entry/src/main/java/org/pitest/mutationtest/incremental/ObjectOutputStreamHistoryStore.java @@ -78,6 +78,11 @@ public Map getHistoricClassPath() { return this.previousClassPath; } + @Override + public void close() { + + } + @Override public void initialize() { if (this.input != null) {