diff --git a/src/main/java/eu/stamp_project/testrunner/EntryPoint.java b/src/main/java/eu/stamp_project/testrunner/EntryPoint.java index 5ed54042..7498eadf 100644 --- a/src/main/java/eu/stamp_project/testrunner/EntryPoint.java +++ b/src/main/java/eu/stamp_project/testrunner/EntryPoint.java @@ -1,7 +1,10 @@ package eu.stamp_project.testrunner; import eu.stamp_project.mutationtest.descartes.DescartesMutationEngine; -import eu.stamp_project.testrunner.listener.*; +import eu.stamp_project.testrunner.listener.Coverage; +import eu.stamp_project.testrunner.listener.CoveragePerTestMethod; +import eu.stamp_project.testrunner.listener.CoveredTestResultPerTestMethod; +import eu.stamp_project.testrunner.listener.TestResult; import eu.stamp_project.testrunner.listener.impl.CoverageImpl; import eu.stamp_project.testrunner.listener.impl.CoveragePerTestMethodImpl; import eu.stamp_project.testrunner.listener.impl.CoveredTestResultPerTestMethodImpl; @@ -33,7 +36,8 @@ import java.lang.reflect.Method; import java.net.URL; import java.util.*; -import java.util.concurrent.*; +import java.util.concurrent.TimeUnit; +import java.util.concurrent.TimeoutException; import java.util.function.Function; import java.util.stream.Collectors; import java.util.stream.Stream; diff --git a/src/main/java/eu/stamp_project/testrunner/listener/Coverage.java b/src/main/java/eu/stamp_project/testrunner/listener/Coverage.java index 1ae1b3d3..ee0b3284 100644 --- a/src/main/java/eu/stamp_project/testrunner/listener/Coverage.java +++ b/src/main/java/eu/stamp_project/testrunner/listener/Coverage.java @@ -9,12 +9,10 @@ */ public interface Coverage { - public static final String SERIALIZE_NAME = "Coverage"; + public static final String SHARED_MEMORY_FILE = "Coverage.dat"; public static final String OUTPUT_DIR = "target" + ConstantsHelper.FILE_SEPARATOR; - public static final String EXTENSION = ".ser"; - public void setExecutionPath(String executionPath); public int getInstructionsCovered(); diff --git a/src/main/java/eu/stamp_project/testrunner/listener/CoveragePerTestMethod.java b/src/main/java/eu/stamp_project/testrunner/listener/CoveragePerTestMethod.java index 43d83f82..2398415a 100644 --- a/src/main/java/eu/stamp_project/testrunner/listener/CoveragePerTestMethod.java +++ b/src/main/java/eu/stamp_project/testrunner/listener/CoveragePerTestMethod.java @@ -12,12 +12,10 @@ */ public interface CoveragePerTestMethod extends Serializable { - public static final String SERIALIZE_NAME = "CoveragePerTest"; + public static final String SHARED_MEMORY_FILE = "CoveragePerTestMethod.dat"; public static final String OUTPUT_DIR = "target" + ConstantsHelper.FILE_SEPARATOR; - public static final String EXTENSION = ".ser"; - public Map getCoverageResultsMap(); public Coverage getCoverageOf(String testMethodName); diff --git a/src/main/java/eu/stamp_project/testrunner/listener/CoveredTestResultPerTestMethod.java b/src/main/java/eu/stamp_project/testrunner/listener/CoveredTestResultPerTestMethod.java index 2eadc65b..c0f1853a 100644 --- a/src/main/java/eu/stamp_project/testrunner/listener/CoveredTestResultPerTestMethod.java +++ b/src/main/java/eu/stamp_project/testrunner/listener/CoveredTestResultPerTestMethod.java @@ -13,12 +13,10 @@ */ public interface CoveredTestResultPerTestMethod extends TestResult, Serializable { - public static final String SERIALIZE_NAME = "CoveredTestResultPerTest"; + public static final String SHARED_MEMORY_FILE = "CoveredTestResultPerTest.dat"; public static final String OUTPUT_DIR = "target" + ConstantsHelper.FILE_SEPARATOR; - public static final String EXTENSION = ".ser"; - public Map getCoverageResultsMap(); public Coverage getCoverageOf(String testMethodName); diff --git a/src/main/java/eu/stamp_project/testrunner/listener/TestResult.java b/src/main/java/eu/stamp_project/testrunner/listener/TestResult.java index bf463ba9..2bb392d9 100644 --- a/src/main/java/eu/stamp_project/testrunner/listener/TestResult.java +++ b/src/main/java/eu/stamp_project/testrunner/listener/TestResult.java @@ -12,12 +12,10 @@ */ public interface TestResult extends Serializable { - public static final String SERIALIZE_NAME = "TestResult"; + public static final String SHARED_MEMORY_FILE = "TestResult.dat"; public static final String OUTPUT_DIR = "target" + ConstantsHelper.FILE_SEPARATOR; - public static final String EXTENSION = ".ser"; - /** * Aggregate result of this instance to the given instance * @param that the other instance of TestResult of which we need to add the values to this instance diff --git a/src/main/java/eu/stamp_project/testrunner/listener/impl/CoverageDetailed.java b/src/main/java/eu/stamp_project/testrunner/listener/impl/CoverageDetailed.java index 16b4826a..97e527db 100644 --- a/src/main/java/eu/stamp_project/testrunner/listener/impl/CoverageDetailed.java +++ b/src/main/java/eu/stamp_project/testrunner/listener/impl/CoverageDetailed.java @@ -1,12 +1,10 @@ package eu.stamp_project.testrunner.listener.impl; +import eu.stamp_project.testrunner.listener.Coverage; +import eu.stamp_project.testrunner.listener.utils.ListenerUtils; + import java.io.File; -import java.io.FileOutputStream; -import java.io.ObjectOutputStream; import java.io.Serializable; -import eu.stamp_project.testrunner.listener.Coverage; -import eu.stamp_project.testrunner.listener.TestResult; -import eu.stamp_project.testrunner.runner.Loader; /** * created by Benjamin DANGLOT benjamin.danglot@inria.fr on 14/11/18 @@ -54,33 +52,16 @@ public String toString() { @Override public void save() { - File outputDir = new File(TestResult.OUTPUT_DIR); - if (!outputDir.exists()) { - if (!outputDir.mkdirs()) { - System.err.println("Error while creating output dir"); - } - } - File f = new File(outputDir, SERIALIZE_NAME + EXTENSION); - try (FileOutputStream fout = new FileOutputStream(f)) { - try (ObjectOutputStream oos = new ObjectOutputStream(fout)) { - oos.writeObject(this); - } catch (Exception e) { - throw new RuntimeException(e); - } - } catch (Exception e) { - System.err.println("Error while writing serialized file."); - throw new RuntimeException(e); - } - System.out.println("File saved to the following path: " + f.getAbsolutePath()); + ListenerUtils.saveToMemoryMappedFile(new File(OUTPUT_DIR, SHARED_MEMORY_FILE), this); } /** - * Load from serialized object + * Loads and deserializes the file from a memory mapped file * - * @return an Instance of JUnit4Coverage loaded from a serialized file. + * @return loaded CoverageDetailed from the memory mapped file */ public static Coverage load() { - return new Loader().load(SERIALIZE_NAME); + return ListenerUtils.loadFromMemoryMappedFile(ListenerUtils.computeTargetFilePath(OUTPUT_DIR, SHARED_MEMORY_FILE)); } @Override diff --git a/src/main/java/eu/stamp_project/testrunner/listener/impl/CoverageImpl.java b/src/main/java/eu/stamp_project/testrunner/listener/impl/CoverageImpl.java index 7a85b150..4d59dd36 100644 --- a/src/main/java/eu/stamp_project/testrunner/listener/impl/CoverageImpl.java +++ b/src/main/java/eu/stamp_project/testrunner/listener/impl/CoverageImpl.java @@ -1,10 +1,13 @@ package eu.stamp_project.testrunner.listener.impl; import eu.stamp_project.testrunner.listener.Coverage; -import eu.stamp_project.testrunner.listener.TestResult; -import eu.stamp_project.testrunner.runner.Loader; -import org.jacoco.core.analysis.*; -import java.io.*; +import eu.stamp_project.testrunner.listener.utils.ListenerUtils; +import org.jacoco.core.analysis.IClassCoverage; +import org.jacoco.core.analysis.ICounter; +import org.jacoco.core.analysis.ILine; + +import java.io.File; +import java.io.Serializable; import java.util.List; import java.util.function.Function; import java.util.stream.Collectors; @@ -89,35 +92,22 @@ public String toString() { return this.instructionsCovered + " / " + this.instructionsTotal; } + /** + * Writes the serialized object to a memory mapped file. + * The location depends on the workspace set for the test runner process. + */ @Override public void save() { - File outputDir = new File(TestResult.OUTPUT_DIR); - if (!outputDir.exists()) { - if (!outputDir.mkdirs()) { - System.err.println("Error while creating output dir"); - } - } - File f = new File(outputDir, SERIALIZE_NAME + EXTENSION); - try (FileOutputStream fout = new FileOutputStream(f)) { - try (ObjectOutputStream oos = new ObjectOutputStream(fout)) { - oos.writeObject(this); - } catch (Exception e) { - throw new RuntimeException(e); - } - } catch (Exception e) { - System.err.println("Error while writing serialized file."); - throw new RuntimeException(e); - } - System.out.println("File saved to the following path: " + f.getAbsolutePath()); + ListenerUtils.saveToMemoryMappedFile(new File(OUTPUT_DIR, SHARED_MEMORY_FILE), this); } /** - * Load from serialized object + * Loads and deserializes the file from a memory mapped file * - * @return an Instance of JUnit4Coverage loaded from a serialized file. + * @return loaded Coverage from the memory mapped file */ public static Coverage load() { - return new Loader().load(SERIALIZE_NAME); + return ListenerUtils.loadFromMemoryMappedFile(ListenerUtils.computeTargetFilePath(OUTPUT_DIR, SHARED_MEMORY_FILE)); } } diff --git a/src/main/java/eu/stamp_project/testrunner/listener/impl/CoveragePerTestMethodImpl.java b/src/main/java/eu/stamp_project/testrunner/listener/impl/CoveragePerTestMethodImpl.java index c1eda232..1b7e049c 100644 --- a/src/main/java/eu/stamp_project/testrunner/listener/impl/CoveragePerTestMethodImpl.java +++ b/src/main/java/eu/stamp_project/testrunner/listener/impl/CoveragePerTestMethodImpl.java @@ -3,16 +3,13 @@ import eu.stamp_project.testrunner.listener.Coverage; import eu.stamp_project.testrunner.listener.CoveragePerTestMethod; import eu.stamp_project.testrunner.listener.CoverageTransformer; -import eu.stamp_project.testrunner.listener.TestResult; -import eu.stamp_project.testrunner.runner.Loader; +import eu.stamp_project.testrunner.listener.utils.ListenerUtils; import eu.stamp_project.testrunner.utils.ConstantsHelper; import org.jacoco.core.data.ExecutionDataStore; import org.jacoco.core.data.SessionInfoStore; import org.jacoco.core.runtime.RuntimeData; import java.io.File; -import java.io.FileOutputStream; -import java.io.ObjectOutputStream; import java.util.HashMap; import java.util.List; import java.util.Map; @@ -109,35 +106,22 @@ public Coverage getCoverageOf(String testMethodName) { return this.getCoverageResultsMap().get(testMethodName); } + /** + * Writes the serialized object to a memory mapped file. + * The location depends on the workspace set for the test runner process. + */ @Override public void save() { - File outputDir = new File(TestResult.OUTPUT_DIR); - if (!outputDir.exists()) { - if (!outputDir.mkdirs()) { - System.err.println("Error while creating output dir"); - } - } - File f = new File(outputDir, SERIALIZE_NAME + EXTENSION); - try (FileOutputStream fout = new FileOutputStream(f)) { - try (ObjectOutputStream oos = new ObjectOutputStream(fout)) { - oos.writeObject(this); - } catch (Exception e) { - throw new RuntimeException(e); - } - } catch (Exception e) { - System.err.println("Error while writing serialized file."); - throw new RuntimeException(e); - } - System.out.println("File saved to the following path: " + f.getAbsolutePath()); + ListenerUtils.saveToMemoryMappedFile(new File(OUTPUT_DIR, SHARED_MEMORY_FILE), this); } /** - * Load from serialized object + * Loads and deserializes the file from a memory mapped file * - * @return an Instance of CoveragePerTestMethod loaded from a serialized file. + * @return loaded CoveragePerTestMethodImpl from the memory mapped file */ public static CoveragePerTestMethodImpl load() { - return new Loader().load(SERIALIZE_NAME); + return ListenerUtils.loadFromMemoryMappedFile(ListenerUtils.computeTargetFilePath(OUTPUT_DIR, SHARED_MEMORY_FILE)); } @Override diff --git a/src/main/java/eu/stamp_project/testrunner/listener/impl/CoveredTestResultPerTestMethodImpl.java b/src/main/java/eu/stamp_project/testrunner/listener/impl/CoveredTestResultPerTestMethodImpl.java index 5f117d4f..7723c371 100644 --- a/src/main/java/eu/stamp_project/testrunner/listener/impl/CoveredTestResultPerTestMethodImpl.java +++ b/src/main/java/eu/stamp_project/testrunner/listener/impl/CoveredTestResultPerTestMethodImpl.java @@ -4,16 +4,14 @@ import eu.stamp_project.testrunner.listener.CoverageTransformer; import eu.stamp_project.testrunner.listener.CoveredTestResultPerTestMethod; import eu.stamp_project.testrunner.listener.TestResult; +import eu.stamp_project.testrunner.listener.utils.ListenerUtils; import eu.stamp_project.testrunner.runner.Failure; -import eu.stamp_project.testrunner.runner.Loader; import eu.stamp_project.testrunner.utils.ConstantsHelper; import org.jacoco.core.data.ExecutionDataStore; import org.jacoco.core.data.SessionInfoStore; import org.jacoco.core.runtime.RuntimeData; import java.io.File; -import java.io.FileOutputStream; -import java.io.ObjectOutputStream; import java.util.*; import java.util.concurrent.ConcurrentHashMap; import java.util.stream.Collectors; @@ -165,35 +163,22 @@ public Failure getFailureOf(String testMethodName) { .orElseThrow(() -> new IllegalArgumentException(String.format("Could not find %s in failing test", testMethodName))); } + /** + * Writes the serialized object to a memory mapped file. + * The location depends on the workspace set for the test runner process. + */ @Override public void save() { - File outputDir = new File(TestResult.OUTPUT_DIR); - if (!outputDir.exists()) { - if (!outputDir.mkdirs()) { - System.err.println("Error while creating output dir"); - } - } - File f = new File(outputDir, SERIALIZE_NAME + EXTENSION); - try (FileOutputStream fout = new FileOutputStream(f)) { - try (ObjectOutputStream oos = new ObjectOutputStream(fout)) { - oos.writeObject(this); - } catch (Exception e) { - throw new RuntimeException(e); - } - } catch (Exception e) { - System.err.println("Error while writing serialized file."); - throw new RuntimeException(e); - } - System.out.println("File saved to the following path: " + f.getAbsolutePath()); + ListenerUtils.saveToMemoryMappedFile(new File(OUTPUT_DIR, SHARED_MEMORY_FILE), this); } /** - * Load from serialized object + * Loads and deserializes the file from a memory mapped file * - * @return an Instance of CoveragePerTestMethod loaded from a serialized file. + * @return loaded CoveredTestResultPerTestMethodImpl from the memory mapped file */ public static CoveredTestResultPerTestMethodImpl load() { - return new Loader().load(SERIALIZE_NAME); + return ListenerUtils.loadFromMemoryMappedFile(ListenerUtils.computeTargetFilePath(OUTPUT_DIR, SHARED_MEMORY_FILE)); } @Override diff --git a/src/main/java/eu/stamp_project/testrunner/listener/impl/TestResultImpl.java b/src/main/java/eu/stamp_project/testrunner/listener/impl/TestResultImpl.java index e67a996f..6a9f50ea 100644 --- a/src/main/java/eu/stamp_project/testrunner/listener/impl/TestResultImpl.java +++ b/src/main/java/eu/stamp_project/testrunner/listener/impl/TestResultImpl.java @@ -1,16 +1,12 @@ package eu.stamp_project.testrunner.listener.impl; import eu.stamp_project.testrunner.listener.TestResult; +import eu.stamp_project.testrunner.listener.utils.ListenerUtils; import eu.stamp_project.testrunner.runner.Failure; -import eu.stamp_project.testrunner.runner.Loader; import java.io.File; -import java.io.FileOutputStream; -import java.io.ObjectOutputStream; import java.io.Serializable; -import java.util.ArrayList; import java.util.HashSet; -import java.util.List; import java.util.Set; import java.util.stream.Collectors; @@ -83,30 +79,22 @@ public Failure getFailureOf(String testMethodName) { .orElseThrow(() -> new IllegalArgumentException(String.format("Could not find %s in failing test", testMethodName))); } + /** + * Writes the serialized object to a memory mapped file. + * The location depends on the workspace set for the test runner process. + */ @Override public synchronized void save() { - File outputDir = new File(OUTPUT_DIR); - if (!outputDir.exists()) { - if (!outputDir.mkdirs()) { - System.err.println("Error while creating output dir"); - } - } - File f = new File(outputDir, SERIALIZE_NAME + EXTENSION); - try (FileOutputStream fout = new FileOutputStream(f)) { - try (ObjectOutputStream oos = new ObjectOutputStream(fout)) { - oos.writeObject(this); - } catch (Exception e) { - throw new RuntimeException(e); - } - } catch (Exception e) { - System.err.println("Error while writing serialized file."); - throw new RuntimeException(e); - } - System.out.println("File saved to the following path: " + f.getAbsolutePath()); + ListenerUtils.saveToMemoryMappedFile(new File(OUTPUT_DIR, SHARED_MEMORY_FILE), this); } + /** + * Loads and deserializes the file from a memory mapped file + * + * @return loaded TestResult from the memory mapped file + */ public static TestResult load() { - return new Loader().load(SERIALIZE_NAME); + return ListenerUtils.loadFromMemoryMappedFile(ListenerUtils.computeTargetFilePath(OUTPUT_DIR, SHARED_MEMORY_FILE)); } public String toString() { diff --git a/src/main/java/eu/stamp_project/testrunner/listener/utils/ListenerUtils.java b/src/main/java/eu/stamp_project/testrunner/listener/utils/ListenerUtils.java index ce9002fd..7f2ff582 100644 --- a/src/main/java/eu/stamp_project/testrunner/listener/utils/ListenerUtils.java +++ b/src/main/java/eu/stamp_project/testrunner/listener/utils/ListenerUtils.java @@ -1,8 +1,15 @@ package eu.stamp_project.testrunner.listener.utils; +import eu.stamp_project.testrunner.EntryPoint; +import eu.stamp_project.testrunner.listener.CoveredTestResultPerTestMethod; import org.jacoco.core.data.ExecutionData; import org.jacoco.core.data.ExecutionDataStore; +import java.io.*; +import java.nio.MappedByteBuffer; +import java.nio.channels.FileChannel; +import java.nio.file.StandardOpenOption; + public class ListenerUtils { /** @@ -21,4 +28,65 @@ public static ExecutionDataStore cloneExecutionDataStore(ExecutionDataStore orig return cloned; } + public static void saveToMemoryMappedFile(File file, Object object) { + try { + // Serialize the object + ByteArrayOutputStream bos = new ByteArrayOutputStream(); + ObjectOutputStream out = new ObjectOutputStream(bos); + out.writeObject(object); + out.flush(); + byte[] bytes = bos.toByteArray(); + + // Create output dir if it does not exist + File outputDir = new File(CoveredTestResultPerTestMethod.OUTPUT_DIR); + if (!outputDir.exists()) { + if (!outputDir.mkdirs()) { + System.err.println("Error while creating output dir"); + } + } + + // Write to shared memory file + FileChannel channel = FileChannel.open(file.toPath(), + StandardOpenOption.CREATE, StandardOpenOption.READ, StandardOpenOption.WRITE); + MappedByteBuffer buffer = channel.map(FileChannel.MapMode.READ_WRITE, 0, bytes.length); + buffer.put(bytes); + + out.close(); + channel.close(); + System.out.println("File saved to the following path: " + file.getAbsolutePath()); + } catch (Exception e) { + System.err.println("Error while writing memory-mapped serialized file."); + throw new RuntimeException(e); + } + } + + public static T loadFromMemoryMappedFile(File file) { + try { + // Access the shared memory file + FileChannel channel = FileChannel.open(file.toPath(), StandardOpenOption.READ); + MappedByteBuffer mappedByteBuffer = channel.map(FileChannel.MapMode.READ_ONLY, 0, channel.size()); + + // Get content + byte[] buffer = new byte[(int) channel.size()]; + mappedByteBuffer.get(buffer); + + // Read and deserialize the file + ObjectInputStream is = new ObjectInputStream(new ByteArrayInputStream(buffer)); + final T load = (T) is.readObject(); + + is.close(); + channel.close(); + file.delete(); + return load; + } catch (IOException | ClassNotFoundException e) { + throw new RuntimeException(e); + } + } + + public static File computeTargetFilePath(String outputDir, String outputFile) { + return new File( + new File(EntryPoint.workingDirectory != null && EntryPoint.workingDirectory.exists() ? EntryPoint.workingDirectory.getAbsolutePath() : "./", + outputDir).getAbsolutePath(), + outputFile); + } } \ No newline at end of file diff --git a/src/main/java/eu/stamp_project/testrunner/reader/TestResultReader.java b/src/main/java/eu/stamp_project/testrunner/reader/TestResultReader.java deleted file mode 100644 index 2408bdcd..00000000 --- a/src/main/java/eu/stamp_project/testrunner/reader/TestResultReader.java +++ /dev/null @@ -1,56 +0,0 @@ -package eu.stamp_project.testrunner.reader; - -import eu.stamp_project.testrunner.listener.junit4.JUnit4TestResult; -import eu.stamp_project.testrunner.runner.Failure; -import eu.stamp_project.testrunner.runner.Loader; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -import java.io.File; - -/** - * created by Benjamin DANGLOT - * benjamin.danglot@inria.fr - * on 11/09/18 - */ -public class TestResultReader { - - private static final Logger LOGGER = LoggerFactory.getLogger(TestResultReader.class); - - /** - * @param args should contain only on argument: the path to the testResult.ser to be read - */ - public static void main(String[] args) { - if (!new File("target/dspot/JUnit4TestResult.ser").exists()) { - usage(); - } - boolean verbose = false; - if (args.length >= 1 && "--verbose".equals(args[1])) { - verbose = true; - } - JUnit4TestResult JUnit4TestResult = new Loader().load("JUnit4TestResult"); - LOGGER.info("Test that has been run:"); - JUnit4TestResult.getRunningTests().forEach(running -> LOGGER.info("\t{}", running)); - LOGGER.info("Passing tests:"); - JUnit4TestResult.getPassingTests().forEach(passing -> LOGGER.info("\t{}", passing)); - LOGGER.info("Failing tests:"); - if (verbose) { - JUnit4TestResult.getFailingTests().stream() - .map(failure -> failure.toString() + ":" + failure.stackTrace) - .forEach(failure -> LOGGER.info("\t{}", failure)); - } else { - JUnit4TestResult.getFailingTests().stream().map(Failure::toString).forEach(failure -> LOGGER.info("\t{}", failure)); - } - LOGGER.info("Assumption failing tests:"); - JUnit4TestResult.getAssumptionFailingTests().stream().map(Failure::toString).forEach(assumptionFailure -> LOGGER.info("\t{}", assumptionFailure)); - LOGGER.info("Ignored tests:"); - JUnit4TestResult.getIgnoredTests().forEach(ignored -> LOGGER.info("\t{}", ignored)); - } - - private static void usage() { - LOGGER.error("Usage: java -cp test-runner--jar-with-dependencies.jar eu.stamp_project.testrunner.reader.TestResultReader"); - LOGGER.error("The target/dspot/JUnit4TestResult.ser must exist and created by the EntryPoint"); - System.exit(1); - } - -} diff --git a/src/main/java/eu/stamp_project/testrunner/runner/Loader.java b/src/main/java/eu/stamp_project/testrunner/runner/Loader.java deleted file mode 100644 index 91af153e..00000000 --- a/src/main/java/eu/stamp_project/testrunner/runner/Loader.java +++ /dev/null @@ -1,42 +0,0 @@ -package eu.stamp_project.testrunner.runner; - -import eu.stamp_project.testrunner.EntryPoint; -import eu.stamp_project.testrunner.listener.impl.TestResultImpl; -import eu.stamp_project.testrunner.utils.ConstantsHelper; - -import java.io.File; -import java.io.FileInputStream; -import java.io.FileNotFoundException; -import java.io.ObjectInputStream; - -/** - * Created by Benjamin DANGLOT - * benjamin.danglot@inria.fr - * on 21/12/17 - */ -public class Loader { - - public T load(String name) { - T object; - String outputDirectoryPath = EntryPoint.workingDirectory != null ? - EntryPoint.workingDirectory.getAbsolutePath() + ConstantsHelper.FILE_SEPARATOR : ""; - File f = new File(outputDirectoryPath + TestResultImpl.OUTPUT_DIR + name + TestResultImpl.EXTENSION); - if (!f.exists()) { - throw new RuntimeException(new FileNotFoundException(f.getAbsolutePath() + " does not exist.")); - } else { - System.out.println("Loading " + f.getAbsolutePath()); - } - try (FileInputStream fin = new FileInputStream(f);) { - try (ObjectInputStream ois = new ObjectInputStream(fin)) { - object = (T) ois.readObject(); - } catch (Exception ex) { - throw new RuntimeException(ex); - } - } catch (Exception ex) { - throw new RuntimeException(ex); - } - f.delete(); - return object; - } - -} diff --git a/src/main/resources/runner-classes/eu/stamp_project/testrunner/listener/Coverage.class b/src/main/resources/runner-classes/eu/stamp_project/testrunner/listener/Coverage.class index e1fa36be..f8a453d7 100644 Binary files a/src/main/resources/runner-classes/eu/stamp_project/testrunner/listener/Coverage.class and b/src/main/resources/runner-classes/eu/stamp_project/testrunner/listener/Coverage.class differ diff --git a/src/main/resources/runner-classes/eu/stamp_project/testrunner/listener/CoveragePerTestMethod.class b/src/main/resources/runner-classes/eu/stamp_project/testrunner/listener/CoveragePerTestMethod.class index 58952322..47850a0e 100644 Binary files a/src/main/resources/runner-classes/eu/stamp_project/testrunner/listener/CoveragePerTestMethod.class and b/src/main/resources/runner-classes/eu/stamp_project/testrunner/listener/CoveragePerTestMethod.class differ diff --git a/src/main/resources/runner-classes/eu/stamp_project/testrunner/listener/TestResult.class b/src/main/resources/runner-classes/eu/stamp_project/testrunner/listener/TestResult.class index 4013a34f..d63c5e8e 100644 Binary files a/src/main/resources/runner-classes/eu/stamp_project/testrunner/listener/TestResult.class and b/src/main/resources/runner-classes/eu/stamp_project/testrunner/listener/TestResult.class differ diff --git a/src/main/resources/runner-classes/eu/stamp_project/testrunner/listener/impl/CoverageImpl.class b/src/main/resources/runner-classes/eu/stamp_project/testrunner/listener/impl/CoverageImpl.class index 02a4c0fb..5a5a4fd9 100644 Binary files a/src/main/resources/runner-classes/eu/stamp_project/testrunner/listener/impl/CoverageImpl.class and b/src/main/resources/runner-classes/eu/stamp_project/testrunner/listener/impl/CoverageImpl.class differ diff --git a/src/main/resources/runner-classes/eu/stamp_project/testrunner/listener/impl/CoveragePerTestMethodImpl.class b/src/main/resources/runner-classes/eu/stamp_project/testrunner/listener/impl/CoveragePerTestMethodImpl.class index a5d755c7..70c9890f 100644 Binary files a/src/main/resources/runner-classes/eu/stamp_project/testrunner/listener/impl/CoveragePerTestMethodImpl.class and b/src/main/resources/runner-classes/eu/stamp_project/testrunner/listener/impl/CoveragePerTestMethodImpl.class differ diff --git a/src/main/resources/runner-classes/eu/stamp_project/testrunner/listener/impl/TestResultImpl.class b/src/main/resources/runner-classes/eu/stamp_project/testrunner/listener/impl/TestResultImpl.class index a7dfd0ed..9196bc3d 100644 Binary files a/src/main/resources/runner-classes/eu/stamp_project/testrunner/listener/impl/TestResultImpl.class and b/src/main/resources/runner-classes/eu/stamp_project/testrunner/listener/impl/TestResultImpl.class differ diff --git a/src/main/resources/runner-classes/eu/stamp_project/testrunner/runner/Loader.class b/src/main/resources/runner-classes/eu/stamp_project/testrunner/runner/Loader.class deleted file mode 100644 index fb8a6bfd..00000000 Binary files a/src/main/resources/runner-classes/eu/stamp_project/testrunner/runner/Loader.class and /dev/null differ