Search in sources :

Example 1 with SelectedTests

use of de.dagere.peass.dependency.persistence.SelectedTests 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 SelectedTests

use of de.dagere.peass.dependency.persistence.SelectedTests in project peass by DaGeRe.

the class GetChanges method call.

@Override
public Void call() throws Exception {
    SelectedTests selectedTests = VersionSorter.getSelectedTests(staticSelectionFile, executionFile);
    if (!out.exists()) {
        out.mkdirs();
    }
    LOG.info("Errors: 1: {} 2: {}", statisticConfigMixin.getType1error(), statisticConfigMixin.getType2error());
    ResultsFolders folders = new ResultsFolders(out, "out");
    final ChangeReader reader = createReader(folders, selectedTests);
    if (staticSelectionFile != null) {
        StaticTestSelection dependencies = Constants.OBJECTMAPPER.readValue(staticSelectionFile, StaticTestSelection.class);
        reader.setTests(dependencies.toExecutionData().getVersions());
    }
    if (executionFile != null) {
        ExecutionData executions = Constants.OBJECTMAPPER.readValue(executionFile, ExecutionData.class);
        reader.setTests(executions.getVersions());
    }
    for (final File dataFile : data) {
        reader.readFile(dataFile);
    }
    return null;
}
Also used : ChangeReader(de.dagere.peass.analysis.changes.ChangeReader) SelectedTests(de.dagere.peass.dependency.persistence.SelectedTests) ResultsFolders(de.dagere.peass.folders.ResultsFolders) File(java.io.File) StaticTestSelection(de.dagere.peass.dependency.persistence.StaticTestSelection) ExecutionData(de.dagere.peass.dependency.persistence.ExecutionData)

Aggregations

ExecutionData (de.dagere.peass.dependency.persistence.ExecutionData)2 SelectedTests (de.dagere.peass.dependency.persistence.SelectedTests)2 StaticTestSelection (de.dagere.peass.dependency.persistence.StaticTestSelection)2 ResultsFolders (de.dagere.peass.folders.ResultsFolders)2 File (java.io.File)2 RepoFolders (de.dagere.peass.analysis.all.RepoFolders)1 ChangeReader (de.dagere.peass.analysis.changes.ChangeReader)1 PropertyReader (de.dagere.peass.analysis.properties.PropertyReader)1 ExecutionConfig (de.dagere.peass.config.ExecutionConfig)1