Search in sources :

Example 11 with VersionIterator

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

the class DependencyDetectorNoUpdateIT method testTestChange.

@Test
public void testTestChange() throws IOException, InterruptedException, XmlPullParserException, ParseException, ViewNotFoundException {
    final File secondVersion = new File(DependencyTestConstants.VERSIONS_FOLDER, "changed_test");
    final Map<ChangedEntity, ClazzChangeData> changes = new TreeMap<>();
    DependencyDetectorTestUtil.addChange(changes, "", "defaultpackage.TestMe", "testMe");
    final ChangeManager changeManager = Mockito.mock(ChangeManager.class);
    Mockito.when(changeManager.getChanges(Mockito.any())).thenReturn(changes);
    final VersionIterator fakeIterator = new FakeFileIterator(DependencyTestConstants.CURRENT, Arrays.asList(secondVersion));
    final DependencyReader reader = DependencyDetectorTestUtil.readTwoVersions(changeManager, fakeIterator);
    System.out.println(reader.getDependencies().getVersions().get(DependencyTestConstants.VERSION_1));
    DependencyDetectorTestUtil.checkTestMeAlsoTestChange(reader, "defaultpackage.TestMe#testMe", "defaultpackage.TestMe", DependencyTestConstants.VERSION_1);
}
Also used : ChangeManager(de.dagere.peass.dependency.ChangeManager) FakeFileIterator(de.dagere.peass.dependencytests.helper.FakeFileIterator) ClazzChangeData(de.dagere.peass.dependency.changesreading.ClazzChangeData) DependencyReader(de.dagere.peass.dependency.reader.DependencyReader) VersionIterator(de.dagere.peass.vcs.VersionIterator) ChangedEntity(de.dagere.peass.dependency.analysis.data.ChangedEntity) TreeMap(java.util.TreeMap) File(java.io.File) Test(org.junit.jupiter.api.Test)

Example 12 with VersionIterator

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

the class DependencyDetectorOneCallWriterIT method testNormalChange.

@Test
public void testNormalChange() throws Exception {
    final ChangeManager changeManager = DependencyDetectorTestUtil.defaultChangeManager();
    final VersionIterator fakeIterator = new FakeFileIterator(DependencyTestConstants.CURRENT, Arrays.asList(DependencyTestConstants.NORMAL_CHANGE));
    final DependencyReader reader = readTwoVersions(changeManager, fakeIterator);
    System.out.println(reader.getDependencies());
    DependencyDetectorTestUtil.checkTestMeAlsoTestChange(reader, "defaultpackage.NormalDependency#executeThing", "defaultpackage.TestMe", DependencyTestConstants.VERSION_1);
}
Also used : ChangeManager(de.dagere.peass.dependency.ChangeManager) FakeFileIterator(de.dagere.peass.dependencytests.helper.FakeFileIterator) DependencyReader(de.dagere.peass.dependency.reader.DependencyReader) VersionIterator(de.dagere.peass.vcs.VersionIterator) Test(org.junit.jupiter.api.Test)

Example 13 with VersionIterator

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

the class DependencyDetectorParameterizedIT method testNormalChange.

@Test
public void testNormalChange() throws IOException, InterruptedException, XmlPullParserException, ParseException, ViewNotFoundException {
    final ChangeManager changeManager = changeManagerWithParameter();
    final VersionIterator fakeIterator = new FakeFileIterator(DependencyTestConstants.CURRENT, Arrays.asList(NORMAL_CHANGE));
    final DependencyReader reader = DependencyDetectorTestUtil.readTwoVersions(changeManager, fakeIterator);
    System.out.println(reader.getDependencies().getInitialversion().getInitialDependencies());
    VersionStaticSelection firstVersion = reader.getDependencies().getVersions().get(DependencyTestConstants.VERSION_1);
    System.out.println(firstVersion.getChangedClazzes());
    Assert.assertEquals(3, reader.getDependencies().getInitialversion().getInitialDependencies().size());
    TestSet selectedTest = firstVersion.getChangedClazzes().get(new ChangedEntity("defaultpackage.NormalDependency#onlyCalledWithOne"));
    Assert.assertEquals(new TestCase("TestMe#testMe(JUNIT_PARAMETERIZED-2)"), selectedTest.getTests().iterator().next());
}
Also used : ChangeManager(de.dagere.peass.dependency.ChangeManager) FakeFileIterator(de.dagere.peass.dependencytests.helper.FakeFileIterator) TestCase(de.dagere.peass.dependency.analysis.data.TestCase) VersionStaticSelection(de.dagere.peass.dependency.persistence.VersionStaticSelection) DependencyReader(de.dagere.peass.dependency.reader.DependencyReader) VersionIterator(de.dagere.peass.vcs.VersionIterator) ChangedEntity(de.dagere.peass.dependency.analysis.data.ChangedEntity) TestSet(de.dagere.peass.dependency.analysis.data.TestSet) Test(org.junit.jupiter.api.Test)

Example 14 with VersionIterator

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

the class DependencyDetectorParametersIT method testNormalChange.

@Test
public void testNormalChange() throws IOException, InterruptedException, XmlPullParserException, ParseException, ViewNotFoundException {
    final ChangeManager changeManager = changeManagerWithParameter();
    final VersionIterator fakeIterator = new FakeFileIterator(DependencyTestConstants.CURRENT, Arrays.asList(DependencyTestConstants.NORMAL_CHANGE_PARAMETERS));
    final DependencyReader reader = DependencyDetectorTestUtil.readTwoVersions(changeManager, fakeIterator);
    System.out.println(reader.getDependencies());
    System.out.println(reader.getDependencies().getVersions().get(DependencyTestConstants.VERSION_1));
    DependencyDetectorTestUtil.checkTestMeAlsoTestChange(reader, "defaultpackage.NormalDependency#innerMethod(java.lang.Integer)", "defaultpackage.TestMe", DependencyTestConstants.VERSION_1);
}
Also used : ChangeManager(de.dagere.peass.dependency.ChangeManager) FakeFileIterator(de.dagere.peass.dependencytests.helper.FakeFileIterator) DependencyReader(de.dagere.peass.dependency.reader.DependencyReader) VersionIterator(de.dagere.peass.vcs.VersionIterator) Test(org.junit.jupiter.api.Test)

Example 15 with VersionIterator

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

the class CoverageBasedSelectionIT method testNormalChange.

@Test
public void testNormalChange() throws IOException, InterruptedException, XmlPullParserException, ParseException, ViewNotFoundException {
    try (MockedStatic<GitUtils> staticMock = Mockito.mockStatic(GitUtils.class)) {
        final ChangeManager changeManager = DependencyDetectorTestUtil.defaultChangeManager();
        final VersionIterator fakeIterator = new FakeFileIterator(DependencyTestConstants.CURRENT, Arrays.asList(DependencyTestConstants.COVERAGE_NORMAL_CHANGE));
        final DependencyReader reader = DependencyDetectorTestUtil.readTwoVersions(changeManager, fakeIterator, new ExecutionConfig(5), DependencyTestConstants.DEFAULT_CONFIG_WITH_COVERAGE, DependencyTestConstants.TARGET_RESULTS_FOLDERS);
        System.out.println(reader.getDependencies());
        DependencyDetectorTestUtil.checkChange(reader, "defaultpackage.NormalDependency#executeThing", "defaultpackage.TestMe", DependencyTestConstants.VERSION_1, "testFirst");
        System.out.println(reader.getCoverageBasedSelection());
        TestSet tests = reader.getCoverageBasedSelection().getVersions().get(DependencyTestConstants.VERSION_1);
        MatcherAssert.assertThat(tests.getTests(), IsIterableContaining.hasItem(new TestCase("defaultpackage.TestMe#testSecond")));
    }
}
Also used : ChangeManager(de.dagere.peass.dependency.ChangeManager) FakeFileIterator(de.dagere.peass.dependencytests.helper.FakeFileIterator) TestCase(de.dagere.peass.dependency.analysis.data.TestCase) GitUtils(de.dagere.peass.vcs.GitUtils) DependencyReader(de.dagere.peass.dependency.reader.DependencyReader) VersionIterator(de.dagere.peass.vcs.VersionIterator) ExecutionConfig(de.dagere.peass.config.ExecutionConfig) TestSet(de.dagere.peass.dependency.analysis.data.TestSet) Test(org.junit.jupiter.api.Test)

Aggregations

VersionIterator (de.dagere.peass.vcs.VersionIterator)27 DependencyReader (de.dagere.peass.dependency.reader.DependencyReader)24 ChangeManager (de.dagere.peass.dependency.ChangeManager)23 FakeFileIterator (de.dagere.peass.dependencytests.helper.FakeFileIterator)23 Test (org.junit.jupiter.api.Test)22 File (java.io.File)15 ChangedEntity (de.dagere.peass.dependency.analysis.data.ChangedEntity)10 ClazzChangeData (de.dagere.peass.dependency.changesreading.ClazzChangeData)9 ExecutionConfig (de.dagere.peass.config.ExecutionConfig)7 TreeMap (java.util.TreeMap)7 TestSet (de.dagere.peass.dependency.analysis.data.TestSet)5 EnvironmentVariables (de.dagere.peass.execution.utils.EnvironmentVariables)5 PeassFolders (de.dagere.peass.folders.PeassFolders)5 KiekerConfig (de.dagere.peass.config.KiekerConfig)4 TestCase (de.dagere.peass.dependency.analysis.data.TestCase)4 StaticTestSelection (de.dagere.peass.dependency.persistence.StaticTestSelection)4 OneReader (de.dagere.peass.dependency.parallel.OneReader)2 VersionIteratorGit (de.dagere.peass.vcs.VersionIteratorGit)2 VersionStaticSelection (de.dagere.peass.dependency.persistence.VersionStaticSelection)1 FirstRunningVersionFinder (de.dagere.peass.dependency.reader.FirstRunningVersionFinder)1