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());
}
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());
}
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());
}
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());
}
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());
}
}
}
Aggregations