Java Code Examples for fr.inria.lille.repair.common.config.NopolContext#getSynthesis()
The following examples show how to use
fr.inria.lille.repair.common.config.NopolContext#getSynthesis() .
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: NopolMojo.java From repairnator with MIT License | 5 votes |
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; }
Example 2
Source File: InternalNopolActor.java From nopol with GNU General Public License v2.0 | 5 votes |
@Override public void onReceive(Object message) throws Exception { if (message instanceof ConfigActor) { ConfigActor configActor = (ConfigActor) message; NopolContext nopolContext = configActor.getNopolContext(); File tempDirectory = Files.createTempDir(); UnZiper.unZipIt(configActor.getContent(), tempDirectory.getAbsolutePath()); ActorRef client = configActor.getClient(); if (nopolContext.getSynthesis() == NopolContext.NopolSynthesis.SMT) { nopolContext.setSolverPath(pathToSolver); } String sourceFile = tempDirectory.toString() + "/src/"; String classPath = getClasspathFromTargetFolder(new File(tempDirectory.getCanonicalPath() + "/target/")); System.out.println(tempDirectory); List<Patch> patches = Collections.EMPTY_LIST; nopolContext.setProjectSources(sourceFile); nopolContext.setProjectClasspath(JavaLibrary.classpathFrom(classPath)); nopolContext.setComplianceLevel(8); try { NoPol noPol = new NoPol(nopolContext); NopolResult status = noPol.build(); patches = status.getPatches(); } catch (Exception e) { throw new RuntimeException("Error launch NoPol", e); } finally { getSender().tell(NoPolActor.Message.AVAILABLE, getSelf()); } client.tell(patches, ActorRef.noSender()); } else unhandled(message);//Unsupported message type }
Example 3
Source File: SynthesizerFactory.java From nopol with GNU General Public License v2.0 | 5 votes |
public static Synthesizer build(final File[] sourceFolders, final SpoonedProject spooner, NopolContext nopolContext, final SourceLocation statement, NopolProcessor nopolProcessor, SpoonedClass spoonCl) { nbStatementsAnalysed++; Class<?> type = nopolContext.getType().getType(); switch (nopolContext.getSynthesis()) { case SMT: //InstrumentedProgram program = getInstrumentedProgramForThisLocation(nopolProcessor, sourceLocation, spooner); return new SMTNopolSynthesizer(spooner, getInstrumentedProgramForThisLocation(spooner, nopolContext, nopolProcessor, statement, spoonCl), statement, nopolProcessor.getRepairType(), nopolProcessor, nopolContext); case DYNAMOTH: return new DynamothSynthesizer(sourceFolders, statement, nopolProcessor.getRepairType(), nopolProcessor, spooner, nopolContext); } return Synthesizer.NO_OP_SYNTHESIZER; }