use of de.dagere.peass.analysis.properties.PropertyReader in project peass by DaGeRe.
the class ReadProperties method call.
@Override
public Void call() throws Exception {
final RepoFolders folders = new RepoFolders();
final String projectName = projectFolder.getName();
SelectedTests selectedTests = VersionSorter.getSelectedTests(staticSelectionFile, executionFile, folders.getDependencyFile(projectName));
if (!projectFolder.exists()) {
GitUtils.downloadProject(selectedTests.getUrl(), projectFolder);
}
System.out.println("Read all: " + ReadAllProperties.readAll);
if (ReadAllProperties.readAll) {
final ExecutionData changedTests = executionFile != null ? Constants.OBJECTMAPPER.readValue(executionFile, ExecutionData.class) : folders.getExecutionData(projectName);
final File resultFile = new File("results" + File.separator + projectName + File.separator + "properties_alltests.json");
out = resultFile;
ResultsFolders resultsFolders = new ResultsFolders(out, projectName);
final PropertyReader reader = new PropertyReader(resultsFolders, projectFolder, changedTests, new ExecutionConfig());
reader.readAllTestsProperties();
} else {
final File changefile;
if (this.changefile != null) {
changefile = this.changefile;
} else {
changefile = folders.getChangeFile(projectName);
}
if (out == null) {
out = folders.getProjectPropertyFile(projectName);
if (!out.getParentFile().exists()) {
out.getParentFile().mkdirs();
}
}
if (!changefile.exists()) {
LOG.error("Changefile {} needs to exist.", changefile);
System.exit(1);
}
if (!viewfolder.exists()) {
LOG.error("ViewFolder {} needs to exist.", viewfolder);
System.exit(1);
}
StaticTestSelection dependencies = Constants.OBJECTMAPPER.readValue(staticSelectionFile, StaticTestSelection.class);
readChangeProperties(changefile, projectFolder, viewfolder, new ExecutionData(dependencies));
}
return null;
}
use of de.dagere.peass.analysis.properties.PropertyReader in project peass by DaGeRe.
the class RegressionTestSelectionStarter method readExecutions.
public void readExecutions(final String project, final List<GitCommit> commits) throws InterruptedException, IOException, JsonGenerationException, JsonMappingException, JAXBException {
KiekerConfig kiekerConfig = kiekerConfigMixin.getKiekerConfig();
ExecutionConfig executionConfig = executionConfigMixin.getExecutionConfig();
final DependencyParallelReader reader = new DependencyParallelReader(config.getProjectFolder(), config.getResultBaseFolder(), project, commits, config.getDependencyConfig(), executionConfig, kiekerConfig, new EnvironmentVariables());
final ResultsFolders[] outFiles = reader.readDependencies();
LOG.debug("Files: {}", outFiles);
ResultsFolders mergedFolders = new ResultsFolders(config.getResultBaseFolder(), project);
final File out = mergedFolders.getStaticTestSelectionFile();
final StaticTestSelection all = PartialDependenciesMerger.mergeVersions(out, outFiles);
final PeassFolders folders = new PeassFolders(config.getProjectFolder());
final File dependencyTempFiles = new File(folders.getTempProjectFolder().getParentFile(), "dependencyTempFiles");
FileUtils.moveDirectory(folders.getTempProjectFolder(), dependencyTempFiles);
ExecutionData executionData = PartialDependenciesMerger.mergeExecutions(mergedFolders, outFiles);
mergeViews(outFiles, mergedFolders);
if (!config.isDoNotGenerateProperties()) {
ResultsFolders resultsFolders = new ResultsFolders(config.getResultBaseFolder(), project);
final PropertyReader propertyReader = new PropertyReader(resultsFolders, config.getProjectFolder(), executionData, executionConfig);
propertyReader.readAllTestsProperties();
}
}
use of de.dagere.peass.analysis.properties.PropertyReader in project peass by DaGeRe.
the class ReadAllProperties method getProperties.
static void getProperties(final RepoFolders folders, final String project) throws JAXBException, IOException, JsonParseException, JsonMappingException, JsonGenerationException {
final File viewFolder = new File(folders.getAllViewFolder(), "views_" + project);
final File executionFile = new File(folders.getDependencyFolder(), ResultsFolders.TRACE_SELECTION_PREFIX + project + ".json");
final ExecutionData changedTests = Constants.OBJECTMAPPER.readValue(executionFile, ExecutionData.class);
final File projectFolder = new File("../../projekte/" + project);
if (!projectFolder.exists()) {
GitUtils.downloadProject(changedTests.getUrl(), projectFolder);
}
if (!readAll) {
final File changeFile = new File(folders.getResultsFolder(), project + File.separator + project + ".json");
if (changeFile.exists()) {
final File resultFile = new File(folders.getPropertiesFolder(), project + File.separator + project + ".json");
if (!resultFile.getParentFile().exists()) {
resultFile.getParentFile().mkdir();
}
final ReadProperties reader = new ReadProperties(resultFile);
reader.readChangeProperties(changeFile, projectFolder, viewFolder, changedTests);
} else {
System.err.println("Error: " + changeFile.getAbsolutePath() + " does not exist");
}
} else {
ResultsFolders resultsFolders = new ResultsFolders(folders.getPropertiesFolder().getParentFile(), project);
new PropertyReader(resultsFolders, projectFolder, changedTests, new ExecutionConfig()).readAllTestsProperties();
}
}
use of de.dagere.peass.analysis.properties.PropertyReader in project peass by DaGeRe.
the class SourceReader method executeSourceReading.
public void executeSourceReading(final Set<TestCase> tests) {
ExecutionData executionData = new ExecutionData();
executionData.addEmptyVersion(version, versionOld);
if (versionOld != null) {
executionData.addEmptyVersion(versionOld, null);
}
for (TestCase test : tests) {
executionData.addCall(version, test);
}
LOG.info("Reading method sources for {} - {}", version, versionOld);
final PropertyReader propertyReader = new PropertyReader(resultsFolders, folders.getProjectFolder(), executionData, config);
propertyReader.readAllTestsProperties();
}
Aggregations