use of fr.inria.diversify.utils.json.ClassTimeJSON in project dspot by STAMP-project.
the class DSpot method amplifyTest.
public CtType amplifyTest(CtType test, List<CtMethod<?>> methods) {
try {
Counter.reset();
Amplification testAmplification = new Amplification(this.inputConfiguration, this.amplifiers, this.testSelector, this.compiler);
final List<CtMethod<?>> filteredTestCases = this.filterTestCases(methods);
long time = System.currentTimeMillis();
testAmplification.amplification(test, filteredTestCases, numberOfIterations);
final long elapsedTime = System.currentTimeMillis() - time;
LOGGER.info("elapsedTime {}", elapsedTime);
this.projectTimeJSON.add(new ClassTimeJSON(test.getQualifiedName(), elapsedTime));
final CtType clone = test.clone();
test.getPackage().addType(clone);
CtType<?> amplification = AmplificationHelper.createAmplifiedTest(testSelector.getAmplifiedTestCases(), clone, testSelector.getMinimizer());
testSelector.report();
final File outputDirectory = new File(inputConfiguration.getOutputDirectory());
LOGGER.info("Print {} with {} amplified test cases in {}", amplification.getSimpleName(), testSelector.getAmplifiedTestCases().size(), this.inputConfiguration.getOutputDirectory());
DSpotUtils.printAmplifiedTestClass(amplification, outputDirectory);
FileUtils.cleanDirectory(compiler.getSourceOutputDirectory());
try {
String pathToDotClass = compiler.getBinaryOutputDirectory().getAbsolutePath() + "/" + test.getQualifiedName().replaceAll("\\.", "/") + ".class";
FileUtils.forceDelete(new File(pathToDotClass));
} catch (IOException ignored) {
// ignored
}
writeTimeJson();
return amplification;
} catch (IOException | InterruptedException | ClassNotFoundException e) {
throw new RuntimeException(e);
}
}
Aggregations