public IfMetric(NopolContext nopolContext) { this.nopolContext = nopolContext; this.sourceFolder = nopolContext.getProjectSources()[0]; this.classpath = nopolContext.getProjectClasspath(); output1 = new File(sourceFolder.getAbsolutePath() + File.separatorChar + ".." + File.separatorChar + "IfMetricPurAndImpur"); output2 = new File(sourceFolder.getAbsolutePath() + File.separatorChar + ".." + File.separatorChar + "IfMetricExecutionDuringTest"); FileWriter writer = null; modifyClass = new ArrayList<>(); try { writer = new FileWriter(output1); } catch (IOException e) { throw new RuntimeException(e); } IfMetric.writer = writer; }
/** uses {@link #createInstance(NopolContext)} */ private GZoltarFaultLocalizer(NopolContext nopolContext) throws IOException { this(nopolContext.getProjectClasspath(), checkNotNull(Arrays.asList("")), nopolContext.getProjectTests(), new Ochiai()); }
public NoPol(NopolContext nopolContext) { this.startTime = System.currentTimeMillis(); this.nopolContext = nopolContext; this.classpath = nopolContext.getProjectClasspath(); this.sourceFiles = nopolContext.getProjectSources(); this.nopolResult = new NopolResult(nopolContext, this.startTime); RepairType type = nopolContext.getType(); logger.info("Source files: " + Arrays.toString(sourceFiles)); logger.info("Classpath: " + Arrays.toString(classpath)); logger.info("Statement type: " + type); logger.info("Args: " + Arrays.toString(nopolContext.getProjectTests())); logger.info("Config: " + nopolContext); this.logSystemInformation(); this.spooner = new SpoonedProject(this.sourceFiles, nopolContext); this.testClasses = nopolContext.getProjectTests(); this.testPatch = new TestPatch(this.sourceFiles[0], this.spooner, nopolContext); }
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); }
URLClassLoader urlClassLoader = new URLClassLoader(nopolContext.getProjectClasspath(), this.getClass().getClassLoader()); Class klass = urlClassLoader.loadClass(testClass);
public SpoonedFile(File[] sourceFiles, NopolContext nopolContext) { this.nopolContext = nopolContext; this.sourceFiles = sourceFiles; this.projectClasspath = nopolContext.getProjectClasspath(); factory = SpoonModelLibrary.newFactory(); factory.getEnvironment().setComplianceLevel(nopolContext.getComplianceLevel()); factory.getEnvironment().setCommentEnabled(false); factory.getEnvironment().setLevel(Level.OFF.toString()); factory = SpoonModelLibrary.modelFor(factory, sourceFiles, projectClasspath()); compiler = new DynamicClassCompiler(compilationClasspath(), nopolContext.getComplianceLevel()); manager = new RuntimeProcessingManager(factory); compiledClasses = MetaMap.newHashMap(); prettyPrinter = new DefaultJavaPrettyPrinter(spoonEnvironment()); }