Search in sources :

Example 1 with FieldStrategy

use of jetbrains.buildServer.server.rest.util.fieldInclusion.FieldStrategy in project teamcity-rest by JetBrains.

the class TestOccurrence method getInvocations.

@XmlElement
@FieldStrategy(name = "invocations", defaultForShort = FieldRule.EXCLUDE, defaultForLong = FieldRule.EXCLUDE)
public TestOccurrences getInvocations() {
    return ValueWithDefault.decideDefault(myChecker.isIncluded("invocations", myFields), () -> {
        if (!(myTestRun instanceof MultiTestRun))
            return null;
        MultiTestRun multiTestRun = (MultiTestRun) myTestRun;
        Fields nestedField = myFields.getNestedField("invocations");
        PagingItemFilter<STestRun> pagingFilter = myTestOccurrenceFinder.getPagingInvocationsFilter(nestedField);
        FilterItemProcessor<STestRun> processor = new FilterItemProcessor<>(pagingFilter);
        multiTestRun.getTestRuns().forEach(processor::processItem);
        ArrayList<STestRun> filtered = processor.getResult();
        return new TestOccurrences(filtered, null, null, null, nestedField, myBeanContext);
    });
}
Also used : Fields(jetbrains.buildServer.server.rest.model.Fields) STestRun(jetbrains.buildServer.serverSide.STestRun) FilterItemProcessor(jetbrains.buildServer.server.rest.data.FilterItemProcessor) MultiTestRun(jetbrains.buildServer.serverSide.MultiTestRun) FieldStrategy(jetbrains.buildServer.server.rest.util.fieldInclusion.FieldStrategy) XmlElement(javax.xml.bind.annotation.XmlElement)

Aggregations

XmlElement (javax.xml.bind.annotation.XmlElement)1 FilterItemProcessor (jetbrains.buildServer.server.rest.data.FilterItemProcessor)1 Fields (jetbrains.buildServer.server.rest.model.Fields)1 FieldStrategy (jetbrains.buildServer.server.rest.util.fieldInclusion.FieldStrategy)1 MultiTestRun (jetbrains.buildServer.serverSide.MultiTestRun)1 STestRun (jetbrains.buildServer.serverSide.STestRun)1