Search in sources :

Example 16 with ChangeManager

use of de.dagere.peass.dependency.ChangeManager 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 17 with ChangeManager

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

the class DependencyDetectorParametersIT method changeManagerWithParameter.

public static ChangeManager changeManagerWithParameter() {
    final Map<ChangedEntity, ClazzChangeData> changes = DependencyDetectorTestUtil.buildChanges("", "defaultpackage.NormalDependency", "innerMethod(java.lang.Integer)");
    final ChangeManager changeManager = Mockito.mock(ChangeManager.class);
    Mockito.when(changeManager.getChanges(Mockito.any())).thenReturn(changes);
    return changeManager;
}
Also used : ChangeManager(de.dagere.peass.dependency.ChangeManager) ClazzChangeData(de.dagere.peass.dependency.changesreading.ClazzChangeData) ChangedEntity(de.dagere.peass.dependency.analysis.data.ChangedEntity)

Example 18 with ChangeManager

use of de.dagere.peass.dependency.ChangeManager 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 19 with ChangeManager

use of de.dagere.peass.dependency.ChangeManager 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)

Example 20 with ChangeManager

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

the class DependencyReader method readCompletedVersions.

public void readCompletedVersions(final StaticTestSelection initialdependencies) {
    dependencyManager = new DependencyManager(folders, executionConfig, kiekerConfig, env);
    changeManager = new ChangeManager(folders, iterator, executionConfig, dependencyManager.getExecutor());
    staticChangeHandler = new StaticChangeHandler(folders, executionConfig, dependencyManager);
    dependencyResult.setVersions(initialdependencies.getVersions());
    dependencyResult.setInitialversion(initialdependencies.getInitialversion());
    InitialVersionReader initialVersionReader = new InitialVersionReader(initialdependencies, dependencyManager, iterator);
    initialVersionReader.readCompletedVersions();
    DependencyReaderUtil.write(dependencyResult, resultsFolders.getStaticTestSelectionFile());
    lastRunningVersion = iterator.getTag();
}
Also used : ChangeManager(de.dagere.peass.dependency.ChangeManager) DependencyManager(de.dagere.peass.dependency.DependencyManager)

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