use of de.dagere.peass.dependency.analysis.data.CalledMethods in project peass by DaGeRe.
the class DependencyManager method findAddedTests.
/**
* A method is unknown if a class-wide change happened, e.g. if a new subclass is declared and because of this change a new testcase needs to be called.
*
* @param oldDepdendencies
* @param changes
*/
private void findAddedTests(final Map<TestCase, Map<ChangedEntity, Set<String>>> oldDepdendencies, final TestExistenceChanges changes) {
for (final Map.Entry<TestCase, CalledMethods> newDependency : dependencies.getDependencyMap().entrySet()) {
// testclass -> depending class -> method
final TestCase testcase = newDependency.getKey();
if (!oldDepdendencies.containsKey(testcase)) {
changes.addAddedTest(testcase.onlyClazzEntity(), testcase);
for (final Map.Entry<ChangedEntity, Set<String>> newCallees : newDependency.getValue().getCalledMethods().entrySet()) {
final ChangedEntity changedclass = newCallees.getKey();
for (final String changedMethod : newCallees.getValue()) {
// Since the testcase is new, is is always caused
// primarily by a change of the test class, and not of
// any other changed class
final ChangedEntity methodEntity = changedclass.copy();
methodEntity.setMethod(changedMethod);
changes.addAddedTest(methodEntity, testcase);
}
}
}
}
}
use of de.dagere.peass.dependency.analysis.data.CalledMethods in project peass by DaGeRe.
the class InitialVersionReader method createInitialVersion.
private InitialVersion createInitialVersion() {
int jdkversion = dependencyManager.getExecutor().getJDKVersion();
final InitialVersion initialversion = new InitialVersion();
initialversion.setVersion(iterator.getTag());
initialversion.setJdk(jdkversion);
LOG.debug("Starting writing: {}", dependencyMap.getDependencyMap().size());
for (final Entry<TestCase, CalledMethods> dependencyEntry : dependencyMap.getDependencyMap().entrySet()) {
final TestCase testcase = dependencyEntry.getKey();
for (final Map.Entry<ChangedEntity, Set<String>> calledClassEntry : dependencyEntry.getValue().getCalledMethods().entrySet()) {
final ChangedEntity dependentclass = calledClassEntry.getKey();
if (!dependentclass.getJavaClazzName().contains("junit") && !dependentclass.getJavaClazzName().contains("log4j")) {
for (final String dependentmethod : calledClassEntry.getValue()) {
final ChangedEntity callee = new ChangedEntity(dependentclass.getClazz(), dependentclass.getModule(), dependentmethod);
initialversion.addDependency(testcase, callee);
}
}
}
initialversion.sort(testcase);
}
return initialversion;
}
Aggregations