private NopolContext fakeContext() { NopolContext nopolContext = new NopolContext(); // nopolContext.setCollectOnlyUsedMethod(ConfigurationProperties.getPropertyBool("collectonlyusedmethod")); nopolContext.setCollectOnlyUsedMethod(false); nopolContext.setDataCollectionTimeoutInSecondForSynthesis(5); nopolContext.setOnlyOneSynthesisResult(false); return nopolContext; }
public String[] projectTestClasses() { return nopolContext.getProjectTests(); }
public NopolContext() { this.testMethodsToIgnore = new ArrayList<String>(); this.initFromFile(); }
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 boolean callListener(CtExpression expression) { for (CombineListenerSpoon combineListener : listeners) { if (combineListener.check(expression)) { if (nopolContext.isOnlyOneSynthesisResult()) { stop = true; } return true; } } return false; }
/** uses {@link #createInstance(NopolContext)} */ private GZoltarFaultLocalizer(NopolContext nopolContext) throws IOException { this(nopolContext.getProjectClasspath(), checkNotNull(Arrays.asList("")), nopolContext.getProjectTests(), new Ochiai()); }
private NopolContext.NopolLocalizer resolveLocalizer() { try { return NopolContext.NopolLocalizer.valueOf(localizer.toUpperCase()); } catch (IllegalArgumentException e) { throw new RuntimeException("Localizer value \""+localizer+"\" is wrong. Only following values are accepted: "+StringUtils.join(NopolContext.NopolLocalizer.values(), ",")); } }
private NopolContext.NopolSynthesis resolveSynthesis() { try { return NopolContext.NopolSynthesis.valueOf(synthesis.toUpperCase()); } catch (IllegalArgumentException e) { throw new RuntimeException("Synthesis value \""+synthesis+"\" is wrong. Only following values are accepted: "+StringUtils.join(NopolContext.NopolSynthesis.values(), ",")); } }
private NopolContext.NopolSolver resolveSolver() { try { return NopolContext.NopolSolver.valueOf(solver.toUpperCase()); } catch (IllegalArgumentException e) { throw new RuntimeException("Solver value \""+solver+"\" is wrong. Only following values are accepted: "+StringUtils.join(NopolContext.NopolSolver.values(),", ")); } }
@Override public double getWeight() { if (getValue().isConstant()) { return nopolContext.getConstantWeight() * getPriority(); } return nopolContext.getVariableWeight() * getPriority(); }
public CocoSpoonBasedSpectrumBasedFaultLocalizer(NopolContext nopolContext, Metric metric) { runTests(nopolContext.getProjectTests(), nopolContext, new SpoonedProject(nopolContext.getProjectSources(), nopolContext), new WatcherProcessor()); this.metric = metric; this.statements = new ArrayList<>(); }
@Override public double getWeight() { return nopolContext.getConstantWeight() * getPriority(); }
public void setProjectSources(String projectSources) { this.setProjectSourcePath(new File[] { FileLibrary.openFrom(projectSources) }); }
@Override public double getWeight() { return nopolContext.getVariableWeight() * getPriority(); }
@Override public double getWeight() { return nopolContext.getMethodCallWeight() * getPriority() * getTarget().getWeight() / (getParameters().size() == 0 ? 1 : getParameters().size()); }
private boolean callListener(Expression expression) { for (CombineListener combineListener : listeners) { if (combineListener.check(expression)) { if (nopolContext.isOnlyOneSynthesisResult()) { stop = true; } return true; } } return false; }
public Ranking(NopolContext nopolContext) { this.classpath = nopolContext.getProjectClasspath(); this.testClasses = nopolContext.getProjectTests(); // get all test classes of the current project if (this.testClasses.length == 0) { this.testClasses = new TestClassesFinder().findIn(classpath, false); } // init gzoltar gZoltar = GZoltarFaultLocalizer.createInstance(nopolContext); }
public NopolContext(File[] sourceFile, URL[] classpath, String[] testClasses, List<String> testMethodsToIgnore) { this.projectSources = sourceFile; this.projectClasspath = classpath; this.projectTests = testClasses; if ((this.projectTests == null || this.projectTests.length == 0) && classpath != null) { this.projectTests = new TestClassesFinder().findIn(classpath, false); } this.testMethodsToIgnore = testMethodsToIgnore; this.initFromFile(); }
private boolean callListener(Expression expression) { for (CombineListener combineListener : listeners) { if (combineListener.check(expression)) { if (nopolContext.isOnlyOneSynthesisResult()) { stop = true; } return true; } } return false; }