use of com.teamscale.test_impacted.engine.ImpactedTestEngine in project teamscale-jacoco-agent by cqse.
the class AvailableTests method convertToUniqueIds.
/**
* Converts the {@link PrioritizableTest}s which are match the {@link UniqueId}s returned by the {@link TestEngine}s
* used by the {@link ImpactedTestEngine}.
*/
public Set<UniqueId> convertToUniqueIds(List<PrioritizableTest> impactedTests) {
Set<UniqueId> list = new HashSet<>();
for (PrioritizableTest impactedTest : impactedTests) {
LOGGER.info(() -> impactedTest.uniformPath + " " + impactedTest.selectionReason);
UniqueId testUniqueId = uniformPathToUniqueIdMapping.get(impactedTest.uniformPath);
if (testUniqueId == null) {
LOGGER.error(() -> "Retrieved invalid test '" + impactedTest.uniformPath + "' from Teamscale server!");
LOGGER.error(() -> "The following seem related:");
uniformPathToUniqueIdMapping.keySet().stream().sorted(Comparator.comparing(testPath -> StringUtils.editDistance(impactedTest.uniformPath, testPath))).limit(5).forEach(testAlternative -> LOGGER.error(() -> " - " + testAlternative));
LOGGER.error(() -> "Falling back to execute all...");
return new HashSet<>(uniformPathToUniqueIdMapping.values());
}
list.add(testUniqueId);
}
return list;
}
Aggregations