Search in sources :

Example 21 with ChangeManager

use of de.dagere.peass.dependency.ChangeManager in project peass by DaGeRe.

the class PropertyReadHelper method getChanges.

private Map<ChangedEntity, ClazzChangeData> getChanges(final PeassFolders folders) {
    GitCommit firstCommit = new GitCommit(versionOld, null, null, null);
    List<GitCommit> commits = Arrays.asList(new GitCommit[] { new GitCommit(version, null, null, null), firstCommit });
    final VersionIteratorGit iterator = new VersionIteratorGit(projectFolder, commits, firstCommit);
    final ChangeManager changeManager = new ChangeManager(folders, iterator, config, testExecutor);
    final Map<ChangedEntity, ClazzChangeData> changes = changeManager.getChanges(versionOld, version);
    return changes;
}
Also used : VersionIteratorGit(de.dagere.peass.vcs.VersionIteratorGit) ChangeManager(de.dagere.peass.dependency.ChangeManager) ClazzChangeData(de.dagere.peass.dependency.changesreading.ClazzChangeData) GitCommit(de.dagere.peass.vcs.GitCommit) ChangedEntity(de.dagere.peass.dependency.analysis.data.ChangedEntity)

Example 22 with ChangeManager

use of de.dagere.peass.dependency.ChangeManager in project peass by DaGeRe.

the class DependencyDetectorIT method testTestChange.

@Test
public void testTestChange() throws Exception {
    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 23 with ChangeManager

use of de.dagere.peass.dependency.ChangeManager in project peass by DaGeRe.

the class DependencyDetectorIT method testNoChange.

@Test
public void testNoChange() throws Exception {
    final Map<ChangedEntity, ClazzChangeData> changes = new HashMap<>();
    final ChangeManager changeManager = Mockito.mock(ChangeManager.class);
    Mockito.when(changeManager.getChanges(Mockito.any())).thenReturn(changes);
    final VersionIterator fakeIterator = new FakeFileIterator(DependencyTestConstants.CURRENT, Arrays.asList(DependencyTestConstants.BASIC_STATE));
    final DependencyReader reader = DependencyDetectorTestUtil.readTwoVersions(changeManager, fakeIterator);
    StaticTestSelection dependencies = reader.getDependencies();
    System.out.println(dependencies.getVersions());
    Assert.assertTrue(dependencies.getVersions().get(dependencies.getNewestVersion()).isRunning());
// 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) ClazzChangeData(de.dagere.peass.dependency.changesreading.ClazzChangeData) HashMap(java.util.HashMap) DependencyReader(de.dagere.peass.dependency.reader.DependencyReader) VersionIterator(de.dagere.peass.vcs.VersionIterator) ChangedEntity(de.dagere.peass.dependency.analysis.data.ChangedEntity) StaticTestSelection(de.dagere.peass.dependency.persistence.StaticTestSelection) Test(org.junit.jupiter.api.Test)

Example 24 with ChangeManager

use of de.dagere.peass.dependency.ChangeManager in project peass by DaGeRe.

the class DependencyDetectorIT 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 = DependencyDetectorTestUtil.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 25 with ChangeManager

use of de.dagere.peass.dependency.ChangeManager in project peass by DaGeRe.

the class DependencyDetectorIT method testAddedTest.

@Test
public void testAddedTest() throws Exception {
    final File secondVersion = new File(DependencyTestConstants.VERSIONS_FOLDER, "added_test");
    final ChangeManager changeManager = DependencyDetectorTestUtil.changedTestClassChangeManager();
    final VersionIterator fakeIterator = new FakeFileIterator(DependencyTestConstants.CURRENT, Arrays.asList(secondVersion));
    final DependencyReader reader = DependencyDetectorTestUtil.readTwoVersions(changeManager, fakeIterator);
    System.out.println(reader.getDependencies());
    DependencyDetectorTestUtil.checkChange(reader, "defaultpackage.NormalDependency#executeThing", "defaultpackage.TestMe", DependencyTestConstants.VERSION_1, "addedTest");
}
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) File(java.io.File) Test(org.junit.jupiter.api.Test)

Aggregations

ChangeManager (de.dagere.peass.dependency.ChangeManager)36 DependencyReader (de.dagere.peass.dependency.reader.DependencyReader)26 Test (org.junit.jupiter.api.Test)26 FakeFileIterator (de.dagere.peass.dependencytests.helper.FakeFileIterator)23 VersionIterator (de.dagere.peass.vcs.VersionIterator)23 ChangedEntity (de.dagere.peass.dependency.analysis.data.ChangedEntity)18 ClazzChangeData (de.dagere.peass.dependency.changesreading.ClazzChangeData)17 File (java.io.File)16 TreeMap (java.util.TreeMap)9 ExecutionConfig (de.dagere.peass.config.ExecutionConfig)6 KiekerConfig (de.dagere.peass.config.KiekerConfig)5 TestSet (de.dagere.peass.dependency.analysis.data.TestSet)5 EnvironmentVariables (de.dagere.peass.execution.utils.EnvironmentVariables)5 PeassFolders (de.dagere.peass.folders.PeassFolders)5 TestCase (de.dagere.peass.dependency.analysis.data.TestCase)4 StaticTestSelection (de.dagere.peass.dependency.persistence.StaticTestSelection)4 DependencyManager (de.dagere.peass.dependency.DependencyManager)2 HashMap (java.util.HashMap)2 OneReader (de.dagere.peass.dependency.parallel.OneReader)1 VersionStaticSelection (de.dagere.peass.dependency.persistence.VersionStaticSelection)1