Search in sources :

Example 1 with InitialVersion

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

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

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

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

the class TestDependencies method testRunningersions.

@Test
public void testRunningersions() {
    StaticTestSelection dependencies = new StaticTestSelection();
    dependencies.setInitialversion(new InitialVersion());
    dependencies.getInitialversion().setVersion("0");
    VersionStaticSelection running1 = new VersionStaticSelection();
    running1.setRunning(true);
    dependencies.getVersions().put("1", running1);
    VersionStaticSelection nonRunning2 = new VersionStaticSelection();
    nonRunning2.setRunning(false);
    dependencies.getVersions().put("2", nonRunning2);
    VersionStaticSelection running3 = new VersionStaticSelection();
    running3.setRunning(true);
    dependencies.getVersions().put("3", running3);
    String[] versionNames = dependencies.getRunningVersionNames();
    Assert.assertEquals("0", versionNames[0]);
    Assert.assertEquals("1", versionNames[1]);
    Assert.assertEquals("3", versionNames[2]);
    Assert.assertEquals("3", dependencies.getNewestVersion());
}
Also used : InitialVersion(de.dagere.peass.dependency.persistence.InitialVersion) VersionStaticSelection(de.dagere.peass.dependency.persistence.VersionStaticSelection) StaticTestSelection(de.dagere.peass.dependency.persistence.StaticTestSelection) Test(org.junit.jupiter.api.Test)

Example 5 with InitialVersion

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

the class TestContinuousDependencyReader method testNoChangeHappened.

@Test
public void testNoChangeHappened() throws JsonGenerationException, JsonMappingException, IOException {
    ResultsFolders resultsFolders = new ResultsFolders(new File("target/current_results"), "current");
    StaticTestSelection value = new StaticTestSelection();
    value.setInitialversion(new InitialVersion());
    value.getVersions().put("A", new VersionStaticSelection());
    Constants.OBJECTMAPPER.writeValue(resultsFolders.getStaticTestSelectionFile(), value);
    ContinuousDependencyReader reader = new ContinuousDependencyReader(new TestSelectionConfig(1, false), new ExecutionConfig(), new KiekerConfig(), new PeassFolders(new File("target/current")), resultsFolders, new EnvironmentVariables());
    reader.getDependencies(null, "git:dummyUrl");
}
Also used : TestSelectionConfig(de.dagere.peass.config.TestSelectionConfig) EnvironmentVariables(de.dagere.peass.execution.utils.EnvironmentVariables) InitialVersion(de.dagere.peass.dependency.persistence.InitialVersion) VersionStaticSelection(de.dagere.peass.dependency.persistence.VersionStaticSelection) ExecutionConfig(de.dagere.peass.config.ExecutionConfig) ResultsFolders(de.dagere.peass.folders.ResultsFolders) File(java.io.File) KiekerConfig(de.dagere.peass.config.KiekerConfig) StaticTestSelection(de.dagere.peass.dependency.persistence.StaticTestSelection) PeassFolders(de.dagere.peass.folders.PeassFolders) Test(org.junit.jupiter.api.Test)

Aggregations

InitialVersion (de.dagere.peass.dependency.persistence.InitialVersion)10 StaticTestSelection (de.dagere.peass.dependency.persistence.StaticTestSelection)7 Test (org.junit.jupiter.api.Test)7 VersionStaticSelection (de.dagere.peass.dependency.persistence.VersionStaticSelection)4 GitCommit (de.dagere.peass.vcs.GitCommit)3 HashMap (java.util.HashMap)2 Map (java.util.Map)2 ExecutionConfig (de.dagere.peass.config.ExecutionConfig)1 KiekerConfig (de.dagere.peass.config.KiekerConfig)1 TestSelectionConfig (de.dagere.peass.config.TestSelectionConfig)1 CalledMethods (de.dagere.peass.dependency.analysis.data.CalledMethods)1 ChangedEntity (de.dagere.peass.dependency.analysis.data.ChangedEntity)1 TestCase (de.dagere.peass.dependency.analysis.data.TestCase)1 TestSet (de.dagere.peass.dependency.analysis.data.TestSet)1 EnvironmentVariables (de.dagere.peass.execution.utils.EnvironmentVariables)1 PeassFolders (de.dagere.peass.folders.PeassFolders)1 ResultsFolders (de.dagere.peass.folders.ResultsFolders)1 File (java.io.File)1 HashSet (java.util.HashSet)1 LinkedList (java.util.LinkedList)1