use of de.dagere.peass.dependency.analysis.data.ChangedEntity in project peass by DaGeRe.
the class CoverageBasedSelector method getCallSum.
private static int getCallSum(final Set<ChangedEntity> changes, final TraceCallSummary summary) {
summary.getSelectedChanges().clear();
int currentCallSum = 0;
LOG.debug("Changes: {} Test: {}", changes.size(), summary.getTestcase());
LOG.debug("Trace Callcounts: {}", summary.getCallCounts().keySet());
for (ChangedEntity change : changes) {
String changeSignature = change.toString();
LOG.debug("Change signature: " + changeSignature);
if (change.getMethod() != null) {
currentCallSum = addExactCallCount(summary, currentCallSum, changeSignature);
} else {
currentCallSum = addClassbasedCallCount(summary, currentCallSum, changeSignature);
}
}
LOG.debug("Sum: " + currentCallSum);
return currentCallSum;
}
use of de.dagere.peass.dependency.analysis.data.ChangedEntity in project peass by DaGeRe.
the class DependencyManager method removeNotExistingClazzes.
private void removeNotExistingClazzes(final Map<ChangedEntity, Set<String>> calledClasses) {
for (final Iterator<ChangedEntity> iterator = calledClasses.keySet().iterator(); iterator.hasNext(); ) {
final ChangedEntity entity = iterator.next();
final String wholeClassName = entity.getJavaClazzName();
// ignore inner class part, because it is in the same file - if the file exists, it is very likely that a subclass, which is in the logs, exists also
final String outerClazzName = ClazzFileFinder.getOuterClass(wholeClassName);
LOG.trace("Testing: " + outerClazzName);
if (!executor.getExistingClasses().contains(outerClazzName)) {
// Removes classes not in package
iterator.remove();
} else {
LOG.trace("Existing: " + outerClazzName);
}
}
}
use of de.dagere.peass.dependency.analysis.data.ChangedEntity in project peass by DaGeRe.
the class DependencyManager method updateDependenciesOnce.
/**
* Updates Dependencies of the given testClassName and the given testMethodName based upon the file where the kieker-results are stored
*
* @param testClassName
* @param testMethodName
* @param parent
*/
public void updateDependenciesOnce(final TestCase testcase, final File parent, final ModuleClassMapping mapping) {
LOG.debug("Parent: " + parent);
final File moduleResultsFolder = KiekerFolderUtil.getModuleResultFolder(folders, testcase);
final File[] kiekerResultFolders = KiekerFolderUtil.getClazzMethodFolder(testcase, moduleResultsFolder);
if (kiekerResultFolders == null) {
LOG.error("No kieker folder found: " + parent);
return;
}
final Map<ChangedEntity, Set<String>> allCalledClasses = getCalledMethods(mapping, kiekerResultFolders);
removeNotExistingClazzes(allCalledClasses);
for (final Iterator<ChangedEntity> iterator = allCalledClasses.keySet().iterator(); iterator.hasNext(); ) {
final ChangedEntity clazz = iterator.next();
if (clazz.getModule() == null) {
throw new RuntimeException("Class " + clazz.getJavaClazzName() + " has no module!");
}
}
LOG.debug("Test: {} ", testcase);
LOG.debug("Dependencies: {}", allCalledClasses.size());
dependencies.setDependencies(testcase, allCalledClasses);
}
use of de.dagere.peass.dependency.analysis.data.ChangedEntity in project peass by DaGeRe.
the class CalledMethodLoader method loadMethods.
private Map<ChangedEntity, Set<String>> loadMethods() {
Set<String> calledMethods = OneCallReader.getCalledMethods(kiekerTraceFolder);
Map<ChangedEntity, Set<String>> calledMethodResult = new HashMap<>();
for (String calledMethod : calledMethods) {
LOG.debug("Adding called method: {}", calledMethod);
ChangedEntity entity = EntityUtil.determineEntityWithDotSeparator(calledMethod);
final String outerClazzName = ClazzFileFinder.getOuterClass(entity.getClazz());
final String moduleOfClass = mapping.getModuleOfClass(outerClazzName);
ChangedEntity fullClassEntity = new ChangedEntity(entity.getClazz(), moduleOfClass);
Set<String> currentMethodSet = calledMethodResult.get(fullClassEntity);
if (currentMethodSet == null) {
currentMethodSet = new HashSet<>();
calledMethodResult.put(fullClassEntity, currentMethodSet);
}
currentMethodSet.add(entity.getMethod() + entity.getParameterString());
}
return calledMethodResult;
}
use of de.dagere.peass.dependency.analysis.data.ChangedEntity in project peass by DaGeRe.
the class CalledMethodLoader method readOneCallTrace.
private ArrayList<TraceElement> readOneCallTrace() {
ArrayList<TraceElement> result = new ArrayList<>();
Set<String> calledMethods = OneCallReader.getCalledMethods(kiekerTraceFolder);
for (String calledMethod : calledMethods) {
ChangedEntity entity = EntityUtil.determineEntityWithDotSeparator(calledMethod);
final String outerClazzName = ClazzFileFinder.getOuterClass(entity.getClazz());
final String moduleOfClass = mapping.getModuleOfClass(outerClazzName);
TraceElement traceelement = new TraceElement(entity.getClazz(), entity.getMethod(), 0, moduleOfClass);
if (calledMethod.contains(" static ")) {
traceelement.setStatic(true);
}
traceelement.setParameterTypes(entity.getParameterTypes());
result.add(traceelement);
}
return result;
}
Aggregations