Search in sources :

Example 16 with GitUtils

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

the class TestDependencyIteratorBuilder method testInitialRun.

@Test
public void testInitialRun() {
    try (MockedStatic<GitUtils> gitUtil = Mockito.mockStatic(GitUtils.class)) {
        gitUtil.when(() -> GitUtils.getName("HEAD", TEMPORARY_FOLDER)).thenReturn(VERSION_2);
        gitUtil.when(() -> GitUtils.getName("HEAD~1", TEMPORARY_FOLDER)).thenReturn(SIMPLE_PREDECESSOR);
        ExecutionConfig config = new ExecutionConfig();
        config.setVersionOld(null);
        config.setVersion("HEAD");
        VersionIteratorGit iterator = new DependencyIteratorBuilder(config, null, new PeassFolders(TEMPORARY_FOLDER)).getIterator();
        Assert.assertEquals(2, iterator.getSize());
        Assert.assertEquals(VERSION_2, iterator.getTag());
        Assert.assertEquals(SIMPLE_PREDECESSOR, iterator.getPredecessor());
    }
}
Also used : VersionIteratorGit(de.dagere.peass.vcs.VersionIteratorGit) GitUtils(de.dagere.peass.vcs.GitUtils) ExecutionConfig(de.dagere.peass.config.ExecutionConfig) PeassFolders(de.dagere.peass.folders.PeassFolders) Test(org.junit.jupiter.api.Test)

Example 17 with GitUtils

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

the class TestDependencyIteratorBuilder method testNightlyBuildWithoutPrePredecessor.

@Test
public void testNightlyBuildWithoutPrePredecessor() {
    try (MockedStatic<GitUtils> gitUtil = Mockito.mockStatic(GitUtils.class)) {
        gitUtil.when(() -> GitUtils.getName(Mockito.any(), Mockito.any())).thenReturn(VERSION_2);
        ExecutionConfig config = new ExecutionConfig();
        config.setVersionOld(null);
        config.setVersion("HEAD");
        StaticTestSelection dependencies = buildVersionDependencies();
        DependencyIteratorBuilder builder = new DependencyIteratorBuilder(config, dependencies, new PeassFolders(TEMPORARY_FOLDER));
        VersionIteratorGit iterator = builder.getIterator();
        Assert.assertNull(iterator);
        Assert.assertEquals(VERSION_2, builder.getVersion());
        Assert.assertEquals(null, builder.getVersionOld());
    }
}
Also used : VersionIteratorGit(de.dagere.peass.vcs.VersionIteratorGit) GitUtils(de.dagere.peass.vcs.GitUtils) ExecutionConfig(de.dagere.peass.config.ExecutionConfig) StaticTestSelection(de.dagere.peass.dependency.persistence.StaticTestSelection) PeassFolders(de.dagere.peass.folders.PeassFolders) Test(org.junit.jupiter.api.Test)

Aggregations

GitUtils (de.dagere.peass.vcs.GitUtils)17 PeassFolders (de.dagere.peass.folders.PeassFolders)11 ExecutionConfig (de.dagere.peass.config.ExecutionConfig)10 Test (org.junit.jupiter.api.Test)9 EnvironmentVariables (de.dagere.peass.execution.utils.EnvironmentVariables)7 VersionControlSystem (de.dagere.peass.vcs.VersionControlSystem)7 Test (org.junit.Test)7 VersionIteratorGit (de.dagere.peass.vcs.VersionIteratorGit)6 MeasurementConfig (de.dagere.peass.config.MeasurementConfig)5 StaticTestSelection (de.dagere.peass.dependency.persistence.StaticTestSelection)5 DependencyReader (de.dagere.peass.dependency.reader.DependencyReader)4 FakeFileIterator (de.dagere.peass.dependencytests.helper.FakeFileIterator)4 File (java.io.File)4 TestSelectionConfig (de.dagere.peass.config.TestSelectionConfig)3 VersionKeeper (de.dagere.peass.dependency.reader.VersionKeeper)3 CauseSearchFolders (de.dagere.peass.folders.CauseSearchFolders)3 ResultsFolders (de.dagere.peass.folders.ResultsFolders)3 KiekerConfig (de.dagere.peass.config.KiekerConfig)2 ExecutorCreator (de.dagere.peass.dependency.ExecutorCreator)2 DependencyTester (de.dagere.peass.measurement.dependencyprocessors.DependencyTester)2