in rest-api/src/jetbrains/buildServer/server/rest/data/problem/TestOccurrenceFinder.java [408:480]
private ItemHolder<STestRun> getPrefilteredItemsInternal(@NotNull final Locator locator) {
String buildDimension = locator.getSingleDimensionValue(BUILD);
if (buildDimension != null) {
// Always include test runs from personal builds when there is a build locator.
locator.setDimension(INCLUDE_PERSONAL, Locator.BOOLEAN_TRUE);
locator.setDimension(INCLUDE_ALL_PERSONAL, Locator.BOOLEAN_TRUE);
List<BuildPromotion> builds = myBuildPromotionFinder.getBuildPromotionsWithLegacyFallback(null, buildDimension).getEntries();
Boolean expandInvocations = locator.getSingleDimensionValueAsBoolean(EXPAND_INVOCATIONS); //getting the dimension early in order not to get "dimension is unknown" for it in case of early exit
String testDimension = locator.getSingleDimensionValue(TEST);
if (testDimension == null) {
List<ItemHolder<STestRun>> result = new ArrayList<>();
for (BuildPromotion build : builds) {
SBuild associatedBuild = build.getAssociatedBuild();
if (associatedBuild != null) {
result.add(getPossibleExpandedTestsHolder(getBuildStatistics(associatedBuild, locator).getAllTests(), expandInvocations));
}
}
return ItemHolder.concat(result);
}
final PagedSearchResult<STest> tests = myTestFinder.getItems(testDimension);
final ArrayList<STestRun> result = new ArrayList<>();
for (BuildPromotion build : builds) {
SBuild associatedBuild = build.getAssociatedBuild();
if (associatedBuild != null) {
Set<Long> allTestNameIds = tests.getEntries().stream().map(STest::getTestNameId).collect(Collectors.toSet());
final List<STestRun> allTests = getBuildStatistics(associatedBuild, locator).getAllTests();
for (STestRun item : allTests) {
if (allTestNameIds.contains(item.getTest().getTestNameId())) {
result.add(item);
}
}
}
}
return getPossibleExpandedTestsHolder(result, expandInvocations);
}
String testDimension = locator.getSingleDimensionValue(TEST);
if (testDimension != null) {
PagedSearchResult<STest> tests = myTestFinder.getItems(testDimension);
if (locator.isAnyPresent(BUILD_TYPE)) {
return getTestRunsByBuildType(tests.getEntries(), locator);
}
final SProject affectedProject = getAffectedProject(locator);
return getItemsByAffectedProject(affectedProject, tests.getEntries(), locator);
}
Boolean currentDimension = locator.lookupSingleDimensionValueAsBoolean(CURRENT);
if (currentDimension != null && currentDimension) {
locator.markUsed(CURRENT);
return getPossibleExpandedTestsHolder(getCurrentOccurrences(getAffectedProject(locator), myCurrentProblemsManager),
locator.getSingleDimensionValueAsBoolean(EXPAND_INVOCATIONS));
}
Boolean currentlyMutedDimension = locator.getSingleDimensionValueAsBoolean(CURRENTLY_MUTED);
if (currentlyMutedDimension != null && currentlyMutedDimension) {
final SProject affectedProject = getAffectedProject(locator);
final Set<STest> currentlyMutedTests = myTestFinder.getCurrentlyMutedTests(affectedProject);
return getItemsByAffectedProject(affectedProject, currentlyMutedTests, locator);
}
ArrayList<String> exampleLocators = new ArrayList<>();
exampleLocators.add(Locator.getStringLocator(DIMENSION_ID, "XXX"));
exampleLocators.add(Locator.getStringLocator(BUILD, "XXX"));
exampleLocators.add(Locator.getStringLocator(TEST, "XXX"));
exampleLocators.add(Locator.getStringLocator(CURRENT, "true", AFFECTED_PROJECT, "XXX"));
exampleLocators.add(Locator.getStringLocator(CURRENTLY_MUTED, "true", AFFECTED_PROJECT, "XXX"));
throw new BadRequestException(
"Unsupported test occurrence locator '" + locator.getStringRepresentation() + "'. Try one of locator dimensions: " + DataProvider.dumpQuoted(exampleLocators));
}