use of de.dagere.peass.dependency.changesreading.ClazzChangeData in project peass by DaGeRe.
the class DependencyDetectorIT method testClassChange.
@Test
public void testClassChange() throws Exception {
final File secondVersion = new File(DependencyTestConstants.VERSIONS_FOLDER, "changed_class");
final Map<ChangedEntity, ClazzChangeData> changes = new TreeMap<>();
changes.put(new ChangedEntity("defaultpackage.NormalDependency", ""), new ClazzChangeData("defaultpackage.NormalDependency", false));
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 = new DependencyReader(DependencyTestConstants.DEFAULT_CONFIG_NO_VIEWS, new PeassFolders(DependencyTestConstants.CURRENT), DependencyTestConstants.NULL_RESULTS_FOLDERS, null, fakeIterator, changeManager, new ExecutionConfig(5), new KiekerConfig(true), new EnvironmentVariables());
final boolean success = reader.readInitialVersion();
Assert.assertTrue(success);
final StaticTestSelection dependencies = reader.getDependencies();
System.out.println(dependencies);
fakeIterator.goToNextCommit();
reader.analyseVersion(changeManager);
final TestSet testMe = DependencyDetectorTestUtil.findDependency(dependencies, "defaultpackage.NormalDependency", DependencyTestConstants.VERSION_1);
System.out.println(testMe);
final ChangedEntity change = dependencies.getVersions().get(DependencyTestConstants.VERSION_1).getChangedClazzes().keySet().iterator().next();
Assert.assertEquals("defaultpackage.NormalDependency", change.toString());
Assert.assertEquals("defaultpackage.TestMe#testMe", testMe.getTests().iterator().next().getExecutable());
}
use of de.dagere.peass.dependency.changesreading.ClazzChangeData in project peass by DaGeRe.
the class DependencyDetectorMultimoduleIT method mockChangeManager.
private ChangeManager mockChangeManager() {
final Map<ChangedEntity, ClazzChangeData> changes = DependencyDetectorTestUtil.buildChanges("base-module", "de.dagere.base.BaseChangeable", "doSomething");
DependencyDetectorTestUtil.addChange(changes, "base-module", "de.dagere.base.NextBaseChangeable", "doSomething");
ChangeManager changeManager = Mockito.mock(ChangeManager.class);
Mockito.when(changeManager.getChanges(Mockito.any())).thenReturn(changes);
return changeManager;
}
use of de.dagere.peass.dependency.changesreading.ClazzChangeData 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);
}
use of de.dagere.peass.dependency.changesreading.ClazzChangeData 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.changesreading.ClazzChangeData in project peass by DaGeRe.
the class TestTestDependencies method testParameterChange.
private void testParameterChange(final TestDependencies dependencies, final String parameterizedMethod) {
HashMap<ChangedEntity, ClazzChangeData> changeTestMap = new HashMap<ChangedEntity, ClazzChangeData>();
ClazzChangeData classChangeData = new ClazzChangeData(new ChangedEntity("package.ClazzB", "moduleA"), true);
classChangeData.addChange("ClazzB", parameterizedMethod);
changeTestMap.put(new ChangedEntity("package.ClazzB", "moduleA"), classChangeData);
ChangeTestMapping changes = dependencies.getChangeTestMap(changeTestMap);
Assert.assertEquals(1, changes.getChanges().size());
}
Aggregations