}
int methodsGenerated = 0;
log.info("Generating test files");
sourceFilesCopier = new SourceFilesCopier(sourceFileProviders);
sourceFilesCopier.setLog(log);
FiniteExecutor executor = new SimpleFiniteExecutor();
if (numThreads != 1) {
int threads = numThreads != 0 ? numThreads : Runtime.getRuntime().availableProcessors();
final ThreadPoolFiniteExecutor threadedExecutor = new ThreadPoolFiniteExecutor(threads);
finalizer = new Runnable() {
@Override public void run() {
threadedExecutor.stop();
}
};
executor = threadedExecutor;
}
for (final MethodReference method : testMethods) {
final ClassHolderSource builderClassSource = classSource;
executor.execute(new Runnable() {
@Override public void run() {
log.debug("Building test for " + method);
try {
decompileClassesForTest(classLoader, new CopyClassHolderSource(builderClassSource), method,
fileNames.get(method));
} catch (IOException e) {
log.error("Error generating JavaScript", e);
}
}
});
++methodsGenerated;
}
executor.complete();
if (sourceFilesCopied) {
sourceFilesCopier.copy(new File(new File(outputDir, "tests"), "src"));
}
log.info("Test files successfully generated for " + methodsGenerated + " method(s).");
} catch (IOException e) {