use of jetbrains.buildServer.serverSide.mute.MuteInfo in project teamcity-rest by JetBrains.
the class Mutes method createMutesWithActualAttributes.
/**
* This method creates Mutes object with attributes which are actual to the current moment, not the moment when the mute was initially created.
* Unfortunately, this includes loading of all mutes for the Root project, so this method is really slow.
*/
@NotNull
static Mutes createMutesWithActualAttributes(@NotNull String problemLocator, @NotNull Fields fields, @NotNull BeanContext beanContext) {
Fields nestedFields = fields.getNestedField("mutes", Fields.NONE, Fields.LONG);
final String actualLocatorText = Locator.merge(nestedFields.getLocator(), problemLocator);
List<MuteInfo> entries = beanContext.getSingletonService(MuteFinder.class).getItems(actualLocatorText).myEntries;
return new Mutes(entries, null, nestedFields, beanContext);
}
use of jetbrains.buildServer.serverSide.mute.MuteInfo in project teamcity-rest by JetBrains.
the class MuteRequest method deleteInstance.
/**
* Comment is read from the body as an experimental approach
*/
@DELETE
@Path("/{muteLocator}")
@Produces({ "application/xml", "application/json" })
@ApiOperation(value = "Unmute the matching test.", nickname = "unmuteTest")
public void deleteInstance(@ApiParam(format = LocatorName.MUTE) @PathParam("muteLocator") String locatorText, String comment) {
MuteInfo item = myMuteFinder.getItem(locatorText);
MuteData muteData = new MuteData(item.getScope(), StringUtil.isEmpty(comment) ? null : comment, item.getTests(), item.getBuildProblemIds().stream().map(i -> i.longValue()).collect(Collectors.toList()), myServiceLocator);
muteData.unmute();
}
use of jetbrains.buildServer.serverSide.mute.MuteInfo in project teamcity-rest by JetBrains.
the class MuteRequest method createInstances.
/**
* Experimental use only!
*/
@POST
@Path("/multiple")
@Consumes({ "application/xml", "application/json" })
@Produces({ "application/xml", "application/json" })
@ApiOperation(value = "Mute multiple tests.", nickname = "muteMultipleTests")
public Mutes createInstances(Mutes mutes, @QueryParam("fields") String fields) {
List<MuteData> postedEntities = mutes.getFromPosted(myServiceLocator);
// muting after getting objects to report any deserialize errors before
List<MuteInfo> results = postedEntities.stream().map(muteData -> muteData.mute()).collect(Collectors.toList());
return new Mutes(results, null, new Fields(fields), myBeanContext);
}
use of jetbrains.buildServer.serverSide.mute.MuteInfo in project teamcity-rest by JetBrains.
the class ProblemWrapper method getMutes.
@NotNull
public List<MuteInfo> getMutes() {
// this returns not full mute data, but only confined to the problem (MuteInfo.getBuildProblemIds() will not return all the problems affected by the mute)
if (mutes == null) {
Set<MuteInfo> mutesSet = new TreeSet<MuteInfo>();
final SProject rootProject = myServiceLocator.getSingletonService(ProjectManager.class).getRootProject();
final CurrentMuteInfo currentMuteInfo = myServiceLocator.getSingletonService(ProblemMutingService.class).getBuildProblemCurrentMuteInfo(rootProject.getProjectId(), id);
if (currentMuteInfo != null) {
mutesSet.addAll(currentMuteInfo.getProjectsMuteInfo().values());
mutesSet.addAll(currentMuteInfo.getBuildTypeMuteInfo().values());
}
mutes = new ArrayList<MuteInfo>(mutesSet);
}
return mutes;
}
Aggregations