Search in sources :

Example 1 with DebuggingObjectOutputStream

use of org.evosuite.utils.DebuggingObjectOutputStream in project evosuite by EvoSuite.

the class TestSuiteSerialization method saveTests.

public static boolean saveTests(TestSuiteChromosome ts, File target) throws IllegalArgumentException {
    File parent = target.getParentFile();
    if (!parent.exists()) {
        parent.mkdirs();
    }
    try (ObjectOutputStream out = new DebuggingObjectOutputStream(new FileOutputStream(target))) {
        for (TestChromosome tc : ts.getTestChromosomes()) {
            out.writeObject(tc);
        }
        out.flush();
        out.close();
    } catch (IOException e) {
        logger.error("Failed to open/handle " + target.getAbsolutePath() + " for writing: " + e.getMessage());
        return false;
    }
    return true;
}
Also used : DebuggingObjectOutputStream(org.evosuite.utils.DebuggingObjectOutputStream) DebuggingObjectOutputStream(org.evosuite.utils.DebuggingObjectOutputStream) TestChromosome(org.evosuite.testcase.TestChromosome)

Example 2 with DebuggingObjectOutputStream

use of org.evosuite.utils.DebuggingObjectOutputStream in project evosuite by EvoSuite.

the class TestSuiteSerialization method saveTests.

public static boolean saveTests(List<TestSuiteChromosome> list, File target) throws IllegalArgumentException {
    Inputs.checkNull(list, target);
    File parent = target.getParentFile();
    if (!parent.exists()) {
        parent.mkdirs();
    }
    try (ObjectOutputStream out = new DebuggingObjectOutputStream(new FileOutputStream(target))) {
        for (TestSuiteChromosome ts : list) {
            for (TestChromosome tc : ts.getTestChromosomes()) {
                out.writeObject(tc);
            }
        }
        out.flush();
        out.close();
    } catch (IOException e) {
        logger.error("Failed to open/handle " + target.getAbsolutePath() + " for writing: " + e.getMessage());
        return false;
    }
    return true;
}
Also used : DebuggingObjectOutputStream(org.evosuite.utils.DebuggingObjectOutputStream) DebuggingObjectOutputStream(org.evosuite.utils.DebuggingObjectOutputStream) TestChromosome(org.evosuite.testcase.TestChromosome)

Example 3 with DebuggingObjectOutputStream

use of org.evosuite.utils.DebuggingObjectOutputStream in project evosuite by EvoSuite.

the class ObjectPool method writePool.

public void writePool(String fileName) {
    try {
        ObjectOutputStream out = new DebuggingObjectOutputStream(new FileOutputStream(fileName));
        out.writeObject(this);
        out.close();
    } catch (IOException e) {
        logger.warn("Error while writing pool to file " + fileName + ": " + e);
    }
}
Also used : DebuggingObjectOutputStream(org.evosuite.utils.DebuggingObjectOutputStream) FileOutputStream(java.io.FileOutputStream) IOException(java.io.IOException) DebuggingObjectOutputStream(org.evosuite.utils.DebuggingObjectOutputStream) ObjectOutputStream(java.io.ObjectOutputStream)

Aggregations

DebuggingObjectOutputStream (org.evosuite.utils.DebuggingObjectOutputStream)3 TestChromosome (org.evosuite.testcase.TestChromosome)2 FileOutputStream (java.io.FileOutputStream)1 IOException (java.io.IOException)1 ObjectOutputStream (java.io.ObjectOutputStream)1