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());
}
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;
}
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);
}
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")));
}
}
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();
}
Aggregations