use of jetbrains.buildServer.serverSide.BuildPromotionEx in project teamcity-rest by JetBrains.
the class ProblemOccurrenceFinderTest method testByProblem.
@Test
public void testByProblem() throws Exception {
final BuildTypeImpl buildType = registerBuildType("buildConf1", "project");
final BuildPromotionEx build10 = (BuildPromotionEx) build().in(buildType).withProblem(BuildProblemData.createBuildProblem("id1", "type1", "descr")).withProblem(BuildProblemData.createBuildProblem("id1", "type2", "descr")).withProblem(BuildProblemData.createBuildProblem("id1", "type3", "descr")).finish().getBuildPromotion();
final BuildPromotionEx build15 = (BuildPromotionEx) build().in(buildType).finish().getBuildPromotion();
final BuildPromotionEx build20 = (BuildPromotionEx) build().in(buildType).withProblem(BuildProblemData.createBuildProblem("id1", "type1", "descr")).finish().getBuildPromotion();
final BuildPromotionEx build30 = (BuildPromotionEx) build().in(buildType).withProblem(BuildProblemData.createBuildProblem("id2", "type1", "descr")).withProblem(BuildProblemData.createBuildProblem("id1", "type2", "descr")).finish().getBuildPromotion();
final BuildPromotionEx build40 = (BuildPromotionEx) build().in(buildType).withProblem(BuildProblemData.createBuildProblem("id1", "type2", "descr")).finish().getBuildPromotion();
checkProblem("problem:(id:1)", pd(1, "id1", "type1", build20.getId()), pd(1, "id1", "type1", build10.getId()));
checkProblem("problem:(currentlyFailing:true)", pd(2, "id1", "type2", build40.getId()), pd(2, "id1", "type2", build30.getId()), pd(2, "id1", "type2", build10.getId()));
checkProblem("problem:(build:(count:1))", pd(2, "id1", "type2", build40.getId()), pd(2, "id1", "type2", build30.getId()), pd(2, "id1", "type2", build10.getId()));
checkProblem("problem:(build:(count:2))", pd(2, "id1", "type2", build40.getId()), pd(2, "id1", "type2", build30.getId()), pd(2, "id1", "type2", build10.getId()), pd(4, "id2", "type1", build30.getId()));
checkProblem("currentlyFailing:true", pd(2, "id1", "type2", build40.getId()));
checkProblem("currentlyFailing:false,build:(id:" + build10.getId() + ")", pd(1, "id1", "type1", build10.getId()), pd(3, "id1", "type3", build10.getId()));
}
use of jetbrains.buildServer.serverSide.BuildPromotionEx in project teamcity-rest by JetBrains.
the class ProblemOccurrenceFinderTest method testByIdentity.
@Test
public void testByIdentity() throws Exception {
final BuildTypeImpl buildType = registerBuildType("buildConf1", "project");
final BuildPromotionEx build10 = (BuildPromotionEx) build().in(buildType).withProblem(BuildProblemData.createBuildProblem("id1", "type1", "descr")).withProblem(BuildProblemData.createBuildProblem("id1", "type2", "descr")).withProblem(BuildProblemData.createBuildProblem("id1", "type3", "descr")).finish().getBuildPromotion();
final BuildPromotionEx build15 = (BuildPromotionEx) build().in(buildType).finish().getBuildPromotion();
final BuildPromotionEx build20 = (BuildPromotionEx) build().in(buildType).withProblem(BuildProblemData.createBuildProblem("id1", "type1", "descr")).finish().getBuildPromotion();
final BuildPromotionEx build30 = (BuildPromotionEx) build().in(buildType).withProblem(BuildProblemData.createBuildProblem("id2", "type1", "descr")).withProblem(BuildProblemData.createBuildProblem("id1", "type2", "descr")).finish().getBuildPromotion();
final BuildPromotionEx build40 = (BuildPromotionEx) build().in(buildType).withProblem(BuildProblemData.createBuildProblem("id1", "type2", "descr")).finish().getBuildPromotion();
checkProblem("build:(item:(id:" + build30.getId() + "),item:(id:" + build10.getId() + "))", pd(4, "id2", "type1", build30.getId()), pd(2, "id1", "type2", build30.getId()), pd(1, "id1", "type1", build10.getId()), pd(2, "id1", "type2", build10.getId()), pd(3, "id1", "type3", build10.getId()));
checkProblem("build:(item:(id:" + build30.getId() + "),item:(id:" + build10.getId() + ")),identity:id1", pd(2, "id1", "type2", build30.getId()), pd(1, "id1", "type1", build10.getId()), pd(2, "id1", "type2", build10.getId()), pd(3, "id1", "type3", build10.getId()));
}
use of jetbrains.buildServer.serverSide.BuildPromotionEx in project teamcity-rest by JetBrains.
the class ProblemOccurrenceFinderTest method testByBuild.
@Test
public void testByBuild() throws Exception {
final BuildTypeImpl buildType = registerBuildType("buildConf1", "project");
final BuildPromotionEx build10 = (BuildPromotionEx) build().in(buildType).withProblem(BuildProblemData.createBuildProblem("id1", "type1", "descr")).withProblem(BuildProblemData.createBuildProblem("id1", "type2", "descr")).withProblem(BuildProblemData.createBuildProblem("id1", "type3", "descr")).finish().getBuildPromotion();
final BuildPromotionEx build15 = (BuildPromotionEx) build().in(buildType).finish().getBuildPromotion();
final BuildPromotionEx build20 = (BuildPromotionEx) build().in(buildType).withProblem(BuildProblemData.createBuildProblem("id1", "type1", "descr")).finish().getBuildPromotion();
final BuildPromotionEx build30 = (BuildPromotionEx) build().in(buildType).withProblem(BuildProblemData.createBuildProblem("id2", "type1", "descr")).withProblem(BuildProblemData.createBuildProblem("id1", "type2", "descr")).finish().getBuildPromotion();
final BuildPromotionEx build40 = (BuildPromotionEx) build().in(buildType).withProblem(BuildProblemData.createBuildProblem("id1", "type2", "descr")).finish().getBuildPromotion();
checkProblem("build:(id:" + build40.getId() + ")", pd(2, "id1", "type2", build40.getId()));
checkProblem("build:(id:" + build10.getId() + ")", pd(1, "id1", "type1", build10.getId()), pd(2, "id1", "type2", build10.getId()), pd(3, "id1", "type3", build10.getId()));
checkProblem("build:(item:(id:" + build10.getId() + "),item:(id:" + build30.getId() + "))", pd(1, "id1", "type1", build10.getId()), pd(2, "id1", "type2", build10.getId()), pd(3, "id1", "type3", build10.getId()), pd(4, "id2", "type1", build30.getId()), pd(2, "id1", "type2", build30.getId()));
}
use of jetbrains.buildServer.serverSide.BuildPromotionEx in project teamcity-rest by JetBrains.
the class ProblemOccurrenceFinderTest method testCurrentlyFailing.
@Test
public void testCurrentlyFailing() {
final BuildTypeImpl buildType1 = registerBuildType("buildConf1", "project");
final BuildTypeImpl buildType2 = registerBuildType("buildConf2", "project");
final BuildPromotionEx build10 = (BuildPromotionEx) build().in(buildType1).withProblem(BuildProblemData.createBuildProblem("id1", "type1", "descr")).withProblem(BuildProblemData.createBuildProblem("id1", "type2", "descr")).finish().getBuildPromotion();
final BuildPromotionEx build20 = (BuildPromotionEx) build().in(buildType1).withProblem(BuildProblemData.createBuildProblem("id1", "type1", "descr")).finish().getBuildPromotion();
final BuildPromotionEx build30 = (BuildPromotionEx) build().in(buildType2).withProblem(BuildProblemData.createBuildProblem("id1", "type2", "descr")).finish().getBuildPromotion();
checkProblem("problem:(id:1)", pd(1, "id1", "type1", build20.getId()), pd(1, "id1", "type1", build10.getId()));
checkProblem("problem:(id:2)", pd(2, "id1", "type2", build30.getId()), pd(2, "id1", "type2", build10.getId()));
checkProblem("build:(id:" + build10.getId() + ")", pd(1, "id1", "type1", build10.getId()), pd(2, "id1", "type2", build10.getId()));
checkProblem("build:(id:" + build20.getId() + ")", pd(1, "id1", "type1", build20.getId()));
checkProblem("currentlyFailing:true", pd(1, "id1", "type1", build20.getId()), pd(2, "id1", "type2", build30.getId()));
checkProblem("currentlyFailing:true,build:(id:" + build10.getId() + ")", pd(1, "id1", "type1", build10.getId()));
checkProblem("currentlyFailing:false,build:(id:" + build10.getId() + ")", pd(2, "id1", "type2", build10.getId()));
checkProblem("currentlyFailing:true,build:(id:" + build20.getId() + ")", pd(1, "id1", "type1", build20.getId()));
checkProblem("currentlyFailing:false,build:(id:" + build20.getId() + ")");
checkProblem("currentlyFailing:true,problem:(id:1)", pd(1, "id1", "type1", build20.getId()));
checkProblem("currentlyFailing:false,problem:(id:1)");
checkProblem("currentlyFailing:true,problem:(id:2)", pd(2, "id1", "type2", build30.getId()));
checkProblem("currentlyFailing:false,problem:(id:2)", pd(2, "id1", "type2", build10.getId()));
checkExceptionOnItemsSearch(BadRequestException.class, "currentlyFailing:false");
}
use of jetbrains.buildServer.serverSide.BuildPromotionEx in project teamcity-rest by JetBrains.
the class BuildArtifactsFinder method getArtifactElement.
@NotNull
public static Element getArtifactElement(@NotNull final BuildPromotion buildPromotion, @NotNull final String path, @NotNull final ServiceLocator serviceLocator) {
final BuildPromotionEx buildPromotionEx = (BuildPromotionEx) buildPromotion;
final BuildArtifacts artifacts = buildPromotionEx.getArtifacts(BuildArtifactsViewMode.VIEW_ALL_WITH_ARCHIVES_CONTENT);
if (!artifacts.isAvailable()) {
return new BuildHoldingElement(artifacts.getRootArtifact(), buildPromotion);
}
final BuildArtifactHolder holder = artifacts.findArtifact(path);
if (!holder.isAvailable() && !"".equals(path)) {
// "".equals(path) is a workaround for no artifact directory case
return getItem(new ArtifactsBrowserImpl(artifacts), path, LogUtil.describe(buildPromotionEx), serviceLocator);
}
if (!holder.isAccessible()) {
throw new AuthorizationFailedException("Artifact is not accessible with current user permissions. Relative path: '" + holder.getRelativePath() + "'");
}
return new BuildHoldingElement(holder.getArtifact(), buildPromotion);
}
Aggregations