Search in sources :

Example 11 with GitCommit

use of de.dagere.peass.vcs.GitCommit in project peass by DaGeRe.

the class PropertyReadHelper method getChanges.

private Map<ChangedEntity, ClazzChangeData> getChanges(final PeassFolders folders) {
    GitCommit firstCommit = new GitCommit(versionOld, null, null, null);
    List<GitCommit> commits = Arrays.asList(new GitCommit[] { new GitCommit(version, null, null, null), firstCommit });
    final VersionIteratorGit iterator = new VersionIteratorGit(projectFolder, commits, firstCommit);
    final ChangeManager changeManager = new ChangeManager(folders, iterator, config, testExecutor);
    final Map<ChangedEntity, ClazzChangeData> changes = changeManager.getChanges(versionOld, version);
    return changes;
}
Also used : VersionIteratorGit(de.dagere.peass.vcs.VersionIteratorGit) ChangeManager(de.dagere.peass.dependency.ChangeManager) ClazzChangeData(de.dagere.peass.dependency.changesreading.ClazzChangeData) GitCommit(de.dagere.peass.vcs.GitCommit) ChangedEntity(de.dagere.peass.dependency.analysis.data.ChangedEntity)

Example 12 with GitCommit

use of de.dagere.peass.vcs.GitCommit in project peass by DaGeRe.

the class TestCleaner method testParameterizedDataCleaner.

@Test
public void testParameterizedDataCleaner() throws IOException, JAXBException {
    VersionComparator.setVersions(Arrays.asList(new GitCommit[] { new GitCommit("49f75e8877c2e9b7cf6b56087121a35fdd73ff8b", null, null, null), new GitCommit("a12a0b7f4c162794fca0e7e3fcc6ea3b3a2cbc2b", null, null, null) }));
    File measurementsFolder = new File("src/test/resources/cleaning/measurementsFull");
    File goalFolder = new File("target/test/cleaned");
    if (goalFolder.exists()) {
        FileUtils.deleteDirectory(goalFolder);
    }
    goalFolder.mkdirs();
    Cleaner cleaner = new Cleaner(goalFolder);
    cleaner.processDataFolder(measurementsFolder);
    File expectedCleanedFolder_1 = new File(goalFolder, "ExampleTest_test(JUNIT_PARAMETERIZED-0).xml");
    MatcherAssert.assertThat(expectedCleanedFolder_1, FileMatchers.anExistingFile());
    Kopemedata data = XMLDataLoader.loadData(expectedCleanedFolder_1);
    TestcaseType testcase1 = data.getTestcases().getTestcase().get(0);
    Assert.assertEquals("test", testcase1.getName());
    Assert.assertEquals(testcase1.getDatacollector().get(0).getChunk().get(0).getResult().size(), 10);
    File expectedCleanedFolder_2 = new File(goalFolder, "ExampleTest_test(JUNIT_PARAMETERIZED-1).xml");
    MatcherAssert.assertThat(expectedCleanedFolder_2, FileMatchers.anExistingFile());
}
Also used : GitCommit(de.dagere.peass.vcs.GitCommit) TestcaseType(de.dagere.kopeme.generated.TestcaseType) Kopemedata(de.dagere.kopeme.generated.Kopemedata) File(java.io.File) Test(org.junit.jupiter.api.Test)

Example 13 with GitCommit

use of de.dagere.peass.vcs.GitCommit in project peass by DaGeRe.

the class DependencyIteratorBuilder method getOldVersionCommit.

private static GitCommit getOldVersionCommit(final ExecutionConfig executionConfig, final String newestRunningVersionName, final PeassFolders folders) {
    String oldVersion;
    if (executionConfig.getVersionOld() != null) {
        oldVersion = executionConfig.getVersionOld();
    } else if (newestRunningVersionName != null) {
        oldVersion = newestRunningVersionName;
    } else {
        oldVersion = GitUtils.getName("HEAD~1", folders.getProjectFolder());
    }
    GitCommit oldVersionCommit = new GitCommit(oldVersion, "", "", "");
    return oldVersionCommit;
}
Also used : GitCommit(de.dagere.peass.vcs.GitCommit)

Example 14 with GitCommit

use of de.dagere.peass.vcs.GitCommit in project peass by DaGeRe.

the class GetValidationExecutionFile method getProjectValidationExecution.

public static void getProjectValidationExecution(final RepoFolders folders, final File projectsFolder, final String project, final Map<String, Map<String, String>> projectsCommits) throws JsonParseException, JsonMappingException, IOException, JsonGenerationException {
    final ExecutionData changedTests = folders.getExecutionData(project);
    final ExecutionData selected = new ExecutionData();
    selected.setAndroid(changedTests.isAndroid());
    selected.setUrl(changedTests.getUrl());
    File projectFolder = new File(projectsFolder, project);
    List<GitCommit> commits = GitUtils.getCommits(projectFolder, false);
    VersionComparator.setVersions(commits);
    Map<String, String> projectCommits = new LinkedHashMap<>();
    projectsCommits.put(project, projectCommits);
    checkVersions(changedTests, selected, commits, projectCommits);
    File dest = getValidationExecutionFile(project);
    Constants.OBJECTMAPPER.writeValue(dest, selected);
}
Also used : GitCommit(de.dagere.peass.vcs.GitCommit) File(java.io.File) ExecutionData(de.dagere.peass.dependency.persistence.ExecutionData) LinkedHashMap(java.util.LinkedHashMap)

Example 15 with GitCommit

use of de.dagere.peass.vcs.GitCommit in project peass by DaGeRe.

the class OnlyMerge method call.

@Override
public Void call() throws Exception {
    final File projectFolder = config.getProjectFolder();
    final List<GitCommit> commits = CommitUtil.getGitCommits(executionConfigMixin.getStartversion(), executionConfigMixin.getEndversion(), projectFolder);
    VersionComparator.setVersions(commits);
    final File[] files = config.getResultBaseFolder().listFiles((FilenameFilter) new WildcardFileFilter("deps*.json"));
    PartialDependenciesMerger.mergeVersions(new File(config.getResultBaseFolder(), "merged.json"), files);
    return null;
}
Also used : GitCommit(de.dagere.peass.vcs.GitCommit) File(java.io.File) WildcardFileFilter(org.apache.commons.io.filefilter.WildcardFileFilter)

Aggregations

GitCommit (de.dagere.peass.vcs.GitCommit)20 Test (org.junit.jupiter.api.Test)8 File (java.io.File)7 LinkedList (java.util.LinkedList)7 StaticTestSelection (de.dagere.peass.dependency.persistence.StaticTestSelection)6 StatisticsConfig (de.dagere.peass.config.StatisticsConfig)3 InitialVersion (de.dagere.peass.dependency.persistence.InitialVersion)3 ProjectChanges (de.dagere.peass.analysis.changes.ProjectChanges)2 ModuleClassMapping (de.dagere.peass.dependency.analysis.ModuleClassMapping)2 VersionIteratorGit (de.dagere.peass.vcs.VersionIteratorGit)2 Test (org.junit.Test)2 JsonProcessingException (com.fasterxml.jackson.core.JsonProcessingException)1 Kopemedata (de.dagere.kopeme.generated.Kopemedata)1 TestcaseType (de.dagere.kopeme.generated.TestcaseType)1 Change (de.dagere.peass.analysis.changes.Change)1 AnalyseFullData (de.dagere.peass.analysis.measurement.AnalyseFullData)1 ProjectStatistics (de.dagere.peass.analysis.measurement.ProjectStatistics)1 ExecutionConfig (de.dagere.peass.config.ExecutionConfig)1 ChangeManager (de.dagere.peass.dependency.ChangeManager)1 ChangedEntity (de.dagere.peass.dependency.analysis.data.ChangedEntity)1