Search in sources :

Example 1 with TestScopeTree

use of jetbrains.buildServer.server.rest.model.problem.scope.TestScopeTree in project teamcity-rest by JetBrains.

the class ChangeRequest method getChangeFailedTestsTree.

/**
 *  Experimental, subject to change
 *  @since 2021.2
 */
@GET
@Path("/{changeLocator}/testsTree")
@Produces({ "application/xml", "application/json" })
@ApiOperation(value = "Get failed tests tree for the matching change.", nickname = "getChangeFailedTestsTree", hidden = true)
public TestScopeTree getChangeFailedTestsTree(@ApiParam(format = LocatorName.CHANGE) @PathParam("changeLocator") String changeLocator, // todo: remove after ui migration
@QueryParam(TestScopeTreeCollector.SUBTREE_ROOT_ID) String subTreeRootId, @QueryParam("treeLocator") String treeLocatorText, @QueryParam("fields") String fields) {
    final SVcsModification change = myChangeFinder.getItem(changeLocator).getSVcsModification();
    ChangeStatusProvider myStatusProvider = myServiceLocator.getSingletonService(ChangeStatusProvider.class);
    ChangeStatus changeStatus = myStatusProvider.getMergedChangeStatus(change);
    Stream<BuildPromotion> firstBuildsPromotions = changeStatus.getBuildTypesStatusMap().values().stream().filter(Objects::nonNull);
    Locator treeLocator = Locator.createPotentiallyEmptyLocator(treeLocatorText);
    if (subTreeRootId != null) {
        treeLocator.setDimension(ProblemOccurrencesTreeCollector.SUB_TREE_ROOT_ID, subTreeRootId);
    }
    return new TestScopeTree(myTestScopeTreeCollector.getSlicedTreeFromBuildPromotions(firstBuildsPromotions, treeLocator), new Fields(fields), myBeanContext);
}
Also used : SVcsModification(jetbrains.buildServer.vcs.SVcsModification) ChangeStatus(jetbrains.buildServer.vcs.ChangeStatus) BuildPromotion(jetbrains.buildServer.serverSide.BuildPromotion) ServiceLocator(jetbrains.buildServer.ServiceLocator) Locator(jetbrains.buildServer.server.rest.data.Locator) Fields(jetbrains.buildServer.server.rest.model.Fields) TestScopeTree(jetbrains.buildServer.server.rest.model.problem.scope.TestScopeTree) Objects(java.util.Objects) ChangeStatusProvider(jetbrains.buildServer.vcs.ChangeStatusProvider) ApiOperation(io.swagger.annotations.ApiOperation)

Aggregations

ApiOperation (io.swagger.annotations.ApiOperation)1 Objects (java.util.Objects)1 ServiceLocator (jetbrains.buildServer.ServiceLocator)1 Locator (jetbrains.buildServer.server.rest.data.Locator)1 Fields (jetbrains.buildServer.server.rest.model.Fields)1 TestScopeTree (jetbrains.buildServer.server.rest.model.problem.scope.TestScopeTree)1 BuildPromotion (jetbrains.buildServer.serverSide.BuildPromotion)1 ChangeStatus (jetbrains.buildServer.vcs.ChangeStatus)1 ChangeStatusProvider (jetbrains.buildServer.vcs.ChangeStatusProvider)1 SVcsModification (jetbrains.buildServer.vcs.SVcsModification)1