Search in sources :

Example 1 with PropertyReader

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;
}
Also used : SelectedTests(de.dagere.peass.dependency.persistence.SelectedTests) ExecutionConfig(de.dagere.peass.config.ExecutionConfig) ResultsFolders(de.dagere.peass.folders.ResultsFolders) PropertyReader(de.dagere.peass.analysis.properties.PropertyReader) File(java.io.File) RepoFolders(de.dagere.peass.analysis.all.RepoFolders) ExecutionData(de.dagere.peass.dependency.persistence.ExecutionData) StaticTestSelection(de.dagere.peass.dependency.persistence.StaticTestSelection)

Example 2 with PropertyReader

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();
    }
}
Also used : EnvironmentVariables(de.dagere.peass.execution.utils.EnvironmentVariables) DependencyParallelReader(de.dagere.peass.dependency.reader.DependencyParallelReader) ExecutionConfig(de.dagere.peass.config.ExecutionConfig) ResultsFolders(de.dagere.peass.folders.ResultsFolders) PropertyReader(de.dagere.peass.analysis.properties.PropertyReader) KiekerConfig(de.dagere.peass.config.KiekerConfig) File(java.io.File) StaticTestSelection(de.dagere.peass.dependency.persistence.StaticTestSelection) PeassFolders(de.dagere.peass.folders.PeassFolders) ExecutionData(de.dagere.peass.dependency.persistence.ExecutionData)

Example 3 with PropertyReader

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();
    }
}
Also used : ReadProperties(de.dagere.peass.ReadProperties) ExecutionConfig(de.dagere.peass.config.ExecutionConfig) ResultsFolders(de.dagere.peass.folders.ResultsFolders) PropertyReader(de.dagere.peass.analysis.properties.PropertyReader) File(java.io.File) ExecutionData(de.dagere.peass.dependency.persistence.ExecutionData)

Example 4 with PropertyReader

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();
}
Also used : TestCase(de.dagere.peass.dependency.analysis.data.TestCase) PropertyReader(de.dagere.peass.analysis.properties.PropertyReader) ExecutionData(de.dagere.peass.dependency.persistence.ExecutionData)

Aggregations

PropertyReader (de.dagere.peass.analysis.properties.PropertyReader)4 ExecutionData (de.dagere.peass.dependency.persistence.ExecutionData)4 ExecutionConfig (de.dagere.peass.config.ExecutionConfig)3 ResultsFolders (de.dagere.peass.folders.ResultsFolders)3 File (java.io.File)3 StaticTestSelection (de.dagere.peass.dependency.persistence.StaticTestSelection)2 ReadProperties (de.dagere.peass.ReadProperties)1 RepoFolders (de.dagere.peass.analysis.all.RepoFolders)1 KiekerConfig (de.dagere.peass.config.KiekerConfig)1 TestCase (de.dagere.peass.dependency.analysis.data.TestCase)1 SelectedTests (de.dagere.peass.dependency.persistence.SelectedTests)1 DependencyParallelReader (de.dagere.peass.dependency.reader.DependencyParallelReader)1 EnvironmentVariables (de.dagere.peass.execution.utils.EnvironmentVariables)1 PeassFolders (de.dagere.peass.folders.PeassFolders)1