Search in sources :

Example 1 with GitCommit

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

the class TestMerging method testMerging.

@Test
public void testMerging() {
    List<GitCommit> commits = ParallelTestUtil.getCommits();
    VersionComparator.setVersions(commits);
    StaticTestSelection deps1 = new StaticTestSelection(), deps2 = new StaticTestSelection();
    deps1.setInitialversion(new InitialVersion());
    deps1.getInitialversion().setVersion("0");
    for (GitCommit commit : commits.subList(1, 6)) {
        deps1.getVersions().put(commit.getTag(), null);
    }
    deps2.setInitialversion(new InitialVersion());
    deps2.getInitialversion().setVersion("5");
    for (GitCommit commit : commits.subList(5, 10)) {
        deps2.getVersions().put(commit.getTag(), null);
    }
    StaticTestSelection merged = DependencyReaderUtil.mergeDependencies(deps1, deps2);
    Assert.assertEquals(9, merged.getVersions().size());
}
Also used : GitCommit(de.dagere.peass.vcs.GitCommit) InitialVersion(de.dagere.peass.dependency.persistence.InitialVersion) StaticTestSelection(de.dagere.peass.dependency.persistence.StaticTestSelection) Test(org.junit.jupiter.api.Test)

Example 2 with GitCommit

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

the class TestMerging method testMergingStrangeDistribution.

@Test
public void testMergingStrangeDistribution() {
    List<GitCommit> commits = ParallelTestUtil.getCommits();
    VersionComparator.setVersions(commits);
    StaticTestSelection deps1 = new StaticTestSelection(), deps2 = new StaticTestSelection();
    deps1.setInitialversion(new InitialVersion());
    deps1.getInitialversion().setVersion("0");
    for (GitCommit commit : commits.subList(1, 8)) {
        deps1.getVersions().put(commit.getTag(), null);
    }
    deps2.setInitialversion(new InitialVersion());
    deps2.getInitialversion().setVersion("7");
    for (GitCommit commit : commits.subList(8, 10)) {
        deps2.getVersions().put(commit.getTag(), null);
    }
    StaticTestSelection merged = DependencyReaderUtil.mergeDependencies(deps1, deps2);
    Assert.assertEquals(9, merged.getVersions().size());
}
Also used : GitCommit(de.dagere.peass.vcs.GitCommit) InitialVersion(de.dagere.peass.dependency.persistence.InitialVersion) StaticTestSelection(de.dagere.peass.dependency.persistence.StaticTestSelection) Test(org.junit.jupiter.api.Test)

Example 3 with GitCommit

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

the class TestMerging method testAlphabetic.

@Test
public void testAlphabetic() {
    List<GitCommit> commits = new LinkedList<>();
    commits.add(new GitCommit("A", "", "", ""));
    commits.add(new GitCommit("C", "", "", ""));
    commits.add(new GitCommit("B", "", "", ""));
    commits.add(new GitCommit("G", "", "", ""));
    commits.add(new GitCommit("E", "", "", ""));
    commits.add(new GitCommit("F", "", "", ""));
    VersionComparator.setVersions(commits);
    StaticTestSelection deps1 = new StaticTestSelection(), deps2 = new StaticTestSelection();
    deps1.setInitialversion(new InitialVersion());
    deps1.getInitialversion().setVersion("A");
    deps1.getVersions().put("C", null);
    deps1.getVersions().put("B", null);
    deps1.getVersions().put("G", null);
    deps2.setInitialversion(new InitialVersion());
    deps2.getInitialversion().setVersion("G");
    deps2.getVersions().put("E", null);
    deps2.getVersions().put("F", null);
    StaticTestSelection merged = DependencyReaderUtil.mergeDependencies(deps1, deps2);
    System.out.println(merged.getVersions().keySet());
    Assert.assertEquals(5, merged.getVersions().size());
}
Also used : GitCommit(de.dagere.peass.vcs.GitCommit) InitialVersion(de.dagere.peass.dependency.persistence.InitialVersion) LinkedList(java.util.LinkedList) StaticTestSelection(de.dagere.peass.dependency.persistence.StaticTestSelection) Test(org.junit.jupiter.api.Test)

Example 4 with GitCommit

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

the class TestVersionSplitting method testSplitting.

@Test
public void testSplitting() throws IOException {
    List<GitCommit> commits = ParallelTestUtil.getCommits();
    int count = 3;
    int size = commits.size() > 2 * count ? commits.size() / count : 2;
    List<StaticTestSelection> dependencies = new LinkedList<>();
    for (int chunk = 0; chunk < count; chunk++) {
        // Assuming one in three commits should contain a source-change
        final int max = Math.min((chunk + 1) * size + 3, commits.size());
        readUntilMax(commits, dependencies, chunk, chunk * size, max);
    }
    StaticTestSelection merged = PartialDependenciesMerger.mergeDependencies(dependencies);
    System.out.println(merged.getVersions().keySet());
    Assert.assertEquals(7, merged.getVersions().size());
}
Also used : GitCommit(de.dagere.peass.vcs.GitCommit) LinkedList(java.util.LinkedList) StaticTestSelection(de.dagere.peass.dependency.persistence.StaticTestSelection) Test(org.junit.jupiter.api.Test)

Example 5 with GitCommit

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

the class TestVersionSplitting method testSplittingNonRunning.

@Test
public void testSplittingNonRunning() throws IOException {
    List<GitCommit> commits = ParallelTestUtil.getCommits();
    int count = 3;
    int size = commits.size() > 2 * count ? commits.size() / count : 2;
    for (int i = 1; i < 10; i++) {
        for (int j = i + 1; j < 10; j++) {
            DummyReader.nonRunning = new HashSet<>(Arrays.asList(String.valueOf(i), String.valueOf(j)));
            List<StaticTestSelection> dependencies = new LinkedList<>();
            for (int chunk = 0; chunk < count; chunk++) {
                // Assuming one in three commits should contain a source-change
                final int max = Math.min((chunk + 1) * size + 3, commits.size());
                readUntilMax(commits, dependencies, chunk, chunk * size, max);
            }
            StaticTestSelection merged = PartialDependenciesMerger.mergeDependencies(dependencies);
            System.out.println(merged.getVersions().keySet() + " " + merged.getVersions().size());
            Assert.assertEquals("Error in " + DummyReader.nonRunning, 7, merged.getVersions().size());
        }
    }
}
Also used : GitCommit(de.dagere.peass.vcs.GitCommit) LinkedList(java.util.LinkedList) StaticTestSelection(de.dagere.peass.dependency.persistence.StaticTestSelection) Test(org.junit.jupiter.api.Test)

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