Search in sources :

Example 16 with GitCommit

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

the class TestAnalyseFullData method testReading.

@Test
public void testReading() throws InterruptedException {
    LinkedList<GitCommit> versions = new LinkedList<GitCommit>();
    versions.add(new GitCommit("946e4318267b56838aa35da0a2a4e5c0528bfe04", "", "", ""));
    versions.add(new GitCommit("fd79b2039667c09167c721b2823425629fad6d11", "", "", ""));
    VersionComparator.setVersions(versions);
    File baseFolder = new File(DATA_READING_FOLDER, "android-example-correct");
    ModuleClassMapping mapping = new ModuleClassMapping(baseFolder, new ProjectModules(new File(baseFolder, "app")), new ExecutionConfig());
    AnalyseFullData afd = new AnalyseFullData(new File("target/test.json"), new ProjectStatistics(), mapping, new StatisticsConfig());
    afd.analyseFolder(REGULAR_DATA_FOLDER);
    ProjectChanges changes = afd.getProjectChanges();
    Set<String> changedTests = changes.getVersion("946e4318267b56838aa35da0a2a4e5c0528bfe04").getTestcaseChanges().keySet();
    MatcherAssert.assertThat(changedTests, Matchers.contains("appĀ§com.example.android_example.ExampleUnitTest"));
}
Also used : GitCommit(de.dagere.peass.vcs.GitCommit) ModuleClassMapping(de.dagere.peass.dependency.analysis.ModuleClassMapping) ExecutionConfig(de.dagere.peass.config.ExecutionConfig) LinkedList(java.util.LinkedList) StatisticsConfig(de.dagere.peass.config.StatisticsConfig) ProjectModules(de.dagere.peass.execution.utils.ProjectModules) ProjectChanges(de.dagere.peass.analysis.changes.ProjectChanges) File(java.io.File) Test(org.junit.Test)

Example 17 with GitCommit

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

the class TestAnalyseFullData method testReadingWithParams.

@Test
public void testReadingWithParams() throws InterruptedException {
    LinkedList<GitCommit> versions = new LinkedList<GitCommit>();
    versions.add(new GitCommit("49f75e8877c2e9b7cf6b56087121a35fdd73ff8b", "", "", ""));
    versions.add(new GitCommit("a12a0b7f4c162794fca0e7e3fcc6ea3b3a2cbc2b", "", "", ""));
    VersionComparator.setVersions(versions);
    ModuleClassMapping mapping = Mockito.mock(ModuleClassMapping.class);
    ProjectStatistics statistics = new ProjectStatistics();
    AnalyseFullData afd = new AnalyseFullData(new File("target/test.json"), statistics, mapping, new StatisticsConfig());
    afd.analyseFolder(new File(PARAM_DATA_FOLDER, "measurements"));
    ProjectChanges changes = afd.getProjectChanges();
    Set<String> changedTests = changes.getVersion("a12a0b7f4c162794fca0e7e3fcc6ea3b3a2cbc2b").getTestcaseChanges().keySet();
    try {
        System.out.println(Constants.OBJECTMAPPER.writeValueAsString(statistics));
        System.out.println(Constants.OBJECTMAPPER.writeValueAsString(changes));
    } catch (JsonProcessingException e) {
        // TODO Auto-generated catch block
        e.printStackTrace();
    }
    MatcherAssert.assertThat(changedTests, Matchers.contains("de.dagere.peass.ExampleTest"));
    List<Change> methodChanges = TestChangeReader.checkParameterizedResult(changes);
    Assert.assertEquals(4152486.88, methodChanges.get(0).getOldTime(), 0.1);
}
Also used : GitCommit(de.dagere.peass.vcs.GitCommit) ModuleClassMapping(de.dagere.peass.dependency.analysis.ModuleClassMapping) Change(de.dagere.peass.analysis.changes.Change) LinkedList(java.util.LinkedList) StatisticsConfig(de.dagere.peass.config.StatisticsConfig) ProjectChanges(de.dagere.peass.analysis.changes.ProjectChanges) File(java.io.File) JsonProcessingException(com.fasterxml.jackson.core.JsonProcessingException) Test(org.junit.Test)

Example 18 with GitCommit

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

the class ParallelTestUtil method getCommits.

public static List<GitCommit> getCommits() {
    List<GitCommit> commits = new LinkedList<>();
    for (int i = 0; i < 10; i++) {
        GitCommit commit = new GitCommit(Integer.toString(i), "Test", null, "Test " + i);
        commits.add(commit);
    }
    VersionComparator.setVersions(commits);
    return commits;
}
Also used : GitCommit(de.dagere.peass.vcs.GitCommit) LinkedList(java.util.LinkedList)

Example 19 with GitCommit

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

the class TestVersionSplitting method readUntilMax.

private void readUntilMax(final List<GitCommit> commits, final List<StaticTestSelection> dependencies, final int i, final int min, final int max) throws IOException {
    final List<GitCommit> currentCommits = commits.subList(min, max);
    final List<GitCommit> reserveCommits = commits.subList(max - 1, commits.size());
    final GitCommit minimumCommit = commits.get(Math.min(max, commits.size() - 1));
    System.out.println("Minimum: " + minimumCommit.getTag());
    readDummyDependencies(dependencies, i, currentCommits, reserveCommits, minimumCommit);
}
Also used : GitCommit(de.dagere.peass.vcs.GitCommit)

Example 20 with GitCommit

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

the class TestVersionSplitting method testSplittingStrangeDistribution.

@Test
public void testSplittingStrangeDistribution() throws IOException {
    List<GitCommit> commits = ParallelTestUtil.getCommits();
    List<StaticTestSelection> dependencies = new LinkedList<>();
    readUntilMax(commits, dependencies, 0, 0, 6);
    readUntilMax(commits, dependencies, 1, 6, 8);
    readUntilMax(commits, dependencies, 2, 7, 10);
    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)

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