Search in sources :

Example 61 with BuildTypeImpl

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

the class ProblemOccurrenceFinderTest method testBasic.

@Test
public void testBasic() throws Exception {
    final BuildTypeImpl buildType = registerBuildType("buildConf1", "project");
    final SFinishedBuild build10 = build().in(buildType).withProblem(createBuildProblem()).finish();
    checkExceptionOnItemSearch(BadRequestException.class, "No_match");
    checkExceptionOnItemsSearch(BadRequestException.class, "No_match");
    check("build:(id:" + build10.getBuildId() + ")", ((BuildPromotionEx) build10.getBuildPromotion()).getBuildProblems().get(0));
}
Also used : SFinishedBuild(jetbrains.buildServer.serverSide.SFinishedBuild) BuildPromotionEx(jetbrains.buildServer.serverSide.BuildPromotionEx) BuildTypeImpl(jetbrains.buildServer.serverSide.impl.BuildTypeImpl) Test(org.testng.annotations.Test)

Example 62 with BuildTypeImpl

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

the class ProblemOccurrenceFinderTest method testPaging.

@Test
public void testPaging() 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:" + 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()));
    checkProblem("build:(item:(id:" + build10.getId() + "),item:(id:" + build30.getId() + ")),count:2", pd(1, "id1", "type1", build10.getId()), pd(2, "id1", "type2", build10.getId()));
    checkProblem("build:(item:(id:" + build10.getId() + "),item:(id:" + build30.getId() + ")),start:2,count:3", 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 63 with BuildTypeImpl

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

the class TestOccurrenceFinderTest method testTestRunFromPersonalBuild.

@Test
public void testTestRunFromPersonalBuild() throws Throwable {
    final BuildTypeImpl buildType = registerBuildType("buildConf1", "project");
    SUser user = myFixture.createUserAccount("andrey");
    user.addRole(RoleScope.projectScope(buildType.getProjectId()), myFixture.getTestRoles().getProjectViewerRole());
    final SFinishedBuild personalBuild = build().in(buildType).personalForUser(user.getUsername()).withTest(BuildBuilder.TestData.test("aaa")).finish();
    final SFinishedBuild regularBuild = build().in(buildType).withTest(BuildBuilder.TestData.test("aaa")).finish();
    TestRunDataWithBuild personalRun = t("aaa", Status.NORMAL, 1, personalBuild.getBuildId());
    TestRunDataWithBuild regularRun = t("aaa", Status.NORMAL, 2, regularBuild.getBuildId());
    myServer.getSecurityContext().runAs(user, () -> {
        check("test:(name:aaa)", TEST_MATCHER, regularRun);
        check("test:(name:aaa),includePersonal:true", TEST_MATCHER, personalRun, regularRun);
        check("test:(name:aaa),includePersonal:false", TEST_MATCHER, regularRun);
    });
}
Also used : SUser(jetbrains.buildServer.users.SUser) BuildTypeImpl(jetbrains.buildServer.serverSide.impl.BuildTypeImpl) Test(org.testng.annotations.Test)

Example 64 with BuildTypeImpl

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

the class TestOccurrenceFinderTest method testInvestigationState.

@Test
public void testInvestigationState() throws Exception {
    final BuildTypeImpl buildType = registerBuildType("buildConf1", "project1");
    final SFinishedBuild build = build().in(buildType).withTest("aaa_active", false).withTest("bbb_fixed", false).withTest("ccc_given_up", false).withTest("ddd_none", false).finish();
    long activeNameId = myFixture.getSingletonService(TestName2Index.class).getOrSaveTestNameId("aaa_active");
    long fixedNameId = myFixture.getSingletonService(TestName2Index.class).getOrSaveTestNameId("bbb_fixed");
    long givenUpNameId = myFixture.getSingletonService(TestName2Index.class).getOrSaveTestNameId("ccc_given_up");
    SUser user = createUser("user");
    ProjectEx project = myServer.getProjectManager().getRootProject().findProjectByName("project1");
    TestNameResponsibilityEntryImpl activeEntry = new TestNameResponsibilityEntryImpl(new TestName("aaa_active"), activeNameId, ResponsibilityEntry.State.TAKEN, user, user, new Date(), "Please, fix", project, ResponsibilityEntry.RemoveMethod.MANUALLY);
    TestNameResponsibilityEntryImpl fixedEntry = new TestNameResponsibilityEntryImpl(new TestName("bbb_fixed"), fixedNameId, ResponsibilityEntry.State.FIXED, user, user, new Date(), "Please, fix", project, ResponsibilityEntry.RemoveMethod.MANUALLY);
    TestNameResponsibilityEntryImpl givenUpEntry = new TestNameResponsibilityEntryImpl(new TestName("ccc_given_up"), givenUpNameId, ResponsibilityEntry.State.GIVEN_UP, user, user, new Date(), "Please, fix", project, ResponsibilityEntry.RemoveMethod.MANUALLY);
    TestNameResponsibilityFacade testNameResponsibilityFacade = myFixture.getSingletonService(TestNameResponsibilityFacade.class);
    testNameResponsibilityFacade.setTestNameResponsibility(new TestName("aaa_active"), project.getProjectId(), activeEntry);
    testNameResponsibilityFacade.setTestNameResponsibility(new TestName("bbb_fixed"), project.getProjectId(), fixedEntry);
    testNameResponsibilityFacade.setTestNameResponsibility(new TestName("ccc_given_up"), project.getProjectId(), givenUpEntry);
    TestRunData activeRunData = t("aaa_active", Status.FAILURE, 1);
    TestRunData fixedRunData = t("bbb_fixed", Status.FAILURE, 2);
    TestRunData givenUpRunData = t("ccc_given_up", Status.FAILURE, 3);
    TestRunData noneRunData = t("ddd_none", Status.FAILURE, 4);
    check("currentlyFailing:true,currentlyInvestigated:true", TEST_MATCHER, activeRunData);
    check("currentlyFailing:true,currentlyInvestigated:false", TEST_MATCHER, fixedRunData, givenUpRunData, noneRunData);
    check("currentlyFailing:true,investigationState:active", TEST_MATCHER, activeRunData);
    check("currentlyFailing:true,investigationState:fixed", TEST_MATCHER, fixedRunData);
    check("currentlyFailing:true,investigationState:givenUp", TEST_MATCHER, givenUpRunData);
    check("currentlyFailing:true,investigationState:none", TEST_MATCHER, noneRunData);
    check("currentlyFailing:true", TEST_MATCHER, activeRunData, fixedRunData, givenUpRunData, noneRunData);
}
Also used : ProjectEx(jetbrains.buildServer.serverSide.impl.ProjectEx) TestName(jetbrains.buildServer.tests.TestName) TestNameResponsibilityFacade(jetbrains.buildServer.responsibility.TestNameResponsibilityFacade) SUser(jetbrains.buildServer.users.SUser) TestNameResponsibilityEntryImpl(jetbrains.buildServer.responsibility.impl.TestNameResponsibilityEntryImpl) BuildTypeImpl(jetbrains.buildServer.serverSide.impl.BuildTypeImpl) Date(java.util.Date) Test(org.testng.annotations.Test)

Example 65 with BuildTypeImpl

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

the class TestOccurrenceFinderTest method testShortStatisticsIsEnoughWhenOnlyLegacyCountersRequested.

@Test
public void testShortStatisticsIsEnoughWhenOnlyLegacyCountersRequested() {
    final BuildTypeImpl buildType = registerBuildType("buildConf1", "project");
    final SFinishedBuild build = createBuildWithSuccessFailedIgnoredTests(buildType);
    assertNotNull("Retrieving counters should be done via short statistics.", myTestOccurrenceFinder.tryGetCachedInfo("build:" + build.getBuildId(), "count,passed,failed,newFailed,ignored,muted").getShortStatistics());
}
Also used : 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