Java Code Examples for fr.inria.lille.repair.common.config.NopolContext#getProjectClasspath()

The following examples show how to use fr.inria.lille.repair.common.config.NopolContext#getProjectClasspath() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: SpoonedFile.java    From nopol with GNU General Public License v2.0 6 votes vote down vote up
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("OFF"); // no logs

    factory = SpoonModelLibrary.modelFor(factory, sourceFiles, projectClasspath());

    compiler = new DynamicClassCompiler(compilationClasspath(), nopolContext.getComplianceLevel());
    manager = new RuntimeProcessingManager(factory);
    compiledClasses = MetaMap.newHashMap();
    prettyPrinter = new DefaultJavaPrettyPrinter(spoonEnvironment());
}
 
Example 2
Source File: NoPol.java    From nopol with GNU General Public License v2.0 6 votes vote down vote up
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);
}
 
Example 3
Source File: Ranking.java    From nopol with GNU General Public License v2.0 5 votes vote down vote up
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);
}
 
Example 4
Source File: IfMetric.java    From nopol with GNU General Public License v2.0 5 votes vote down vote up
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;
}
 
Example 5
Source File: TestUtility.java    From nopol with GNU General Public License v2.0 5 votes vote down vote up
public static List<Patch> setupAndRun(String executionType, int projectNumber, TestCasesListener listener, RepairType type) {
	NopolContext nopolContext = configForExample(executionType, projectNumber);
	nopolContext.setType(type);
	SolverFactory.setSolver(SOLVER, solverPath);
	URLClassLoader classLoader = new URLClassLoader(nopolContext.getProjectClasspath());
	TestSuiteExecution.runCasesIn(nopolContext.getProjectTests(), classLoader, listener, nopolContext);
	return patchFor(executionType, nopolContext);
}
 
Example 6
Source File: NopolTest.java    From nopol with GNU General Public License v2.0 5 votes vote down vote up
@Test
public void testSkippingRegressionStepLeadToAPatch() {
	NopolContext nopolContext = TestUtility.configForExample(executionType, 1);
	nopolContext.setType(RepairType.CONDITIONAL);
	nopolContext.setSkipRegressionStep(true);
	SolverFactory.setSolver("z3", TestUtility.solverPath);
	URLClassLoader classLoader = new URLClassLoader(nopolContext.getProjectClasspath());
	TestSuiteExecution.runCasesIn(nopolContext.getProjectTests(), classLoader, new TestCasesListener(), nopolContext);
	List<Patch> patches = TestUtility.patchFor(executionType, nopolContext);
	assertTrue(patches.size() > 0);
}
 
Example 7
Source File: GZoltarFaultLocalizer.java    From nopol with GNU General Public License v2.0 4 votes vote down vote up
/** uses {@link #createInstance(NopolContext)} */
private GZoltarFaultLocalizer(NopolContext nopolContext) throws IOException {
	this(nopolContext.getProjectClasspath(), checkNotNull(Arrays.asList("")), nopolContext.getProjectTests(), new Ochiai());
}