Search in sources :

Example 26 with BuildTypeImpl

use of jetbrains.buildServer.serverSide.impl.BuildTypeImpl in project teamcity-rest by JetBrains.

the class ChangeFinderTest method testDuplicate.

@Test
public void testDuplicate() {
    final BuildTypeImpl buildConf1 = registerBuildType("buildConf1", "project");
    final BuildTypeImpl buildConf2 = registerBuildType("buildConf2", "project");
    MockVcsSupport vcs = new MockVcsSupport("vcs");
    myFixture.getVcsManager().registerVcsSupport(vcs);
    SVcsRootEx parentRoot1 = myFixture.addVcsRoot(vcs.getName(), "", buildConf1);
    SVcsRootEx parentRoot2 = myFixture.addVcsRoot(vcs.getName(), "", buildConf2);
    VcsRootInstance root1 = buildConf1.getVcsRootInstanceForParent(parentRoot1);
    VcsRootInstance root2 = buildConf2.getVcsRootInstanceForParent(parentRoot2);
    assert root1 != null && root2 != null;
    final String version = "12345";
    myFixture.addModification(modification().in(root1).by("user1").version(version));
    myFixture.addModification(modification().in(root2).by("user1").version(version));
    List<SVcsModificationOrChangeDescriptor> result = myChangeFinder.getItems("unique:true").myEntries;
    assertEquals(1, result.size());
    List<SVcsModificationOrChangeDescriptor> resultWithDuplicate = myChangeFinder.getItems("count:10").myEntries;
    assertEquals(2, resultWithDuplicate.size());
}
Also used : MockVcsSupport(jetbrains.buildServer.serverSide.impl.MockVcsSupport) SVcsModificationOrChangeDescriptor(jetbrains.buildServer.server.rest.data.change.SVcsModificationOrChangeDescriptor) BuildTypeImpl(jetbrains.buildServer.serverSide.impl.BuildTypeImpl) Test(org.testng.annotations.Test)

Example 27 with BuildTypeImpl

use of jetbrains.buildServer.serverSide.impl.BuildTypeImpl in project teamcity-rest by JetBrains.

the class ChangeFinderTest method testLimitedProcessing.

@Test
public void testLimitedProcessing() {
    final BuildTypeImpl buildConf = registerBuildType("buildConf1", "project");
    final BuildTypeImpl buildConf2 = registerBuildType("buildConf2", "project");
    MockVcsSupport vcs = new MockVcsSupport("vcs");
    myFixture.getVcsManager().registerVcsSupport(vcs);
    SVcsRootEx parentRoot1 = myFixture.addVcsRoot(vcs.getName(), "", buildConf);
    VcsRootInstance root1 = buildConf.getVcsRootInstanceForParent(parentRoot1);
    assert root1 != null;
    SVcsModification m20 = myFixture.addModification(modification().in(root1).by("user1").version("20").parentVersions("10"));
    SVcsModification m30 = myFixture.addModification(modification().in(root1).version("30").parentVersions("20"));
    SVcsModification m40 = myFixture.addModification(modification().in(root1).version("40").parentVersions("10"));
    SVcsModification m50 = myFixture.addModification(modification().in(root1).by("user1").version("50").parentVersions("40"));
    SVcsModification m60 = myFixture.addModification(modification().in(root1).version("60").parentVersions("15"));
    SVcsModification m70 = myFixture.addModification(modification().in(root1).version("70").parentVersions("10"));
    myFixture.getVcsModificationChecker().checkForModifications(buildConf.getVcsRootInstances(), OperationRequestor.UNKNOWN);
    check(null, m70, m60, m50, m40, m30, m20);
    checkCounts("count:3", 3, 4);
    checkCounts("lookupLimit:3", 3, 4);
    checkCounts("username:user1", 2, 6);
    checkCounts("buildType:(id:" + buildConf2.getExternalId() + ")", 0, 0);
    checkCounts("version:50", 1, 6);
}
Also used : MockVcsSupport(jetbrains.buildServer.serverSide.impl.MockVcsSupport) BuildTypeImpl(jetbrains.buildServer.serverSide.impl.BuildTypeImpl) Test(org.testng.annotations.Test)

Example 28 with BuildTypeImpl

use of jetbrains.buildServer.serverSide.impl.BuildTypeImpl 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 29 with BuildTypeImpl

use of jetbrains.buildServer.serverSide.impl.BuildTypeImpl 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 30 with BuildTypeImpl

use of jetbrains.buildServer.serverSide.impl.BuildTypeImpl 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)

Aggregations

BuildTypeImpl (jetbrains.buildServer.serverSide.impl.BuildTypeImpl)80 Test (org.testng.annotations.Test)68 BaseFinderTest (jetbrains.buildServer.server.rest.data.BaseFinderTest)19 BadRequestException (jetbrains.buildServer.server.rest.errors.BadRequestException)12 ChangeStatus (jetbrains.buildServer.server.rest.model.change.ChangeStatus)12 SVcsModification (jetbrains.buildServer.vcs.SVcsModification)12 VcsRootInstance (jetbrains.buildServer.vcs.VcsRootInstance)12 SUser (jetbrains.buildServer.users.SUser)11 MockVcsSupport (jetbrains.buildServer.serverSide.impl.MockVcsSupport)10 SFinishedBuild (jetbrains.buildServer.serverSide.SFinishedBuild)9 TestOccurrence (jetbrains.buildServer.server.rest.model.problem.TestOccurrence)7 ProjectEx (jetbrains.buildServer.serverSide.impl.ProjectEx)7 TestFor (jetbrains.buildServer.util.TestFor)7 BuildPromotionEx (jetbrains.buildServer.serverSide.BuildPromotionEx)6 TestOccurrences (jetbrains.buildServer.server.rest.model.problem.TestOccurrences)5 RunningBuildEx (jetbrains.buildServer.serverSide.RunningBuildEx)5 Set (java.util.Set)4 Collectors (java.util.stream.Collectors)4 FakeHttpServletRequest (jetbrains.buildServer.controllers.fakes.FakeHttpServletRequest)4 TestScope (jetbrains.buildServer.server.rest.data.problem.scope.TestScope)4