Search in sources :

Example 1 with BuildPromotionEx

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()));
}
Also used : BuildPromotionEx(jetbrains.buildServer.serverSide.BuildPromotionEx) BuildTypeImpl(jetbrains.buildServer.serverSide.impl.BuildTypeImpl) Test(org.testng.annotations.Test)

Example 2 with BuildPromotionEx

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()));
}
Also used : BuildPromotionEx(jetbrains.buildServer.serverSide.BuildPromotionEx) BuildTypeImpl(jetbrains.buildServer.serverSide.impl.BuildTypeImpl) Test(org.testng.annotations.Test)

Example 3 with BuildPromotionEx

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()));
}
Also used : BuildPromotionEx(jetbrains.buildServer.serverSide.BuildPromotionEx) BuildTypeImpl(jetbrains.buildServer.serverSide.impl.BuildTypeImpl) Test(org.testng.annotations.Test)

Example 4 with BuildPromotionEx

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");
}
Also used : BuildPromotionEx(jetbrains.buildServer.serverSide.BuildPromotionEx) BuildTypeImpl(jetbrains.buildServer.serverSide.impl.BuildTypeImpl) Test(org.testng.annotations.Test)

Example 5 with BuildPromotionEx

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);
}
Also used : BuildArtifactHolder(jetbrains.buildServer.serverSide.artifacts.BuildArtifactHolder) ArtifactsBrowserImpl(jetbrains.buildServer.web.artifacts.browser.ArtifactsBrowserImpl) BuildPromotionEx(jetbrains.buildServer.serverSide.BuildPromotionEx) BuildArtifacts(jetbrains.buildServer.serverSide.artifacts.BuildArtifacts) NotNull(org.jetbrains.annotations.NotNull)

Aggregations

BuildPromotionEx (jetbrains.buildServer.serverSide.BuildPromotionEx)7 BuildTypeImpl (jetbrains.buildServer.serverSide.impl.BuildTypeImpl)6 Test (org.testng.annotations.Test)6 SFinishedBuild (jetbrains.buildServer.serverSide.SFinishedBuild)1 BuildArtifactHolder (jetbrains.buildServer.serverSide.artifacts.BuildArtifactHolder)1 BuildArtifacts (jetbrains.buildServer.serverSide.artifacts.BuildArtifacts)1 ArtifactsBrowserImpl (jetbrains.buildServer.web.artifacts.browser.ArtifactsBrowserImpl)1 NotNull (org.jetbrains.annotations.NotNull)1