use of jetbrains.buildServer.serverSide.impl.BuildTypeImpl in project teamcity-rest by JetBrains.
the class TestOccurrenceFinderTest method testNoTestRunsFromOthersPersonalBuild.
@Test
public void testNoTestRunsFromOthersPersonalBuild() {
final BuildTypeImpl buildType = registerBuildType("buildConf1", "project");
SUser user = myFixture.createUserAccount("andrey");
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 regularRun = t("aaa", Status.NORMAL, 2, regularBuild.getBuildId());
check("test:(name:aaa)", TEST_MATCHER, regularRun);
check("test:(name:aaa),includePersonal:true", TEST_MATCHER, regularRun);
check("test:(name:aaa),includePersonal:false", TEST_MATCHER, regularRun);
}
use of jetbrains.buildServer.serverSide.impl.BuildTypeImpl in project teamcity-rest by JetBrains.
the class TestOccurrenceFinderTest method testTestFromOtherUsersPersonalBuildByBuildLocator.
@Test
public void testTestFromOtherUsersPersonalBuildByBuildLocator() {
final BuildTypeImpl buildType = registerBuildType("buildConf1", "project");
SUser user = myFixture.createUserAccount("andrey");
final SFinishedBuild personalBuild = build().in(buildType).personalForUser(user.getUsername()).withTest(BuildBuilder.TestData.test("aaa")).finish();
TestRunDataWithBuild personalRun = t("aaa", Status.NORMAL, 1, personalBuild.getBuildId());
check(String.format("build:(id:%d)", personalBuild.getBuildId()), TEST_MATCHER, personalRun);
}
use of jetbrains.buildServer.serverSide.impl.BuildTypeImpl in project teamcity-rest by JetBrains.
the class TestOccurrenceFinderTest method testBranchFiltering.
@Test
public void testBranchFiltering() throws Exception {
final BuildTypeImpl buildType = registerBuildType("buildConf1", "project");
BuildBuilder.TestData test10, test20, test30, test40, test50, test60;
final SFinishedBuild build10 = build().in(buildType).withTest(test10 = BuildBuilder.TestData.test("test").duration(10)).finish();
final SFinishedBuild build20 = build().in(buildType).withBranch("branch1").withTest(test20 = BuildBuilder.TestData.test("test").duration(20)).finish();
final SFinishedBuild build30 = build().in(buildType).withDefaultBranch().withTest(test30 = BuildBuilder.TestData.test("test").duration(30)).finish();
final SFinishedBuild build40 = build().in(buildType).personalForUser("user").withTest(test40 = BuildBuilder.TestData.test("test").duration(40)).finish();
final SFinishedBuild build50 = build().in(buildType).withTest(test50 = BuildBuilder.TestData.test("test").duration(50)).cancel(null);
final SFinishedBuild build60 = build().in(buildType).withBranch("branch3:(a)").withTest(test60 = BuildBuilder.TestData.test("test").duration(60)).finish();
Matcher<BuildBuilder.TestData, STestRun> matcher = (testData, sTestRun) -> testData.duration == sTestRun.getDuration();
check("buildType:(id:" + buildType.getExternalId() + "),test:(name:test)", matcher, test60, test50, test30, test20, test10);
// comparing the branch filtering with behavior while filtering builds
String locatorPartTests__ = "buildType:(id:" + buildType.getExternalId() + "),test:(name:test),";
String locatorPartBuilds = "buildType:(id:" + buildType.getExternalId() + "),build:(defaultFilter:false,personal:false,buildType:(id:" + buildType.getExternalId() + "),";
check(locatorPartTests__ + "branch:(default:true)", matcher, test50, test30, test10);
check(locatorPartBuilds + "branch:(default:true))", matcher, test50, test30, test10);
// the build is not branched in this test
check(locatorPartTests__ + "branch:(<default>)", matcher);
check(locatorPartBuilds + "branch:(<default>))", matcher);
check(locatorPartTests__ + "branch:(branch1)", matcher, test20);
check(locatorPartBuilds + "branch:(branch1))", matcher, test20);
check(locatorPartTests__ + "branch:(Branch1)", matcher, test20);
check(locatorPartBuilds + "branch:(Branch1))", matcher, test20);
check(locatorPartTests__ + "branch:(name:(branch1))", matcher, test20);
check(locatorPartBuilds + "branch:(name:(branch1)))", matcher, test20);
check(locatorPartTests__ + "branch:(name:Branch1,unknown:false)", matcher);
checkExceptionOnItemsSearch(jetbrains.buildServer.server.rest.errors.BadRequestException.class, "buildType:(id:" + buildType.getExternalId() + "),build:(buildType:(id:" + buildType.getExternalId() + "),branch:(name:Branch1,unknown:false))");
check(locatorPartTests__ + "branch:(branch3:(a))", matcher, test60);
checkExceptionOnItemsSearch(jetbrains.buildServer.server.rest.errors.BadRequestException.class, "buildType:(id:" + buildType.getExternalId() + "),build:(buildType:(id:" + buildType.getExternalId() + "),branch:(branch3:(a)))");
check(locatorPartTests__ + "branch:missing", matcher);
check("buildType:(id:" + buildType.getExternalId() + "),build:(buildType:(id:" + buildType.getExternalId() + "),branch:missing)", matcher);
}
use of jetbrains.buildServer.serverSide.impl.BuildTypeImpl in project teamcity-rest by JetBrains.
the class TestOccurrenceFinderTest method testTestRunFromOthersPersonalBuild.
@Test
public void testTestRunFromOthersPersonalBuild() throws Throwable {
final BuildTypeImpl buildType = registerBuildType("buildConf1", "project");
SUser user = myFixture.createUserAccount("andrey");
SUser requester = myFixture.createUserAccount("requester");
requester.setUserProperty(StandardProperties.SHOW_ALL_PERSONAL_BUILDS, "true");
requester.addRole(RoleScope.projectScope(buildType.getProjectId()), 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(requester, () -> {
check("test:(name:aaa)", TEST_MATCHER, regularRun);
check("test:(name:aaa),includePersonal:true", TEST_MATCHER, personalRun, regularRun);
});
}
use of jetbrains.buildServer.serverSide.impl.BuildTypeImpl in project teamcity-rest by JetBrains.
the class TestOccurrenceFinderTest method testTestStatus.
@Test
public void testTestStatus() {
final BuildTypeImpl buildType = registerBuildType("buildConf1", "project");
final SFinishedBuild build10 = createBuildWithSuccessFailedIgnoredTests(buildType);
long bId = build10.getBuildId();
TestRunDataWithBuild aaa = t("aaa", Status.NORMAL, 1, bId);
TestRunDataWithBuild bbb = t("bbb", Status.FAILURE, 2, bId);
TestRunDataWithBuild ccc = t("ccc", Status.UNKNOWN, 3, bId);
check("build:(id:" + bId + ")", TEST_WITH_BUILD_MATCHER, aaa, bbb, ccc);
check("build:(id:" + bId + "),status:SUCCESS", TEST_WITH_BUILD_MATCHER, aaa);
check("build:(id:" + bId + "),status:FAILURE", TEST_WITH_BUILD_MATCHER, bbb);
check("build:(id:" + bId + "),status:failure", TEST_WITH_BUILD_MATCHER, bbb);
check("build:(id:" + bId + "),status:unknown", TEST_WITH_BUILD_MATCHER, ccc);
checkExceptionOnItemsSearch(BadRequestException.class, "build:(id:" + bId + "),status:AAA");
check("build:(id:" + bId + "),ignored:true", TEST_WITH_BUILD_MATCHER, ccc);
check("build:(id:" + bId + "),ignored:false", TEST_WITH_BUILD_MATCHER, aaa, bbb);
check("build:(id:" + bId + "),ignored:any", TEST_WITH_BUILD_MATCHER, aaa, bbb, ccc);
}
Aggregations