Search in sources :

Example 1 with TestScopes

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

the class TestScopesRequest method serveGroupedTestOccurrences.

// Very highly experimental
@GET
@Path("/{scopeName}")
@Produces({ "application/xml", "application/json" })
@ApiOperation(hidden = true, value = "highly experimental")
public TestScopes serveGroupedTestOccurrences(@QueryParam("locator") String locatorText, @PathParam("scopeName") String scopeName, @QueryParam("fields") String fields, @Context UriInfo uriInfo, @Context HttpServletRequest request) {
    Set<String> supportedGroupings = new HashSet<>(Arrays.asList("package", "suite", "class"));
    if (!supportedGroupings.contains(scopeName)) {
        throw new BadRequestException("Invalid scope. Only scopes " + String.join(",", supportedGroupings) + " are supported.");
    }
    Locator patchedLocator = new Locator(locatorText);
    patchedLocator.setDimension(TestScopesCollector.SCOPE_TYPE, scopeName);
    PagedSearchResult<TestScope> items = myTestScopesCollector.getPagedItems(patchedLocator);
    PagerData pager = new PagerData(uriInfo.getRequestUriBuilder(), request.getContextPath(), items, locatorText, "locator");
    return new TestScopes(items.myEntries, new Fields(fields), pager, uriInfo, myBeanContext);
}
Also used : ServiceLocator(jetbrains.buildServer.ServiceLocator) Locator(jetbrains.buildServer.server.rest.data.Locator) Fields(jetbrains.buildServer.server.rest.model.Fields) TestScope(jetbrains.buildServer.server.rest.data.problem.scope.TestScope) BadRequestException(jetbrains.buildServer.server.rest.errors.BadRequestException) PagerData(jetbrains.buildServer.server.rest.model.PagerData) TestScopes(jetbrains.buildServer.server.rest.model.problem.scope.TestScopes) HashSet(java.util.HashSet) ApiOperation(io.swagger.annotations.ApiOperation)

Aggregations

ApiOperation (io.swagger.annotations.ApiOperation)1 HashSet (java.util.HashSet)1 ServiceLocator (jetbrains.buildServer.ServiceLocator)1 Locator (jetbrains.buildServer.server.rest.data.Locator)1 TestScope (jetbrains.buildServer.server.rest.data.problem.scope.TestScope)1 BadRequestException (jetbrains.buildServer.server.rest.errors.BadRequestException)1 Fields (jetbrains.buildServer.server.rest.model.Fields)1 PagerData (jetbrains.buildServer.server.rest.model.PagerData)1 TestScopes (jetbrains.buildServer.server.rest.model.problem.scope.TestScopes)1