public static void main(String[] args) { if (2 != args.length) { printUsage(); return; } File sourceFolder = new File(args[0]); checkArgument(sourceFolder.exists(), "%s: does not exist.", sourceFolder); checkArgument(sourceFolder.isDirectory(), "%s: is not a directory.", sourceFolder); System.setProperty("java.class.path", System.getProperty("java.class.path") + File.pathSeparatorChar + args[1]); String[] paths = args[1].split(Character .toString(File.pathSeparatorChar)); URL[] classpath = IfMetric.createUrls(paths); new IfMetric(new NopolContext(new File[]{ sourceFolder }, classpath, null)).run(); }
public static void main(String[] args) { File sourceFile = FileLibrary.openFrom(args[0]); URL[] classpath = JavaLibrary.classpathFrom(args[1]); new InfinitelDiagnostician(new NopolContext(new File[]{sourceFile}, classpath, null)).diagnose(); System.out.println("Diagnostics ended"); }
public static void run(File[] sourceFile, URL[] classpath) { Infinitel infiniteLoopFixer = new Infinitel(new NopolContext(sourceFile, classpath, null)); try { infiniteLoopFixer.repair(); } catch (Exception e) { e.printStackTrace(); logError(infiniteLoopFixer.logger(), "Repair failed"); } }
private NopolContext fakeContext() { NopolContext nopolContext = new NopolContext(); // nopolContext.setCollectOnlyUsedMethod(ConfigurationProperties.getPropertyBool("collectonlyusedmethod")); nopolContext.setCollectOnlyUsedMethod(false); nopolContext.setDataCollectionTimeoutInSecondForSynthesis(5); nopolContext.setOnlyOneSynthesisResult(false); return nopolContext; }
public DynamothCollector createCollector(ProjectRepairFacade facade, ModificationPoint mp, Map<String, Object[]> oracle, String[] testClasses) { SuspiciousModificationPoint smp = (SuspiciousModificationPoint) mp; String classPath = facade.getOutDirWithPrefix(ProgramVariant.DEFAULT_ORIGINAL_VARIANT) + File.pathSeparator + facade.getProperties().getDependenciesString(); URL[] urls = (FinderTestCases.classpathFrom(classPath)); File[] sources = new File[facade.getProperties().getOriginalDirSrc().size()]; int i = 0; for (String s : facade.getProperties().getOriginalDirSrc()) { sources[i++] = new File(s); } log.info("Astor-Dynamoth config: "); NopolContext nopolContext = new NopolContext(sources, urls, testClasses); nopolContext.setCollectOnlyUsedMethod(ConfigurationProperties.getPropertyBool("collectonlyusedmethod")); nopolContext.setDataCollectionTimeoutInSecondForSynthesis(5); nopolContext.setOnlyOneSynthesisResult(false); log.info("-sources: " + Arrays.toString(sources)); log.info("-url: " + Arrays.toString(urls)); log.info("-testClasses: " + Arrays.toString(testClasses)); DynamothCollector dynamothCodeGenesis = new DynamothCollector(oracle, smp, sources, urls, testClasses, nopolContext); dynamothCodeGenesis.run(TimeUnit.MINUTES.toMillis(15)); return dynamothCodeGenesis; }
logger.debug("testClasses = "+testClasses); NopolContext nopolContext = new NopolContext(sourceFiles, classPath, testClasses); nopolContext.setMaxTimeInMinutes(maxTime); nopolContext.setType(nopolType);
private NopolContext createNopolContext(List<String> failingTestCases, List<URL> dependencies, List<File> sourceFolders) { NopolContext nopolContext = new NopolContext(sourceFolders.toArray(new File[0]), dependencies.toArray(new URL[0]), failingTestCases.toArray(new String[0]), Collections.<String>emptyList()); nopolContext.setComplianceLevel(getComplianceLevel()); nopolContext.setTimeoutTestExecution(300); nopolContext.setMaxTimeEachTypeOfFixInMinutes(15); nopolContext.setMaxTimeInMinutes(maxTime); nopolContext.setLocalizer(this.resolveLocalizer()); nopolContext.setSynthesis(this.resolveSynthesis()); nopolContext.setType(this.resolveType()); nopolContext.setOnlyOneSynthesisResult(true); nopolContext.setJson(true); if (!outputDirectory.exists()) { outputDirectory.mkdirs(); } nopolContext.setOutputFolder(outputDirectory.getAbsolutePath()); NopolContext.NopolSolver solver = this.resolveSolver(); nopolContext.setSolver(solver); if (nopolContext.getSynthesis() == NopolContext.NopolSynthesis.SMT) { if (solver == NopolContext.NopolSolver.Z3) { String z3Path = this.loadZ3AndGivePath(); SolverFactory.setSolver(solver, z3Path); nopolContext.setSolverPath(z3Path); } else { SolverFactory.setSolver(solver, null); } } return nopolContext; }
+ " (should timeout in " + timeout + " minutes)"); NopolContext nopolContext = new NopolContext(sources, classPath.toArray(new URL[classPath.size()]), testClass.toArray(new String[0]), testsToIgnore); nopolContext.setComplianceLevel(8); nopolContext.setTimeoutTestExecution(300);
this.nopolContext = new NopolContext(sourceFiles, classpath, jsapConfig.getStringArray("test"));