Search in sources :

Example 6 with RunningBuildEx

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

the class BuildFinderFixedBuildSequenceTest method setUp.

@Override
@BeforeMethod
public void setUp() throws Exception {
    super.setUp();
    // testing BuildFinder
    setInternalProperty(BuildFinder.LEGACY_BUILDS_FILTERING, "true");
    // testing BuildFinder
    setInternalProperty(BuildFinder.LEGACY_BUILDS_FILTERING_FORCED, "true");
    myTimeService = new MockTimeService(Dates.now().getTime());
    myServer.setTimeService(myTimeService);
    // do not need this in finally, do we?     myServer.setTimeService(SystemTimeService.getInstance());
    myUser = createUser("uuser");
    myBuildConf = registerBuildType("buildConf1", "project");
    myBuildConf2 = registerBuildType("buildConf2", "project");
    myBuild1 = build().in(myBuildConf).finish();
    myBuild2failed = build().in(myBuildConf).failed().finish();
    myDeleted = build().in(myBuildConf).failed().finish();
    myFixture.getHistory().removeEntry(myDeleted);
    myTimeService.jumpTo(10);
    myBuild3tagged = build().in(myBuildConf).finish();
    myBuild3tagged.setTags(Arrays.asList("tag1", "tag2"));
    myTimeService.jumpTo(10);
    myBuild4conf2FailedPinned = build().in(myBuildConf2).failed().finish();
    myBuild4conf2FailedPinned.setPinned(true, myUser, "pin comment");
    myTimeService.jumpTo(10);
    myTimeAfterBuild4 = myTimeService.getNow();
    myTimeService.jumpTo(10);
    myBuild5personal = build().in(myBuildConf).personalForUser(myUser.getUsername()).finish();
    myBuild6personalFailed = build().in(myBuildConf2).personalForUser(myUser.getUsername()).failed().finish();
    RunningBuildEx build7running = startBuild(myBuildConf);
    build7running.stop(myUser, "cancel comment");
    myBuild7canceled = finishBuild(build7running, false);
    final RunningBuildEx build8running = startBuild(myBuildConf);
    // make the build failed
    build8running.addBuildProblem(createBuildProblem());
    build8running.stop(myUser, "cancel comment");
    myBuild8canceledFailed = finishBuild(build8running, true);
    myBuild9failedToStart = build().in(myBuildConf).failedToStart().finish();
    myTimeService.jumpTo(10);
    myBuild10byUser = build().in(myBuildConf).by(myUser).finish();
    myTimeService.jumpTo(10);
    myBuild11inBranch = build().in(myBuildConf).withBranch("branch").finish();
    myTimeService.jumpTo(10);
    myBuild12 = build().in(myBuildConf).finish();
    myBuild13running = startBuild(myBuildConf);
    myBuild14queued = addToQueue(myBuildConf);
}
Also used : RunningBuildEx(jetbrains.buildServer.serverSide.RunningBuildEx) MockTimeService(jetbrains.buildServer.MockTimeService) BeforeMethod(org.testng.annotations.BeforeMethod)

Example 7 with RunningBuildEx

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

the class BuildFinderFixedBuildSequenceByPromotionTest method setUp.

@Override
@BeforeMethod
public void setUp() throws Exception {
    super.setUp();
    // testing BuildPromotionFinder
    setInternalProperty(BuildFinder.LEGACY_BUILDS_FILTERING, "false");
    myTimeService = new MockTimeService(Dates.now().getTime());
    myServer.setTimeService(myTimeService);
    // do not need this in finally, do we?     myServer.setTimeService(SystemTimeService.getInstance());
    myUser = createUser("uuser");
    myBuildConf = registerBuildType("buildConf1", "project");
    myBuildConf2 = registerBuildType("buildConf2", "project");
    myBuild1 = build().in(myBuildConf).finish();
    myBuild2failed = build().in(myBuildConf).failed().finish();
    myDeleted = build().in(myBuildConf).failed().finish();
    myFixture.getHistory().removeEntry(myDeleted);
    myTimeService.jumpTo(10);
    myBuild3tagged = build().in(myBuildConf).finish();
    myBuild3tagged.setTags(Arrays.asList("tag1", "tag2"));
    myTimeService.jumpTo(10);
    myBuild4conf2FailedPinned = build().in(myBuildConf2).failed().finish();
    myBuild4conf2FailedPinned.setPinned(true, myUser, "pin comment");
    myTimeService.jumpTo(10);
    myTimeAfterBuild4 = myTimeService.getNow();
    myTimeService.jumpTo(10);
    myBuild5personal = build().in(myBuildConf).personalForUser(myUser.getUsername()).finish();
    myBuild6personalFailed = build().in(myBuildConf2).personalForUser(myUser.getUsername()).failed().finish();
    RunningBuildEx build7running = startBuild(myBuildConf);
    build7running.stop(myUser, "cancel comment");
    myBuild7canceled = finishBuild(build7running, false);
    final RunningBuildEx build8running = startBuild(myBuildConf);
    // make the build failed
    build8running.addBuildProblem(createBuildProblem());
    build8running.stop(myUser, "cancel comment");
    myBuild8canceledFailed = finishBuild(build8running, true);
    myBuild9failedToStart = build().in(myBuildConf).failedToStart().finish();
    myTimeService.jumpTo(10);
    myBuild10byUser = build().in(myBuildConf).by(myUser).finish();
    myTimeService.jumpTo(10);
    myBuild11inBranch = build().in(myBuildConf).withBranch("branch").finish();
    myTimeService.jumpTo(10);
    myBuild12 = build().in(myBuildConf).finish();
    myBuild13running = startBuild(myBuildConf);
    myBuild14queued = addToQueue(myBuildConf);
}
Also used : RunningBuildEx(jetbrains.buildServer.serverSide.RunningBuildEx) MockTimeService(jetbrains.buildServer.MockTimeService) BeforeMethod(org.testng.annotations.BeforeMethod)

Aggregations

RunningBuildEx (jetbrains.buildServer.serverSide.RunningBuildEx)7 ChangeStatus (jetbrains.buildServer.server.rest.model.change.ChangeStatus)5 BuildTypeImpl (jetbrains.buildServer.serverSide.impl.BuildTypeImpl)5 SVcsModification (jetbrains.buildServer.vcs.SVcsModification)5 VcsRootInstance (jetbrains.buildServer.vcs.VcsRootInstance)5 MockTimeService (jetbrains.buildServer.MockTimeService)2 BaseFinderTest (jetbrains.buildServer.server.rest.data.BaseFinderTest)2 BeforeMethod (org.testng.annotations.BeforeMethod)2 Test (org.testng.annotations.Test)2 SUser (jetbrains.buildServer.users.SUser)1